mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Search: Fixed angular digest issues (#20906)
This commit is contained in:
parent
9d9f0e1b8c
commit
a9bf8f80e9
@ -1,9 +1,9 @@
|
||||
import { IScope } from 'angular';
|
||||
import _ from 'lodash';
|
||||
import coreModule from 'app/core/core_module';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import { SearchSrv } from 'app/core/services/search_srv';
|
||||
import { BackendSrv } from 'app/core/services/backend_srv';
|
||||
import { NavModelSrv } from 'app/core/nav_model_srv';
|
||||
import { ContextSrv } from 'app/core/services/context_srv';
|
||||
import { CoreEvents } from 'app/types';
|
||||
|
||||
@ -70,8 +70,8 @@ export class ManageDashboardsCtrl {
|
||||
|
||||
/** @ngInject */
|
||||
constructor(
|
||||
private $scope: IScope,
|
||||
private backendSrv: BackendSrv,
|
||||
navModelSrv: NavModelSrv,
|
||||
private searchSrv: SearchSrv,
|
||||
private contextSrv: ContextSrv
|
||||
) {
|
||||
@ -107,6 +107,7 @@ export class ManageDashboardsCtrl {
|
||||
})
|
||||
.then(() => {
|
||||
if (!this.folderUid) {
|
||||
this.$scope.$digest();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -115,6 +116,7 @@ export class ManageDashboardsCtrl {
|
||||
if (!this.canSave) {
|
||||
this.hasEditPermissionInFolders = false;
|
||||
}
|
||||
this.$scope.$digest();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ export class SearchCtrl {
|
||||
queryParser: SearchQueryParser;
|
||||
|
||||
/** @ngInject */
|
||||
constructor($scope: any, private $location: any, private $timeout: any, private searchSrv: SearchSrv) {
|
||||
constructor(private $scope: any, private $location: any, private $timeout: any, private searchSrv: SearchSrv) {
|
||||
appEvents.on(CoreEvents.showDashSearch, this.openSearch.bind(this), $scope);
|
||||
appEvents.on(CoreEvents.hideDashSearch, this.closeSearch.bind(this), $scope);
|
||||
appEvents.on(CoreEvents.searchQuery, debounce(this.search.bind(this), 500), $scope);
|
||||
@ -252,6 +252,7 @@ export class SearchCtrl {
|
||||
this.results = results || [];
|
||||
this.isLoading = false;
|
||||
this.moveSelection(1);
|
||||
this.$scope.$digest();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,6 @@ import {
|
||||
} from 'app/core/components/manage_dashboards/manage_dashboards';
|
||||
import { SearchSrv } from 'app/core/services/search_srv';
|
||||
import { BackendSrv } from '../services/backend_srv';
|
||||
import { NavModelSrv } from '../nav_model_srv';
|
||||
import { ContextSrv } from '../services/context_srv';
|
||||
|
||||
const mockSection = (overides?: object): Section => {
|
||||
@ -593,8 +592,8 @@ function createCtrlWithStubs(searchResponse: any, tags?: any) {
|
||||
};
|
||||
|
||||
return new ManageDashboardsCtrl(
|
||||
{ $digest: jest.fn() } as any,
|
||||
{} as BackendSrv,
|
||||
{ getNav: () => {} } as NavModelSrv,
|
||||
searchSrvStub as SearchSrv,
|
||||
{ isEditor: true } as ContextSrv
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user