From 6f750f1b1e82dcb29e31b1f97448ff6f8e1f9995 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Mon, 15 Jun 2015 13:32:51 -0700 Subject: [PATCH 1/2] [dashboard/panel] use service to make full editUrl --- src/kibana/plugins/dashboard/components/panel/lib/search.js | 2 +- .../plugins/dashboard/components/panel/lib/visualization.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kibana/plugins/dashboard/components/panel/lib/search.js b/src/kibana/plugins/dashboard/components/panel/lib/search.js index d5a147c187e66..426e61e2fabaa 100644 --- a/src/kibana/plugins/dashboard/components/panel/lib/search.js +++ b/src/kibana/plugins/dashboard/components/panel/lib/search.js @@ -17,7 +17,7 @@ define(function (require) { return { savedObj: savedSearch, panel: panel, - edit: '#discover' + edit: savedSearches.urlFor(panel.id) }; }); }; diff --git a/src/kibana/plugins/dashboard/components/panel/lib/visualization.js b/src/kibana/plugins/dashboard/components/panel/lib/visualization.js index 38f18ef7af678..63d05ff8d12cf 100644 --- a/src/kibana/plugins/dashboard/components/panel/lib/visualization.js +++ b/src/kibana/plugins/dashboard/components/panel/lib/visualization.js @@ -13,7 +13,7 @@ define(function (require) { return { savedObj: savedVis, panel: panel, - edit: '#visualize/edit' + edit: savedVisualizations.urlFor(panel.id) }; }); }; From 86ac687a017ffad42ab752a661d0a91f56af5e61 Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Mon, 15 Jun 2015 13:34:48 -0700 Subject: [PATCH 2/2] [dashbaord/panel] fallback urls should have ?notFound=type query string --- .../dashboard/components/panel/lib/search.js | 2 +- .../components/panel/lib/visualization.js | 2 +- .../dashboard/components/panel/panel.html | 10 +++++++--- .../plugins/dashboard/components/panel/panel.js | 16 ++++++++++------ 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/kibana/plugins/dashboard/components/panel/lib/search.js b/src/kibana/plugins/dashboard/components/panel/lib/search.js index 426e61e2fabaa..cf7dc1a8647c5 100644 --- a/src/kibana/plugins/dashboard/components/panel/lib/search.js +++ b/src/kibana/plugins/dashboard/components/panel/lib/search.js @@ -17,7 +17,7 @@ define(function (require) { return { savedObj: savedSearch, panel: panel, - edit: savedSearches.urlFor(panel.id) + editUrl: savedSearches.urlFor(panel.id) }; }); }; diff --git a/src/kibana/plugins/dashboard/components/panel/lib/visualization.js b/src/kibana/plugins/dashboard/components/panel/lib/visualization.js index 63d05ff8d12cf..12bce66c1b50a 100644 --- a/src/kibana/plugins/dashboard/components/panel/lib/visualization.js +++ b/src/kibana/plugins/dashboard/components/panel/lib/visualization.js @@ -13,7 +13,7 @@ define(function (require) { return { savedObj: savedVis, panel: panel, - edit: savedVisualizations.urlFor(panel.id) + editUrl: savedVisualizations.urlFor(panel.id) }; }); }; diff --git a/src/kibana/plugins/dashboard/components/panel/panel.html b/src/kibana/plugins/dashboard/components/panel/panel.html index 5abb8b64aca67..9e2f1b4ad40f3 100644 --- a/src/kibana/plugins/dashboard/components/panel/panel.html +++ b/src/kibana/plugins/dashboard/components/panel/panel.html @@ -2,8 +2,12 @@
{{savedObj.title}}
- - + + + + + +
@@ -26,4 +30,4 @@ class="panel-content" filter="filter"> - \ No newline at end of file + diff --git a/src/kibana/plugins/dashboard/components/panel/panel.js b/src/kibana/plugins/dashboard/components/panel/panel.js index d663a8eaae591..ae03ab2e090a4 100644 --- a/src/kibana/plugins/dashboard/components/panel/panel.js +++ b/src/kibana/plugins/dashboard/components/panel/panel.js @@ -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) { @@ -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; }); });