| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="UTF-8" /> |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
| <% include ../partials/head %> |
| <% include ../partials/header %> |
| <script type="text/javascript" src="/javascripts/admportal.js" async></script> |
| <title>SDN-C AdminPortal</title> |
| <script class="init"> |
| $(document).ready(function() { |
| $('#preload_vnf_data').DataTable( { |
| "order": [[ 0, "asc" ]] |
| } ); |
| } ); |
| </script> |
| |
| |
| </head> |
| <body> |
| |
| <div class="well well-sm"> |
| <h3>Pre-load VNF Network Data</h3> |
| </div> |
| |
| <% if ( typeof result != 'undefined' ) { |
| if (result.code.length > 0) { |
| if ( result.code == 'success' ) { %> |
| <div class='alert alert-success' role='alert'> |
| <% |
| for ( x in result.msg ){ %> |
| <div><%= result.msg[x] %></div> |
| <% } %> |
| </div> |
| <% } else { %> |
| <div class='alert alert-danger' role='danger'> |
| <% |
| for ( x in result.msg ){ %> |
| <div><%= result.msg[x] %></div> |
| <% } %> |
| </div> |
| <% } %> |
| <% } %> |
| <% } %> |
| |
| <% if( typeof privilege != 'undefined'){ |
| var priv = privilege.privilege; |
| } else { |
| var priv = 'A'; |
| } %> |
| |
| |
| <div class="container-fluid"> |
| |
| <table id="preload_vnf_data" class="table table-hover table-condensed"> |
| <thead> |
| <tr> |
| <th>ID</th> |
| <th>SVC_REQUEST_ID</th> |
| <th>NETWORK_NAME</th> |
| <th>NETWORK_TYPE</th> |
| <th>SVC_ACTION</th> |
| <th>UPLOAD STATUS</th> |
| <th>FILENAME</th> |
| <th>IMPORT/UPLOAD TIMESTAMP</th> |
| <% if(priv == 'A'){ %> |
| <th>Action</th> |
| <% } %> |
| </tr> |
| </thead> |
| <tbody> |
| <% var i=0; retData.forEach( function(rowObj) { %> |
| <tr> |
| <td><%= rowObj.row.id %></td> |
| <td><a href="javascript:getVnfNetworkData('<%= rowObj.network_name %>','<%= rowObj.network_type %>');"><%= rowObj.row.svc_request_id %></a></td> |
| <td><%= rowObj.network_name %></td> |
| <td><%= rowObj.network_type %></td> |
| <td><%= rowObj.row.svc_action %></td> |
| <td><%= rowObj.row.status %></td> |
| <td> |
| <a data-toggle="collapse" |
| href="#collapseExample<%= i %>" aria-expanded="false" |
| aria-controls="collapseExample"><%= rowObj.row.filename %> |
| </a> |
| <div class="collapse" id="collapseExample<%= i %>"> |
| <div class="well"> |
| <pre><%= JSON.stringify(rowObj.filecontent,null,4) %></pre> |
| </div> |
| </div> |
| </td> |
| |
| <td><%= rowObj.row.ts %></td> |
| <% if(priv == 'A' ) { %> |
| <td> |
| <button type="button" class="btn btn-default btn-xs" |
| onclick="deleteVnfNetworkData('<%= rowObj.row.id %>','<%= rowObj.row.svc_request_id %>','<%= rowObj.row.filename %>','<%= rowObj.row.status %>','<%= rowObj.network_name %>','<%= rowObj.network_type %>');">Delete</button> |
| <% if (typeof rowObj.network_name != 'undefined' || typeof rowObj.network_type != 'undefined'){ %> |
| <button type="button" class="btn btn-default btn-xs" |
| onclick="loadVnfNetworkData('<%= rowObj.row.id %>','<%= rowObj.row.svc_request_id %>','<%= rowObj.row.svc_action %>','<%= rowObj.row.status %>','<%= rowObj.row.filename %>','<%= rowObj.row.ts %>');">Load Data</button> |
| <% } %> |
| </td> |
| <% } %> |
| </tr> |
| <% i++; }); %> |
| </tbody> |
| </table> |
| |
| <% if(priv == 'A'){ %> |
| <div class="row"> |
| <div class="col-md-8 col-md-push-4"> |
| <form method="POST" action="/mobility/uploadVnfNetworkData" enctype="multipart/form-data"> |
| <div class="form-group"> |
| <label for="dest">Upload pre processed JSON file.</label> |
| <input name="filename" type="file" id="dest" /> |
| <p class="help-block">Choose a JSON file to upload.</p> |
| <button type="button" class="btn btn-default" |
| data-toggle="tooltip" data-placement="bottom" |
| title="Upload a JSON file that has already been pre processed." |
| onclick="uploadFile(this.form);">Upload JSON File |
| </button> |
| </div> |
| </form> |
| </div> |
| <div class="col-md-4 col-md-pull-8"> |
| <form method="POST" action="/preload/uploadNetworkCsv" enctype="multipart/form-data"> |
| <div class="form-group"> |
| <label for="dest">Upload Worksheet CSV files from the <%= preloadImportDirectory %> directory.</label> |
| <input name="filename" type="file" id="dest" multiple /> |
| <p class="help-block">Choose Worksheet CSV files to upload.</p> |
| <button type="button" class="btn btn-default" |
| data-toggle="tooltip" data-placement="bottom" |
| title="Must upload all the VNF CSV files from <%= preloadImportDirectory %>" |
| onclick="importWorksheet(this.form);">Upload Network Worksheet CSV files |
| </button> |
| </div> |
| </form> |
| </div> |
| </div> |
| <% } %> |
| </div> |
| |
| <footer> |
| <% include ../partials/footer %> |
| </footer> |
| |
| <script type="text/javascript"> |
| |
| function importWorksheet(form) |
| { |
| if ( form.filename.value.length == 0) |
| { |
| bootbox.alert('Must select a file.'); |
| return false; |
| } |
| else { |
| |
| bootbox.confirm({ |
| message: "Are you sure you want to import Network WORKSHEET .csv files from <%= preloadImportDirectory %>", |
| callback: function(result) { |
| if ( result ) |
| { |
| form.submit(); |
| } |
| return; |
| }, |
| buttons: { |
| cancel: { |
| label: "Cancel" |
| }, |
| confirm: { |
| label: "Yes" |
| } |
| } |
| }); |
| } |
| } |
| |
| function getVnfNetworkData(network_name,network_type) |
| { |
| location.assign("/mobility/viewVnfNetworkData?network_name=" + network_name + "&network_type=" + network_type ); |
| return; |
| } |
| function loadVnfNetworkData(id,svc_request_id,svc_action,status,filename,ts) |
| { |
| if ( status != 'pending' ) |
| { |
| bootbox.alert("Upload Status must be in 'pending' state."); |
| return; |
| } |
| bootbox.confirm({ |
| message: "Are you sure you want to load file [" + filename + "]? ", |
| callback: function(result) { |
| if ( result ) |
| { |
| location.assign("/mobility/loadVnfNetworkData?id=" + id + "&svc_request_id=" + svc_request_id + "&filename=" + filename + "&status=" + status); |
| } |
| return; |
| }, |
| buttons: { |
| cancel: { |
| label: "Cancel" |
| }, |
| confirm: { |
| label: "Yes" |
| } |
| } |
| }); |
| } |
| |
| function deleteVnfNetworkData(id,svc_request_id,filename,status,network_name,network_type) { |
| |
| bootbox.confirm({ |
| message: "Are you sure you want to delete uploaded file [" + filename + "]? ", |
| callback: function(result) { |
| if ( result ) |
| { |
| location.assign("/mobility/deleteVnfNetworkData?id=" |
| + id |
| + "&svc_request_id=" + svc_request_id |
| + "&filename=" + filename |
| + "&status=" + status |
| + "&network_name=" + network_name |
| + "&network_type=" + network_type); |
| } |
| return; |
| }, |
| buttons: { |
| cancel: { |
| label: "Cancel" |
| }, |
| confirm: { |
| label: "Yes" |
| } |
| } |
| }); |
| } |
| |
| </script> |
| |
| </body> |
| </html> |
| |