From dc236b506343a3d1d065c7c6a1c0d200c3f89e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Wed, 5 Sep 2018 12:09:16 +0200 Subject: [PATCH] refatoring: minor changes to PR #13149 --- public/app/core/components/search/search.ts | 5 ++--- public/app/features/dashboard/dashboard_import_ctrl.ts | 4 +++- public/app/features/dashboard/upload.ts | 10 ++++++---- public/sass/components/_search.scss | 4 ++++ 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/public/app/core/components/search/search.ts b/public/app/core/components/search/search.ts index d459c497521..e347fcd829a 100644 --- a/public/app/core/components/search/search.ts +++ b/public/app/core/components/search/search.ts @@ -130,9 +130,8 @@ export class SearchCtrl { } const max = flattenedResult.length; - let newIndex = this.selectedIndex + direction; - const something = (newIndex %= max); - this.selectedIndex = something < 0 ? newIndex + max : newIndex; + const newIndex = (this.selectedIndex + direction) % max; + this.selectedIndex = newIndex < 0 ? newIndex + max : newIndex; const selectedItem = flattenedResult[this.selectedIndex]; if (selectedItem.dashboardIndex === undefined && this.results[selectedItem.folderIndex].id === 0) { diff --git a/public/app/features/dashboard/dashboard_import_ctrl.ts b/public/app/features/dashboard/dashboard_import_ctrl.ts index 3dfae1250dd..455fa682edd 100644 --- a/public/app/features/dashboard/dashboard_import_ctrl.ts +++ b/public/app/features/dashboard/dashboard_import_ctrl.ts @@ -1,5 +1,6 @@ import _ from 'lodash'; import config from 'app/core/config'; +import locationUtil from 'app/core/utils/location_util'; export class DashboardImportCtrl { navModel: any; @@ -179,7 +180,8 @@ export class DashboardImportCtrl { folderId: this.folderId, }) .then(res => { - this.$location.url(res.importedUrl); + const dashUrl = locationUtil.stripBaseFromUrl(res.importedUrl); + this.$location.url(dashUrl); }); } diff --git a/public/app/features/dashboard/upload.ts b/public/app/features/dashboard/upload.ts index ee77c6e5394..974a0c35cd2 100644 --- a/public/app/features/dashboard/upload.ts +++ b/public/app/features/dashboard/upload.ts @@ -37,12 +37,14 @@ function uploadDashboardDirective(timer, alertSrv, $location) { }; let i = 0; - let f = files[i]; - for (i; f; i++) { + let file = files[i]; + + while (file) { const reader = new FileReader(); reader.onload = readerOnload(); - reader.readAsText(f); - f = files[i]; + reader.readAsText(file); + i += 1; + file = files[i]; } } diff --git a/public/sass/components/_search.scss b/public/sass/components/_search.scss index 8338a5d72ae..a27fc830317 100644 --- a/public/sass/components/_search.scss +++ b/public/sass/components/_search.scss @@ -192,6 +192,10 @@ &:hover, &.selected { background: $list-item-hover-bg; + + .search-item__body-title { + color: $text-color-strong; + } } }