Commit c12d8301 by Torkel Ödegaard

Panel: added search typeahead for dashboard links, #1041

parent a49a9b3b
......@@ -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 () {});
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);
};
......
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',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment