Search: Fixed angular digest issues (#20906)

pull/20875/head^2
Torkel Ödegaard 6 years ago committed by GitHub
parent 9d9f0e1b8c
commit a9bf8f80e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      public/app/core/components/manage_dashboards/manage_dashboards.ts
  2. 3
      public/app/core/components/search/search.ts
  3. 3
      public/app/core/specs/manage_dashboards.test.ts

@ -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…
Cancel
Save