Skip to content

Commit

Permalink
[Monitoring] No longer overwriting time to the 1h default (#88102)
Browse files Browse the repository at this point in the history
* No longer overwriting time to the 1h default

* Added auto refresh
  • Loading branch information
igoristic authored Jan 26, 2021
1 parent 0c9c2c9 commit ca3f4de
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions x-pack/plugins/monitoring/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
FeatureCatalogueCategory,
HomePublicPluginSetup,
} from '../../../../src/plugins/home/public';
import { UI_SETTINGS } from '../../../../src/plugins/data/public';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/public';
import { MonitoringStartPluginDependencies, MonitoringConfig } from './types';
import { TriggersAndActionsUIPublicPluginSetup } from '../../triggers_actions_ui/public';
Expand Down Expand Up @@ -98,7 +97,6 @@ export class MonitoringPlugin
};

this.setInitialTimefilter(deps);

const monitoringApp = new AngularApp(deps);
const removeHistoryListener = params.history.listen((location) => {
if (location.pathname === '' && location.hash === '') {
Expand All @@ -121,18 +119,10 @@ export class MonitoringPlugin

public stop() {}

private setInitialTimefilter({ core: coreContext, data }: MonitoringStartPluginDependencies) {
private setInitialTimefilter({ data }: MonitoringStartPluginDependencies) {
const { timefilter } = data.query.timefilter;
const { uiSettings } = coreContext;
const refreshInterval = { value: 10000, pause: false };
const time = { from: 'now-1h', to: 'now' };
timefilter.setRefreshInterval(refreshInterval);
timefilter.setTime(time);
uiSettings.overrideLocalDefault(
UI_SETTINGS.TIMEPICKER_REFRESH_INTERVAL_DEFAULTS,
JSON.stringify(refreshInterval)
);
uiSettings.overrideLocalDefault(UI_SETTINGS.TIMEPICKER_TIME_DEFAULTS, JSON.stringify(time));
}

private getExternalConfig() {
Expand Down

0 comments on commit ca3f4de

Please sign in to comment.