Rework UI
[clamp.git] / src / main / resources / META-INF / resources / designer / scripts / propertyController.js
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2019 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  * ===================================================================
21  * 
22  */
23
24 function saveMsProperties(type, form) {
25          var newMsProperties = cl_props["microServicePolicies"];
26     for (p in newMsProperties) {
27         if (newMsProperties[p]["name"] == type) {
28                 newMsProperties[p]["properties"] = form;
29         }
30     }
31 }
32
33 function updateGlobalProperties(form) {
34     cl_props["globalPropertiesJson"] = form;
35 }
36
37 function updateOpPolicyProperties(form) {       
38    cl_props["operationalPolicies"] = newOpProperties;
39 }
40
41 function getLoopName() {
42     return cl_props["name"];
43 }
44
45 function getOperationalPolicyProperty() {
46     return cl_props["operationalPolicies"]["0"]["configurationsJson"];
47 }
48
49 function getOperationalPolicies() {
50     return cl_props["operationalPolicies"];
51 }
52
53 function getGlobalProperty() {
54     return cl_props["globalPropertiesJson"];
55 }
56
57 function getMsJson(type) {
58     var msProperties = cl_props["microServicePolicies"];
59     for (p in msProperties) {
60         if (msProperties[p]["name"] == type) {
61            return msProperties[p];
62         }
63     }
64     return null;
65 }
66
67 function getMsProperty(type) {
68     var msProperties = cl_props["microServicePolicies"];
69     for (p in msProperties) {
70         if (msProperties[p]["name"] == type) {
71            return msProperties[p]["properties"];
72         }
73     }
74     return null;
75 }
76
77 function getMsUI(type) {
78     var msProperties = cl_props["microServicePolicies"];
79     for (p in msProperties) {
80         if (msProperties[p]["name"] == type) {
81            return msProperties[p]["jsonRepresentation"];
82         }
83     }
84     return null;
85 }
86
87 function getStatus() {
88     return cl_props["lastComputedState"];
89 }
90
91 function getDeploymentID() {
92     return cl_props["dcaeDeploymentId"];
93 }
94
95 function getDeploymentStatusURL() {
96     return cl_props["dcaeDeploymentStatusUrl"];
97 }
98 module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getStatus,getDeploymentID,getDeploymentStatusURL };