From 27a480462de4bea9b97b057f851e3f7606517009 Mon Sep 17 00:00:00 2001 From: mtangaro Date: Wed, 24 Jul 2019 07:56:54 +0000 Subject: [PATCH 1/2] fix configurable forms --- app/routes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/routes.py b/app/routes.py index 42fe1cc69..b2d83e170 100644 --- a/app/routes.py +++ b/app/routes.py @@ -42,6 +42,7 @@ def avatar(email, size): "metadata": { "icon": "https://cdn4.iconfinder.com/data/icons/mosaicon-04/512/websettings-512.png" }, + "enable_config_form": False, "inputs": {}, "tabs": {} } @@ -65,7 +66,6 @@ def avatar(email, size): toscaInfo[tosca]['inputs'] = template['topology_template']['inputs'] ## add parameters code here - enable_config_form = False tabs = {} if tosca_pars_dir: tosca_pars_path = tosca_pars_dir + "/" # this has to be reassigned here because is local. @@ -77,7 +77,7 @@ def avatar(email, size): if fname[0] != '.': tosca_pars_file = os.path.join(fpath, fname) with io.open(tosca_pars_file) as pars_file: - enable_config_form = True + toscaInfo[tosca]['enable_config_form'] = True pars_data = yaml.load(pars_file) toscaInfo[tosca]['inputs'] = pars_data["inputs"] if "tabs" in pars_data: @@ -262,7 +262,7 @@ def configure(): template=toscaInfo[selected_tosca], selectedTemplate=selected_tosca, slas=slas, - enable_config_form=enable_config_form) + enable_config_form=toscaInfo[selected_tosca]['enable_config_form']) def add_sla_to_template(template, sla_id): From db2fea2532f18404b87ff79266fc0f1e4db834ee Mon Sep 17 00:00:00 2001 From: mtangaro Date: Wed, 24 Jul 2019 13:39:03 +0000 Subject: [PATCH 2/2] remove enable_config_form, using toscaInfo --- app/routes.py | 3 +-- app/templates/createdep.html | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/routes.py b/app/routes.py index b2d83e170..59cb0414c 100644 --- a/app/routes.py +++ b/app/routes.py @@ -261,8 +261,7 @@ def configure(): return render_template('createdep.html', template=toscaInfo[selected_tosca], selectedTemplate=selected_tosca, - slas=slas, - enable_config_form=toscaInfo[selected_tosca]['enable_config_form']) + slas=slas) def add_sla_to_template(template, sla_id): diff --git a/app/templates/createdep.html b/app/templates/createdep.html index ec245e3b0..7f5928d09 100644 --- a/app/templates/createdep.html +++ b/app/templates/createdep.html @@ -29,7 +29,7 @@

- {% if enable_config_form %} + {% if template['enable_config_form'] is defined and template['enable_config_form'] is sameas true %} {% include 'config_form.html' %} {% else %} {% include 'default_form.html' %}