Skip to content

Commit e02770d

Browse files
committed
fix: change notification preview message to have time in UTC format. fix an improper import
Signed-off-by: vikhy-aws <[email protected]>
1 parent ad86031 commit e02770d

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

cypress/fixtures/sample_composite_level_monitor.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"name": "sample_channel",
4949
"destination_id": "6dYFw4gB2qeAWe54NgyL",
5050
"message_template": {
51-
"source": "Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.\n - Trigger: {{ctx.trigger.name}}\n - Severity: {{ctx.trigger.severity}}\n - Period start: {{ctx.periodStart}}\n - Period end: {{ctx.periodEnd}}",
51+
"source": "Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.\n - Trigger: {{ctx.trigger.name}}\n - Severity: {{ctx.trigger.severity}}\n - Period start: {{ctx.periodStart}} UTC\n - Period end: {{ctx.periodEnd}} UTC",
5252
"lang": "mustache"
5353
},
5454
"throttle_enabled": false,

public/pages/CreateTrigger/components/Action/actions/Message.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function getRenderWrapper(customProps = {}) {
1919
action={{
2020
message_template: {
2121
source:
22-
'Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.\n- Trigger: {{ctx.trigger.name}}\n- Severity: {{ctx.trigger.severity}}\n- Period start: {{ctx.periodStart}}\n- Period end: {{ctx.periodEnd}}',
22+
'Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.\n- Trigger: {{ctx.trigger.name}}\n- Severity: {{ctx.trigger.severity}}\n- Period start: {{ctx.periodStart}} UTC\n- Period end: {{ctx.periodEnd}} UTC',
2323
lang: 'mustache',
2424
},
2525
}}

public/pages/CreateTrigger/utils/constants.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export const DEFAULT_MESSAGE_SOURCE = {
1111
Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.
1212
- Trigger: {{ctx.trigger.name}}
1313
- Severity: {{ctx.trigger.severity}}
14-
- Period start: {{ctx.periodStart}}
15-
- Period end: {{ctx.periodEnd}}
14+
- Period start: {{ctx.periodStart}} UTC
15+
- Period end: {{ctx.periodEnd}} UTC
1616
1717
- Deduped Alerts:
1818
{{#ctx.dedupedAlerts}}
@@ -33,8 +33,8 @@ export const DEFAULT_MESSAGE_SOURCE = {
3333
Monitor {{ctx.monitor.name}} just entered alert status. Please investigate the issue.
3434
- Trigger: {{ctx.trigger.name}}
3535
- Severity: {{ctx.trigger.severity}}
36-
- Period start: {{ctx.periodStart}}
37-
- Period end: {{ctx.periodEnd}}
36+
- Period start: {{ctx.periodStart}} UTC
37+
- Period end: {{ctx.periodEnd}} UTC
3838
`.trim(),
3939
};
4040

public/pages/CreateTrigger/utils/helper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,10 @@ export const getTriggerContext = (executeResponse, monitor, values, triggerIndex
7474
if (_.isArray(trigger) && triggerIndex >= 0) trigger = trigger[triggerIndex];
7575

7676
return {
77-
periodStart: moment.utc(_.get(executeResponse, 'period_start', Date.now())).tz(getTimeZone()).format(),
78-
periodEnd: moment.utc(_.get(executeResponse, 'period_end', Date.now())).tz(getTimeZone()).format(),
77+
// Backend only supports, UTC timezone.
78+
// Don't use user's local timezone.
79+
periodStart: moment.utc(_.get(executeResponse, 'period_start', Date.now())).format(),
80+
periodEnd: moment.utc(_.get(executeResponse, 'period_end', Date.now())).format(),
7981
results: [_.get(executeResponse, 'input_results.results[0]')].filter((result) => !!result),
8082
trigger: trigger,
8183
alert: null,

public/pages/Dashboard/components/AcknowledgeAlertsModal/AcknowledgeAlertsModal.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ import { MAX_ALERT_COUNT } from '../../utils/constants';
4242
import { DEFAULT_PAGE_SIZE_OPTIONS } from '../../../Monitors/containers/Monitors/utils/constants';
4343
import DashboardControls from '../DashboardControls';
4444
import ContentPanel from '../../../../components/ContentPanel';
45-
import { appendCommentsAction, queryColumns } from '../../utils/tableUtils';
45+
import { queryColumns } from '../../utils/tableUtils';
4646
import DashboardEmptyPrompt from '../DashboardEmptyPrompt';
4747
import { getAlertsFindingColumn } from '../FindingsDashboard/findingsUtils';
48-
import { getDataSourceId, getIsCommentsEnabled } from '../../../utils/helpers';
48+
import { appendCommentsAction, getDataSourceId, getIsCommentsEnabled } from '../../../utils/helpers';
4949

5050
export const DEFAULT_NUM_MODAL_ROWS = 10;
5151

0 commit comments

Comments
 (0)