From 215269dba05980f835be99f13858415a738bdfa6 Mon Sep 17 00:00:00 2001 From: Pradnya Bhagwat Date: Tue, 29 Jun 2021 15:49:30 +0530 Subject: [PATCH 1/4] Changes for Delete Action/workflow functionality --- apps/st2-actions/actions-details.component.js | 21 +++++++++++++-- apps/st2-actions/actions-panel.component.js | 27 ++++++++++++++++--- apps/st2-actions/store.js | 26 ++++++++++++++++++ 3 files changed, 69 insertions(+), 5 deletions(-) diff --git a/apps/st2-actions/actions-details.component.js b/apps/st2-actions/actions-details.component.js index 99d780e30..5b44d71e5 100644 --- a/apps/st2-actions/actions-details.component.js +++ b/apps/st2-actions/actions-details.component.js @@ -57,6 +57,7 @@ export default class ActionsDetails extends React.Component { static propTypes = { handleNavigate: PropTypes.func.isRequired, handleRun: PropTypes.func.isRequired, + handleDelete: PropTypes.func.isRequired, id: PropTypes.string, section: PropTypes.string, @@ -127,10 +128,10 @@ export default class ActionsDetails extends React.Component { } } - - componentDidUpdate(prevProps) { + console.log('inside did update prevprops',prevProps); const { id } = this.props; + console.log('id',id); if (id && id !== prevProps.id) { this.fetchAction(id); } @@ -242,8 +243,22 @@ export default class ActionsDetails extends React.Component { return this.props.handleRun(...args); } + handleDelete (ref) { + const { id } = this.props; + + console.log('id',id); + + if (!window.confirm('Do you really want to delete this item?')) { + return undefined; + } + const res = this.props.handleDelete(id); + + return res; + } + render() { const { section, action, executions, entrypoint } = this.props; + console.log('action',action); if (!action) { return null; } @@ -281,6 +296,8 @@ export default class ActionsDetails extends React.Component { />