NonRT-RIC A1 Northbound API
[nonrtric.git] / sdnc-a1-controller / oam / admportal / views / gamma / listSite.ejs
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4   <meta charset="UTF-8" />
5   <meta http-equiv="X-UA-Compatible" content="IE=edge">
6   <% include ../partials/head %>
7   <% include ../partials/header %>
8   <script type="text/javascript" src="/javascripts/admportal.js" async></script>
9   <title>SDN-C AdminPortal</title>
10 <script class="init">
11     $(document).ready(function() {
12     $('#site').DataTable( {
13         "order": [[ 0, "asc" ]]
14     } );
15 } );
16 </script>
17
18 </head>
19 <body>
20
21 <div class="well well-sm">
22     <h3>AIC Site</h3>
23 </div>
24 <!--
25 <div class="actions" style="padding:0px 25px;">
26 <h2>AIC SITE</h2>
27 </div>
28 -->
29
30 <% if ( typeof result != 'undefined' ) {
31                 if (result.code.length > 0) { 
32                         if ( result.code == 'success' ) { %>
33                                 <div class='alert alert-success' role='alert'>
34                                 <%
35                                 for ( x in result.msg ){ %>
36                                         <div><%= result.msg[x] %></div>
37                                 <% } %>
38                                 </div>
39                         <% } else { %> 
40                                 <div class='alert alert-danger' role='danger'>
41                                 <%
42                                 for ( x in result.msg ){ %>
43                                         <div><%= result.msg[x] %></div>
44                                 <% } %>
45                                 </div>
46                         <% } %>
47                 <% } %>
48 <% } %>
49
50 <% if( typeof privilege != 'undefined'){
51     var priv = privilege.privilege;
52 } else {
53     var priv = 'A';
54 } %>
55
56 <div class="container-fluid">
57         <table id="site" class="table table-hover table-condensed">
58       <thead>
59         <tr>
60                   <th>Name</th>
61           <th>AIC Site ID</th>
62           <th>VCenter URL</th>
63                   <th>OAM Gateway Address</th>
64           <th>VCenter User</th>
65           <th>VCenter Passwd</th>
66           <th>City</th>
67           <th>State</th>
68           <th>Status</th>
69                   <% if(priv == 'A') { %>
70                   <th>Action</th>
71                   <% } %>
72         </tr>
73       </thead>
74       <tbody>
75       <% rows.forEach( function(row) { %> 
76         <tr>
77             <td><%= row.name %></td>
78             <td><%= row.aic_site_id %></td>
79             <td><%= row.vcenter_url %></td>
80                         <td><%= row.oam_gateway_addr %></td>
81             <td><%= row.vcenter_username %></td>
82                         <td>*****</td>
83             <td><%= row.city %></td>
84             <td><%= row.state %></td>
85             <td><%= row.operational_status %></td>
86                         <% if(priv == 'A') { %>
87                         <td>
88                                 <button type="button" class="btn btn-default btn-xs"
89                                         onclick="updateAicSite('<%= row.name %>','<%=row.aic_site_id %>',
90                                         '<%= row.vcenter_url %>','<%= JSON.stringify(row.vcenter_username).replace(/\"/g,'') %>',
91                                         '<%= row.vcenter_passwd %>', '<%= row.city %>','<%= row.state %>',
92                                         '<%= row.operational_status %>', '<%= row.oam_gateway_addr %>');">Update</button>
93                                 <button type="button" class="btn btn-default btn-xs"
94                                         onclick="deleteSite('<%=row.aic_site_id %>');">Delete</button>
95                         </td>
96                         <% } %>
97         </tr>
98     <% }); %>
99       </tbody>
100     </table>
101
102 <!--
103         <% if(priv == 'A') { %>
104         <div class="actions" style="padding:0px 25px;">
105         <form method="POST" action="/gamma/uploadAicSite" enctype="multipart/form-data">
106                 <div class="form-group">
107                 <label for="dest">File input</label>
108                 <input name="filename" type="file" id="dest">
109                 <p class="help-block">Choose a file to upload.</p>
110                 </div>
111                 <% if(priv == 'A') { %>
112             <button type="button" class="btn btn-default"
113                 onclick="uploadFile(this.form);">Upload File</button>
114         <% } else { %>
115             <button type="button" class="btn btn-default disabled"
116                 onclick="uploadFile(this.form);">Upload File</button>
117         <% } %>
118         </form>
119         </div>
120         <% } %>
121 -->
122 </div>
123
124 <% include ../partials/update_aic_site %>
125 <footer>
126     <% include ../partials/footer %>
127 </footer>
128
129 <script type="text/javascript">
130 function updateAicSite(name,aic_site_id,vcenter_url,vcenter_username,vcenter_passwd,city,state,operational_status,oam_gateway_addr) 
131 {
132     document.getElementById('uf_name').value=name
133     document.getElementById('uf_aic_site_id').value=aic_site_id;
134     document.getElementById('uf_vcenter_url').value=vcenter_url;
135     document.getElementById('uf_vcenter_username').value=vcenter_username;
136     document.getElementById('uf_vcenter_passwd').value=vcenter_passwd;
137     document.getElementById('uf_city').value=city;
138     document.getElementById('uf_state').value=state;
139     document.getElementById('uf_operational_status').value=operational_status;
140     document.getElementById('uf_oam_gateway_addr').value=oam_gateway_addr;
141
142     document.getElementById('uf_key_aic_site_id').value=aic_site_id;
143     $('#update_aic_site_modal').modal('show');
144 }
145
146 function deleteSite(siteId) {
147
148     bootbox.confirm({
149         message: "Their may be SERVICE_HOMING entry pointing to this site.  Are you sure you want to delete site [" + siteId + "] ?",
150         callback: function(result) {
151             if ( result )
152             {
153                 location.assign("/gamma/deleteSite?siteid=" + siteId);
154             }
155             return;
156         },
157         buttons: {
158             cancel: {
159                 label: "Cancel"
160             },
161             confirm: {
162                 label: "Yes"
163             }
164         }
165     });
166 }
167 </script>
168
169 </body>
170 </html>
171