From 5870d6b1e0aa3567669136e0ecfbdf76350bef2f Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Mon, 8 Mar 2021 14:11:50 +0100 Subject: [PATCH] allow ICs to be re-created in case VILLAScontroller lost its state (got restarted) --- src/ic/ic-action.js | 11 +++++++++-- src/ic/ics.js | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/ic/ic-action.js b/src/ic/ic-action.js index 584f1f5..9c39da4 100644 --- a/src/ic/ic-action.js +++ b/src/ic/ic-action.js @@ -73,10 +73,17 @@ class ICAction extends React.Component { * see: https://villas.fein-aachen.org/doc/controller-protocol.html */ - if (newAction.action === "delete") { + if (newAction.action == "create" || newAction.action === "delete") { // prepare parameters for delete incl. correct IC id newAction["parameters"] = {}; - newAction.parameters["uuid"] = ic.uuid; + + if (newAction.action == "delete") { + newAction.parameters["uuid"] = ic.uuid; + } + else if (newAction.action == "create") { + newAction.parameters = ic.statusupdateraw.properties; + } + // get the ID of the manager IC let managerIC = null; for (let i of this.props.ics) { diff --git a/src/ic/ics.js b/src/ic/ics.js index def093e..6bf620b 100644 --- a/src/ic/ics.js +++ b/src/ic/ics.js @@ -514,7 +514,8 @@ class InfrastructureComponents extends Component { {id: '-1', title: 'Action', data: {action: 'none'}}, {id: '0', title: 'Reset', data: {action: 'reset'}}, {id: '1', title: 'Shutdown', data: {action: 'shutdown'}}, - {id: '2', title: 'Delete', data: {action: 'delete'}} + {id: '2', title: 'Delete', data: {action: 'delete'}}, + {id: '3', title: 'Recreate', data: {action: 'create'}}, ]} />