[CLAMP-1] Initial ONAP CLAMP seed code commit
[clamp.git] / src / main / resources / META-INF / resources / designer / partials / portfolios / global_properties.html
1 <!--
2   ============LICENSE_START=======================================================
3   ONAP CLAMP
4   ================================================================================
5   Copyright (C) 2017 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   ECOMP is a trademark and service mark of AT&T Intellectual Property.
22   -->
23
24 <style>
25 .fileUpload {
26         position: relative;
27         overflow: hidden;
28         margin: 10px;
29 }
30
31 .fileUpload input.upload {
32         position: absolute;
33         top: 0;
34         right: 0;
35         margin: 0;
36         padding: 0;
37         font-size: 20px;
38         cursor: pointer;
39         opacity: 0;
40         filter: alpha(opacity = 0);
41         float: left;
42 }
43
44 .fileDisplay {
45         display: inline-block;
46         overflow: hidden;
47         float: right;
48         margin-left: 0px;
49         z-index: initial;
50         text-align: center;
51         margin-top: 17px;
52 }
53  #paramsWarn {
54       display: none;
55 }
56 </style>
57 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
58 <script type="text/javascript">
59         function disablefile() {
60
61                 document.getElementById("fileUpload").disabled = true;
62
63         }
64
65         function disableSVN() {
66
67                 document.getElementById("schemaLocation").disabled = true;
68                 document.getElementById("userID").disabled = true;
69                 document.getElementById("password").disabled = true;
70
71         }
72
73 </script>
74
75
76 <div id="configure-widgets">
77         <div class="modal-header">
78                 <button type="button" class="close" ng-click="close(false)"
79                         aria-hidden="true" style="margin-top: -3px">&times;</button>
80                 <h4>Model Properties</h4>
81         </div>
82         <div class="modal-body" style="height: 280px">
83                 <div style="height: 10px"></div>
84                 <form id="saveProps" >
85                                 <div class="alert alert-danger" role="alert" id='paramsWarn'> 
86                                                         <strong>Ooops!</strong> Unable to load properties for <span id='servName'>. Would you like to</span>
87                                                         <a href="javascript:void(0);" class="btn-link"  id='paramsRetry'>Retry </a> /
88                                                         <a href="javascript:void(0);" class="btn-link" id='paramsCancel'>Cancel</a>
89                                                 </div>
90                                                 <div>                                   
91                                         
92                                         <div class="form-group clearfix">
93                                                 <label for="services" class="col-sm-4 control-label" >Services</label>
94         
95                                                 <div class="col-sm-8">
96                                                         <select  class="form-control" 
97                                                                 name="service" id="service" >
98 <!--                                                             <option ng-repeat="(key, value) in services" value="{{key}}">{{value}}</option>  -->
99                                                         </select>
100                                                 </div>
101                                         </div>
102                                         <div class="form-group">
103                                                 <label for="vf" class="col-sm-4 control-label">
104                                                         Resource-VF</label>
105
106                                                 <div class="col-sm-8">
107                                                         <select class="form-control" id="vf" name="vf" >
108
109                                                         </select>
110
111                                                 </div>
112                                         </div>
113                                         <div class="form-group">
114                                                 <label for="location" class="col-sm-4 control-label">
115                                                         Location</label>
116
117                                                 <div class="col-sm-8">
118                                                         <select class="form-control" id="location" name="location" multiple size=2>
119
120                                                         </select>
121
122                                                 </div>
123                                         </div>
124                                 </div>
125
126                 </form>
127         <i hidden id="ridinSpinners" class="fa fa-spinner fa-spin" style="display:none;width:100%;text-align:center;font-size:24px;color:black;"></i>
128
129         </div>
130         <div class="modal-footer">
131                 <!--<button ng-click="reset()" class="btn btn-primary" style="float:left">Reset</button>-->
132                 <button id="savePropsBtn" class="btn btn-primary">Close</button>
133                 <button ng-click="close(true)" id="close_button"
134                         class="btn btn-primary">Cancel</button>
135
136         </div>
137   <!-- <select id="vUSP_vfc" disabled hidden></select>
138         <select id="vUSP_location" disabled hidden></select>
139         <select id="vUSP_recipe" disabled hidden></select>
140         <select id="vUSP_vf" disabled hidden></select>
141         
142         <select id="Trinity_vfc" disabled hidden></select>
143         <select id="Trinity_location" disabled hidden></select>
144         <select id="Trinity_recipe" disabled hidden></select>
145         <select id="Trinity_vf" disabled hidden></select>
146         
147         
148         <select id="vSCP_vfc" disabled hidden></select>
149         <select id="vSCP_location" disabled hidden></select>
150         <select id="vSCP_recipe" disabled hidden></select>
151         <select id="vSCP_vf" disabled hidden></select>
152         
153         <select id="vProbes_vfc" disabled hidden></select>
154         <select id="vProbes_location" disabled hidden></select>
155         <select id="vProbes_recipe" disabled hidden></select>   
156         <select id="vProbes_vf" disabled hidden></select>       -->
157         
158
159         <script> 
160 //              $.ajax({
161 //                      async:false,
162 //                  dataType: "json",
163 //                  url: '/restservices/clds/v1/jaxrsClds/clds/asdc/services/',
164 //                  success: function(data){
165 //                      vf_Services=data;
166 //                  },
167 //                  error:function(s,a,err){
168 //                      console.log(err)
169 //                      console.log(s)
170 //                      console.log(a)
171 //                  },
172 //                  timeout:100000
173 //              });
174 //              var services=vf_Services.service
175 //              console.log(elementMap["global"])
176 //              for(k in services){
177 //                      console.log("lol")
178 //                      $("#service").append("<option value="+k+">"+services[k]+"</option>")
179 //              }
180 //              loadSharedPropertyByService()
181 //              var el = elementMap["global"];
182 //              $("#status").val($("#activity_modeler").text())
183 //              if (el !== undefined) {
184 //                      for (var i = 0; i < el.length; i++) {
185 //                              $("#" + el[i].name).val(el[i].value);
186 //                      }
187 //              }   
188
189
190       
191
192          (function () {
193                         
194                     var previous;
195                     $("#paramsWarn").hide();
196                     /*Below service method is called for checking the service is being loaded or not*/
197                         loadSharedPropertyByService();
198
199                     $("#service").on('focus', function () {
200                         // Store the current value on focus and on change
201                         previous = this.value;
202                         
203                     }).change(function(){
204                                 $("#ridinSpinners").css("display","")
205                                 var bool=loadSharedPropertyByService($(this).val())
206                                 $("#ridinSpinners").css("display","none")
207                                 if(!bool)
208                                         $(this).val(previous)
209                     });
210                         $("#paramsRetry").on('click', function () {
211                                 //$("#paramsWarn").hide();
212                                 var currentValue = $("#service").val() == null ? previous : $("#service").val();
213                                 $("#ridinSpinners").css("display","")
214                                 var bool=loadSharedPropertyByService(currentValue);
215                                 $("#ridinSpinners").css("display","none")
216                         });
217                         $("#paramsCancel").on('click', function () {
218                                 loadSharedPropertyByServiceProperties();
219                                 $("#paramsWarn").hide();
220                                 
221                         });
222                 })();
223 //              $("#service").on("change",function(){
224 //                      $("#ridinSpinners").css("display","")
225 //                      loadSharedPropertyByService($(this).val())
226 //                      $("#ridinSpinners").css("display","none")
227 //              })
228                 function noRepeats(form){
229                         var select={};
230                         for(var i=0;i<form.length;i++){
231                                 if(form[i].hasOwnProperty("name")){
232                                                 if(select[form[i].name]===undefined)
233                                                         select[form[i].name]=[]
234                                                 select[form[i].name].push(form[i].value);
235                                         }
236                         }
237                         var arr=[]
238                         for(s in select){
239                                 var f={}
240                                 f.name=s
241                                 f.value=select[s]
242                                 arr.push(f)
243                         }
244                         return arr
245                 }
246                 
247                 $("#saveProps").on('submit', function(event) {
248                         saveGlobalProperties(noRepeats($(this).serializeArray()))
249                         event.preventDefault();
250                         
251                         $("#close_button").click();
252
253                 })
254                 $("#savePropsBtn").click(function(event) {
255                         //alert($("#CProp_Target").val())
256                         $("#saveProps").submit();
257                 })
258
259
260         </script>
261 </div>
262