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
1 change: 0 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
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" 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>
25 changes: 23 additions & 2 deletions src/kibana/plugins/dashboard/components/panel/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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) {
Expand All @@ -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;
});

});
Expand Down
1 change: 1 addition & 0 deletions src/kibana/plugins/settings/sections/objects/_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ <h4>There is a problem with that saved object</h4>

<p ng-if="notFound === 'search'">The saved search associated with this object no longer exists.</p>
<p ng-if="notFound === 'index-pattern'">The index pattern associated with this object no longer exists.</p>
<p ng-if="notFound === 'index-pattern-field'">A field associated with this object no longer exists in the index pattern.</p>

<p>If you know what this error means, go ahead and fix it - otherwise click the delete button above.</p>
</div>
Expand Down
3 changes: 1 addition & 2 deletions src/kibana/plugins/settings/sections/objects/_view.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions src/kibana/require.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -55,9 +54,6 @@ require.config({
'leaflet-heat': {
deps: ['leaflet']
},
inflection: {
exports: 'inflection'
},
file_saver: {
exports: 'saveAs'
},
Expand Down