From bd2b26e9f5f13509a64bc7fce8985413997bc00d Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Tue, 21 Nov 2017 14:47:19 +0100 Subject: [PATCH 1/4] dashlist: fix tag filtering and some css --- public/app/core/services/search_srv.ts | 2 +- .../features/dashboard/dashboard_list_ctrl.ts | 29 ++++++---- .../dashboard/partials/dashboardList.html | 29 +++++----- .../specs/dashboard_list_ctrl.jest.ts | 57 +++++++++++++++++++ 4 files changed, 93 insertions(+), 24 deletions(-) diff --git a/public/app/core/services/search_srv.ts b/public/app/core/services/search_srv.ts index 4b32c2735bf..3d85cb20005 100644 --- a/public/app/core/services/search_srv.ts +++ b/public/app/core/services/search_srv.ts @@ -52,7 +52,7 @@ export class SearchSrv { } search(options) { - if (!options.query) { + if (!options.query && !options.tag) { return this.browse(); } diff --git a/public/app/features/dashboard/dashboard_list_ctrl.ts b/public/app/features/dashboard/dashboard_list_ctrl.ts index 032e8d7ffa0..8f6820498b7 100644 --- a/public/app/features/dashboard/dashboard_list_ctrl.ts +++ b/public/app/features/dashboard/dashboard_list_ctrl.ts @@ -22,20 +22,29 @@ export class DashboardListCtrl { } getDashboards() { - return this.searchSrv.browse().then((result) => { + if (this.query.query.length === 0 && this.query.tag.length === 0) { + return this.searchSrv.browse().then((result) => { + return this.initDashboardList(result); + }); + } - this.sections = result; - - for (let section of this.sections) { - section.checked = false; - - for (let dashboard of section.items) { - dashboard.checked = false; - } - } + return this.searchSrv.search(this.query).then((result) => { + return this.initDashboardList(result); }); } + initDashboardList(result: any) { + this.sections = result; + + for (let section of this.sections) { + section.checked = false; + + for (let dashboard of section.items) { + dashboard.checked = false; + } + } + } + selectionChanged() { let selectedDashboards = 0; diff --git a/public/app/features/dashboard/partials/dashboardList.html b/public/app/features/dashboard/partials/dashboardList.html index 104861af637..ffd7faa6db5 100644 --- a/public/app/features/dashboard/partials/dashboardList.html +++ b/public/app/features/dashboard/partials/dashboardList.html @@ -58,19 +58,22 @@ +