1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/web/ synced 2025-03-09 00:00:01 +01:00

Fixed IC creation bouncing issue

Signed-off-by: SystemsPurge <naktiyoussef@proton.me>
This commit is contained in:
SystemsPurge 2024-10-23 12:14:59 +02:00
parent 02f1161218
commit 5b2f8d2f91
No known key found for this signature in database
2 changed files with 23 additions and 5 deletions

View file

@ -27,7 +27,6 @@ class NewICDialog extends React.Component {
constructor(props) {
super(props);
this.state = {
name: '',
websocketurl: '',
@ -103,9 +102,9 @@ class NewICDialog extends React.Component {
setManager(e) {
this.setState({ [e.target.id]: e.target.value });
if (this.props.managers) {
let schema = this.props.managers.find(m => m.uuid === e.target.value).createparameterschema
let manager = this.props.managers.find(m => m.uuid === e.target.value)
let schema = manager ? manager.createparameterschema : false
if (schema) {
$RefParser.dereference(schema, (err, deref) => {
if (err) {
@ -116,6 +115,9 @@ class NewICDialog extends React.Component {
}
})
}
else{
this.setState({schema:{}})
}
}
}

View file

@ -77,14 +77,30 @@ const Infrastructure = () => {
newAction["action"] = "create";
newAction["parameters"] = data.parameters;
newAction["when"] = new Date();
// find the manager IC
const managerIC = ics.find(ic => ic.uuid === data.manager)
if (managerIC === null || managerIC === undefined) {
NotificationsDataManager.addNotification(NotificationsFactory.ADD_ERROR("Could not find manager IC with UUID " + data.manager));
return;
}
switch (managerIC.type){
case "kubernetes","kubernetes-simple":
newAction["parameters"]["type"] = "kubernetes"
newAction["parameters"]["category"] = "simulator"
delete newAction.parameters.location
delete newAction.parameters.description
if (newAction.parameters.uuid === undefined){
delete newAction.parameters.uuid
}
break;
case "generic":
// should check that the form contains following VALID MANDATORY fields:
// name, type , owner,realm,ws_url,api_url,category and location <= generic create action schema
break;
default:
NotificationsDataManager.addNotification(NotificationsFactory.ADD_ERROR("Creation not supported for manager type " + managerIC.type));
return;
}
dispatch(sendActionToIC({token: sessionToken, id: managerIC.id, actions: newAction}))
}
}