Jelajahi Sumber

Updated dashboard links feature to support search by my multiple tags, #1944

Torkel Ödegaard 10 tahun lalu
induk
melakukan
6df9012141

+ 2 - 1
public/app/features/dashlinks/editor.html

@@ -25,7 +25,8 @@
 
 
 				<li class="tight-form-item" ng-show="link.type === 'dashboards'">With tag</li>
 				<li class="tight-form-item" ng-show="link.type === 'dashboards'">With tag</li>
 				<li ng-show="link.type === 'dashboards'">
 				<li ng-show="link.type === 'dashboards'">
-					<input type="text" ng-model="link.tag" class="input-small tight-form-input" style="width: 151px" ng-model-onblur ng-change="updated()">
+					<bootstrap-tagsinput ng-model="link.tags" tagclass="label label-tag" placeholder="add tags">
+					</bootstrap-tagsinput>
 				</li>
 				</li>
 				<li class="tight-form-item" ng-show="link.type === 'dashboards'">
 				<li class="tight-form-item" ng-show="link.type === 'dashboards'">
 					<editor-checkbox text="As dropdown" model="link.asDropdown" change="updated()"></editor-checkbox>
 					<editor-checkbox text="As dropdown" model="link.asDropdown" change="updated()"></editor-checkbox>

+ 3 - 3
public/app/features/dashlinks/module.js

@@ -89,7 +89,7 @@ function (angular, _) {
 
 
     function buildLinks(linkDef) {
     function buildLinks(linkDef) {
       if (linkDef.type === 'dashboards') {
       if (linkDef.type === 'dashboards') {
-        if (!linkDef.tag) {
+        if (!linkDef.tags) {
           console.log('Dashboard link missing tag');
           console.log('Dashboard link missing tag');
           return $q.when([]);
           return $q.when([]);
         }
         }
@@ -97,7 +97,7 @@ function (angular, _) {
         if (linkDef.asDropdown) {
         if (linkDef.asDropdown) {
           return $q.when([{
           return $q.when([{
             title: linkDef.title,
             title: linkDef.title,
-            tag: linkDef.tag,
+            tags: linkDef.tags,
             keepTime: linkDef.keepTime,
             keepTime: linkDef.keepTime,
             includeVars: linkDef.includeVars,
             includeVars: linkDef.includeVars,
             icon: "fa fa-bars",
             icon: "fa fa-bars",
@@ -132,7 +132,7 @@ function (angular, _) {
     }
     }
 
 
     $scope.searchDashboards = function(link) {
     $scope.searchDashboards = function(link) {
-      return backendSrv.search({tag: link.tag}).then(function(results) {
+      return backendSrv.search({tag: link.tags}).then(function(results) {
         return _.reduce(results, function(memo, dash) {
         return _.reduce(results, function(memo, dash) {
           // do not add current dashboard
           // do not add current dashboard
           if (dash.id !== currentDashId) {
           if (dash.id !== currentDashId) {