Merge "Parsing CSAR to retrieve policy model"
authorAdam Krysiak <adam.krysiak@nokia.com>
Tue, 26 Feb 2019 10:35:47 +0000 (10:35 +0000)
committerGerrit Code Review <gerrit@onap.org>
Tue, 26 Feb 2019 10:35:47 +0000 (10:35 +0000)
16 files changed:
pom.xml
src/main/java/org/onap/clamp/clds/model/CldsToscaModel.java
src/main/java/org/onap/clamp/clds/service/CldsService.java
src/main/java/org/onap/clamp/clds/service/CldsToscaService.java
src/main/resources/META-INF/resources/designer/partials/portfolios/PolicyWindow_properties.html
src/main/resources/META-INF/resources/designer/partials/portfolios/holmes_properties.html [deleted file]
src/main/resources/META-INF/resources/designer/partials/portfolios/tca_properties.html [deleted file]
src/main/resources/META-INF/resources/designer/partials/portfolios/vesCollector_properties.html [deleted file]
src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
src/main/resources/META-INF/resources/designer/scripts/CldsOpenModelCtrl.js
src/main/resources/META-INF/resources/designer/scripts/GlobalPropertiesCtrl.js
src/main/resources/META-INF/resources/designer/scripts/ToscaModelCtrl.js
src/main/resources/META-INF/resources/designer/scripts/aOnBoot.js
src/main/resources/META-INF/resources/designer/scripts/app.js
src/main/resources/clds/camel/rest/clds-services.xml
src/test/java/org/onap/clamp/clds/it/CldsToscaServiceItCase.java

diff --git a/pom.xml b/pom.xml
index 3a0cc25..a2fe2cb 100644 (file)
--- a/pom.xml
+++ b/pom.xml
 
                <distributionManagement>
                                <repository>
-                                               <id>onap-releases</id>
+                                               <id>ecomp-releases</id>
                                                <name>Clamp Release Repository</name>
                                                <url>https://nexus.onap.org/content/repositories/releases/</url>
                                </repository>
                                <snapshotRepository>
-                                               <id>onap-snapshots</id>
+                                               <id>ecomp-snapshots</id>
                                                <name>Clamp Snapshot Repository</name>
                                                <url>https://nexus.onap.org/content/repositories/snapshots/</url>
                                </snapshotRepository>
                                <site>
-                                               <id>onap-site</id>
+                                               <id>ecomp-site</id>
                                                <url>dav:https://nexus.onap.org/content/sites/site/org/onap/clamp/${project.version}</url>
                                </site>
                </distributionManagement>
                                                <url>http://repo2.maven.org/maven2/</url>
                                </repository>
                                <repository>
-                                               <id>onap-releases</id>
+                                               <id>ecomp-releases</id>
                                                <name>ONAP Release Repository</name>
                                                <url>https://nexus.onap.org/content/repositories/releases/</url>
                                </repository>
                                <repository>
-                                               <id>onap-staging</id>
+                                               <id>ecomp-staging</id>
                                                <name>ONAP Staging Repository</name>
                                                <url>https://nexus.onap.org/content/repositories/staging/</url>
                                </repository>
                                <repository>
-                                               <id>onap-snapshots</id>
+                                               <id>ecomp-snapshots</id>
                                                <name>ONAP Snapshot Repository</name>
                                                <url>https://nexus.onap.org/content/repositories/snapshots/</url>
                                                <snapshots>
index 25b8d40..6184b39 100644 (file)
@@ -36,7 +36,12 @@ public class CldsToscaModel extends CldsToscaModelRevision {
     private String id;
     private String policyType;
     private String toscaModelName;
-    private String toscaModelYaml;
+
+    /**
+     * Construct
+     */
+    public CldsToscaModel () {
+    }
 
     /**
      * Creates or updates Tosca Model to DB
@@ -123,21 +128,4 @@ public class CldsToscaModel extends CldsToscaModelRevision {
         this.toscaModelName = toscaModelName;
     }
 
-    /**
-     * @return the toscaModelYaml
-     */
-    @Override
-    public String getToscaModelYaml() {
-        return toscaModelYaml;
-    }
-
-    /**
-     * @param toscaModelYaml
-     *        the toscaModelYaml to set
-     */
-    @Override
-    public void setToscaModelYaml(String toscaModelYaml) {
-        this.toscaModelYaml = toscaModelYaml;
-    }
-
 }
index 42e9cf7..e3a379b 100644 (file)
@@ -394,11 +394,14 @@ public class CldsService extends SecureServiceBase {
             errorMessage = e.getMessage();
         }
 
