Commit 16f6ac19 authored by Siddharth Asthana's avatar Siddharth Asthana Committed by Olena Horal-Koretska

Improve inline error message for elapsed time field in policy model

parent 1effe4bc
......@@ -26,9 +26,7 @@ export const i18n = {
emptyScheduleValidationMsg: s__(
'EscalationPolicies|A schedule is required for adding an escalation policy.',
),
invalidTimeValidationMsg: s__(
'EscalationPolicies|Elapsed time must be greater than or equal to zero.',
),
invalidTimeValidationMsg: s__('EscalationPolicies|Minutes must be between 0 and 1440.'),
},
},
};
......
......@@ -16,8 +16,9 @@ export const isNameFieldValid = (name) => {
*/
export const getRulesValidationState = (rules) => {
return rules.map((rule) => {
const minutes = parseInt(rule.elapsedTimeMinutes, 10);
return {
isTimeValid: parseInt(rule.elapsedTimeMinutes, 10) >= 0,
isTimeValid: minutes >= 0 && minutes <= 1440,
isScheduleValid: Boolean(rule.oncallScheduleIid),
};
});
......
......@@ -13075,9 +13075,6 @@ msgstr ""
msgid "EscalationPolicies|Edit escalation policy"
msgstr ""
msgid "EscalationPolicies|Elapsed time must be greater than or equal to zero."
msgstr ""
msgid "EscalationPolicies|Email on-call user in schedule"
msgstr ""
......@@ -13096,6 +13093,9 @@ msgstr ""
msgid "EscalationPolicies|IF alert is not %{alertStatus} in %{minutes} minutes"
msgstr ""
msgid "EscalationPolicies|Minutes must be between 0 and 1440."
msgstr ""
msgid "EscalationPolicies|Remove escalation rule"
msgstr ""
......
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