Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Frontend
Commits
9a621e29
Commit
9a621e29
authored
1 year ago
by
ml bonhomme
Committed by
Erwan Rouchet
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Add confirmation modal when deleting a process from the processes list
parent
da18ca19
No related branches found
No related tags found
1 merge request
!1636
Add confirmation modal when deleting a process from the processes list
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/Process/Row.vue
+42
-7
42 additions, 7 deletions
src/components/Process/Row.vue
with
42 additions
and
7 deletions
src/components/Process/Row.vue
+
42
−
7
View file @
9a621e29
...
...
@@ -57,7 +57,7 @@
<p
class=
"control"
v-if=
"canDelete"
>
<button
class=
"button has-text-danger"
v-on:click=
"
remove
"
v-on:click=
"
deleteModal = hasAdminAccess
"
:disabled=
"!hasAdminAccess || null"
:title=
"hasAdminAccess ? 'Delete this process' : 'An admin access is required to delete this process'"
>
...
...
@@ -67,25 +67,47 @@
</div>
</td>
</tr>
<Modal
v-model=
"deleteModal"
title=
"Delete process"
>
<span>
Are you sure you want to delete process
<strong>
{{ deleteModalText }}
</strong>
?
</span>
<br
/>
<span>
This action is irreversible.
</span>
<
template
v-slot:footer=
"{ close }"
>
<button
class=
"button"
v-on:click=
"close"
>
Cancel
</button>
<button
class=
"button is-danger"
:class=
"
{ 'is-loading': deleteLoading }"
v-on:click="remove"
>
Delete
</button>
</
template
>
</Modal>
</template>
<
script
>
import
{
mapState
,
mapGetters
,
mapMutations
,
mapActions
}
from
'
vuex
'
import
{
mapState
,
mapGetters
,
mapActions
as
mapVuexActions
}
from
'
vuex
'
import
{
mapActions
}
from
'
pinia
'
import
{
PROCESS_MODES
,
PROCESS_FINAL_STATES
}
from
'
@/config
'
import
{
ago
,
errorParser
,
humanTimedelta
,
secondsToTimedelta
}
from
'
@/helpers
'
import
{
corporaMixin
}
from
'
@/mixins
'
import
{
corporaMixin
,
truncateMixin
}
from
'
@/mixins
'
import
ItemId
from
'
@/components/ItemId.vue
'
import
StateTag
from
'
./StateTag.vue
'
import
Modal
from
'
@/components/Modal.vue
'
import
{
useNotificationStore
}
from
'
@/stores
'
export
default
{
mixins
:
[
corporaMixin
corporaMixin
,
truncateMixin
],
components
:
{
ItemId
,
StateTag
StateTag
,
Modal
},
emits
:
[
'
update
'
],
props
:
{
...
...
@@ -94,6 +116,10 @@ export default {
required
:
true
}
},
data
:
()
=>
({
deleteModal
:
false
,
deleteLoading
:
false
}),
computed
:
{
...
mapState
(
'
process
'
,
[
'
processes
'
]),
...
mapGetters
(
'
auth
'
,
[
'
isVerified
'
]),
...
...
@@ -164,17 +190,26 @@ export default {
durationText
()
{
if
([
'
unscheduled
'
,
'
pending
'
].
includes
(
this
.
process
.
state
))
return
'
Pending for
'
return
'
Running for
'
},
deleteModalText
()
{
if
(
this
.
process
.
name
?.
length
>
0
)
return
`
${
this
.
truncateShort
(
this
.
process
.
name
)}
(
${
this
.
process
.
id
}
)`
return
this
.
process
.
id
}
},
methods
:
{
...
mapActions
(
'
process
'
,
[
'
deleteProcess
'
,
'
retryProcess
'
]),
...
map
Muta
tions
(
'
n
otification
s
'
,
[
'
notify
'
]),
...
map
Vuex
Actions
(
'
process
'
,
[
'
deleteProcess
'
,
'
retryProcess
'
]),
...
map
Ac
tions
(
useN
otification
Store
,
[
'
notify
'
]),
async
remove
()
{
if
(
this
.
deleteLoading
||
!
this
.
hasAdminAccess
)
return
this
.
deleteLoading
=
true
try
{
const
response
=
await
this
.
deleteProcess
(
this
.
processId
)
if
(
response
.
status
===
204
)
this
.
$emit
(
'
update
'
)
this
.
deleteModal
=
false
}
catch
(
err
)
{
this
.
notify
({
type
:
'
error
'
,
text
:
errorParser
(
err
)
})
}
finally
{
this
.
deleteLoading
=
false
}
},
async
retry
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment