Initial commit for OpenECOMP SDN-C OA&M
[sdnc/oam.git] / admportal / views / gamma / list.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     $('#vlan_id_pool').DataTable( {
13         "order": [[ 0, "asc" ]]
14     } );
15 } );
16 </script>
17
18 </head>
19 <body>
20
21 <div class="well well-sm">
22 <h3>NoD VLAN ID POOL</h3>
23 </div>
24
25 <% if ( typeof result != 'undefined' ) {
26                 if (result.code.length > 0) { 
27                         if ( result.code == 'success' ) { %>
28                                 <div class='alert alert-success' role='alert'>
29                                 <%
30                                 for ( x in result.msg ){ %>
31                                         <div><%= result.msg[x] %></div>
32                                 <% } %>
33                                 </div>
34                         <% } else { %> 
35                                 <div class='alert alert-danger' role='danger'>
36                                 <%
37                                 for ( x in result.msg ){ %>
38                                         <div><%= result.msg[x] %></div>
39                                 <% } %>
40                                 </div>
41                         <% } %>
42                 <% } %>
43 <% } %>
44
45 <% if( typeof privilege != 'undefined'){ 
46     var priv = privilege.privilege;
47 } else {
48     var priv = 'A';
49 } %>
50
51 <div class="container-fluid">
52         <table id="vlan_id_pool" class="table table-hover table-condensed">
53       <thead>
54         <tr>
55           <th>AIC Site ID</th>
56           <th>Purpose</th>
57                   <th>VLAN ID</th>
58               <th>VLPSPE Name</th>
59                   <th>Availability Zone</th>
60           <th>Status</th>
61           <th>Svc Instance ID</th>
62                   <% if(priv == 'A'){ %>
63                   <th>Action</th>
64                   <% } %>
65         </tr>
66       </thead>
67       <tbody>
68       <% rows.forEach( function(row) { %> 
69         <tr>
70             <td><%= row.aic_site_id %></td>
71             <td><%= row.purpose %></td>
72             <td><%= row.vlan_id %></td>
73             <td><%= row.vplspe_name %></td>
74             <td><%= row.availability_zone %></td>
75             <td><%= row.status %></td>
76             <td><%= row.svc_instance_id %></td>
77                         <% if(priv == 'A') { %>
78             <td>
79                                  <button type="button" class="btn btn-default btn-xs"
80                         onclick="updateVlanPool('<%=row.aic_site_id %>','<%= row.availability_zone %>',
81                                                 '<%= row.purpose %>','<%= row.vlan_id %>','<%= row.status %>',
82                                                 '<%= row.svc_instance_id %>','<%= row.vplspe_name %>');">Update</button>
83                                  <button type="button" class="btn btn-default btn-xs"
84                         onclick="deleteVlanPool('<%=row.aic_site_id %>', '<%= row.purpose %>', 
85                                                 '<%= row.vlan_id %>');">Delete</button>
86             </td>
87             <% } %>
88         </tr>
89     <% }); %>
90       </tbody>
91     </table>
92
93 <!--
94         <% if(priv == 'A'){ %>
95         <div class="actions" style="padding:0px 25px;">
96         <form method="POST" action="/gamma/uploadVLAN" enctype="multipart/form-data">
97                 <div class="form-group">
98                 <label for="dest">File input</label>
99                 <input name="filename" type="file" id="dest">
100                 <p class="help-block">Choose a file to upload.</p>
101                 </div>
102                 <% if(priv == 'A') { %>
103             <button type="button" class="btn btn-default"
104                 onclick="uploadFile(this.form);">Upload File</button>
105         <% } else { %>
106             <button type="button" class="btn btn-default disabled"
107                 onclick="uploadFile(this.form);">Upload File</button>
108         <% } %>
109         </form>
110         </div>
111         <% } %>
112 -->
113 </div>
114
115 <% include ../partials/update_vlan_id_pool %>
116 <footer>
117     <% include ../partials/footer %>
118 </footer>
119
120 <script type="text/javascript">
121 function updateVlanPool(aic_site_id,availability_zone,purpose,vlan_id,status,svc_instance_id,vplspe_name) {
122
123     document.getElementById('uf_aic_site_id').value=aic_site_id;
124     document.getElementById('uf_availability_zone').value=availability_zone
125     document.getElementById('uf_purpose').value=purpose;
126     document.getElementById('uf_vlan_id').value=vlan_id;
127     document.getElementById('uf_status').value=status;
128     document.getElementById('uf_svc_instance_id').value=svc_instance_id;
129     document.getElementById('uf_vplspe_name').value=vplspe_name;
130
131     document.getElementById('uf_key_aic_site_id').value=aic_site_id;
132     document.getElementById('uf_key_purpose').value=purpose;
133     document.getElementById('uf_key_vlan_id').value=vlan_id;
134     $('#update_vlan_id_pool_modal').modal('show');
135 }
136
137 function deleteVlanPool(aic_site_id,purpose,vlan_id) {
138
139     bootbox.confirm({
140         message: "Are you sure you want to delete VLAN Id [" + aic_site_id + "][" + purpose + "][" + vlan_id + "] ?",
141         callback: function(result) {
142             if ( result )
143             {
144                 location.assign("/gamma/deleteVlanPool?aic_site_id=" + aic_site_id + "&purpose=" + purpose + "&vlan_id=" + vlan_id);
145             }
146             return;
147         },
148         buttons: {
149             cancel: {
150                 label: "Cancel"
151             },
152             confirm: {
153                 label: "Yes"
154             }
155         }
156     });
157 }
158 </script>
159
160 </body>
161 </html>
162