Initial commit for OpenECOMP SDN-C OA&M
[sdnc/oam.git] / admportal / views / gamma / listVpePool.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
11 <script class="init">
12     $(document).ready(function() {
13     $('#vpe_pool').DataTable( {
14         "order": [[ 0, "asc" ]]
15     } );
16 } );
17 </script>
18
19 </head>
20 <body>
21
22 <div class="well well-sm">
23 <h3>VPE Pool</h3>
24 </div>
25
26 <% if ( typeof result != 'undefined' ) {
27                 if (result.code.length > 0) { 
28                         if ( result.code == 'success' ) { %>
29                                 <div class='alert alert-success' role='alert'>
30                                 <%
31                                 for ( x in result.msg ){ %>
32                                         <div><%= result.msg[x] %></div>
33                                 <% } %>
34                                 </div>
35                         <% } else { %> 
36                                 <div class='alert alert-danger' role='danger'>
37                                 <%
38                                 for ( x in result.msg ){ %>
39                                         <div><%= result.msg[x] %></div>
40                                 <% } %>
41                                 </div>
42                         <% } %>
43                 <% } %>
44 <% } %>
45
46 <% if( typeof privilege != 'undefined'){
47     var priv = privilege.privilege;
48 } else {
49     var priv = 'A';
50 } %>
51
52
53 <div class="container-fluid">
54         <table id="vpe_pool" class="table table-hover table-condensed">
55       <thead>
56         <tr>
57           <th>AIC Site ID</th>
58           <th>VPE Name</th>
59           <th>Availability Zone</th>
60                   <th>IPV4 OAM Address</th>
61           <th>Loopback IPV4 Address</th>
62           <th>Prov Status</th>
63           <th>VLAN ID Outer</th>
64           <th>Vendor</th>
65           <th>Interface Name</th>
66           <th>Interface Speed</th>
67           <th>Interface Units</th>
68           <th>VPE UUID</th>
69           <th>VPE ID</th>
70                   <th>AS_NUMBER</th>
71           <th>Image Filename</th>
72                   <% if(priv == 'A'){ %>
73                   <th>Action</th>
74                   <% } %>
75         </tr>
76       </thead>
77       <tbody>
78       <% rows.forEach( function(row) { %> 
79         <tr>
80             <td><%= row.aic_site_id %></td>
81             <td><%= row.vpe_name %></td>
82             <td><%= row.availability_zone %></td>
83             <td><%= row.ipv4_oam_address %></td>
84             <td><%= row.loopback0_ipv4_address %></td>
85             <td><%= row.provisioning_status %></td>
86             <td><%= row.vlan_id_outer %></td>
87             <td><%= row.vendor %></td>
88             <td><%= row.physical_intf_name %></td>
89             <td><%= row.physical_intf_speed %></td>
90             <td><%= row.physical_intf_units %></td>
91             <td><%= row.vpe_uuid %></td>
92             <td><%= row.vpe_id %></td>
93             <td><%= row.as_number %></td>
94             <td><%= row.image_filename %></td>
95                         <td>
96 <!--
97                                 <form name="rowform">
98                 <input type="hidden" name="rf_aic_site_id" id="rf_aic_site_id" value="<%= row.aic_site_id %>"</input>
99                 <input type="hidden" name="rf_vpe_name" id="rf_vpe_name" value="<%= row.vpe_name %>"</input>
100                 <input type="hidden" name="rf_availability_zone" id="rf_availability_zone" value="<%= row.availability_zone %>"</input>
101                 </form>
102 -->
103                 <!-- <% var _attuid = row.attuid %> -->
104                 <% if(priv == 'A') { %>
105                                         <button type="button" class="btn btn-default btn-xs"
106                     onclick="updateVpePool('<%=row.aic_site_id %>','<%=row.vpe_name %>', '<%=row.availability_zone %>','<%=row.provisioning_status %>','<%= row.ipv4_oam_address %>','<%= row.loopback0_ipv4_address %>','<%= row.vlan_id_outer %>','<%= row.vendor %>','<%= row.physical_intf_name %>','<%= row.physical_intf_speed %>','<%= row.physical_intf_units %>','<%= row.vpe_uuid %>','<%= row.vpe_id %>', '<%= row.image_filename %>', '<%= row.as_number %>' );">Update</button>
107                                         <button type="button" class="btn btn-default btn-xs"
108                     onclick="deleteVpePool('<%= row.vpe_name %>','<%=row.aic_site_id %>','<%= row.availability_zone %>');">Delete</button>
109                 <% } %>
110             </td>
111         </tr>
112     <% }); %>
113       </tbody>
114     </table>
115
116 <!--
117         <% if(priv == 'A'){ %>
118         <div class="actions" style="padding:0px 25px;">
119         <form method="POST" action="/gamma/uploadVpePool" enctype="multipart/form-data">
120                 <div class="form-group">
121                 <label for="dest">File input</label>
122                 <input name="filename" type="file" id="dest">
123                 <p class="help-block">Choose a file to upload.</p>
124                 </div>
125                 <% if(priv == 'A') { %>
126             <button type="button" class="btn btn-default"
127                 onclick="uploadFile(this.form);">Upload File</button>
128         <% } else { %>
129             <button type="button" class="btn btn-default disabled"
130                 onclick="uploadFile(this.form);">Upload File</button>
131         <% } %>
132         </form>
133         </div>
134         <% } %>
135 -->
136 </div>
137
138 <% include ../partials/update_vpe_pool %>
139 <footer>
140     <% include ../partials/footer %>
141 </footer>
142
143 <script type="text/javascript">
144 function updateVpePool(aic_site_id,vpe_name,availability_zone,provisioning_status,ipv4_oam_address,loopback0_ipv4_address,vlan_id_outer,vendor,physical_intf_name,physical_intf_speed,physical_intf_units,vpe_uuid,vpe_id,image_filename, as_number) {
145
146     document.getElementById('uf_aic_site_id').value=aic_site_id;
147     document.getElementById('uf_vpe_name').value=vpe_name;
148     document.getElementById('uf_availability_zone').value=availability_zone;
149     document.getElementById('uf_provisioning_status').value=provisioning_status;
150     document.getElementById('uf_ipv4_oam_address').value=ipv4_oam_address;
151     document.getElementById('uf_loopback0_ipv4_address').value=loopback0_ipv4_address;
152     document.getElementById('uf_vlan_id_outer').value=vlan_id_outer;
153     document.getElementById('uf_vendor').value=vendor;
154     document.getElementById('uf_physical_intf_name').value=physical_intf_name;
155     document.getElementById('uf_physical_intf_speed').value=physical_intf_speed;
156     document.getElementById('uf_physical_intf_units').value=physical_intf_units;
157     document.getElementById('uf_vpe_uuid').value=vpe_uuid;
158     document.getElementById('uf_vpe_id').value=vpe_id;
159     document.getElementById('uf_as_number').value=as_number;
160     document.getElementById('uf_image_filename').value=image_filename;
161
162     document.getElementById('uf_key_availability_zone').value=availability_zone;
163     document.getElementById('uf_key_aic_site_id').value=aic_site_id;
164     document.getElementById('uf_key_vpe_name').value=vpe_name;
165     $('#update_vpe_pool_modal').modal('show');
166
167 }
168 function deleteVpePool(vpe_name,aic_site_id,availability_zone) {
169
170     bootbox.confirm({
171         message: "Are you sure you want to delete VPE [" + aic_site_id + "][" + vpe_name + "][" + availability_zone + "] ?",
172         callback: function(result) {
173             if ( result )
174             {
175                 location.assign("/gamma/deleteVpePool?aic_site_id=" + aic_site_id + "&vpe_name=" + vpe_name + "&availability_zone=" + availability_zone);
176             }
177             return;
178         },
179         buttons: {
180             cancel: {
181                 label: "Cancel"
182             },
183             confirm: {
184                 label: "Yes"
185             }
186         }
187     });
188 }
189
190 </script>
191
192 </body>
193 </html>
194