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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
c6c493a7
Commit
c6c493a7
authored
Nov 15, 2017
by
Clement Ho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport delete epic changes
parent
2f74b1d3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
103 additions
and
20 deletions
+103
-20
app/assets/javascripts/issue_show/components/app.vue
app/assets/javascripts/issue_show/components/app.vue
+14
-3
app/assets/javascripts/issue_show/components/edit_actions.vue
...assets/javascripts/issue_show/components/edit_actions.vue
+9
-1
app/assets/javascripts/issue_show/components/form.vue
app/assets/javascripts/issue_show/components/form.vue
+7
-1
app/assets/javascripts/vue_shared/components/loading_button.vue
...sets/javascripts/vue_shared/components/loading_button.vue
+6
-1
app/assets/stylesheets/framework/blocks.scss
app/assets/stylesheets/framework/blocks.scss
+4
-0
spec/javascripts/issue_show/components/app_spec.js
spec/javascripts/issue_show/components/app_spec.js
+37
-14
spec/javascripts/issue_show/components/edit_actions_spec.js
spec/javascripts/issue_show/components/edit_actions_spec.js
+9
-0
spec/javascripts/vue_shared/components/loading_button_spec.js
.../javascripts/vue_shared/components/loading_button_spec.js
+17
-0
No files found.
app/assets/javascripts/issue_show/components/app.vue
View file @
c6c493a7
...
@@ -29,6 +29,11 @@ export default {
...
@@ -29,6 +29,11 @@ export default {
required
:
false
,
required
:
false
,
default
:
false
,
default
:
false
,
},
},
showDeleteButton
:
{
type
:
Boolean
,
required
:
false
,
default
:
true
,
},
issuableRef
:
{
issuableRef
:
{
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
...
@@ -92,6 +97,11 @@ export default {
...
@@ -92,6 +97,11 @@ export default {
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
},
},
issuableType
:
{
type
:
String
,
required
:
false
,
default
:
'
issue
'
,
},
},
},
data
()
{
data
()
{
const
store
=
new
Store
({
const
store
=
new
Store
({
...
@@ -157,21 +167,21 @@ export default {
...
@@ -157,21 +167,21 @@ export default {
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
eventHub
.
$emit
(
'
close.form
'
);
eventHub
.
$emit
(
'
close.form
'
);
window
.
Flash
(
'
Error updating issue
'
);
window
.
Flash
(
`Error updating
${
this
.
issuableType
}
`
);
});
});
},
},
deleteIssuable
()
{
deleteIssuable
()
{
this
.
service
.
deleteIssuable
()
this
.
service
.
deleteIssuable
()
.
then
(
res
=>
res
.
json
())
.
then
(
res
=>
res
.
json
())
.
then
((
data
)
=>
{
.
then
((
data
)
=>
{
// Stop the poll so we don't get 404's with the issue not existing
// Stop the poll so we don't get 404's with the issu
abl
e not existing
this
.
poll
.
stop
();
this
.
poll
.
stop
();
gl
.
utils
.
visitUrl
(
data
.
web_url
);
gl
.
utils
.
visitUrl
(
data
.
web_url
);
})
})
.
catch
(()
=>
{
.
catch
(()
=>
{
eventHub
.
$emit
(
'
close.form
'
);
eventHub
.
$emit
(
'
close.form
'
);
window
.
Flash
(
'
Error deleting issue
'
);
window
.
Flash
(
`Error deleting
${
this
.
issuableType
}
`
);
});
});
},
},
},
},
...
@@ -223,6 +233,7 @@ export default {
...
@@ -223,6 +233,7 @@ export default {
:markdown-preview-path=
"markdownPreviewPath"
:markdown-preview-path=
"markdownPreviewPath"
:project-path=
"projectPath"
:project-path=
"projectPath"
:project-namespace=
"projectNamespace"
:project-namespace=
"projectNamespace"
:show-delete-button=
"showDeleteButton"
/>
/>
<div
v-else
>
<div
v-else
>
<title-component
<title-component
...
...
app/assets/javascripts/issue_show/components/edit_actions.vue
View file @
c6c493a7
...
@@ -13,6 +13,11 @@
...
@@ -13,6 +13,11 @@
type
:
Object
,
type
:
Object
,
required
:
true
,
required
:
true
,
},
},
showDeleteButton
:
{
type
:
Boolean
,
required
:
false
,
default
:
true
,
},
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -23,6 +28,9 @@
...
@@ -23,6 +28,9 @@
isSubmitEnabled
()
{
isSubmitEnabled
()
{
return
this
.
formState
.
title
.
trim
()
!==
''
;
return
this
.
formState
.
title
.
trim
()
!==
''
;
},
},
shouldShowDeleteButton
()
{
return
this
.
canDestroy
&&
this
.
showDeleteButton
;
},
},
},
methods
:
{
methods
:
{
closeForm
()
{
closeForm
()
{
...
@@ -62,7 +70,7 @@
...
@@ -62,7 +70,7 @@
Cancel
Cancel
</button>
</button>
<button
<button
v-if=
"
canDestroy
"
v-if=
"
shouldShowDeleteButton
"
class=
"btn btn-danger pull-right append-right-default"
class=
"btn btn-danger pull-right append-right-default"
:class=
"
{ disabled: deleteLoading }"
:class=
"
{ disabled: deleteLoading }"
type="button"
type="button"
...
...
app/assets/javascripts/issue_show/components/form.vue
View file @
c6c493a7
...
@@ -36,6 +36,11 @@
...
@@ -36,6 +36,11 @@
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
},
},
showDeleteButton
:
{
type
:
Boolean
,
required
:
false
,
default
:
true
,
},
},
},
components
:
{
components
:
{
lockedWarning
,
lockedWarning
,
...
@@ -81,6 +86,7 @@
...
@@ -81,6 +86,7 @@
:markdown-docs-path=
"markdownDocsPath"
/>
:markdown-docs-path=
"markdownDocsPath"
/>
<edit-actions
<edit-actions
:form-state=
"formState"
:form-state=
"formState"
:can-destroy=
"canDestroy"
/>
:can-destroy=
"canDestroy"
:show-delete-button=
"showDeleteButton"
/>
</form>
</form>
</
template
>
</
template
>
app/assets/javascripts/vue_shared/components/loading_button.vue
View file @
c6c493a7
...
@@ -35,6 +35,11 @@ export default {
...
@@ -35,6 +35,11 @@ export default {
type
:
String
,
type
:
String
,
required
:
false
,
required
:
false
,
},
},
containerClass
:
{
type
:
String
,
required
:
false
,
default
:
'
btn btn-align-content
'
,
},
},
},
components
:
{
components
:
{
loadingIcon
,
loadingIcon
,
...
@@ -49,9 +54,9 @@ export default {
...
@@ -49,9 +54,9 @@ export default {
<
template
>
<
template
>
<button
<button
class=
"btn btn-align-content"
@
click=
"onClick"
@
click=
"onClick"
type=
"button"
type=
"button"
:class=
"containerClass"
:disabled=
"loading || disabled"
:disabled=
"loading || disabled"
>
>
<transition
name=
"fade"
>
<transition
name=
"fade"
>
...
...
app/assets/stylesheets/framework/blocks.scss
View file @
c6c493a7
...
@@ -353,3 +353,7 @@
...
@@ -353,3 +353,7 @@
display
:
-
webkit-flex
;
display
:
-
webkit-flex
;
display
:
flex
;
display
:
flex
;
}
}
.flex-right
{
margin-left
:
auto
;
}
spec/javascripts/issue_show/components/app_spec.js
View file @
c6c493a7
...
@@ -223,23 +223,46 @@ describe('Issuable output', () => {
...
@@ -223,23 +223,46 @@ describe('Issuable output', () => {
});
});
});
});
it
(
'
closes form on error
'
,
(
done
)
=>
{
describe
(
'
error when updating
'
,
()
=>
{
spyOn
(
window
,
'
Flash
'
).
and
.
callThrough
();
beforeEach
(()
=>
{
spyOn
(
vm
.
service
,
'
updateIssuable
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
,
reject
)
=>
{
spyOn
(
window
,
'
Flash
'
).
and
.
callThrough
();
reject
();
spyOn
(
vm
.
service
,
'
updateIssuable
'
).
and
.
callFake
(()
=>
new
Promise
((
resolve
,
reject
)
=>
{
}));
reject
();
}));
});
vm
.
updateIssuable
();
it
(
'
closes form on error
'
,
(
done
)
=>
{
vm
.
updateIssuable
();
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
expect
(
eventHub
.
$emit
,
eventHub
.
$emit
,
).
toHaveBeenCalledWith
(
'
close.form
'
);
).
toHaveBeenCalledWith
(
'
close.form
'
);
expect
(
expect
(
window
.
Flash
,
window
.
Flash
,
).
toHaveBeenCalledWith
(
'
Error updating issue
'
);
).
toHaveBeenCalledWith
(
'
Error updating issue
'
);
done
();
done
();
});
});
it
(
'
returns the correct error message for issuableType
'
,
(
done
)
=>
{
vm
.
issuableType
=
'
merge request
'
;
Vue
.
nextTick
(()
=>
{
vm
.
updateIssuable
();
setTimeout
(()
=>
{
expect
(
eventHub
.
$emit
,
).
toHaveBeenCalledWith
(
'
close.form
'
);
expect
(
window
.
Flash
,
).
toHaveBeenCalledWith
(
'
Error updating merge request
'
);
done
();
});
});
});
});
});
});
});
});
...
...
spec/javascripts/issue_show/components/edit_actions_spec.js
View file @
c6c493a7
...
@@ -61,6 +61,15 @@ describe('Edit Actions components', () => {
...
@@ -61,6 +61,15 @@ describe('Edit Actions components', () => {
});
});
});
});
it
(
'
should not show delete button if showDeleteButton is false
'
,
(
done
)
=>
{
vm
.
showDeleteButton
=
false
;
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.btn-danger
'
)).
toBeNull
();
done
();
});
});
describe
(
'
updateIssuable
'
,
()
=>
{
describe
(
'
updateIssuable
'
,
()
=>
{
it
(
'
sends update.issauble event when clicking save button
'
,
()
=>
{
it
(
'
sends update.issauble event when clicking save button
'
,
()
=>
{
vm
.
$el
.
querySelector
(
'
.btn-save
'
).
click
();
vm
.
$el
.
querySelector
(
'
.btn-save
'
).
click
();
...
...
spec/javascripts/vue_shared/components/loading_button_spec.js
View file @
c6c493a7
...
@@ -66,6 +66,23 @@ describe('LoadingButton', function () {
...
@@ -66,6 +66,23 @@ describe('LoadingButton', function () {
});
});
});
});
describe
(
'
container class
'
,
()
=>
{
it
(
'
should default to btn btn-align-content
'
,
()
=>
{
vm
=
mountComponent
(
LoadingButton
,
{});
expect
(
vm
.
$el
.
classList
.
contains
(
'
btn
'
)).
toEqual
(
true
);
expect
(
vm
.
$el
.
classList
.
contains
(
'
btn-align-content
'
)).
toEqual
(
true
);
});
it
(
'
should be configurable through props
'
,
()
=>
{
vm
=
mountComponent
(
LoadingButton
,
{
containerClass
:
'
test-class
'
,
});
expect
(
vm
.
$el
.
classList
.
contains
(
'
btn
'
)).
toEqual
(
false
);
expect
(
vm
.
$el
.
classList
.
contains
(
'
btn-align-content
'
)).
toEqual
(
false
);
expect
(
vm
.
$el
.
classList
.
contains
(
'
test-class
'
)).
toEqual
(
true
);
});
});
describe
(
'
click callback prop
'
,
()
=>
{
describe
(
'
click callback prop
'
,
()
=>
{
it
(
'
calls given callback when normal
'
,
()
=>
{
it
(
'
calls given callback when normal
'
,
()
=>
{
vm
=
mountComponent
(
LoadingButton
,
{
vm
=
mountComponent
(
LoadingButton
,
{
...
...
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