UnsavedChangesSrv.ts 731 B

1234567891011121314151617181920212223
  1. import angular, { IQService, ILocationService } from 'angular';
  2. import { ChangeTracker } from './ChangeTracker';
  3. import { ContextSrv } from 'app/core/services/context_srv';
  4. import { DashboardSrv } from './DashboardSrv';
  5. /** @ngInject */
  6. export function unsavedChangesSrv(
  7. this: any,
  8. $rootScope: any,
  9. $q: IQService,
  10. $location: ILocationService,
  11. $timeout: any,
  12. contextSrv: ContextSrv,
  13. dashboardSrv: DashboardSrv,
  14. $window: any
  15. ) {
  16. this.init = function(dashboard: any, scope: any) {
  17. this.tracker = new ChangeTracker(dashboard, scope, 1000, $location, $window, $timeout, contextSrv, $rootScope);
  18. return this.tracker;
  19. };
  20. }
  21. angular.module('grafana.services').service('unsavedChangesSrv', unsavedChangesSrv);