Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
07b8f924
Commit
07b8f924
authored
Jun 02, 2021
by
Olena Horal-Koretska
Committed by
Frédéric Caplette
Jun 02, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Escalation rule improvements
parent
2aba3074
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
41 additions
and
19 deletions
+41
-19
ee/app/assets/javascripts/escalation_policies/components/add_edit_escalation_policy_form.vue
...n_policies/components/add_edit_escalation_policy_form.vue
+0
-1
ee/app/assets/javascripts/escalation_policies/components/add_edit_escalation_policy_modal.vue
..._policies/components/add_edit_escalation_policy_modal.vue
+10
-4
ee/app/assets/javascripts/escalation_policies/components/escalation_rule.vue
...cripts/escalation_policies/components/escalation_rule.vue
+8
-2
ee/spec/frontend/escalation_policies/add_edit_escalation_policy_form_spec.js
...calation_policies/add_edit_escalation_policy_form_spec.js
+2
-10
ee/spec/frontend/escalation_policies/add_edit_escalation_policy_modal_spec.js
...alation_policies/add_edit_escalation_policy_modal_spec.js
+18
-2
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
ee/app/assets/javascripts/escalation_policies/components/add_edit_escalation_policy_form.vue
View file @
07b8f924
...
...
@@ -79,7 +79,6 @@ export default {
methods
:
{
addRule
()
{
this
.
rules
.
push
({
...
cloneDeep
(
defaultEscalationRule
),
key
:
this
.
getUid
()
});
this
.
emitUpdate
();
},
updateEscalationRules
(
index
,
rule
)
{
this
.
rules
[
index
]
=
rule
;
...
...
ee/app/assets/javascripts/escalation_policies/components/add_edit_escalation_policy_modal.vue
View file @
07b8f924
...
...
@@ -38,7 +38,7 @@ export default {
rules
:
[],
},
validationState
:
{
name
:
true
,
name
:
null
,
rules
:
[],
},
error
:
null
,
...
...
@@ -103,7 +103,7 @@ export default {
}
this
.
$refs
.
addUpdateEscalationPolicyModal
.
hide
();
this
.
$emit
(
'
policyCreated
'
);
this
.
clear
Form
();
this
.
reset
Form
();
},
)
.
catch
((
error
)
=>
{
...
...
@@ -124,12 +124,17 @@ export default {
hideErrorAlert
()
{
this
.
error
=
null
;
},
clear
Form
()
{
reset
Form
()
{
this
.
form
=
{
name
:
''
,
description
:
''
,
rules
:
[],
};
this
.
validationState
=
{
name
:
null
,
rules
:
[],
};
this
.
hideErrorAlert
();
},
},
};
...
...
@@ -144,7 +149,8 @@ export default {
:action-primary=
"actionsProps.primary"
:action-cancel=
"actionsProps.cancel"
@
primary.prevent=
"createEscalationPolicy"
@
cancel=
"clearForm"
@
canceled=
"resetForm"
@
close=
"resetForm"
>
<gl-alert
v-if=
"error"
variant=
"danger"
class=
"gl-mt-n3 gl-mb-3"
@
dismiss=
"hideErrorAlert"
>
{{
error
}}
...
...
ee/app/assets/javascripts/escalation_policies/components/escalation_rule.vue
View file @
07b8f924
...
...
@@ -5,6 +5,7 @@ import {
GlDropdown
,
GlDropdownItem
,
GlCard
,
GlButton
,
GlIcon
,
GlSprintf
,
GlTooltipDirective
as
GlTooltip
,
...
...
@@ -24,6 +25,7 @@ export const i18n = {
noSchedules
:
s__
(
'
EscalationPolicies|A schedule is required for adding an escalation policy. Please create an on-call schedule first.
'
,
),
removeRuleLabel
:
s__
(
'
EscalationPolicies|Remove escalation rule
'
),
},
},
};
...
...
@@ -38,6 +40,7 @@ export default {
GlDropdown
,
GlDropdownItem
,
GlCard
,
GlButton
,
GlIcon
,
GlSprintf
,
},
...
...
@@ -111,9 +114,12 @@ export default {
<
template
>
<gl-card
class=
"gl-border-gray-400 gl-bg-gray-10 gl-mb-3 gl-relative"
>
<gl-
ic
on
<gl-
butt
on
v-if=
"index !== 0"
name=
"close"
category=
"tertiary"
size=
"small"
icon=
"close"
:aria-label=
"$options.i18n.fields.rules.removeRuleLabel"
class=
"gl-absolute rule-close-icon"
@
click=
"$emit('remove-escalation-rule', index)"
/>
...
...
ee/spec/frontend/escalation_policies/add_edit_escalation_policy_form_spec.js
View file @
07b8f924
...
...
@@ -82,18 +82,10 @@ describe('AddEscalationPolicyForm', () => {
expect
(
rules
.
at
(
1
).
props
(
'
rule
'
)).
toMatchObject
(
defaultEscalationRule
);
});
it
(
'
should emit updates when rule is added
'
,
async
()
=>
{
it
(
'
should
NOT
emit updates when rule is added
'
,
async
()
=>
{
findAddRuleLink
().
vm
.
$emit
(
'
click
'
);
await
wrapper
.
vm
.
$nextTick
();
expect
(
wrapper
.
emitted
(
'
update-escalation-policy-form
'
)[
0
]).
toMatchObject
([
{
field
:
'
rules
'
,
value
:
[
expect
.
objectContaining
(
defaultEscalationRule
),
expect
.
objectContaining
(
defaultEscalationRule
),
],
},
]);
expect
(
wrapper
.
emitted
(
'
update-escalation-policy-form
'
)).
toBeUndefined
();
});
it
(
'
on rule update emitted should update rules array and emit updates up
'
,
()
=>
{
...
...
ee/spec/frontend/escalation_policies/add_edit_escalation_policy_modal_spec.js
View file @
07b8f924
...
...
@@ -90,14 +90,30 @@ describe('AddEscalationPolicyModal', () => {
expect
(
alert
.
text
()).
toContain
(
error
);
});
it
(
'
clears the form on modal c
lose
'
,
()
=>
{
it
(
'
clears the form on modal c
ancel
'
,
()
=>
{
expect
(
wrapper
.
vm
.
form
).
toEqual
(
mockPolicy
);
findModal
().
vm
.
$emit
(
'
cancel
'
,
{
preventDefault
:
jest
.
fn
()
});
findModal
().
vm
.
$emit
(
'
cancel
ed
'
,
{
preventDefault
:
jest
.
fn
()
});
expect
(
wrapper
.
vm
.
form
).
toEqual
({
name
:
''
,
description
:
''
,
rules
:
[],
});
expect
(
wrapper
.
vm
.
validationState
).
toEqual
({
name
:
null
,
rules
:
[],
});
});
it
(
'
clears the validation state on modal cancel
'
,
()
=>
{
expect
(
wrapper
.
vm
.
validationState
.
name
).
toBe
(
null
);
findEscalationPolicyForm
().
vm
.
$emit
(
'
update-escalation-policy-form
'
,
{
field
:
'
name
'
,
value
:
''
,
});
expect
(
wrapper
.
vm
.
validationState
.
name
).
toBe
(
false
);
findModal
().
vm
.
$emit
(
'
canceled
'
,
{
preventDefault
:
jest
.
fn
()
});
expect
(
wrapper
.
vm
.
validationState
.
name
).
toBe
(
null
);
});
});
...
...
locale/gitlab.pot
View file @
07b8f924
...
...
@@ -13108,6 +13108,9 @@ msgstr ""
msgid "EscalationPolicies|IF alert is not %{alertStatus} in %{minutes} minutes"
msgstr ""
msgid "EscalationPolicies|Remove escalation rule"
msgstr ""
msgid "EscalationPolicies|Select schedule"
msgstr ""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment