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
1a852a08
Commit
1a852a08
authored
2 years ago
by
ml bonhomme
Committed by
Erwan Rouchet
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
add clear process button
parent
ab6f7aa3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1275
add clear process button
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
js/api.js
+3
-0
3 additions, 0 deletions
js/api.js
js/store/process.js
+5
-0
5 additions, 0 deletions
js/store/process.js
test/store/process.js
+26
-0
26 additions, 0 deletions
test/store/process.js
vue/Process/Configure.vue
+23
-0
23 additions, 0 deletions
vue/Process/Configure.vue
with
57 additions
and
0 deletions
js/api.js
+
3
−
0
View file @
1a852a08
...
...
@@ -317,6 +317,9 @@ export const createProcessTemplate = unique(async ({ id, payload }) => (await ax
// Apply a process template on a process
export
const
applyProcessTemplate
=
unique
(
async
({
id
,
payload
})
=>
(
await
axios
.
post
(
`/process/
${
id
}
/apply/`
,
payload
)).
data
)
// Clear a process (remove all worker runs and templates)
export
const
clearProcess
=
unique
(
async
id
=>
await
axios
.
delete
(
`/imports/
${
id
}
/clear/`
))
// Run a file import process from files
export
const
importFromFiles
=
async
payload
=>
(
await
axios
.
post
(
'
/imports/fromfiles/
'
,
payload
)).
data
...
...
This diff is collapsed.
Click to expand it.
js/store/process.js
+
5
−
0
View file @
1a852a08
...
...
@@ -323,6 +323,11 @@ export const actions = {
commit
(
'
removeWorkerRun
'
,
{
dataImportId
,
workerRunId
})
},
async
clearProcess
({
commit
},
{
dataImportId
})
{
await
api
.
clearProcess
(
dataImportId
)
commit
(
'
removeWorkerRuns
'
,
{
dataImportId
})
},
async
listProcesses
({
commit
},
params
)
{
try
{
const
data
=
await
api
.
listProcesses
(
removeEmptyStrings
(
params
))
...
...
This diff is collapsed.
Click to expand it.
test/store/process.js
+
26
−
0
View file @
1a852a08
...
...
@@ -9,6 +9,7 @@ import {
workerTypesSample
,
workerConfigurationsSample
,
workerVersionsSample
,
workerRunSample
,
workerRunsSample
,
workerSample
,
processSample
,
...
...
@@ -1097,6 +1098,31 @@ describe('process', () => {
})
})
describe
(
'
clearProcess
'
,
()
=>
{
it
(
'
removes all worker runs from a process
'
,
async
()
=>
{
store
.
state
.
process
.
workerRuns
=
{
test_process_id
:
workerRunsSample
,
other_process_id
:
[
workerRunSample
]
}
mock
.
onDelete
(
'
/imports/test_process_id/clear/
'
).
reply
(
204
)
await
store
.
dispatch
(
'
process/clearProcess
'
,
{
dataImportId
:
'
test_process_id
'
})
assert
.
deepStrictEqual
(
store
.
history
,
[
{
action
:
'
process/clearProcess
'
,
payload
:
{
dataImportId
:
'
test_process_id
'
}
},
{
mutation
:
'
process/removeWorkerRuns
'
,
payload
:
{
dataImportId
:
'
test_process_id
'
}
}
])
assert
.
deepStrictEqual
(
mock
.
history
.
all
.
map
(
req
=>
pick
(
req
,
[
'
method
'
,
'
url
'
])),
[
{
method
:
'
delete
'
,
url
:
'
/imports/test_process_id/clear/
'
}
])
assert
.
deepStrictEqual
(
store
.
state
.
process
.
workerRuns
,
{
test_process_id
:
{},
other_process_id
:
[
workerRunSample
]
})
})
})
describe
(
'
startProcess
'
,
()
=>
{
it
(
'
starts a specific process
'
,
async
()
=>
{
store
.
state
.
process
.
processes
=
processesSample
...
...
This diff is collapsed.
Click to expand it.
vue/Process/Configure.vue
+
23
−
0
View file @
1a852a08
...
...
@@ -30,6 +30,16 @@
:disabled=
"thumbnails"
/>
</div>
<div
v-if=
"hasWorkerRuns"
class=
"control"
>
<button
title=
"Remove all worker runs from this process"
class=
"button"
v-on:click=
"clearProcess"
>
<i
class=
"icon-trash mr-2"
></i>
Clear process
</button>
</div>
</div>
<p
v-if=
"fieldErrors.model_version"
class=
"notification is-danger"
>
{{
fieldErrors
.
model_version
}}
</p>
<WorkerRunWithParents
...
...
@@ -319,6 +329,19 @@ export default {
}
finally
{
this
.
processStarting
=
false
}
},
async
clearProcess
()
{
if
(
!
this
.
hasWorkerRuns
)
return
if
(
this
.
processStarting
)
return
this
.
processLoading
=
true
try
{
await
this
.
$store
.
dispatch
(
'
process/clearProcess
'
,
{
dataImportId
:
this
.
id
})
}
catch
(
e
)
{
this
.
notify
({
type
:
'
error
'
,
text
:
errorParser
(
e
)
})
}
finally
{
this
.
processLoading
=
false
}
}
},
watch
:
{
...
...
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