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
2f4945d0
Commit
2f4945d0
authored
Jan 07, 2021
by
wortschi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clear modal form fields
parent
9b3bc6b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
3 deletions
+28
-3
ee/app/assets/javascripts/admin/dev_ops_report/components/devops_adoption_segment_modal.vue
...v_ops_report/components/devops_adoption_segment_modal.vue
+14
-3
ee/changelogs/unreleased/293714-devops-adoption-clear-previously-selected-groups-when-creating-.yml
...ption-clear-previously-selected-groups-when-creating-.yml
+5
-0
ee/spec/frontend/admin/dev_ops_report/components/devops_adoption_segment_modal_spec.js
...s_report/components/devops_adoption_segment_modal_spec.js
+9
-0
No files found.
ee/app/assets/javascripts/admin/dev_ops_report/components/devops_adoption_segment_modal.vue
View file @
2f4945d0
...
...
@@ -53,8 +53,11 @@ export default {
},
cancelOptions
()
{
return
{
text
:
this
.
$options
.
i18n
.
cancel
,
attributes
:
[{
disabled
:
this
.
loading
}],
button
:
{
text
:
this
.
$options
.
i18n
.
cancel
,
attributes
:
[{
disabled
:
this
.
loading
}],
},
callback
:
this
.
resetForm
,
};
},
primaryOptions
()
{
...
...
@@ -115,6 +118,7 @@ export default {
if
(
errors
.
length
)
{
this
.
errors
=
errors
;
}
else
{
this
.
resetForm
();
this
.
closeModal
();
}
}
catch
(
error
)
{
...
...
@@ -161,6 +165,11 @@ export default {
checkboxValuesFromSegment
()
{
return
this
.
segment
.
groups
.
map
(({
id
})
=>
getIdFromGraphQLId
(
id
));
},
resetForm
()
{
this
.
name
=
this
.
segment
?.
name
||
''
;
this
.
checkboxValues
=
this
.
segment
?
this
.
checkboxValuesFromSegment
()
:
[];
this
.
filter
=
''
;
},
},
devopsSegmentModalId
:
DEVOPS_ADOPTION_SEGMENT_MODAL_ID
,
};
...
...
@@ -173,8 +182,10 @@ export default {
size=
"sm"
scrollable
:action-primary=
"primaryOptions.button"
:action-cancel=
"cancelOptions"
:action-cancel=
"cancelOptions
.button
"
@
primary.prevent=
"primaryOptions.callback"
@
canceled=
"cancelOptions.callback"
@
hide=
"resetForm"
>
<gl-alert
v-if=
"errors.length"
variant=
"danger"
class=
"gl-mb-3"
@
dismiss=
"clearErrors"
>
{{
displayError
}}
...
...
ee/changelogs/unreleased/293714-devops-adoption-clear-previously-selected-groups-when-creating-.yml
0 → 100644
View file @
2f4945d0
---
title
:
'
DevOps
Adoption:
Clear
form
when
creating
a
new
segment'
merge_request
:
50766
author
:
type
:
fixed
ee/spec/frontend/admin/dev_ops_report/components/devops_adoption_segment_modal_spec.js
View file @
2f4945d0
...
...
@@ -298,6 +298,15 @@ describe('DevopsAdoptionSegmentModal', () => {
it('closes the modal after a successful mutation', async () => {
expect(wrapper.vm.$refs.modal.hide).toHaveBeenCalled();
});
it('resets the form fields', async () => {
const name = segment ? 'Segment 1' : '';
const checkboxValues = segment ? [1] : [];
expect(wrapper.vm.name).toBe(name);
expect(wrapper.vm.checkboxValues).toEqual(checkboxValues);
expect(wrapper.vm.filter).toBe('');
});
});
describe('error handling', () => {
...
...
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