7f6e9e195a22f70a0e7c1130e6760dbb9edf6c76
[clamp.git] / src / main / resources / META-INF / resources / designer / partials / portfolios / refresh_asdc.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   
22   -->
23
24 <style>
25 .fileUpload {
26         position: relative;
27         overflow: hidden;
28         margin: 10px;
29 }
30 #paramsWarnrefresh {
31     display: none;
32 }
33
34 .fileUpload input.upload {
35         position: absolute;
36         top: 0;
37         right: 0;
38         margin: 0;
39         padding: 0;
40         font-size: 20px;
41         cursor: pointer;
42         opacity: 0;
43         filter: alpha(opacity = 0);
44         float: left;
45 }
46
47 .fileDisplay {
48         display: inline-block;
49         overflow: hidden;
50         float: right;
51         margin-left: 0px;
52         z-index: initial;
53         text-align: center;
54         margin-top: 17px;
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 </script>
73
74
75 <div attribute-test="refreshasdc" id="configure-widgets">
76         <div attribute-test="refreshasdch" class="modal-header">
77                 <button type="button" class="close" ng-click="close(false)"
78                         aria-hidden="true" style="margin-top: -3px">&times;</button>
79                 <h4>Model Properties</h4>
80         </div>
81         <div class="modal-body" style="height: 280px">
82                 <div style="height: 10px"></div>
83                 <div class="alert alert-danger refreshASDC" role="alert" id='paramsWarnrefresh'> 
84                                                         <strong>Ooops!</strong> Unable to load properties for <span id='servName'>. Would you like to</span>
85                                                         <a href="javascript:void(0);" ng-click="paramsRetry();" class="btn-link"  id='paramsRetry'>Retry </a> /
86                                                         <a href="javascript:void(0);" ng-click="paramsCancel();" class="btn-link" id='paramsCancel'>Cancel</a>
87                                                 </div>
88                 <form id="saveProps" >
89                                 <div>                           
90                                         
91                                         <div class="form-group">
92                                                 <label for="services" class="col-sm-4 control-label" >Refresh ASDC services?</label>
93         
94                         
95                                         </div>
96                                         
97                                 </div>
98
99                 </form>
100         <i hidden id="ridinSpinners" class="fa fa-spinner fa-spin" style="display:none;width:100%;text-align:center;font-size:24px;color:black;"></i>
101
102         </div>
103         <div attribute-test="refreshasdcf" class="modal-footer">
104                 <!--<button ng-click="reset()" class="btn btn-primary" style="float:left">Reset</button>-->
105                 <button ng-click="refreshASDC()" class="btn btn-primary">refresh</button>
106                 <button ng-click="close(true)" id="close_button"
107                         class="btn btn-primary">Cancel</button>
108
109         </div>  
110         <script>
111 //              $.ajax({
112 //                      async:false,
113 //                  dataType: "json",
114 //                  url: '/restservices/clds/v1/clds/asdc/services/',
115 //                  success: function(data){
116 //                      vf_Services=data;
117 //                  },
118 //                  error:function(s,a,err){
119 //                      console.log(err)
120 //                      console.log(s)
121 //                      console.log(a)
122 //                  },
123 //                  timeout:100000
124 //              });
125 //              var services=vf_Services.service
126 //              console.log(elementMap["global"])
127 //              for(k in services){
128 //                      console.log("lol")
129 //                      $("#service").append("<option value="+k+">"+services[k]+"</option>")
130 //              }
131 //              loadSharedPropertyByService()
132 //              var el = elementMap["global"];
133 //              $("#status").val($("#activity_modeler").text())
134 //              if (el !== undefined) {
135 //                      for (var i = 0; i < el.length; i++) {
136 //                              $("#" + el[i].name).val(el[i].value);
137 //                      }
138 //              }
139                 var previous;
140                 (function () {      
141                 
142                     $("#service").on('focus', function () {
143                         // Store the current value on focus and on change
144                         previous = this.value;
145                         console.log("hello")
146                     }).change(function(){
147                                 $("#ridinSpinners").css("display","")
148                                 var bool=loadSharedPropertyByService($(this).val())
149                                 $("#ridinSpinners").css("display","none")
150                                 if(!bool)
151                                         $(this).val(previous)
152                         });
153
154                 })();
155 //              $("#service").on("change",function(){
156 //                      $("#ridinSpinners").css("display","")
157 //                      loadSharedPropertyByService($(this).val())
158 //                      $("#ridinSpinners").css("display","none")
159 //              })
160                 function noRepeats(form){
161                         var select={};
162                         for(var i=0;i<form.length;i++){
163                                 if(select[form[i].name]===undefined)
164                                         select[form[i].name]=[]
165                                 select[form[i].name].push(form[i].value);
166                         }
167                         var arr=[]
168                         for(s in select){
169                                 var f={}
170                                 f.name=s
171                                 f.value=select[s]
172                                 arr.push(f)
173                         }
174                         return arr
175                 }
176                 
177                 $("#saveProps").on('submit', function(event) {
178                         saveGlobalProperties(noRepeats($(this).serializeArray()))
179                         event.preventDefault();
180                         
181                         $("#close_button").click();
182
183                 })
184                 $("#savePropsBtn").click(function(event) {
185                         //alert($("#CProp_Target").val())
186                         $("#saveProps").submit();
187                 })
188         </script>
189 </div>
190