mirror of
https://github.com/grafana/grafana.git
synced 2025-09-24 23:24:04 +08:00
Panel: added search typeahead for dashboard links, #1041
This commit is contained in:
@ -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 () {});
|
||||
|
3
src/app/features/all.js
Normal file
3
src/app/features/all.js
Normal file
@ -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',
|
||||
|
Reference in New Issue
Block a user