diff --git a/bower.json b/bower.json index ae61559c12f7b..f899253c5409a 100644 --- a/bower.json +++ b/bower.json @@ -35,7 +35,6 @@ "FileSaver": "babc6d9d8f", "font-awesome": "4.2.0", "gridster": "0.5.6", - "inflection": "1.3.8", "jquery": "2.1.4", "leaflet": "0.7.3", "Leaflet.heat": "Leaflet/Leaflet.heat#627ede7c11bbe43", diff --git a/src/kibana/plugins/dashboard/components/panel/lib/search.js b/src/kibana/plugins/dashboard/components/panel/lib/search.js index d5a147c187e66..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: '#discover' + 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 38f18ef7af678..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: '#visualize/edit' + 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 c16d6c9e3dec1..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 cb8f595f27834..ae03ab2e090a4 100644 --- a/src/kibana/plugins/dashboard/components/panel/panel.js +++ b/src/kibana/plugins/dashboard/components/panel/panel.js @@ -3,12 +3,20 @@ define(function (require) { var $ = require('jquery'); require('modules') .get('app/dashboard') - .directive('dashboardPanel', function (savedVisualizations, savedSearches, Notifier, Private, $compile) { + .directive('dashboardPanel', function (savedVisualizations, savedSearches, Notifier, Private, $injector) { var _ = require('lodash'); var loadPanel = Private(require('plugins/dashboard/components/panel/lib/load_panel')); var filterManager = Private(require('components/filter_manager/filter_manager')); var notify = new Notifier(); + var services = require('plugins/settings/saved_object_registry').all().map(function (serviceObj) { + var service = $injector.get(serviceObj.service); + return { + type: service.type, + name: serviceObj.service + }; + }); + require('components/visualize/visualize'); require('components/doc_table/doc_table'); @@ -29,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) { @@ -38,6 +46,19 @@ define(function (require) { }; }).catch(function (e) { $scope.error = e.message; + + // 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 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; }); }); diff --git a/src/kibana/plugins/settings/sections/objects/_view.html b/src/kibana/plugins/settings/sections/objects/_view.html index 7c9202280c309..b8ce631383970 100644 --- a/src/kibana/plugins/settings/sections/objects/_view.html +++ b/src/kibana/plugins/settings/sections/objects/_view.html @@ -10,6 +10,7 @@

There is a problem with that saved object

The saved search associated with this object no longer exists.

The index pattern associated with this object no longer exists.

+

A field associated with this object no longer exists in the index pattern.

If you know what this error means, go ahead and fix it - otherwise click the delete button above.

diff --git a/src/kibana/plugins/settings/sections/objects/_view.js b/src/kibana/plugins/settings/sections/objects/_view.js index 80dcd6e469f19..cfed63c63d72b 100644 --- a/src/kibana/plugins/settings/sections/objects/_view.js +++ b/src/kibana/plugins/settings/sections/objects/_view.js @@ -1,7 +1,6 @@ define(function (require) { var _ = require('lodash'); var angular = require('angular'); - var inflection = require('inflection'); var rison = require('utils/rison'); var registry = require('plugins/settings/saved_object_registry'); var objectViewHTML = require('text!plugins/settings/sections/objects/_view.html'); @@ -101,7 +100,7 @@ define(function (require) { $scope.notFound = $routeParams.notFound; - $scope.title = inflection.singularize(serviceObj.title); + $scope.title = service.type; es.get({ index: config.file.kibana_index, diff --git a/src/kibana/require.config.js b/src/kibana/require.config.js index 22eb9cce98abb..cff1fbaa17940 100644 --- a/src/kibana/require.config.js +++ b/src/kibana/require.config.js @@ -26,7 +26,6 @@ require.config({ file_saver: 'bower_components/FileSaver/FileSaver', gridster: 'bower_components/gridster/dist/jquery.gridster', 'leaflet-heat': 'bower_components/Leaflet.heat/dist/leaflet-heat', - inflection: 'bower_components/inflection/lib/inflection', jquery: 'bower_components/jquery/dist/jquery', leaflet: 'bower_components/leaflet/dist/leaflet', 'leaflet-draw': 'bower_components/leaflet-draw/dist/leaflet.draw', @@ -55,9 +54,6 @@ require.config({ 'leaflet-heat': { deps: ['leaflet'] }, - inflection: { - exports: 'inflection' - }, file_saver: { exports: 'saveAs' },