1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

B #~: Fix service template update (#696)

Signed-off-by: Frederick Borges <fborges@opennebula.io>
This commit is contained in:
Frederick Borges 2021-01-26 14:14:49 +01:00 committed by GitHub
parent a7cdfccf38
commit 0f31068bfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 9 deletions

View File

@ -104,7 +104,7 @@
<div class="row">
<div class="service_template_param st_man small-12 columns">
<input type="checkbox" name="automatic_deletion" id="automatic_deletion"/>
<label for="c">
<label for="automatic_deletion">
{{tr "Automatic deletion of service when all VMs terminated"}}
</label>
</div>

View File

@ -57,6 +57,16 @@
{{/if}}
</td>
</tr>
<tr>
<td class="key_td">{{tr "Automatic Deletion"}}</td>
<td class="value_td">
{{#if element.TEMPLATE.BODY.automatic_deletion}}
{{tr "yes"}}
{{else}}
{{tr "no"}}
{{/if}}
</td>
</tr>
</tbody>
</table>
</div>

View File

@ -299,7 +299,9 @@ define(function(require) {
name: name,
deployment: deployment,
description: description,
roles: roles
roles: roles,
ready_status_gate: ready_status_gate,
automatic_deletion: automatic_deletion
};
//add networks in post body
@ -316,10 +318,6 @@ define(function(require) {
json_template['shutdown_action'] = shutdown_action_service;
}
json_template['ready_status_gate'] = ready_status_gate;
json_template['automatic_deletion'] = automatic_deletion;
// add labels
var currentInfo = Sunstone.getElementRightInfo(TAB_ID)
if (
@ -331,11 +329,15 @@ define(function(require) {
json_template['labels'] = currentInfo.TEMPLATE.BODY.labels
}
var new_template = {};
$.extend(true, new_template, that.old_template, json_template);
if (this.action == "create") {
Sunstone.runAction("ServiceTemplate.create", json_template );
Sunstone.runAction("ServiceTemplate.create", new_template );
return false;
} else if (this.action == "update") {
Sunstone.runAction("ServiceTemplate.update",this.resourceId, JSON.stringify(json_template));
var templateStr = JSON.stringify(new_template);
Sunstone.runAction("ServiceTemplate.update", this.resourceId, templateStr);
return false;
}
}
@ -371,6 +373,7 @@ define(function(require) {
if (this.action != "update") {return;}
this.setHeader(element);
this.resourceId = element.ID;
this.old_template = element.TEMPLATE.BODY;
// Populates the Avanced mode Tab
$('#template', context).val(JSON.stringify(element.TEMPLATE.BODY, null, " "));

View File

@ -103,7 +103,7 @@
<div class="row">
<div class="service_template_param st_man small-12 columns">
<input type="checkbox" name="automatic_deletion" id="automatic_deletion"/>
<label for="c">
<label for="automatic_deletion">
{{tr "Automatic deletion of service when all VMs terminated"}}
</label>
</div>

View File

@ -57,6 +57,16 @@
{{/if}}
</td>
</tr>
<tr>
<td class="key_td">{{tr "Automatic Deletion"}}</td>
<td class="value_td">
{{#if element.TEMPLATE.BODY.automatic_deletion}}
{{tr "yes"}}
{{else}}
{{tr "no"}}
{{/if}}
</td>
</tr>
</tbody>
</table>
{{#if customAttrs}}