-        if (!errorMessage.isEmpty()) {
+        if (null == errorMessage || (null != errorMessage && !errorMessage.isEmpty())) {
             CldsEvent.insEvent(cldsDao, model.getControlName(), getUserId(), actionCd, CldsEvent.ACTION_STATE_ERROR,
                 null);
             // Need a refresh as new events have been inserted
             model = CldsModel.retrieve(cldsDao, modelName, false);
+            if (null == errorMessage) {
+                errorMessage = "No response from Policy";
+            }
             model.setErrorMessageForUi(errorMessage);
             util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "putModelAndProcessAction failed", Level.INFO,
                 ONAPLogConstants.ResponseStatus.ERROR);
index 04205b7..adebd78 100644 (file)
@@ -101,7 +101,7 @@ public class CldsToscaService extends SecureServiceBase {
      * 
      * @return clds tosca models - list of CLDS tosca models
      */
-    public ResponseEntity<List<CldsToscaModel>> getAllToscaModels() {
+    public List<CldsToscaModel> getAllToscaModels() {
 
         Date startTime = new Date();
         LoggingUtils.setRequestContext("CldsToscaService: Get All tosca models", getPrincipalName());
@@ -111,7 +111,7 @@ public class CldsToscaService extends SecureServiceBase {
         LoggingUtils.setTimeContext(startTime, new Date());
         LoggingUtils.setResponseContext("0", "Get All tosca models success", this.getClass().getName());
         auditLogger.info("Get All tosca models");
-        return new ResponseEntity<>(cldsToscaModels, HttpStatus.OK);
+        return cldsToscaModels;
     }
 
     /**
@@ -123,7 +123,7 @@ public class CldsToscaService extends SecureServiceBase {
      * 
      * @return clds tosca model - CLDS tosca model for a given tosca model name
      */
-    public ResponseEntity<CldsToscaModel> getToscaModel(String toscaModelName) {
+    public CldsToscaModel getToscaModel(String toscaModelName) {
         Date startTime = new Date();
         LoggingUtils.setRequestContext("CldsToscaService: Get tosca models by model name", getPrincipalName());
         // TODO revisit based on new permissions
@@ -132,8 +132,7 @@ public class CldsToscaService extends SecureServiceBase {
         LoggingUtils.setTimeContext(startTime, new Date());
         LoggingUtils.setResponseContext("0", "Get tosca models by model name success", this.getClass().getName());
         auditLogger.info("GET tosca models by model name completed");
-        return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(),
-                HttpStatus.OK);
+        return cldsToscaModels.get(0);
     }
 
     /**
@@ -143,7 +142,7 @@ public class CldsToscaService extends SecureServiceBase {
      * @param policyType
      * @return clds tosca model - CLDS tosca model for a given policy type
      */
-    public ResponseEntity<CldsToscaModel> getToscaModelsByPolicyType(String policyType) {
+    public CldsToscaModel getToscaModelsByPolicyType(String policyType) {
         Date startTime = new Date();
         LoggingUtils.setRequestContext("CldsToscaService: Get tosca models by policyType", getPrincipalName());
         // TODO revisit based on new permissions
@@ -152,8 +151,7 @@ public class CldsToscaService extends SecureServiceBase {
         LoggingUtils.setTimeContext(startTime, new Date());
         LoggingUtils.setResponseContext("0", "Get tosca models by policyType success", this.getClass().getName());
         auditLogger.info("GET tosca models by policyType completed");
-        return new ResponseEntity<>(Optional.ofNullable(cldsToscaModels).get().stream().findFirst().get(),
-                HttpStatus.OK);
+        return cldsToscaModels.get(0);
     }
 
     public ResponseEntity<?> deleteToscaModelById(String toscaModeId) {
index 331ab5c..182dab8 100644 (file)
 
 
 <style>
-#deletePolicy {
-       height: 34px;
-       background-color: #dddd;
-}
-
 .disabled {
        background-color: #dddd;
 }
 
-.modelSearchBox {
-       position: absolute;
-       padding: 25px 12px;
-}
-
 label {
        text-align: right;
        vertical-align: middle;
@@ -46,12 +36,6 @@ label {
        padding: 0 10px 0 0;
 }
 
-#createNewPolicy {
-       height: 34px;
-       width: 120px; /*84*/
-       background-color: #f2bfab;
-}
-
 .idError {
        color: red;
        padding: 50px 0px;
@@ -74,14 +58,6 @@ label {
        margin-bottom: 0px;
 }
 
-#policySearch {
-       height: 33px;
-       font-size: 12px;
-       padding: 2px 2px 2px 30px;
-       margin-bottom: 5px;
-       width: 100%;
-}
-
 #policyTable {
        cursor: pointer;
        width: 100%;
@@ -124,36 +100,17 @@ label {
 
        <div class="modal-body">
                <div attribute-test="policywindowpropertiesb" class="modal-body row">
-
-                       <div class="leftPolicyPanel">
+                       <div class="leftPolicyPanel" style="display: none;">
                                <div class="panel panel-default">
-                                       <i class="glyphicon glyphicon-search modelSearchBox"></i> <input
-                                               type="text" id="policySearch" onkeyup="searchPolicyList()"
-                                               placeholder="Search ...">
                                        <div id="policyTableHolder">
                                                <table id="policyTable"></table>
                                        </div>
                                </div>
-                               <div style="float: left">
-                                       <button type="button" id="createNewPolicy" class="btn btn-sm">New
-                                               Policy</button>
-                                       </span>
-                               </div>
-                               <div style="float: right">
-                                       <button type="button" id="deletePolicy"
-                                               class="btn btn-sm glyphicon glyphicon-trash" disabled></button>
-                                       </span>
-                               </div>
-                               <div id="repeatIdError" class="idError">Error: This Policy
-                                       name is already taken.</div>
-                               <div id="newIdError" class="idError">Error: Please rename your
-                                       new Policy.</div>
+
                                <div id="spaceError" class="idError">Error: Spaces are not
                                        allowed in the ID.</div>
                        </div>
-
-                       <div class="panel panel-default col-sm-9 policyPanel"
-                               style="display: none;">
+                       <div class="panel panel-default col-sm-9 policyPanel">
                                <form id="Timeoutform" class="form-horizontal">
                                        <div>
                                                <div class="form-group clearfix row">
@@ -379,11 +336,12 @@ label {
                }
 
                function initTargetResourceId() {
+                       if (vf_Services !== null && vf_Services !== undefined) {
                        // Set all the Resource Invariant UUID in the target resource ID list (+Empty and other) 
                        Object.keys(vf_Services["shared"]["byVf"]).forEach(function(key) {
                                        $("#targetResourceId").append($('<option></option>').val(key).html(key));
                        });
-                       
+                       }
                }
                
                function changeTargetResourceIdOther() {
@@ -409,6 +367,7 @@ label {
                //Basically this method will add a new form. All forms share the same class. When you want one form to show(active form) the other forms get the 
                // css attribute display:none
                $("#add_one_more").click(function(event) {
+                       console.log("add one more");
                        event.preventDefault();
                        var num = add_one_more();
                        setMultiSelect();
@@ -425,7 +384,8 @@ label {
                
                //Grab saved values for dropdowns
                var obj = elementMap[lastElementSelected];
-               
+               var loadPolicy;
+               console.log("lastElementSelected :"+ lastElementSelected);
                if (!($.isEmptyObject(obj))){
                        allPolicies = jQuery.extend({}, obj);                   
                        for (var x in allPolicies){
@@ -433,12 +393,23 @@ label {
                                if (allPolicies[x][1]['value']){
                                        allPolIds.push(parseInt(allPolicies[x][1]['value']));
                                }
+                               console.log("policies found :"+ x);
+                               loadPolicy = x;
                        }
                }
-               $("#pname").val('');            
+               
+               if (loadPolicy !== undefined && loadPolicy !== null) {
+                       // load properties
+                       console.log("load properties");
+                       disperseConfig(allPolicies,loadPolicy);
+               } else  {
+                       console.log("create new policy");
+                       add_new_policy();
+               }               
 
                //load recipes for a chosen policy
                function disperseConfig(policyObj, id){
+                       console.log("disperseConfig with id:" + id);
                        parent_policy={};
                        //remove old gui forms
                        for (var i=1; i<($(".formId").length + 1); i++){
@@ -446,18 +417,21 @@ label {
                        }
                        $(".formId").remove();
                        
-                       if (policyObj !== undefined) {
+                       if (policyObj !== undefined && policyObj[id] !== undefined) {
                                var el = policyObj[id][3]['policyConfigurations']
                                for (var i = 0; i < el.length; i++) {
                                        loadingId=true;
                                        var num = add_one_more();
+                                       console.log("number is=:" + num);
                                        loadingId=false;
                                        for (var j = 0; j < el[i].length; j++) {
                                                if(el[i][j].hasOwnProperty("name")){
                                                        $("#formId" + num + " #" + el[i][j].name).val(
                                                                        el[i][j].value);
-                                                       if(el[i][j].name==="_id")
+                                                       if(el[i][j].name==="_id") {
+                                                               console.log("formId num:" + num + "; value is:" + el[i][j].value);
                                                                policy_ids["#formId" + num]=el[i][j].value
+                                                       }
                                                        if(el[i][j].name==='parentPolicy')
                                                                parent_policy[num]=el[i][j].value 
                                                        if(el[i][j].name==='recipe' && el[i][j].value.toString()!==''){
@@ -563,25 +537,14 @@ label {
                }
                
                $("#savePropsBtn").click(function(event) {
+                       console.log("save properties triggered");
                        if($("#targetResourceIdOther").is(":visible")) {
                                $('#targetResourceId').append($('<option></option>').val($("#targetResourceIdOther").val()).html($("#targetResourceIdOther").val()))
                                $("#targetResourceId").val($("#targetResourceIdOther").val());
                        }
                        $(".idError").hide();
-                       if ($("#policyTable .highlight td").html() !== $("#pname").val()){
-                               //repeated name
-                               if ($.inArray($("#pname").val(), Object.keys(allPolicies)) > -1){
-                                       $("#repeatIdError").show();
-                                       return;
-                               } else { //not repeated
-                                       delete allPolicies[$("#policyTable .highlight td").html()];
-                               }
-                       }
-                       if ($("#pname").val().trim() == "New_Policy"){
-                               $("#newIdError").show();
-                               return;
-                       }
-                       
+
+                       console.log("save properties triggered2");
                        //Saves edits
                        /* if ($("#policyTable .highlight").length > 0){
                                saveLastPolicyLocally($("#policyTable .highlight").attr("id"));
@@ -589,12 +552,15 @@ label {
                        startNextItem();
                        
                        //Removes outdated (deleted) policies by checking against left menu
+                       console.log("get all policies");
                        var finalSaveList = {};
                        $("#policyTable td").each(function(){
+                               console.log("enter policy table each loop");
                                var tableVal = $(this).text();
                                if (tableVal in allPolicies){
                                        finalSaveList[tableVal] = allPolicies[tableVal];
                                }
+                               console.log("save properties; add tableVal to policies: "+ tableVal);
                        });
 
                        saveProperties(finalSaveList);
@@ -669,21 +635,8 @@ label {
                        
                        return count;
                }
-               
-               function add_new_policy(issueNewNames) {        
-                       //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);
-                       
-                       $("#add_one_more").click();
-               }
+
+
 
                function addCustListen(count) {                 
                        $('#go_properties_tab' + count).click(function(event) {
@@ -751,21 +704,8 @@ label {
                        this.name = name
                }
 
-               //Policy table search filter
-               function searchPolicyList() {
-                       var search = document.getElementById("policySearch");
-                       var row = document.getElementsByTagName("td");
-                       for (var i = 0; i < row.length; i++) {
-                               if (row[i].innerHTML.toUpperCase().indexOf(
-                                               search.value.toUpperCase()) > -1) {
-                                       row[i].style.display = "";
-                               } else {
-                                       row[i].style.display = "none";
-                               }
-                       }
-               }
-
                function saveLastPolicyLocally(lastPolicyId) {
+                       console.log("last policy id is:" + lastPolicyId);
                        var polForm = []
 
                        var properties = $(".saveProps").not("#formSpan .saveProps");
@@ -783,100 +723,29 @@ label {
                                d["policyConfigurations"].push(s);
                        }
                        polForm.push(d);
-                       allPolicies[lastPolicyId] = polForm;
-               }
                
-               function getNextId(){
-                       var newPolId;
-                       allPolIds.sort();
-                       if ((Math.min.apply(Math, allPolIds) == 0)
-                                       && (allPolIds.length > 0)) {
-                               loop1: 
-                                       for (var i = 1; i < allPolIds.length; i++) {
-                                               if ((allPolIds[i] - allPolIds[i - 1]) != 1) {
-                                                       newPolId = (allPolIds[i - 1] + 1);
-                                                       break loop1;
-                                               };
-                                       };
-                               if (!newPolId) {
-                                       newPolId = (Math.max.apply(Math, allPolIds)) + 1;
+                       for (var x in allPolicies){
+                               if (x !== lastPolicyId) {
+                                       delete allPolicies[x];
+                                       console.log("remove old policy"+ x);
                                }
-                       } else {
-                               newPolId = 0;
                        }
-                       allPolIds.push(newPolId);
-                       $("#pid").val(newPolId);
-               }
-
-               $("#deletePolicy").on('click', function() {
-                       $(".idError").hide();
-                       //delete policy id
-                       allPolIds.splice((allPolIds.indexOf(parseInt($("#pid").val()))),1);
                        
-                       //delete policy name
-                       var deleteId = $("#policyTable .highlight td").html();
-                       delete allPolicies[deleteId];
-                       $("#policyTable .highlight").remove();
-                       $("#pname").val('');
-                       expandTable();
-               });
+                       allPolicies[lastPolicyId] = polForm;
+               }
 
                $('#policyTable').on('click', 'tr', function(event) {
+                       
+                       console.log("click on policyTable");
                        $(".idError").hide();
-                       //edited name
-                       if ($("#policyTable .highlight td").html() !== $("#pname").val()){
-                               //repeated name
-                               if ($.inArray($("#pname").val(), Object.keys(allPolicies)) > -1){
-                                       $("#repeatIdError").show();
-                                       return;
-                               } else { //not repeated
-                                       $("#repeatIdError").hide();
-                                       delete allPolicies[$("#policyTable .highlight td").html()];
-                               }
-                       }
-                       //if (parseInt($("#pname").val()) == 0){
-                       if ($("#pname").val().trim() == "New_Policy"){
-                               $("#newIdError").show();
-                               return;
-                       }
+
                        if (!(readMOnly)){
                                startNextItem();
-                       } else {
-                               if ($("#policyTable .highlight").length == 0){
-                                       collapseTable();                
-                               }
                        }
                        $(this).addClass('highlight').siblings().removeClass('highlight');
                        disperseConfig(allPolicies, $(this).find("td").html());
                });
 
-               $('#createNewPolicy').on('click', function(){
-                       $(".idError").hide();
-                       //edited name
-                       if ($("#policyTable .highlight td").html() !== $("#pname").val()){
-                               //repeated name
-                               if ($.inArray($("#pname").val(), Object.keys(allPolicies)) > -1){
-                                       $("#repeatIdError").show();
-                                       return;
-                               } else { //not repeated
-                                       $("#repeatIdError").hide();
-                                       delete allPolicies[$("#policyTable .highlight td").html()];
-                               }
-                       }
-                       //if (parseInt($("#pname").val()) == 0){
-                       if ($("#pname").val().trim() == "New_Policy"){
-                               $("#newIdError").show();
-                               return;
-                       }
-                       startNextItem();
-                       add_new_policy();
-                       if (("#policyTable .highlight").length > 0){
-                               $('#policyTable tr.highlight').removeClass('highlight');
-                       }
-            $("#policyTable").prepend("<tr class='highlight'><td>New_Policy</td></tr>");
-            
-            getNextId();
-               });
 
                $('#pname').on('keypress', function(e){
                        /* var newVal = $(this).val() + String.fromCharCode(e.which);
@@ -898,22 +767,41 @@ label {
                }
 
                function startNextItem() {
+                       console.log("start next Item");
                        //save last item before transitioning
                        var lastItem = $("#policyTable .highlight");
                        if (lastItem.length > 0) {
+                               console.log("start next Item length > 0");
                                saveLastPolicyLocally($("#pname").val());
                                //lastItem.attr("id", $("#pname").val()); 
                                lastItem.find("td").html($("#pname").val());
-                       } else {
-                               collapseTable();
                        }
-
-                       //allow deleting
-                       if ($("#deletePolicy").prop("disabled")) {
-                               $("#deletePolicy").prop("disabled", false);
+               }
+               
+               function add_new_policy(issueNewNames) {        
+                       //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);
+                       
+                       $("#add_one_more").click();
                }
                
+               startNextItem();
+
+               if (("#policyTable .highlight").length > 0){
+                       $('#policyTable tr.highlight').removeClass('highlight');
+               }
+        $("#policyTable").prepend("<tr class='highlight'><td>New_Policy</td></tr>");
+
+               $("#pid").val(0);
+
                setASDCFields();
                initTargetResourceId();
                
@@ -922,7 +810,7 @@ label {
                        for (var i = 0; i < (elementMap["global"].length); i++){
                                if ((elementMap["global"][i]["name"]) == "actionSet"){
                                        var asSel = elementMap["global"][i]["value"];
-                                       if (asSel == "vnfRecipe"){
+                                       if (asSel == "vnfRecipe" && vf_Services !== null && vf_Services !== undefined){
                                                if (vf_Services["policy"][asSel]){
                                                        $.each((vf_Services["policy"][asSel]), function(val, text) {
                                                $('#recipe').append(
@@ -935,21 +823,6 @@ label {
                                };
                        };
                };
-               //Show table panel only
-               function expandTable() {
-                       $(".policyPanel").css("display", "none");
-                       $(".leftPolicyPanel").removeClass("col-sm-3");
-                       $(".modelSearchBox").css("padding", "25px 12px");
-                       if (!($("#deletePolicy").prop("disabled"))) {
-                               $("#deletePolicy").prop("disabled", true);
-                       }
-               }
 
-               //Show both menus
-               function collapseTable() {
-                       $(".leftPolicyPanel").addClass("col-sm-3");
-                       $(".modelSearchBox").css("padding", "10px 12px");
-                       $(".policyPanel").css("display", "unset");
-               }
        </script>
 </div>
diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/holmes_properties.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/holmes_properties.html
deleted file mode 100644 (file)
index 1a9f9ba..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-<!--
-  ============LICENSE_START=======================================================
-  ONAP CLAMP
-  ================================================================================
-  Copyright (C) 2017 AT&T Intellectual Property. All rights
-                              reserved.
-  ================================================================================
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  ============LICENSE_END============================================
-  ===================================================================
-  -->
-<style>
-</style>
-
-
-<div id="holmes-configuration">
-  <!-- form header -->
-  <div class="modal-header">
-    <button type="button" class="close" ng-click="close(false)" aria-hidden="true" style="margin-top: -3px">&times;</button>
-    <h4>Holmes Microservice Configuration</h4>
-  </div>
-
-  <!-- Form center-->
-  <div class="modal-body" style="height: 280px">
-
-    <form id="saveProps" class="form-horizontal">
-      <div class="form-group">
-        <div>
-          <label for="correlationalLogic" class="col-sm-4 control-label">Correlational logic</label>
-        </div>
-        <div class="col-sm-8">
-          <textarea class="form-control" focus="true" name="correlationalLogic"  id="correlationalLogic" />
-        </div>
-        <div>
-          <label for="configPolicyName" class="col-sm-4 control-label">Configuration Policy Name</label>
-        </div>
-        <div class="col-sm-8">
-          <textarea class="form-control" focus="true" name="configPolicyName"  id="configPolicyName" />
-        </div>
-      </div>
-    </form>
-
-  </div>
-
-  <!-- footer -->
-  <div class="modal-footer">
-    <button id="savePropsBtn" class="btn btn-primary">Save</button>
-    <button id="close_button" class="btn btn-primary" ng-click="close(true)">Cancel</button>
-  </div>
-</div>
-
-<script language="javascript">
-
-// load window
-loadPropertyWindow('holmes')
-
-// fill policy combo box (allPolicies from ImporSchemaCtrl.js
-if (typeof allPolicies !== "undefined"){
-         $.each(Object.keys(allPolicies), function(val, text) {
-             $('#operationalPolicy').append($('<option></option>').val(text).html(text));
-         });  
-} else if (typeof elementMap !== "undefined"){
-               for (key in elementMap){
-                               if (key.indexOf("Policy")>-1){
-                                         $.each(Object.keys(elementMap[key]), function(val, text){
-                                                   $('#operationalPolicy').append(
-                                                             $('<option></option>').val(text).html(text)
-                                                   );
-                                         });
-                               }
-               }
-}
-
-// load property values
-var el=elementMap[lastElementSelected];
-if(el!==undefined){
-    for(var i=0;i<el.length;i++){
-        $("#"+el[i].name).val(el[i].value);
-    }
-}
-
-$("#saveProps").on('submit', function (event) {
-    saveProperties($(this).serializeArray())
-    event.preventDefault();
-    $("#close_button").click();
-});
-
-$("#savePropsBtn").click(function (event) {
-    $("#saveProps").submit();
-});
-
-
-
-
-
-</script>
diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/tca_properties.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/tca_properties.html
deleted file mode 100644 (file)
index 89b13fa..0000000
+++ /dev/null
@@ -1,505 +0,0 @@
-<!--
-  ============LICENSE_START=======================================================
-  ONAP CLAMP
-  ================================================================================
-  Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
-                              reserved.
-  ================================================================================
-  Licensed under the Apache License, Version 2.0 (the "License"); 
-  you may not use this file except in compliance with the License. 
-  You may obtain a copy of the License at
-  
-  http://www.apache.org/licenses/LICENSE-2.0
-  
-  Unless required by applicable law or agreed to in writing, software 
-  distributed under the License is distributed on an "AS IS" BASIS, 
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
-  See the License for the specific language governing permissions and 
-  limitations under the License.
-  ============LICENSE_END============================================
-  ===================================================================
-  
-  -->
-
-<style>
-#createNewThresh{
-       height:34px;
-       width:120px; /*84*/
-       background-color:#f2bfab;
-}
-
-#deleteThresh{
-       height:34px;
-       background-color:#dddd;
-}
-
-.form-group {
-       margin-bottom:15px;
-       display:-webkit-flex; 
-       display: flex; 
-       align-items: center;
-}
-
-#tcaEditHolder{
-       background-color: #f5f5f5; 
-       padding:10px 10px; 
-       margin: 15px 15px 0 0; 
-       float: right;
-}
-
-
-#tcaEditHolder #properties_tab>div+div {
-  margin-top: 10px;
-}
-
-.tcaErr{
-       display:none; 
-       text-align:center; 
-       margin-bottom:20px; 
-       color:red;
-}
-
-.tcaParentItems {
-       padding-left: 20px;
-}
-
-.tcaParentItems label{
-       margin-bottom: 0px;
-}
-
-#tcaTable{
-       cursor: pointer;
-       width:100%;
-}
-
-#tcaTable tr{
-       border-bottom: 1px solid #ddd;
-       border-collapse: collapse;
-       text-align: center;
-       font-size: 12px;
-       font-weight: normal;
-}
-
-#tcaTable td{
-       padding: 8px 10px;
-}
-
-#tcaTable tr.highlight{
-       background-color: #f5f5f5;
-       font-weight: bold;
-       font-size: 13px;
-}
-
-#tcaTableHolder{
-       height:160px; 
-       width: 100%; 
-       overflow:auto;
-}
-
-</style>
-
-<div id="configure-widgets" class="disabled-block-container">
-       <div class="modal-header">
-               <button type="button" class="close" ng-click="close(false)"
-                       aria-hidden="true" style="margin-top: -3px">&times;</button>
-               <h4>TCA Micro Services</h4>
-       </div>
-       <div class="modal-body">
-               <div style="height: 10px"></div>
-               <div class="panel panel-default" id="panelHolder">
-                       
-                       <span id="formSpan" style="display:none;">
-                       <div class="panel-body">
-                       
-                               <form class="tcaParentItems">
-                                       <div class="row">
-                                               <div class="col-sm-8 form-group">
-                                                       <label class="col-sm-3"> Name </label>
-                                                       <div class="col-sm-9" style="padding:0px;">
-                                                               <input class="form-control" type="text" maxlength="48" id="tname" name="tname"></input>
-                                                       </div>
-                                               </div>
-                                               
-                                               <div class="col-sm-8 form-group" style="display:none;">
-                                                       <label class="col-sm-3"> UUID </label>
-                                                       <div class="col-sm-9" style="padding:0px;">
-                                                               <input class="form-control" onkeydown="return false;" type="text" id="tuuid" name="tuuid"></input>
-                                                       </div>
-                                               </div>
-                                       </div>
-                                       <div class="row">
-                                               <div class="col-sm-8 form-group">
-                                                       <label class="col-sm-3"> Policy </label>
-                                                       <div class="col-sm-9" style="padding:0px;">
-                                                               <select name="tcaPol" id="tcaPol" enableFilter="true"></select>
-                                                       </div>
-                                               </div>
-                                               <div class="col-sm-8 form-group">
-                                                       <label class="col-sm-3">EventName</label>
-                                                       <div class="col-sm-9" style="padding:0px;">
-                                                               <select name="eventName" id="eventName" enableFilter="true"></select>
-                                                       </div>
-                                               </div>
-                                               <div class="col-sm-8 form-group">
-                                                       <label class="col-sm-3">Control Loop Schema Type</label>
-                                                       <div class="col-sm-9" style="padding:0px;">
-                                                               <select name="controlLoopSchemaType" id="controlLoopSchemaType" enableFilter="true"></select>
-                                                       </div>
-                                               </div>
-                                               <div class="col-sm-8 form-group" style="display:none;">
-                                                       <label class="col-sm-3"> Policy ID </label>
-                                                       <div class="col-sm-9" style="padding:0px;">
-                                                               <input class="form-control" onkeydown="return false;" type="text" id="tcaPolId" name="tcaPolId"></input>
-                                                       </div>
-                                               </div>
-
-                                       </div>
-                               </form>
-
-                               <div class="tcaBody row">
-                                       <div class="col-sm-5" style="padding:0px 5px; margin: 15px;">
-                                               <div class="panel panel-default" id="tcaTableHolder">
-                                                       <table id="tcaTable">
-                                                       </table>
-                                               </div>
-                                               <div id="tcaError" class="tcaErr">Error: Please define/delete this new threshold</div>
-                                               <div id="tcaUnique" class="tcaErr">Error: Duplicate Set Name Found</div>
-                                               <div style="float:left">
-                                                       <button type="button" id="createNewThresh" class="btn btn-sm">New Threshold</button>
-                                               </div>
-                                               <div style="float:right">
-                                                       <button type="button" id="deleteThresh" class="btn btn-sm glyphicon glyphicon-trash" disabled></button>
-                                               </div>
-                                               
-                                       </div>
-                                       
-                                       <div id="tcaEditHolder" class="panel panel-default col-sm-6">
-                                               <div class="tab-content">
-                                                       <div id="properties_tab" class="form-vertical">
-                                                               <div>
-                                                                       <label class="control-label">Metric</label>
-                                                                       <div>
-                                                                               <select id="fieldPathM" name="fieldPathM"></select>
-                                                                       </div>
-                                                               </div>
-                                                               <div>
-                                                                       <label class="control-label">Operator</label>
-                                                                       <div>
-                                                                               <select id="operator" name="operator"></select>
-                                                                       </div>
-                                                               </div>
-                                                               <div>
-                                                                       <label class="control-label">Threshold</label>
-                                                                       <div>
-                                                                               <input type="text" maxlength="10" class="form-control" name="threshold" 
-                                                                               onkeypress="return isNumberKey(event)" id="threshold"></input>
-                                                                       </div>
-                                                               </div>
-                                                               <div>
-                                                                       <label class="control-label">Closed Loop Event Status</label>
-                                                                       <div>
-                                                                               <select id="closedLoopEventStatus" name="closedLoopEventStatus"></select>
-                                                                       </div>
-                                                               </div>
-                                                       </div>
-                                               </div>
-                                       </div>
-                               </div>
-                               
-                       </div>          
-                       </span>
-                               
-               </div>
-       </div>
-</div>
-
-       <div class="modal-footer">
-               <!--<button ng-click="reset()" class="btn btn-primary" style="float:left">Reset</button>-->
-               <button id="savePropsBtn" class="btn btn-primary">Close</button>
-               <button ng-click="close(true)" id="close_button"
-                       class="btn btn-primary">Cancel</button>
-       </div>
-       
-       <script language="javascript">
-    // helper that make jquery objects visibles or invisible
-    // to use instead of show to keep placeholder size correct
-    jQuery.fn.visible = function() {
-        return this.css('visibility', 'visible');
-    };
-    jQuery.fn.invisible = function() {
-        return this.css('visibility', 'hidden');
-    };
-
-               var generateTUUID = function(count){
-                       var d = new Date().getTime();
-                       var tuuid = 'xxxxxxxx-xxxx-txxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/g, function(c){
-                               var r = (d + Math.random()*16)%16 | 0;
-                               d = Math.floor(d/16);
-                               return (c == 'x' ? r : (r*0x3|0*8)).toString(16);
-                       });
-                       $("#formId" + count + " #tuuid").val(tuuid);
-               };
-
-
-    var propertiesToString = function(formIdNum) {
-      return $('#formId'+formIdNum+' #fieldPathM').find(':selected').text() + ' ' +
-                               $('#formId'+formIdNum+' #operator').val() + ' ' +
-                               $('#formId'+formIdNum+' #threshold').val() + ' ' +
-        $('#formId'+formIdNum+' #closedLoopEventStatus').val();
-    };
-
-               loadPropertyWindow("tca");
-
-               //load dropdown with policy options
-               if (typeof allPolicies !== "undefined"){
-               $.each(Object.keys(allPolicies), function(val, text) {
-                       $('#tcaPol').append($('<option></option>').val(text).html(text));
-               });
-               } else if (typeof elementMap !== "undefined"){
-                       for (key in elementMap){
-                               if (key.indexOf("Policy")>-1){
-                                       $.each(Object.keys(elementMap[key]), function(val, text){
-                                               $('#tcaPol').append(
-                                                       $('<option></option>').val(text).html(text)
-                                               );
-                                       });
-                               }
-                       }
-               }
-
-               var fieldPathMLabel2Value = function(label) {
-                       return Object.keys(defaults_props['tca']['fieldPathM']).find(key => defaults_props['tca']['fieldPathM'][key] == label)
-               }
-               var fieldPathMValue2Label = function(value) {
-                       return defaults_props['tca']['fieldPathM'][value];
-               }
-
-               setASDCFields();
-
-               var arr = elementMap[lastElementSelected];
-
-               if (arr !== undefined) {
-                       for (var x in arr){
-                               var num = add_one_more();
-                               for (var i=0; i< arr[x].length; i++){
-                                       
-                                       if (arr[x][i].hasOwnProperty('serviceConfigurations')){
-                                               for (var j=0; j<arr[x][i]["serviceConfigurations"].length; j++){
-                                                       $("#formId" + num + " #tcaTable").prepend("<tr><td>"
-                                                                       +fieldPathMValue2Label(arr[x][i]["serviceConfigurations"][j][0])+ " "
-                                                                       +(Object.keys(defaults_props['tca']['operator']).find(key => defaults_props['tca']['operator'][key] == (arr[x][i]["serviceConfigurations"][j][1])))+ " "
-                                                                       +arr[x][i]["serviceConfigurations"][j][2]+" "
-                                                                       +arr[x][i]["serviceConfigurations"][j][3]+" "
-                                                                       +arr[x][i]["serviceConfigurations"][j][4]+"</td></tr>");
-                                               }
-                                       } else {
-                                               $("#formId" + num + " #"+arr[x][i].name).val(arr[x][i].value);
-                                       }
-                               }
-                               $('#go_properties_tab'+num).text($('#formId' +num+ ' #tname').val());
-                               $("#formId"+num + " #properties_tab").invisible();
-                       }
-               } else {
-      var count = add_one_more();
-      generateTUUID(count);
-    }
-       
-               $("#savePropsBtn").click(function(event) {
-                       var num = 1
-                       if (($('#formId'+num+' #tcaTable .highlight').length > 0 ) &&
-                                       (!($('#formId'+num+' #threshold').val()) || !($('#formId'+num+' #fieldPathM').val())) ) {
-                               $('#formId'+num+' #tcaError').show();
-                               return;
-                       } else {
-                               $('#formId'+num+' .tcaErr').hide();
-                               if ($('#formId'+num+' #tcaTable .highlight').length > 0){
-                                       $('#formId'+num+' #tcaTable .highlight td').text(propertiesToString(num));
-                               }
-                               var saveP = {};
-                               $('.formId').each(function(){
-                                       var count = $(this).attr('id').slice(-1);
-                                       var header = $(this).find('.tcaParentItems').serializeArray();
-                                       var sconf = {};
-                                       var sconfa = [];
-                                       $('#formId' +count+' #tcaTable tr').each(function(){
-                                               $('td', this).each(function(){
-                                                       var splitTd = $(this).text().split(' ');
-              splitTd[0]=fieldPathMLabel2Value(splitTd[0]);
-                                                       splitTd[1]=defaults_props['tca']['operator'][splitTd[1]];
-                                                       sconfa.push(splitTd);
-                                               });
-                                               
-                                       });
-                                       var polSel = $(this).find('.tcaParentItems #tcaPol').val();
-                                       $.grep(header, function(e,i){
-                                               if (e.name == "tcaPolId"){
-                                                       if (polSel){
-                                                               if (typeof allPolicies !== "undefined"){
-                                                                       header[i]["value"] = allPolicies[polSel][1]["value"];
-                                                               } else if (typeof elementMap !== "undefined"){
-                                                                       for (key in elementMap){
-                                                                               if (key.indexOf("Policy")>-1){
-                                                                                       header[i]["value"] = elementMap[key][polSel][1]["value"];
-                                                                               }
-                                                                       }
-                                                               }
-                                                       } else {
-                                                               header[i]["value"]="";
-                                                       }
-                                               }
-                                       });
-                                       
-                                       sconf["serviceConfigurations"]=sconfa;
-                                       header.push(sconf);
-                                       saveP[$(this).find('.tcaParentItems #tname').val()] = header;
-                               });                     
-                               
-                               saveProperties(saveP);
-                               $("#close_button").click();
-                       }
-               })
-               
-               function uniquet(arr) {
-                   var a = [];
-                   for (var i=0, l=arr.length; i<l; i++){
-                       if (a.indexOf(arr[i]) === -1 && arr[i] !== ''){ 
-                                a.push(arr[i]);
-                       }
-                   }
-                   if (a.length==arr.length){
-                       return false;
-                   } else {
-                       return true;
-                   }
-               }
-               
-               function add_one_more(){
-                       $("#nav_Tabs li").removeClass("active");
-                       var form=$($("#formSpan").children()[0]).clone();
-                       var count=0;
-                       if($(".formId").length>0){
-                               var greatest=0;
-                               var s=$(".formId");
-                               for(var i=0;i<s.length; i++){
-                                       if(parseInt($(s[i]).attr("id").substring(6))>greatest){
-                                               greatest=parseInt($(s[i]).attr("id").substring(6))
-                                       }
-                               }
-                               count=greatest+1;
-                               $("#panelHolder").append(('<span class="formId" id="formId'+count+'"></span>'));
-                       }else{
-                               count++;
-                               $("#panelHolder").append('<span class="formId" id="formId1"></span>');
-                       }
-                       
-                       $("#add_one_more").parent().before(' <li class="active"><a id="go_properties_tab'+count+'">New_Set</a><button id="tab_close'+count+'" type="button" class="close tab-close-popup" aria-hidden="true" style="margin-top: -30px;margin-right: 5px">&times;</button></li>');
-                       $("#formId"+count).append(form);
-                       $('#formId'+count+ ' #properties_tab').invisible();
-                       $(".formId").not($("#formId"+count)).css("display","none");
-                       addCustListen(count);
-                       setMultiSelect();
-                       return count;
-               }
-               
-               function isNumberKey(event){
-                       var charCode = (event.which) ? event.which : event.keyCode
-                       if (charCode > 31 && (charCode < 48 || charCode > 57)){
-                               return false;
-                       }
-                       return true;
-               };
-               
-               function addCustListen(count) {                 
-                       $('#go_properties_tab' + count).click(function(event) {
-                               if ($("#nav_Tabs li.active").length>0){
-                                       var oldCount = $("#nav_Tabs li.active").find("a").attr("id").slice(-1);
-                                       if (($('#formId'+oldCount+' #tcaTable .highlight').length > 0 ) &&
-                                                       (!($('#formId'+oldCount+' #threshold').val()) || !($('#formId'+oldCount+' #fieldPathM').val())) ) {
-                                               $('#formId'+oldCount+' #tcaError').show();
-                                               return;
-                                       } else {
-                                               $('#formId'+oldCount+' .tcaErr').hide();
-                                               if ($('#formId'+oldCount+' #tcaTable .highlight').length > 0){
-                                                       $('#formId'+oldCount+' #tcaTable .highlight td').text(propertiesToString(oldCount));
-                                               }
-                                               $("#formId"+oldCount+" #tcaTable .highlight").removeClass("highlight")
-                                       }
-                               }
-                               
-                               $("#nav_Tabs li").removeClass("active");
-                               $(this).parent().addClass("active");
-                               $("#formId"+count).css("display","");
-                               $(".formId").not($("#formId"+count)).css("display","none");
-                       });
-                       
-                       $('#tab_close'+count).click(function(event){
-                               $(this).parent().remove();
-                               $("#formId"+count).remove();
-                       });
-                       
-                       $('#formId'+count+' #tcaTable').on('click', 'tr', function(event){
-                               if (($('#formId'+count+' #tcaTable .highlight').length > 0 ) &&
-                                               (!($('#formId'+count+' #threshold').val()) || !($('#formId'+count+' #fieldPathM').val())) ) {
-                                       $('#formId'+count+' #tcaError').show();
-                                       return;
-                               } else {
-                                       $('#formId'+count+' .tcaErr').hide();
-                                       if ($('#formId'+count+' #tcaTable .highlight').length > 0){
-                                               $('#formId'+count+' #tcaTable .highlight td').text(propertiesToString(num));
-                                       }
-                                       //$('#formId'+count+' #tcaTable .highlight').text();
-                                       $(this).addClass('highlight').siblings().removeClass('highlight');
-                                       var str = $(this).text().split(' ');
-                                       $('#formId'+count + ' #properties_tab').visible();
-                                       if (str.length == 5){
-                                               $('#formId'+count+' #fieldPathM').val(fieldPathMLabel2Value(str[0])).multiselect('refresh');
-                                               $('#formId'+count+' #operator').val(str[1]).multiselect('refresh');
-                                               $('#formId'+count+' #threshold').val(str[2]);
-            $('#formId'+count+' #closedLoopEventStatus').val(str[3]).multiselect('refresh');
-                                       }
-
-                                       if ((!(readMOnly)) && ($('#formId'+count + ' #deleteThresh').prop('disabled'))) {
-                                               $('#formId'+count + ' #deleteThresh').prop('disabled', false);
-                                       }
-                               }
-                       });
-
-                       $('#formId'+count+' #deleteThresh').on('click', function(){
-                               $('#formId'+num+' .tcaErr').hide();
-                               $('#formId'+count+ ' #properties_tab').invisible();
-                               $('#formId'+count+ ' #tcaTable .highlight').remove();
-                               $('#formId'+count+ ' #deleteThresh').prop('disabled', true);
-                       });
-                       
-                       $('#formId'+count+' #createNewThresh').on('click', function(){
-                               if (($('#formId'+count+' #tcaTable .highlight').length > 0 ) &&
-                                               (!($('#formId'+count+' #threshold').val()) || !($('#formId'+count+' #fieldPathM').val())) ){
-                                       $('#formId'+count+' #tcaError').show();
-                                       return;
-                               } else {
-                                       $('#formId'+count+' .tcaErr').hide();
-                                       if ($('#formId'+count+' #tcaTable .highlight').length > 0){
-                                               $('#formId'+count+' #tcaTable .highlight td').text(propertiesToString(count));
-                                       }
-                                       $('#formId'+count+ ' #properties_tab').visible();
-                                       if (('#formId'+count+' #tcaTable .highlight').length > 0 ){
-                                               $('#formId'+count+' #tcaTable tr.highlight').removeClass('highlight');
-                                       }
-                                       $('#formId'+count+' #tcaTable').prepend('<tr class="highlight"><td>New Threshold</td></tr>');
-                                       $('#formId'+count+' #fieldPathM').prop("selectedIndex", 0).multiselect('refresh');
-                                       $('#formId'+count+' #operator').prop("selectedIndex", 0).multiselect('refresh');
-                                       $('#formId'+count+' #threshold').val("");
-                                       $('#formId'+count+' #closedLoopEventStatus').prop("selectedIndex", 0).multiselect('refresh');
-
-                                       if ($('#formId'+count + ' #deleteThresh').prop('disabled')) {
-                                               $('#formId'+count + ' #deleteThresh').prop('disabled', false);
-                                       }
-                               }
-                       });
-
-                       $('#formId'+count+' #tname').on('change',function(){
-                               $('#go_properties_tab'+count).text($('#formId'+count+' #tname').val())
-                       });
-               }
-       </script>
-</div>
diff --git a/src/main/resources/META-INF/resources/designer/partials/portfolios/vesCollector_properties.html b/src/main/resources/META-INF/resources/designer/partials/portfolios/vesCollector_properties.html
deleted file mode 100644 (file)
index 97263d8..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-<!--
-  ============LICENSE_START=======================================================
-  ONAP CLAMP
-  ================================================================================
-  Copyright (C) 2017 AT&T Intellectual Property. All rights
-                              reserved.
-  ================================================================================
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-
-  http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
-  ============LICENSE_END============================================
-  ===================================================================
-  -->
-<style>
-</style>
-
-<div attribute-test="vescollectorproperties" id="configure-widgets"  >
-      <div attribute-test="cldsopentemplateh" class="modal-header">
-        <button type="button" class="close" ng-click="close(false)" aria-hidden="true" style="margin-top: -3px">&times;</button>
-        <h4>VES Collector</h4>
-      </div>
-
-      <div attribute-test="cldsopentemplateb" class="modal-body" style="height: 280px">
-        No parameter can be configured.
-      </div>
-
-      <div class="modal-footer">
-        <button ng-click="close(true)" id="close_button" class="btn btn-primary">Close</button>
-      </div>
-</div>
index 0e44aec..62ab5ab 100644 (file)
@@ -30,10 +30,9 @@ app
     '$rootScope',
     function(alertService, $http, $q, $rootScope) {
 
-           function checkIfElementType(name, isSimple) {
+           function checkIfElementType(name) {
 
         //This will open the methods located in the app.js
-                 if (isSimple){
                          if (undefined == name) {
                                  return;
                          }else if (name.toLowerCase().indexOf("policy") >= 0){
@@ -42,21 +41,6 @@ app
                                  $rootScope.selectedBoxName = name.toLowerCase();
                                  ToscaModelWindow();
                          }
-                 } else {
-                         if (undefined == name) {
-                                 return;
-                         }
-                       mapping = {
-                               'tca' : TCAWindow,
-                               'policy' : PolicyWindow,
-                               'vescollector' : VesCollectorWindow,
-                               'holmes' : HolmesWindow,
-                           };
-                           key = name.split('_')[0].toLowerCase()
-                           if (key in mapping) {
-                                   mapping[key]();
-                           }
-                 };
            }
            function handleQueryToBackend(def, svcAction, svcUrl, svcPayload) {
 
@@ -226,7 +210,7 @@ app
                            document.getElementById(menuText).classList.add('ThisLink');
                    }
            };
-           this.processActionResponse = function(modelName, pars, simple) {
+           this.processActionResponse = function(modelName, pars) {
 
                    // populate control name (prefix and uuid here)
                    var controlNamePrefix = pars.controlNamePrefix;
@@ -244,7 +228,7 @@ app
                    document.getElementById("modeler_name").textContent = headerText;
                    document.getElementById("templa_name").textContent = ("Template Used - " + selected_template);
                    setStatus(pars)
-                   disableBPMNAddSVG(pars, simple);
+                   disableBPMNAddSVG(pars);
                    this.enableDisableMenuOptions(pars);
            };
            this.processRefresh = function(pars) {
@@ -293,7 +277,7 @@ app
                    '<span id="status_clds" style="position: absolute;  left: 61%;top: 151px; font-size:20px;">Status: '
                    + statusMsg + '</span>');
            }
-           function disableBPMNAddSVG(pars, simple) {
+           function disableBPMNAddSVG(pars) {
 
                    var svg = pars.imageText.substring(pars.imageText.indexOf("<svg"))
                    if ($("#svgContainer").length > 0)
@@ -314,7 +298,7 @@ app
                            var name = $($(event.target).parent()).attr("data-element-id")
                            lastElementSelected = $($(event.target).parent()).attr(
                            "data-element-id")
-                           checkIfElementType(name, simple)
+                           checkIfElementType(name)
                    });
            }
            this.enableDisableMenuOptions = function(pars) {
index 2b7c625..111bb24 100644 (file)
@@ -163,10 +163,8 @@ function($scope, $rootScope, $modalInstance, $window, $uibModalInstance, cldsMod
                        } else {
                                elementMap = JSON.parse(propText);
                        }
-                       var simple = elementMap.simpleModel;
-                       $rootScope.isSimpleModel = simple;
                        selected_model = modelName;
-                       cldsModelService.processActionResponse(modelName, pars, simple);
+                       cldsModelService.processActionResponse(modelName, pars);
                        // set model bpmn and open diagram
                        $rootScope.isPalette = true;
                }, function(data) {
index 21572a5..2916f39 100644 (file)
@@ -104,17 +104,6 @@ function($scope, $rootScope, $uibModalInstance, cldsModelService, $location,
     
     $scope.submitForm = function() {
         saveGlobalProperties(noRepeats($("#saveProps").serializeArray()))
-        //module reset, based on property updates
-        if (elementMap["global"]) {
-               $.each(Object.keys(elementMap), function(i, v) {
-                       if ((v.match(/^Policy/)) && asDiff) {
-                               elementMap[v] = {};
-                       }
-                       if ((v.match(/^TCA/)) && (vfDiff || serDiff)) {
-                               elementMap[v] = {};
-                       }
-               });
-        }
         $uibModalInstance.close();
     }
   
index f43161e..f78ad1e 100644 (file)
@@ -28,9 +28,8 @@ app.controller('ToscaModelCtrl',
                if (selectedPolicy && selectedPolicy != '') {
                        toscaModelService.getHpModelJsonByPolicyType(selectedPolicy).then(function(response) {
                                $('#editor').empty();
-                               // get the list of available policies
-                               $scope.getPolicyList();
-                               var toscaModel = JSON.parse(response.body.toscaModelJson);
+
+                               var toscaModel = JSON.parse(response.toscaModelJson);
                                if($scope.policyList && toscaModel.schema.properties && toscaModel.schema.properties.policyList){
                                        toscaModel.schema.properties.policyList.enum = $scope.policyList;
                                }
@@ -59,24 +58,6 @@ app.controller('ToscaModelCtrl',
                        }
         }
 
-        $scope.getPolicyList = function(){
-                       var policyNameList = [];
-                       if (typeof elementMap !== 'undefined'){
-                               for (key in elementMap){
-                                       if (key.indexOf('Policy')>-1){
-                                               angular.forEach(Object.keys(elementMap[key]), function(text, val){
-                                                       for (policyKey in elementMap[key][text]){
-                                                               if(elementMap[key][text][policyKey].name == 'pname'){
-                                                                       policyNameList.push(elementMap[key][text][policyKey].value);
-                                                               }
-                                                       }
-                                               });
-                                       }
-                               }
-                       };
-                       $scope.policyList = policyNameList;
-               }
-
         if($rootScope.selectedBoxName) {
                var policyType = $rootScope.selectedBoxName.split('_')[0].toLowerCase();
                $scope.toscaModelName = policyType.toUpperCase() + " Microservice";
index 11ad5fa..2da505c 100644 (file)
@@ -151,7 +151,7 @@ function loadSharedPropertyByServiceProperties(callBack) {
     dataType: "json",
     url: '/restservices/clds/v1/clds/properties/',
     success: function(data) {
-      vf_Services = JSON.parse(data);
+
       setASDCFields();
       if (callBack && _.isFunction(callBack)) {
         callBack(true);
@@ -206,7 +206,7 @@ function setASDCFields() {
 //Typically used when opening a new model/template
 function reloadDefaultVariables(isTemp) {
   isTemplate = isTemp;
-  vf_Services = null;
+
 }
 
 $(window).on('load',function() {
index 5447568..100dda3 100644 (file)
@@ -709,56 +709,6 @@ function($scope, $rootScope, $timeout, dialogs) {
 
                    });
            }
-           $scope.VesCollectorWindow = function(vesCollector) {
-
-                   var dlg = dialogs.create(
-                   'partials/portfolios/vesCollector_properties.html',
-                   'ImportSchemaCtrl', {
-                       closable : true,
-                       draggable : true
-                   }, {
-                       size : 'lg',
-                       keyboard : true,
-                       backdrop : 'static',
-                       windowClass : 'my-class'
-                   });
-                   dlg.result.then(function(name) {
-
-                   }, function() {
-
-                   });
-           };
-           $scope.HolmesWindow = function(holmes) {
-
-                   var partial = 'partials/portfolios/holmes_properties.html'
-                   var dlg = dialogs.create(partial, 'ImportSchemaCtrl', holmes, {
-                       closable : true,
-                       draggable : true
-                   }, {
-                       size : 'lg',
-                       keyboard : true,
-                       backdrop : 'static',
-                       windowClass : 'my-class'
-                   });
-           };
-           $scope.TCAWindow = function(tca) {
-
-                   var dlg = dialogs.create('partials/portfolios/tca_properties.html',
-                   'ImportSchemaCtrl', {
-                       closable : true,
-                       draggable : true
-                   }, {
-                       size : 'lg',
-                       keyboard : true,
-                       backdrop : 'static',
-                       windowClass : 'my-class'
-                   });
-                   dlg.result.then(function(name) {
-
-                   }, function() {
-
-                   });
-           };
            $scope.ToscaModelWindow = function (tosca_model) {
 
                var dlg = dialogs.create('partials/portfolios/tosca_model_properties.html','ToscaModelCtrl',{closable:true,draggable:true},{size:'lg',keyboard: true,backdrop: 'static',windowClass: 'my-class'});
@@ -872,24 +822,10 @@ function importshema() {
 
        angular.element(document.getElementById('navbar')).scope().importSchema();
 }
-function VesCollectorWindow(vesCollectorWin) {
-
-       angular.element(document.getElementById('navbar')).scope()
-       .VesCollectorWindow(vesCollectorWin);
-}
-function HolmesWindow(holmesWin) {
-
-       angular.element(document.getElementById('navbar')).scope().HolmesWindow(
-       holmesWin);
-}
 function F5Window() {
 
        angular.element(document.getElementById('navbar')).scope().F5Window();
 }
-function TCAWindow(tca) {
-
-       angular.element(document.getElementById('navbar')).scope().TCAWindow(tca);
-}
 function GOCWindow() {
 
        angular.element(document.getElementById('navbar')).scope().GOCWindow();
index e4c4f4c..7abffd3 100644 (file)
                                uri="bean:org.onap.clamp.clds.service.CldsToscaService?method=parseToscaModelAndSave(${header.toscaModelName},${body})" />
                </put>
                <get uri="/tosca/models/policyType/{policyType}"
+               outType="org.onap.clamp.clds.model.CldsToscaModel"
                        produces="application/json">
                        <to
                                uri="bean:org.onap.clamp.clds.service.CldsToscaService?method=getToscaModelsByPolicyType(${header.policyType})" />
index d4c7e5c..7d48086 100644 (file)
@@ -120,16 +120,14 @@ public class CldsToscaServiceItCase {
 
     @Test
     public void testGetToscaModel() throws Exception {
-        ResponseEntity<CldsToscaModel> responseEntity = cldsToscaService.getToscaModel("tca-policy-test");
-        CldsToscaModel savedModel = responseEntity.getBody();
+        CldsToscaModel savedModel = cldsToscaService.getToscaModel("tca-policy-test");
         assertNotNull(savedModel);
         assertEquals("tca-policy-test", savedModel.getToscaModelName());
     }
 
     @Test
     public void testGetToscaModelsByPolicyType() throws Exception {
-        ResponseEntity<CldsToscaModel> responseEntity = cldsToscaService.getToscaModelsByPolicyType("tca");
-        CldsToscaModel savedModel = responseEntity.getBody();
+        CldsToscaModel savedModel = cldsToscaService.getToscaModelsByPolicyType("tca");
         assertNotNull(savedModel);
         assertEquals("tca-policy-test", savedModel.getToscaModelName());
         assertEquals("tca", savedModel.getPolicyType());