diff --git a/public/app/features/dashboard/dashboard_list_ctrl.ts b/public/app/features/dashboard/dashboard_list_ctrl.ts index 4522a53e81d..a8479de92e0 100644 --- a/public/app/features/dashboard/dashboard_list_ctrl.ts +++ b/public/app/features/dashboard/dashboard_list_ctrl.ts @@ -11,12 +11,12 @@ export class DashboardListCtrl { /** @ngInject */ constructor(private backendSrv, navModelSrv, private $q) { this.navModel = navModelSrv.getNav('cfg', 'dashboards'); - this.query = ''; + this.query = {query: '', mode: 'tree', tag: []}; this.getDashboards(); } getDashboards() { - return this.backendSrv.get(`/api/search?query=${this.query}&mode=tree`).then((result) => { + return this.backendSrv.search(this.query).then((result) => { this.dashboards = this.groupDashboardsInFolders(result); @@ -134,4 +134,22 @@ export class DashboardListCtrl { model: {dashboards: selectedDashboards, afterSave: this.getDashboards.bind(this)} }); } + + filterByTag(tag, evt) { + this.query.tag.push(tag); + this.getDashboards(); + if (evt) { + evt.stopPropagation(); + evt.preventDefault(); + } + } + + removeTag(tag, evt) { + this.query.tag = _.without(this.query.tag, tag); + this.getDashboards(); + if (evt) { + evt.stopPropagation(); + evt.preventDefault(); + } + } } diff --git a/public/app/features/dashboard/partials/dashboardList.html b/public/app/features/dashboard/partials/dashboardList.html index aca798ebf32..313ec2337b7 100644 --- a/public/app/features/dashboard/partials/dashboardList.html +++ b/public/app/features/dashboard/partials/dashboardList.html @@ -14,11 +14,24 @@ Create Folder -