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
97f08c65
Commit
97f08c65
authored
Feb 06, 2018
by
Shah El-Rahman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add modal for stopping and retrying pipelines
Fix tests Address code review feedback Fix tests
parent
d2a2f22f
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
167 additions
and
25 deletions
+167
-25
app.vue
app/assets/javascripts/groups/components/app.vue
+3
-3
async_button.vue
app/assets/javascripts/pipelines/components/async_button.vue
+7
-9
pipelines_table.vue
...sets/javascripts/pipelines/components/pipelines_table.vue
+6
-0
pipelines_table_row.vue
.../javascripts/pipelines/components/pipelines_table_row.vue
+6
-1
retry_confirmation_modal.vue
...scripts/pipelines/components/retry_confirmation_modal.vue
+65
-0
stop_confirmation_modal.vue
...ascripts/pipelines/components/stop_confirmation_modal.vue
+65
-0
pipelines_spec.rb
spec/features/projects/pipelines/pipelines_spec.rb
+5
-2
app_spec.js
spec/javascripts/groups/components/app_spec.js
+6
-6
async_button_spec.js
spec/javascripts/pipelines/async_button_spec.js
+4
-4
No files found.
app/assets/javascripts/groups/components/app.vue
View file @
97f08c65
...
...
@@ -152,14 +152,14 @@ export default {
showLeaveGroupModal
(
group
,
parentGroup
)
{
this
.
targetGroup
=
group
;
this
.
targetParentGroup
=
parentGroup
;
this
.
show
Modal
=
true
;
this
.
update
Modal
=
true
;
this
.
groupLeaveConfirmationMessage
=
s__
(
`GroupsTree|Are you sure you want to leave the "
${
group
.
fullName
}
" group?`
);
},
hideLeaveGroupModal
()
{
this
.
show
Modal
=
false
;
this
.
update
Modal
=
false
;
},
leaveGroup
()
{
this
.
show
Modal
=
false
;
this
.
update
Modal
=
false
;
this
.
targetGroup
.
isBeingRemoved
=
true
;
this
.
service
.
leaveGroup
(
this
.
targetGroup
.
leavePath
)
.
then
(
res
=>
res
.
json
())
...
...
app/assets/javascripts/pipelines/components/async_button.vue
View file @
97f08c65
...
...
@@ -31,10 +31,9 @@
type
:
String
,
required
:
true
,
},
confirmActionMessage
:
{
type
:
String
,
required
:
false
,
default
:
''
,
id
:
{
type
:
Number
,
required
:
true
,
},
},
data
()
{
...
...
@@ -49,11 +48,10 @@
},
methods
:
{
onClick
()
{
if
(
this
.
confirmActionMessage
!==
''
&&
confirm
(
this
.
confirmActionMessage
))
{
this
.
makeRequest
();
}
else
if
(
this
.
confirmActionMessage
===
''
)
{
this
.
makeRequest
();
}
eventHub
.
$emit
(
'actionConfirmationModal'
,
{
id
:
this
.
id
,
callback
:
this
.
makeRequest
,
});
},
makeRequest
()
{
this
.
isLoading
=
true
;
...
...
app/assets/javascripts/pipelines/components/pipelines_table.vue
View file @
97f08c65
<
script
>
import
pipelinesTableRowComponent
from
'./pipelines_table_row.vue'
;
import
stopConfirmationModal
from
'./stop_confirmation_modal.vue'
;
import
retryConfirmationModal
from
'./retry_confirmation_modal.vue'
;
/**
* Pipelines Table Component.
...
...
@@ -9,6 +11,8 @@
export
default
{
components
:
{
pipelinesTableRowComponent
,
stopConfirmationModal
,
retryConfirmationModal
,
},
props
:
{
pipelines
:
{
...
...
@@ -70,5 +74,7 @@
:auto-devops-help-path=
"autoDevopsHelpPath"
:view-type=
"viewType"
/>
<stop-confirmation-modal
/>
<retry-confirmation-modal
/>
</div>
</
template
>
app/assets/javascripts/pipelines/components/pipelines_table_row.vue
View file @
97f08c65
...
...
@@ -305,6 +305,9 @@
css-class=
"js-pipelines-retry-button btn-default btn-retry"
title=
"Retry"
icon=
"repeat"
:id=
"pipeline.id"
data-toggle=
"modal"
data-target=
"#retry-confirmation-modal"
/>
<async-button-component
...
...
@@ -313,7 +316,9 @@
css-class=
"js-pipelines-cancel-button btn-remove"
title=
"Cancel"
icon=
"close"
confirm-action-message=
"Are you sure you want to cancel this pipeline?"
:id=
"pipeline.id"
data-toggle=
"modal"
data-target=
"#stop-confirmation-modal"
/>
</div>
</div>
...
...
app/assets/javascripts/pipelines/components/retry_confirmation_modal.vue
0 → 100644
View file @
97f08c65
<
script
>
import
modal
from
'~/vue_shared/components/modal.vue'
;
import
{
s__
,
sprintf
}
from
'~/locale'
;
import
eventHub
from
'../event_hub'
;
export
default
{
components
:
{
modal
,
},
data
()
{
return
{
id
:
''
,
callback
:
()
=>
{},
};
},
computed
:
{
title
()
{
return
sprintf
(
s__
(
'Pipeline|Retry pipeline #%{id}?'
),
{
id
:
`'
${
this
.
id
}
'`
,
},
false
);
},
text
()
{
return
sprintf
(
s__
(
'Pipeline|You’re about to retry pipeline %{id}.'
),
{
id
:
`<strong>#
${
this
.
id
}
</strong>`
,
},
false
);
},
primaryButtonLabel
()
{
return
s__
(
'Pipeline|Retry pipeline'
);
},
},
created
()
{
eventHub
.
$on
(
'actionConfirmationModal'
,
this
.
updateModal
);
},
beforeDestroy
()
{
eventHub
.
$off
(
'actionConfirmationModal'
,
this
.
updateModal
);
},
methods
:
{
updateModal
(
action
)
{
this
.
id
=
action
.
id
;
this
.
callback
=
action
.
callback
;
},
onSubmit
()
{
this
.
callback
();
},
},
};
</
script
>
<
template
>
<modal
id=
"retry-confirmation-modal"
:title=
"title"
:text=
"text"
kind=
"danger"
:primary-button-label=
"primaryButtonLabel"
@
submit=
"onSubmit"
>
<template
slot=
"body"
slot-scope=
"props"
>
<p
v-html=
"props.text"
></p>
</
template
>
</modal>
</template>
app/assets/javascripts/pipelines/components/stop_confirmation_modal.vue
0 → 100644
View file @
97f08c65
<
script
>
import
modal
from
'~/vue_shared/components/modal.vue'
;
import
{
s__
,
sprintf
}
from
'~/locale'
;
import
eventHub
from
'../event_hub'
;
export
default
{
components
:
{
modal
,
},
data
()
{
return
{
id
:
''
,
callback
:
()
=>
{},
};
},
computed
:
{
title
()
{
return
sprintf
(
s__
(
'Pipeline|Stop pipeline #%{id}?'
),
{
id
:
`'
${
this
.
id
}
'`
,
},
false
);
},
text
()
{
return
sprintf
(
s__
(
'Pipeline|You’re about to stop pipeline %{id}.'
),
{
id
:
`<strong>#
${
this
.
id
}
</strong>`
,
},
false
);
},
primaryButtonLabel
()
{
return
s__
(
'Pipeline|Stop pipeline'
);
},
},
created
()
{
eventHub
.
$on
(
'actionConfirmationModal'
,
this
.
updateModal
);
},
beforeDestroy
()
{
eventHub
.
$off
(
'actionConfirmationModal'
,
this
.
updateModal
);
},
methods
:
{
updateModal
(
action
)
{
this
.
id
=
action
.
id
;
this
.
callback
=
action
.
callback
;
},
onSubmit
()
{
this
.
callback
();
},
},
};
</
script
>
<
template
>
<modal
id=
"stop-confirmation-modal"
:title=
"title"
:text=
"text"
kind=
"danger"
:primary-button-label=
"primaryButtonLabel"
@
submit=
"onSubmit"
>
<template
slot=
"body"
slot-scope=
"props"
>
<p
v-html=
"props.text"
></p>
</
template
>
</modal>
</template>
spec/features/projects/pipelines/pipelines_spec.rb
View file @
97f08c65
...
...
@@ -109,7 +109,8 @@ describe 'Pipelines', :js do
context
'when canceling'
do
before
do
accept_confirm
{
find
(
'.js-pipelines-cancel-button'
).
click
}
find
(
'.js-pipelines-cancel-button'
).
click
find
(
'.js-primary-button'
).
click
wait_for_requests
end
...
...
@@ -140,6 +141,7 @@ describe 'Pipelines', :js do
context
'when retrying'
do
before
do
find
(
'.js-pipelines-retry-button'
).
click
find
(
'.js-primary-button'
).
click
wait_for_requests
end
...
...
@@ -238,7 +240,8 @@ describe 'Pipelines', :js do
context
'when canceling'
do
before
do
accept_alert
{
find
(
'.js-pipelines-cancel-button'
).
click
}
find
(
'.js-pipelines-cancel-button'
).
click
find
(
'.js-primary-button'
).
click
end
it
'indicates that pipeline was canceled'
do
...
...
spec/javascripts/groups/components/app_spec.js
View file @
97f08c65
...
...
@@ -268,10 +268,10 @@ describe('AppComponent', () => {
it
(
'updates props which show modal confirmation dialog'
,
()
=>
{
const
group
=
Object
.
assign
({},
mockParentGroupItem
);
expect
(
vm
.
show
Modal
).
toBeFalsy
();
expect
(
vm
.
update
Modal
).
toBeFalsy
();
expect
(
vm
.
groupLeaveConfirmationMessage
).
toBe
(
''
);
vm
.
showLeaveGroupModal
(
group
,
mockParentGroupItem
);
expect
(
vm
.
show
Modal
).
toBeTruthy
();
expect
(
vm
.
update
Modal
).
toBeTruthy
();
expect
(
vm
.
groupLeaveConfirmationMessage
).
toBe
(
`Are you sure you want to leave the "
${
group
.
fullName
}
" group?`
);
});
});
...
...
@@ -280,9 +280,9 @@ describe('AppComponent', () => {
it
(
'hides modal confirmation which is shown before leaving the group'
,
()
=>
{
const
group
=
Object
.
assign
({},
mockParentGroupItem
);
vm
.
showLeaveGroupModal
(
group
,
mockParentGroupItem
);
expect
(
vm
.
show
Modal
).
toBeTruthy
();
expect
(
vm
.
update
Modal
).
toBeTruthy
();
vm
.
hideLeaveGroupModal
();
expect
(
vm
.
show
Modal
).
toBeFalsy
();
expect
(
vm
.
update
Modal
).
toBeFalsy
();
});
});
...
...
@@ -307,7 +307,7 @@ describe('AppComponent', () => {
spyOn
(
$
,
'scrollTo'
);
vm
.
leaveGroup
();
expect
(
vm
.
show
Modal
).
toBeFalsy
();
expect
(
vm
.
update
Modal
).
toBeFalsy
();
expect
(
vm
.
targetGroup
.
isBeingRemoved
).
toBeTruthy
();
expect
(
vm
.
service
.
leaveGroup
).
toHaveBeenCalledWith
(
vm
.
targetGroup
.
leavePath
);
setTimeout
(()
=>
{
...
...
@@ -475,7 +475,7 @@ describe('AppComponent', () => {
it
(
'renders modal confirmation dialog'
,
()
=>
{
vm
.
groupLeaveConfirmationMessage
=
'Are you sure you want to leave the "foo" group?'
;
vm
.
show
Modal
=
true
;
vm
.
update
Modal
=
true
;
const
modalDialogEl
=
vm
.
$el
.
querySelector
(
'.modal'
);
expect
(
modalDialogEl
).
not
.
toBe
(
null
);
expect
(
modalDialogEl
.
querySelector
(
'.modal-title'
).
innerText
.
trim
()).
toBe
(
'Are you sure?'
);
...
...
spec/javascripts/pipelines/async_button_spec.js
View file @
97f08c65
...
...
@@ -15,6 +15,7 @@ describe('Pipelines Async Button', () => {
title
:
'Foo'
,
icon
:
'repeat'
,
cssClass
:
'bar'
,
id
:
123
,
},
}).
$mount
();
});
...
...
@@ -38,9 +39,8 @@ describe('Pipelines Async Button', () => {
describe
(
'With confirm dialog'
,
()
=>
{
it
(
'should call the service when confimation is positive'
,
()
=>
{
spyOn
(
window
,
'confirm'
).
and
.
returnValue
(
true
);
eventHub
.
$on
(
'postAction'
,
(
endpoint
)
=>
{
expect
(
endpoint
).
toEqual
(
'/foo'
);
eventHub
.
$on
(
'actionConfirmationModal'
,
(
data
)
=>
{
expect
(
data
.
id
).
toEqual
(
123
);
});
component
=
new
AsyncButtonComponent
({
...
...
@@ -49,7 +49,7 @@ describe('Pipelines Async Button', () => {
title
:
'Foo'
,
icon
:
'fa fa-foo'
,
cssClass
:
'bar'
,
confirmActionMessage
:
'bar'
,
id
:
123
,
},
}).
$mount
();
...
...
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