Skip to content

Commit

Permalink
Fix inputs in case of dep update
Browse files Browse the repository at this point in the history
  • Loading branch information
maricaantonacci committed Oct 11, 2023
1 parent 9df21b6 commit 9f442d8
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
4 changes: 3 additions & 1 deletion app/deployments/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,9 @@ def updatedep():
else:
remove_sla_from_template(template)

inputs = {k: v for (k, v) in form_data.items() if not k.startswith("extra_opts.") and not k == '_depid'}
stinputs = json.loads(dep.stinputs.strip('\"')) if dep.stinputs else {}
inputs = {k: v for (k, v) in form_data.items() if not k.startswith("extra_opts.") and not k == '_depid' and (
k in stinputs and 'updatable' in stinputs[k] and stinputs[k]['updatable'] == True)}

additionaldescription = form_data['additional_description']

Expand Down
8 changes: 4 additions & 4 deletions app/deployments/templates/input_types.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@

<!-- list text type -->
{% elif value.type == "list" and value.entry_schema.type|lower == "string" %}
<fieldset class="border p-2">
<fieldset class="border p-2" {{mode}}>
<!--legend class="w-auto">{{key}}</legend-->
{% include 'inputs/list.html' %}
</fieldset>
<!-- end list text type -->

<!-- list text type -->
{% elif value.type == "list" and value.entry_schema.type|lower == "map" %}
<fieldset class="border p-2">
<fieldset class="border p-2" {{mode}}>
<!--legend class="w-auto">{{key}}</legend-->
{% include 'inputs/list_map_string.html' %}
</fieldset>
Expand Down Expand Up @@ -177,15 +177,15 @@ <h5 class="modal-title">Storage encryption alert</h5>

<!-- List of map of strings -->
{% elif value.type == "map" and value.entry_schema.type == "string" %}
<fieldset class="border p-2">
<fieldset class="border p-2" {{mode}}>
{% include 'inputs/map_string.html' %}
</fieldset>
<!-- end Port field -->

<!-- Port field -->
{% elif value.type == "map" and (value.entry_schema.type == "tosca.datatypes.network.PortSpec" or value.entry_schema.type == "tosca.datatypes.indigo.network.PortSpec") %}
{% set ports_type = "indigo" if 'indigo' in value.entry_schema.type else "" %}
<fieldset class="border p-2">
<fieldset class="border p-2" {{mode}}>
{% include 'inputs/ports.html' %}
</fieldset>
<!-- end Port field -->
Expand Down
2 changes: 1 addition & 1 deletion app/deployments/templates/inputs/combined.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<select class="js-example-basic-single js-states form-control" id="{{key}}" name="{{key}}" data-action="removeOnSubmit" onchange="setfields(this)" required>
<select class="js-example-basic-single js-states form-control" id="{{key}}" name="{{key}}" data-action="removeOnSubmit" onchange="setfields(this)" {{mode}} required>
<option value="" disabled selected>--Select--</option>
{% for constraint in value.constraints %}
<option value="{{constraint['value']}}" data-values="{{constraint['set']}}">{{constraint['label']}}</option>
Expand Down
2 changes: 1 addition & 1 deletion app/deployments/templates/inputs/dependent_select.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<select class="js-example-basic-single js-states form-control" id="{{key}}" name="{{key}}" data-parent-id="{{value.parent}}">
<select class="js-example-basic-single js-states form-control" id="{{key}}" name="{{key}}" data-parent-id="{{value.parent}}" {{mode}}>
{% for constraint in value.constraints %}
<option data-parent-value="{{constraint['parent_value']}}" value="{{constraint['value']}}" {% if constraint['value'] in value.default %}selected="selected"{% endif %}>{{constraint['label']}}</option>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion app/deployments/templates/inputs/list.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="mt-2">
<div id="{{key}}-container"></div>
<button type="button" class="btn btn-sm btn-outline-info" id="add-new-item" class="add-new" data-tag-name="{{key}}">Add</button>
<input id="id-{{key}}" type="hidden" data-output-type="json" name="{{key}}" value""/>
<input id="id-{{key}}" type="hidden" data-output-type="json" name="{{key}}" value=""/>
</div>


Expand Down
2 changes: 1 addition & 1 deletion app/deployments/templates/inputs/list_map_string.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="mt-2">
<div id="{{key}}-container"></div>
<button type="button" class="btn btn-sm btn-outline-info" id="add-new-item" class="add-new" data-tag-name="{{key}}" onclick="addItem(this)">Add</button>
<input id="id-{{key}}" type="hidden" data-output-type="json" name="{{key}}" value""/>
<input id="id-{{key}}" type="hidden" data-output-type="json" name="{{key}}" value=""/>
</div>


Expand Down
2 changes: 1 addition & 1 deletion app/deployments/templates/inputs/map_string.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div class="mt-2">
<div id="{{key}}-container"></div>
<button type="button" class="btn btn-sm btn-outline-info" id="add-new-item" class="add-new" data-tag-name="{{key}}">Add</button>
<input id="id-{{key}}" type="hidden" data-output-type="json" name="{{key}}" value""/>
<input id="id-{{key}}" type="hidden" data-output-type="json" name="{{key}}" value=""/>
</div>


Expand Down

0 comments on commit 9f442d8

Please sign in to comment.