BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7f34b7cb
Commit
7f34b7cb
authored
May 26, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-edit-inline-project-move-warning' into 'issue-edit-inline'
Warn before moving issue in inline edit form See merge request !11708
parents
0defc4f7
10dccdc4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
7 deletions
+36
-7
app.vue
app/assets/javascripts/issue_show/components/app.vue
+10
-1
edit_actions.vue
...assets/javascripts/issue_show/components/edit_actions.vue
+3
-4
index.js
app/assets/javascripts/issue_show/stores/index.js
+1
-0
issuable_actions.rb
app/controllers/concerns/issuable_actions.rb
+1
-1
app_spec.js
spec/javascripts/issue_show/components/app_spec.js
+21
-1
No files found.
app/assets/javascripts/issue_show/components/app.vue
View file @
7f34b7cb
...
...
@@ -114,6 +114,7 @@ export default {
description
:
this
.
state
.
descriptionText
,
lockedWarningVisible
:
false
,
move_to_project_id
:
0
,
updateLoading
:
false
,
});
}
},
...
...
@@ -121,6 +122,14 @@ export default {
this
.
showForm
=
false
;
},
updateIssuable
()
{
const
canPostUpdate
=
this
.
store
.
formState
.
move_to_project_id
!==
0
?
confirm
(
'Are you sure you want to move this issue to another project?'
)
:
true
;
// eslint-disable-line no-alert
if
(
!
canPostUpdate
)
{
this
.
store
.
formState
.
updateLoading
=
false
;
return
;
}
this
.
service
.
updateIssuable
(
this
.
store
.
formState
)
.
then
(
res
=>
res
.
json
())
.
then
((
data
)
=>
{
...
...
@@ -149,7 +158,7 @@ export default {
// Stop the poll so we don't get 404's with the issue not existing
this
.
poll
.
stop
();
gl
.
utils
.
visitUrl
(
data
.
path
);
gl
.
utils
.
visitUrl
(
data
.
web_url
);
})
.
catch
(()
=>
{
eventHub
.
$emit
(
'close.form'
);
...
...
app/assets/javascripts/issue_show/components/edit_actions.vue
View file @
7f34b7cb
...
...
@@ -15,7 +15,6 @@
data
()
{
return
{
deleteLoading
:
false
,
updateLoading
:
false
,
};
},
computed
:
{
...
...
@@ -25,7 +24,7 @@
},
methods
:
{
updateIssuable
()
{
this
.
updateLoading
=
true
;
this
.
formState
.
updateLoading
=
true
;
eventHub
.
$emit
(
'update.issuable'
);
},
closeForm
()
{
...
...
@@ -47,7 +46,7 @@
<div
class=
"prepend-top-default append-bottom-default clearfix"
>
<button
class=
"btn btn-save pull-left"
:class=
"
{ disabled: updateLoading || !isSubmitEnabled }"
:class=
"
{ disabled:
formState.
updateLoading || !isSubmitEnabled }"
type="submit"
:disabled="updateLoading || !isSubmitEnabled"
@click.prevent="updateIssuable">
...
...
@@ -55,7 +54,7 @@
<i
class=
"fa fa-spinner fa-spin"
aria-hidden=
"true"
v-if=
"updateLoading"
>
v-if=
"
formState.
updateLoading"
>
</i>
</button>
<button
...
...
app/assets/javascripts/issue_show/stores/index.js
View file @
7f34b7cb
...
...
@@ -19,6 +19,7 @@ export default class Store {
description
:
''
,
lockedWarningVisible
:
false
,
move_to_project_id
:
0
,
updateLoading
:
false
,
};
}
...
...
app/controllers/concerns/issuable_actions.rb
View file @
7f34b7cb
...
...
@@ -20,7 +20,7 @@ module IssuableActions
format
.
html
{
redirect_to
index_path
}
format
.
json
do
render
json:
{
path
:
index_path
web_url
:
index_path
}
end
end
...
...
spec/javascripts/issue_show/components/app_spec.js
View file @
7f34b7cb
...
...
@@ -32,13 +32,16 @@ describe('Issuable output', () => {
canMove
:
true
,
endpoint
:
'/gitlab-org/gitlab-shell/issues/9/realtime_changes'
,
issuableRef
:
'#1'
,
initialTitle
:
''
,
initialTitleHtml
:
''
,
initialTitleText
:
''
,
initialDescriptionHtml
:
''
,
initialDescriptionText
:
''
,
markdownPreviewUrl
:
'/'
,
markdownDocs
:
'/'
,
projectsAutocompleteUrl
:
'/'
,
isConfidential
:
false
,
projectNamespace
:
'/'
,
projectPath
:
'/'
,
},
}).
$mount
();
});
...
...
@@ -224,6 +227,23 @@ describe('Issuable output', () => {
});
});
it
(
'does not update issuable if project move confirm is false'
,
(
done
)
=>
{
spyOn
(
window
,
'confirm'
).
and
.
returnValue
(
false
);
spyOn
(
vm
.
service
,
'updateIssuable'
);
vm
.
store
.
formState
.
move_to_project_id
=
1
;
vm
.
updateIssuable
();
setTimeout
(()
=>
{
expect
(
vm
.
service
.
updateIssuable
,
).
not
.
toHaveBeenCalled
();
done
();
});
});
it
(
'closes form on error'
,
(
done
)
=>
{
spyOn
(
window
,
'Flash'
).
and
.
callThrough
();
spyOn
(
vm
.
service
,
'updateIssuable'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
,
reject
)
=>
{
...
...
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