Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ define(function (require) {
return {
savedObj: savedSearch,
panel: panel,
edit: '#discover'
editUrl: savedSearches.urlFor(panel.id)
};
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ define(function (require) {
return {
savedObj: savedVis,
panel: panel,
edit: '#visualize/edit'
editUrl: savedVisualizations.urlFor(panel.id)
};
});
};
Expand Down
10 changes: 7 additions & 3 deletions src/kibana/plugins/dashboard/components/panel/panel.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
<div class="panel-heading">
<span class="panel-title">{{savedObj.title}}</span>
<div class="btn-group">
<a aria-label="Edit" ng-show="!appEmbedded && edit" ng-href="{{edit}}/{{panel.id | uriescape}}"><i aria-hidden="true" class="fa fa-pencil"></i></a>
<a aria-label="Remove" ng-show="!appEmbedded" ng-click="remove()"><i aria-hidden="true" class="fa fa-times"></i></a>
<a aria-label="Edit" ng-show="!appEmbedded && editUrl" ng-href="{{editUrl}}">
<i aria-hidden="true" class="fa fa-pencil"></i>
</a>
<a aria-label="Remove" ng-show="!appEmbedded" ng-click="remove()">
<i aria-hidden="true" class="fa fa-times"></i>
</a>
</div>
<div class="clearfix"></div>
</div>
Expand All @@ -26,4 +30,4 @@
class="panel-content"
filter="filter">
</doc-table>
</div>
</div>
16 changes: 10 additions & 6 deletions src/kibana/plugins/dashboard/components/panel/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ define(function (require) {
loadPanel($scope.panel, $scope).then(function (panelConfig) {
// These could be done in loadPanel, putting them here to make them more explicit
$scope.savedObj = panelConfig.savedObj;
$scope.edit = panelConfig.edit;
$scope.editUrl = panelConfig.editUrl;
$scope.$on('$destroy', panelConfig.savedObj.destroy);

$scope.filter = function (field, value, operator) {
Expand All @@ -50,11 +50,15 @@ define(function (require) {
// If the savedObjectType matches the panel type, this means the object itself has been deleted,
// so we shouldn't even have an edit link. If they don't match, it means something else is wrong
// with the object (but the object still exists), so we link to the object editor instead.
var objectHasBeenDeleted = e.savedObjectType === $scope.panel.type;
if (!objectHasBeenDeleted) {
var service = _.find(services, {type: $scope.panel.type});
$scope.edit = '#settings/objects/' + (service && service.name);
}
var objectItselfDeleted = e.savedObjectType === $scope.panel.type;
if (objectItselfDeleted) return;

var type = $scope.panel.type;
var id = $scope.panel.id;
var service = _.find(services, { type: type });
if (!service) return;

$scope.editUrl = '#settings/objects/' + service.name + '/' + id + '?notFound=' + e.savedObjectType;
});

});
Expand Down