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 = [
'services/all',
'features/all',
'controllers/all',
'directives/all',
'filters/all',

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

@ -19,6 +19,5 @@ define([
'./graphiteSegment',
'./grafanaVersionCheck',
'./dropdown.typeahead',
'components/panellinkeditor/module',
'./influxdbFuncEditor'
], 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 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 class="grafana-target-segment" ng-show="link.type === 'absolute'">url</li>

@ -15,11 +15,11 @@ function (angular, _) {
},
restrict: 'E',
controller: 'PanelLinkEditorCtrl',
templateUrl: 'app/components/panellinkeditor/module.html',
templateUrl: 'app/features/panellinkeditor/module.html',
link: function() {
}
};
}).controller('PanelLinkEditorCtrl', function($scope) {
}).controller('PanelLinkEditorCtrl', function($scope, datasourceSrv) {
$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.panel.links = _.without($scope.panel.links, link);
};

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

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

Loading…
Cancel
Save