mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Events: Remove unused or unnecessary events (#28783)
* Events: Removing unused or unnessary events * More cleanup * Updated
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
import coreModule from 'app/core/core_module';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import { dispatch, store } from 'app/store/store';
|
||||
import { updateLocation } from 'app/core/actions';
|
||||
import { ILocationService, ITimeoutService, IWindowService } from 'angular';
|
||||
import { CoreEvents } from 'app/types';
|
||||
import { ILocationService, ITimeoutService } from 'angular';
|
||||
import { GrafanaRootScope } from 'app/routes/GrafanaCtrl';
|
||||
import { locationUtil, UrlQueryMap } from '@grafana/data';
|
||||
import { UrlQueryMap } from '@grafana/data';
|
||||
import { getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv';
|
||||
import { templateVarsChangedInUrl } from 'app/features/variables/state/actions';
|
||||
import { isArray, isEqual } from 'lodash';
|
||||
|
||||
// Services that handles angular -> redux store sync & other react <-> angular sync
|
||||
export class BridgeSrv {
|
||||
private fullPageReloadRoutes: string[];
|
||||
private lastQuery: UrlQueryMap = {};
|
||||
private lastPath = '';
|
||||
private angularUrl: string;
|
||||
@@ -22,11 +19,9 @@ export class BridgeSrv {
|
||||
constructor(
|
||||
private $location: ILocationService,
|
||||
private $timeout: ITimeoutService,
|
||||
private $window: IWindowService,
|
||||
private $rootScope: GrafanaRootScope,
|
||||
private $route: any
|
||||
) {
|
||||
this.fullPageReloadRoutes = ['/logout'];
|
||||
this.angularUrl = $location.url();
|
||||
}
|
||||
|
||||
@@ -101,19 +96,6 @@ export class BridgeSrv {
|
||||
this.lastQuery = state.location.query;
|
||||
this.lastUrl = state.location.url;
|
||||
});
|
||||
|
||||
appEvents.on(CoreEvents.locationChange, payload => {
|
||||
const urlWithoutBase = locationUtil.stripBaseFromUrl(payload.href);
|
||||
if (this.fullPageReloadRoutes.indexOf(urlWithoutBase) > -1) {
|
||||
this.$window.location.href = payload.href;
|
||||
return;
|
||||
}
|
||||
|
||||
this.$timeout(() => {
|
||||
// A hack to use timeout when we're changing things (in this case the url) from outside of Angular.
|
||||
this.$location.url(urlWithoutBase);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import { ContextSrv } from './context_srv';
|
||||
export class KeybindingSrv {
|
||||
helpModal: boolean;
|
||||
modalOpen = false;
|
||||
timepickerOpen = false;
|
||||
|
||||
/** @ngInject */
|
||||
constructor(
|
||||
@@ -39,8 +38,6 @@ export class KeybindingSrv {
|
||||
|
||||
this.setupGlobal();
|
||||
appEvents.on(CoreEvents.showModal, () => (this.modalOpen = true));
|
||||
appEvents.on(CoreEvents.timepickerOpen, () => (this.timepickerOpen = true));
|
||||
appEvents.on(CoreEvents.timepickerClosed, () => (this.timepickerOpen = false));
|
||||
}
|
||||
|
||||
setupGlobal() {
|
||||
@@ -116,12 +113,6 @@ export class KeybindingSrv {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.timepickerOpen) {
|
||||
this.$rootScope.appEvent(CoreEvents.closeTimepicker);
|
||||
this.timepickerOpen = false;
|
||||
return;
|
||||
}
|
||||
|
||||
// close settings view
|
||||
const search = this.$location.search();
|
||||
if (search.editview) {
|
||||
|
||||
Reference in New Issue
Block a user