Commit 787ef845 authored by Jose Vargas's avatar Jose Vargas

Change the url when the timeslider changes

This changes the url for the monitoring dashboard
once the timeslider for any panel has changed.

This doesn't refreshes the page
parent 5536de83
...@@ -19,7 +19,12 @@ import PanelType from 'ee_else_ce/monitoring/components/panel_type.vue'; ...@@ -19,7 +19,12 @@ import PanelType from 'ee_else_ce/monitoring/components/panel_type.vue';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
import createFlash from '~/flash'; import createFlash from '~/flash';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { mergeUrlParams, redirectTo, refreshCurrentPage } from '~/lib/utils/url_utility'; import {
mergeUrlParams,
redirectTo,
refreshCurrentPage,
updateHistory,
} from '~/lib/utils/url_utility';
import invalidUrl from '~/lib/utils/invalid_url'; import invalidUrl from '~/lib/utils/invalid_url';
import Icon from '~/vue_shared/components/icon.vue'; import Icon from '~/vue_shared/components/icon.vue';
import DateTimePicker from '~/vue_shared/components/date_time_picker/date_time_picker.vue'; import DateTimePicker from '~/vue_shared/components/date_time_picker/date_time_picker.vue';
...@@ -356,6 +361,13 @@ export default { ...@@ -356,6 +361,13 @@ export default {
refreshDashboard() { refreshDashboard() {
refreshCurrentPage(); refreshCurrentPage();
}, },
onTimeRange({ start, end }) {
updateHistory({
url: mergeUrlParams({ start, end }, window.location.href),
title: document.title,
});
},
}, },
addMetric: { addMetric: {
title: s__('Metrics|Add metric'), title: s__('Metrics|Add metric'),
...@@ -577,6 +589,7 @@ export default { ...@@ -577,6 +589,7 @@ export default {
:alerts-endpoint="alertsEndpoint" :alerts-endpoint="alertsEndpoint"
:prometheus-alerts-available="prometheusAlertsAvailable" :prometheus-alerts-available="prometheusAlertsAvailable"
:index="`${index}-${graphIndex}`" :index="`${index}-${graphIndex}`"
@timerange="onTimeRange"
/> />
</div> </div>
</div> </div>
......
...@@ -159,6 +159,7 @@ export default { ...@@ -159,6 +159,7 @@ export default {
}, },
onDatazoom({ start, end }) { onDatazoom({ start, end }) {
this.zoomedTimeRange = { start, end }; this.zoomedTimeRange = { start, end };
this.$emit('timerange', { start, end });
}, },
}, },
}; };
......
---
title: Change the url when the timeslider changes
merge_request: 27726
author:
type: changed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment