grafana/public/app/features/dashboard/services/UnsavedChangesSrv.ts
kay delaney 880fbcb09a
Chore/Tech debt: Remove (most) instances of $q angular service use (#20668)
* Chore/Tech debt: Remove (most) instances of $q angular service use
Removes instances where the angular $q service is used and replaces
it with native Promises.
2019-12-05 09:04:03 +00:00

24 lines
775 B
TypeScript

import angular, { ILocationService } from 'angular';
import { ChangeTracker } from './ChangeTracker';
import { ContextSrv } from 'app/core/services/context_srv';
import { DashboardSrv } from './DashboardSrv';
import { GrafanaRootScope } from 'app/routes/GrafanaCtrl';
/** @ngInject */
export function unsavedChangesSrv(
this: any,
$rootScope: GrafanaRootScope,
$location: ILocationService,
$timeout: any,
contextSrv: ContextSrv,
dashboardSrv: DashboardSrv,
$window: any
) {
this.init = function(dashboard: any, scope: any) {
this.tracker = new ChangeTracker(dashboard, scope, 1000, $location, $window, $timeout, contextSrv, $rootScope);
return this.tracker;
};
}
angular.module('grafana.services').service('unsavedChangesSrv', unsavedChangesSrv);