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
e108a9a7
Commit
e108a9a7
authored
Sep 22, 2020
by
Natalia Tepluhina
Committed by
Phil Hughes
Sep 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Error when quickly reordering designs"
parent
58f318e0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
1 deletion
+26
-1
app/assets/javascripts/design_management/pages/index.vue
app/assets/javascripts/design_management/pages/index.vue
+6
-1
changelogs/unreleased/237923-error-when-quickly-reordering-designs.yml
...released/237923-error-when-quickly-reordering-designs.yml
+5
-0
spec/frontend/design_management/pages/index_spec.js
spec/frontend/design_management/pages/index_spec.js
+15
-0
No files found.
app/assets/javascripts/design_management/pages/index.vue
View file @
e108a9a7
...
@@ -71,6 +71,7 @@ export default {
...
@@ -71,6 +71,7 @@ export default {
selectedDesigns
:
[],
selectedDesigns
:
[],
isDraggingDesign
:
false
,
isDraggingDesign
:
false
,
reorderedDesigns
:
null
,
reorderedDesigns
:
null
,
isReorderingInProgress
:
false
,
};
};
},
},
computed
:
{
computed
:
{
...
@@ -277,6 +278,7 @@ export default {
...
@@ -277,6 +278,7 @@ export default {
return
variables
;
return
variables
;
},
},
reorderDesigns
({
moved
:
{
newIndex
,
element
}
})
{
reorderDesigns
({
moved
:
{
newIndex
,
element
}
})
{
this
.
isReorderingInProgress
=
true
;
this
.
$apollo
this
.
$apollo
.
mutate
({
.
mutate
({
mutation
:
moveDesignMutation
,
mutation
:
moveDesignMutation
,
...
@@ -287,6 +289,9 @@ export default {
...
@@ -287,6 +289,9 @@ export default {
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
createFlash
(
MOVE_DESIGN_ERROR
);
createFlash
(
MOVE_DESIGN_ERROR
);
})
.
finally
(()
=>
{
this
.
isReorderingInProgress
=
false
;
});
});
},
},
onDesignMove
(
designs
)
{
onDesignMove
(
designs
)
{
...
@@ -358,7 +363,7 @@ export default {
...
@@ -358,7 +363,7 @@ export default {
<vue-draggable
<vue-draggable
v-else
v-else
:value=
"designs"
:value=
"designs"
:disabled=
"!isLatestVersion"
:disabled=
"!isLatestVersion
|| isReorderingInProgress
"
v-bind=
"$options.dragOptions"
v-bind=
"$options.dragOptions"
tag=
"ol"
tag=
"ol"
draggable=
".js-design-tile"
draggable=
".js-design-tile"
...
...
changelogs/unreleased/237923-error-when-quickly-reordering-designs.yml
0 → 100644
View file @
e108a9a7
---
title
:
Resolve Error when quickly reordering designs
merge_request
:
42818
author
:
type
:
fixed
spec/frontend/design_management/pages/index_spec.js
View file @
e108a9a7
...
@@ -99,6 +99,7 @@ describe('Design management index page', () => {
...
@@ -99,6 +99,7 @@ describe('Design management index page', () => {
const
findFirstDropzoneWithDesign
=
()
=>
wrapper
.
findAll
(
DesignDropzone
).
at
(
1
);
const
findFirstDropzoneWithDesign
=
()
=>
wrapper
.
findAll
(
DesignDropzone
).
at
(
1
);
const
findDesignsWrapper
=
()
=>
wrapper
.
find
(
'
[data-testid="designs-root"]
'
);
const
findDesignsWrapper
=
()
=>
wrapper
.
find
(
'
[data-testid="designs-root"]
'
);
const
findDesigns
=
()
=>
wrapper
.
findAll
(
Design
);
const
findDesigns
=
()
=>
wrapper
.
findAll
(
Design
);
const
draggableAttributes
=
()
=>
wrapper
.
find
(
VueDraggable
).
vm
.
$attrs
;
async
function
moveDesigns
(
localWrapper
)
{
async
function
moveDesigns
(
localWrapper
)
{
await
jest
.
runOnlyPendingTimers
();
await
jest
.
runOnlyPendingTimers
();
...
@@ -676,6 +677,20 @@ describe('Design management index page', () => {
...
@@ -676,6 +677,20 @@ describe('Design management index page', () => {
).
toBe
(
'
2
'
);
).
toBe
(
'
2
'
);
});
});
it
(
'
prevents reordering when reorderDesigns mutation is in progress
'
,
async
()
=>
{
createComponentWithApollo
({});
await
moveDesigns
(
wrapper
);
expect
(
draggableAttributes
().
disabled
).
toBe
(
true
);
await
jest
.
runOnlyPendingTimers
();
// kick off the mocked GQL stuff (promises)
await
wrapper
.
vm
.
$nextTick
();
// kick off the DOM update
await
wrapper
.
vm
.
$nextTick
();
// kick off the DOM update for finally block
expect
(
draggableAttributes
().
disabled
).
toBe
(
false
);
});
it
(
'
displays flash if mutation had a recoverable error
'
,
async
()
=>
{
it
(
'
displays flash if mutation had a recoverable error
'
,
async
()
=>
{
createComponentWithApollo
({
createComponentWithApollo
({
moveHandler
:
jest
.
fn
().
mockResolvedValue
(
moveDesignMutationResponseWithErrors
),
moveHandler
:
jest
.
fn
().
mockResolvedValue
(
moveDesignMutationResponseWithErrors
),
...
...
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