Add a "timezone" prop to heatmaps, time series and anomaly charts
What does this MR do?
Chart related implementation of #214370 (closed)
Allow heatmaps, time series and anomaly charts to accept a timezone
prop. Both x axis and tooltip formats have been updated to consider this prop.
No changes are expected in the UX as local timezone is used by default.
- In follow-up issue #219210 (closed), other charts should be updated but they need to format their dates as well!
- In a follow-up MR, I will connect the use configuration to the
dashboard_panel
to wire the solution.
Most loc changes are in time_series_spec.js
that were due for a refactor anyway.
How to test
Add :timezone="'UTC'"
to the settings of the charts:
diff --git a/app/assets/javascripts/monitoring/components/dashboard_panel.vue b/app/assets/javascripts/monitoring/components/dashboard_panel.vue
index a23d6692e33..221ff21d7be 100644
--- a/app/assets/javascripts/monitoring/components/dashboard_panel.vue
+++ b/app/assets/javascripts/monitoring/components/dashboard_panel.vue
@@ -373,6 +373,7 @@ export default {
:is="basicChartComponent"
v-else-if="basicChartComponent"
:graph-data="graphData"
+ :timezone="'UTC'"
v-bind="$attrs"
v-on="$listeners"
/>
@@ -386,6 +387,7 @@ export default {
:project-path="projectPath"
:thresholds="getGraphAlertValues(graphData.metrics)"
:group-id="groupId"
+ :timezone="'UTC'"
v-bind="$attrs"
v-on="$listeners"
@datazoom="onDatazoom"
Screenshots
On my local machine, at 7PM (China time), the time format changes depending on the settings:
:timezone="'UTC'" (local clock in Shanghai) |
:timezone="'LOCAL'" (local clock in Shanghai) | :timezone="'LOCAL'" (local clock in Los Angeles) |
---|---|---|
Anomaly chart verification |
---|
Does this MR meet the acceptance criteria?
Conformity
- [-] Changelog entry
- [-] Documentation (if required)
-
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team
Edited by 🤖 GitLab Bot 🤖