From c1d50a5f8c65c5428a93a75c7e71a228d8681a3e Mon Sep 17 00:00:00 2001 From: xg353y Date: Wed, 27 Feb 2019 15:18:20 +0100 Subject: Rework UI Rework Clamp UI to cooperate with the internal data model changes. Issue-ID: CLAMP-310 Change-Id: Ic3fdbdf5e405b57ef1537672a1d4528325b68a74 Signed-off-by: xg353y --- .../META-INF/resources/designer/index.html | 2 +- .../portfolios/PolicyWindow_properties.html | 24 +-- .../partials/portfolios/Template_model.html | 100 ------------ .../partials/portfolios/global_properties.html | 13 +- .../portfolios/tosca_model_properties.html | 11 -- .../resources/designer/scripts/CldsModelService.js | 12 +- .../designer/scripts/CldsOpenModelCtrl.js | 19 --- .../designer/scripts/GlobalPropertiesCtrl.js | 13 +- .../resources/designer/scripts/ImportSchemaCtrl.js | 7 +- .../resources/designer/scripts/ToscaModelCtrl.js | 32 ++-- .../designer/scripts/ToscaModelService.js | 7 + .../META-INF/resources/designer/scripts/aOnBoot.js | 174 ++++++++------------- .../resources/designer/scripts/common_variables.js | 1 + .../designer/scripts/propertyController.js | 81 ++++++++++ 14 files changed, 196 insertions(+), 300 deletions(-) delete mode 100644 src/main/resources/META-INF/resources/designer/partials/portfolios/Template_model.html create mode 100644 src/main/resources/META-INF/resources/designer/scripts/propertyController.js (limited to 'src/main') diff --git a/src/main/resources/META-INF/resources/designer/index.html b/src/main/resources/META-INF/resources/designer/index.html index 5d1e53047..0d87e2693 100644 --- a/src/main/resources/META-INF/resources/designer/index.html +++ b/src/main/resources/META-INF/resources/designer/index.html @@ -180,6 +180,6 @@ - + diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html index 182dab8d5..0da015358 100644 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html @@ -372,7 +372,6 @@ label { var num = add_one_more(); setMultiSelect(); }); - loadPropertyWindow("policy") // by default, parentPolicyConditions is disabled //$("#parentPolicyConditions").prop('disabled', 'disabled'); @@ -383,7 +382,7 @@ label { var allPolIds=[]; //Grab saved values for dropdowns - var obj = elementMap[lastElementSelected]; + var obj = getOperationalPolicyProperty(); var loadPolicy; console.log("lastElementSelected :"+ lastElementSelected); if (!($.isEmptyObject(obj))){ @@ -425,6 +424,7 @@ label { console.log("number is=:" + num); loadingId=false; for (var j = 0; j < el[i].length; j++) { + console.log("attr:" + el[i][j].name + "; value is:" + el[i][j].value); if(el[i][j].hasOwnProperty("name")){ $("#formId" + num + " #" + el[i][j].name).val( el[i][j].value); @@ -563,11 +563,13 @@ label { console.log("save properties; add tableVal to policies: "+ tableVal); }); - saveProperties(finalSaveList); + saveOpPolicyProperties(finalSaveList); $("#close_button").click(); }) function add_one_more() { + console.log("add one more"); + setPolicyOptions(); $("#nav_Tabs li").removeClass("active"); //FormSpan contains a block of the form that is not being displayed. We will create clones of that and add them to tabs @@ -767,9 +769,10 @@ label { } function startNextItem() { - console.log("start next Item"); + console.log("start next Item, policyname is:" + $("#pname").val()); //save last item before transitioning var lastItem = $("#policyTable .highlight"); + console.log("start next Item, lastitem is:" + lastItem); if (lastItem.length > 0) { console.log("start next Item length > 0"); saveLastPolicyLocally($("#pname").val()); @@ -777,22 +780,20 @@ label { lastItem.find("td").html($("#pname").val()); } } - + function add_new_policy(issueNewNames) { + console.log("add new policy"); //remove old gui forms for (var i=1; i<($(".formId").length + 1); i++){ $("#go_properties_tab"+i).parent().remove(); } $(".formId").remove(); - - //Reset headers - //$("#pname").val("0"); $("#pname").val("New_Policy"); - $("#timeout").val(defaults_props.policy.timeout); - + $("#timeout").val(getOperationalPolicyProperty().timeout); + $("#add_one_more").click(); } - + console.log("start next Item on 796"); startNextItem(); if (("#policyTable .highlight").length > 0){ @@ -804,7 +805,6 @@ label { setASDCFields(); initTargetResourceId(); - //load metrics dropdown if (elementMap["global"]) { for (var i = 0; i < (elementMap["global"].length); i++){ diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/Template_model.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/Template_model.html deleted file mode 100644 index 0ca4e7ca8..000000000 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/Template_model.html +++ /dev/null @@ -1,100 +0,0 @@ - - -
- - - - -
- - diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/global_properties.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/global_properties.html index c47e90a49..febdb6b61 100644 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/global_properties.html +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/global_properties.html @@ -107,12 +107,13 @@ function propChangeAlert(actionset) { //throw warnings only if options were previously chosen - if (elementMap["global"]) { - loop1: for (var i = 0; i < elementMap["global"].length; i++) { - if (elementMap["global"][i]["name"] == actionset.id) { + var globalProp = getGlobalProperty(); + if (globalProp) { + loop1: for (var i = 0; i < globalProp.length; i++) { + if (globalProp[i]["name"] == actionset.id) { //user did not change properties - if (elementMap["global"][i]["value"][0] == actionset.value) { - if (elementMap["global"][i]["name"] == "actionSet") { + if (globalProp[i]["value"][0] == actionset.value) { + if (globalProp[i]["name"] == "actionSet") { asDiff = false; } if (!asDiff) { @@ -121,7 +122,7 @@ ; //user changed properties } else { - if (elementMap["global"][i]["name"] == "actionSet") { + if (globalProp[i]["name"] == "actionSet") { asDiff = true; }; $(".propChangeWarn").show(); diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/tosca_model_properties.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/tosca_model_properties.html index b053b24ed..ca627b354 100644 --- a/src/main/resources/META-INF/resources/designer/partials/portfolios/tosca_model_properties.html +++ b/src/main/resources/META-INF/resources/designer/partials/portfolios/tosca_model_properties.html @@ -48,18 +48,7 @@ href="javascript:void(0)" class="btn-link" id='paramsRetry'>Retry / Cancel -
- -
- -
-