Skip to content

Commit

Permalink
Merge pull request #5 from spalger/issues/4200
Browse files Browse the repository at this point in the history
display info about missing object
  • Loading branch information
lukasolson committed Jun 15, 2015
2 parents 30cb7af + 86ac687 commit d64a9a8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
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

0 comments on commit d64a9a8

Please sign in to comment.