Panel: added search typeahead for dashboard links, #1041

pull/1047/head
Torkel Ödegaard 11 years ago
parent a49a9b3b64
commit c12d830162
  1. 2
      src/app/app.js
  2. 1
      src/app/controllers/dashboardCtrl.js
  3. 1
      src/app/directives/all.js
  4. 3
      src/app/features/all.js
  5. 0
      src/app/features/panellinkeditor/linkSrv.js
  6. 5
      src/app/features/panellinkeditor/module.html
  7. 17
      src/app/features/panellinkeditor/module.js
  8. 1
      src/app/services/dashboard/dashboardKeyBindings.js
  9. 7
      tasks/options/requirejs.js

@ -78,6 +78,8 @@ function (angular, $, _, appLevelRequire, config) {
}); });
var preBootRequires = [ var preBootRequires = [
'services/all',
'features/all',
'controllers/all', 'controllers/all',
'directives/all', 'directives/all',
'filters/all', 'filters/all',

@ -3,7 +3,6 @@ define([
'jquery', 'jquery',
'config', 'config',
'lodash', 'lodash',
'services/all',
], ],
function (angular, $, config, _) { function (angular, $, config, _) {
"use strict"; "use strict";

@ -19,6 +19,5 @@ define([
'./graphiteSegment', './graphiteSegment',
'./grafanaVersionCheck', './grafanaVersionCheck',
'./dropdown.typeahead', './dropdown.typeahead',
'components/panellinkeditor/module',
'./influxdbFuncEditor' './influxdbFuncEditor'
], function () {}); ], function () {});

@ -0,0 +1,3 @@
define([
'./panellinkeditor/module',
], function () {});

@ -21,7 +21,10 @@
<li class="grafana-target-segment" ng-show="link.type === 'dashboard'">dashboard</li> <li class="grafana-target-segment" ng-show="link.type === 'dashboard'">dashboard</li>
<li ng-show="link.type === 'dashboard'"> <li ng-show="link.type === 'dashboard'">
<input type="text" ng-model="link.dashboard" class="input-large grafana-target-segment-input"> <input type="text"
ng-model="link.dashboard"
bs-typeahead="searchDashboards"
class="input-large grafana-target-segment-input">
</li> </li>
<li class="grafana-target-segment" ng-show="link.type === 'absolute'">url</li> <li class="grafana-target-segment" ng-show="link.type === 'absolute'">url</li>

@ -15,11 +15,11 @@ function (angular, _) {
}, },
restrict: 'E', restrict: 'E',
controller: 'PanelLinkEditorCtrl', controller: 'PanelLinkEditorCtrl',
templateUrl: 'app/components/panellinkeditor/module.html', templateUrl: 'app/features/panellinkeditor/module.html',
link: function() { link: function() {
} }
}; };
}).controller('PanelLinkEditorCtrl', function($scope) { }).controller('PanelLinkEditorCtrl', function($scope, datasourceSrv) {
$scope.panel.links = $scope.panel.links || []; $scope.panel.links = $scope.panel.links || [];
@ -30,6 +30,19 @@ function (angular, _) {
}); });
}; };
$scope.searchDashboards = function(query, callback) {
var ds = datasourceSrv.getGrafanaDB();
if (ds === null) { return; }
ds.searchDashboards(query).then(function(result) {
var dashboards = _.map(result.dashboards, function(dash) {
return dash.title;
});
callback(dashboards);
});
};
$scope.deleteLink = function(link) { $scope.deleteLink = function(link) {
$scope.panel.links = _.without($scope.panel.links, link); $scope.panel.links = _.without($scope.panel.links, link);
}; };

@ -1,7 +1,6 @@
define([ define([
'angular', 'angular',
'jquery', 'jquery',
'services/all'
], ],
function(angular, $) { function(angular, $) {
"use strict"; "use strict";

@ -54,12 +54,13 @@ module.exports = function(config,grunt) {
'timepicker', 'timepicker',
'datepicker', 'datepicker',
'lodash', 'lodash',
'filters/all',
'jquery.flot', 'jquery.flot',
'services/all',
'angular-strap', 'angular-strap',
'directives/all',
'angular-dragdrop', 'angular-dragdrop',
'services/all',
'features/all',
'directives/all',
'filters/all',
'controllers/all', 'controllers/all',
'routes/all', 'routes/all',
'components/partials', 'components/partials',

Loading…
Cancel
Save