From dff95fab2dd22c72e996a4d06b6423d2f044c809 Mon Sep 17 00:00:00 2001 From: Stanislaw Adaszewski Date: Thu, 2 Apr 2020 17:15:54 +0200 Subject: [PATCH] Add ability to cancel container_requests --- frontend/src/js/component/wb-process-dashboard.js | 1 + frontend/src/js/component/wb-process-listing.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/frontend/src/js/component/wb-process-dashboard.js b/frontend/src/js/component/wb-process-dashboard.js index 1b83390..0ee047d 100644 --- a/frontend/src/js/component/wb-process-dashboard.js +++ b/frontend/src/js/component/wb-process-dashboard.js @@ -80,6 +80,7 @@ class WBProcessDashboard extends Component { const filters = [ [ 'uuid', 'in', uuids ] ]; return getAll(ofs => makeArvadosRequest(arvHost, arvToken, '/arvados/v1/containers?filters=' + encodeURIComponent(JSON.stringify(filters)) + + '&order=' + encodeURIComponent(JSON.stringify([ 'uuid asc' ])) + '&offset=' + ofs)); }); prom = prom.then(cl => { diff --git a/frontend/src/js/component/wb-process-listing.js b/frontend/src/js/component/wb-process-listing.js index b4f9130..c2961e6 100644 --- a/frontend/src/js/component/wb-process-listing.js +++ b/frontend/src/js/component/wb-process-listing.js @@ -27,6 +27,18 @@ class WBProcessListing extends Component { this.fetchItems(); } + cancelProcess(uuid) { + const { app } = this.props; + const { arvHost, arvToken } = app.state; + let prom = makeArvadosRequest(arvHost, arvToken, + '/arvados/v1/container_requests/' + encodeURIComponent(uuid), + { method: 'PUT', data: JSON.stringify({ priority: 0 }) }); + prom = prom.then(() => { + this.setState({ rows: maskRows(this.state.rows) }); + this.fetchItems(); + }); + } + prepareRows(requests, containerLookup, ownerLookup, outputLookup) { const { app, renderRenameLink, renderDeleteButton, renderSelectionCell, renderSharingButton, @@ -51,6 +63,9 @@ class WBProcessListing extends Component { wbFormatDate(item['created_at']), ( ), (
+ { renderDeleteButton(item, () => this.fetchItems()) } { renderSharingButton(item) }
)