aboutsummaryrefslogtreecommitdiffstats
path: root/admportal/views/mobility/vnfPreloadData.ejs
diff options
context:
space:
mode:
Diffstat (limited to 'admportal/views/mobility/vnfPreloadData.ejs')
-rw-r--r--admportal/views/mobility/vnfPreloadData.ejs244
1 files changed, 244 insertions, 0 deletions
diff --git a/admportal/views/mobility/vnfPreloadData.ejs b/admportal/views/mobility/vnfPreloadData.ejs
new file mode 100644
index 00000000..69f02e59
--- /dev/null
+++ b/admportal/views/mobility/vnfPreloadData.ejs
@@ -0,0 +1,244 @@
+<!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() {
+ $('#vnf_data').DataTable( {
+ "order": [[ 0, "asc" ]]
+ } );
+} );
+</script>
+
+
+</head>
+<body>
+
+<div class="well well-sm">
+<h3>Pre-load VNF 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="vnf_data" class="table table-hover table-condensed">
+ <thead>
+ <tr>
+ <th>ID</th>
+ <th>SVC_REQUEST_ID</th>
+ <th>VNF_NAME</th>
+ <th>VNF_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:getVnfData('<%= rowObj.vnf_name %>','<%= rowObj.vnf_type %>');"><%= rowObj.row.svc_request_id %></a></td>
+ <td><%= rowObj.vnf_name %></td>
+ <td><%= rowObj.vnf_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="deleteVnfData('<%= rowObj.row.id %>','<%= rowObj.row.svc_request_id %>','<%= rowObj.row.filename %>','<%= rowObj.row.status %>','<%= rowObj.vnf_name %>','<%= rowObj.vnf_type %>');">Delete</button>
+ <% if (typeof rowObj.vnf_name != 'undefined' || typeof rowObj.vnf_type != 'undefined'){ %>
+ <button type="button" class="btn btn-default btn-xs"
+ onclick="loadVnfData('<%= 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/uploadVnfData" 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/uploadVnfCsv" 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 VNF Worksheet CSV files
+ </button>
+ </div>
+ </form>
+ </div>
+ </div>
+ <% } %>
+</div>
+
+<% include ../partials/add_service_homing %>
+<% include ../partials/update_service_homing %>
+<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 VNF WORKSHEET .csv files from <%= preloadImportDirectory %>",
+ callback: function(result) {
+ if ( result )
+ {
+ form.submit();
+ }
+ return;
+ },
+ buttons: {
+ cancel: {
+ label: "Cancel"
+ },
+ confirm: {
+ label: "Yes"
+ }
+ }
+ });
+ }
+}
+
+
+function getVnfData(vnf_name,vnf_type,svc_request_id)
+{
+ location.assign("/mobility/viewVnfData?vnf_name=" + vnf_name + "&vnf_type=" + vnf_type );
+ return;
+}
+function loadVnfData(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/loadVnfData?id=" + id + "&svc_request_id=" + svc_request_id + "&filename=" + filename + "&status=" + status);
+ }
+ return;
+ },
+ buttons: {
+ cancel: {
+ label: "Cancel"
+ },
+ confirm: {
+ label: "Yes"
+ }
+ }
+ });
+}
+
+function deleteVnfData(id,svc_request_id,filename,status,vnf_name,vnf_type) {
+
+ bootbox.confirm({
+ message: "Are you sure you want to delete uploaded file [" + filename + "]? ",
+ callback: function(result) {
+ if ( result )
+ {
+ location.assign("/mobility/deleteVnfData?id="
+ + id
+ + "&svc_request_id=" + svc_request_id
+ + "&filename=" + filename
+ + "&status=" + status
+ + "&vnf_name=" + vnf_name
+ + "&vnf_type=" + vnf_type);
+ }
+ return;
+ },
+ buttons: {
+ cancel: {
+ label: "Cancel"
+ },
+ confirm: {
+ label: "Yes"
+ }
+ }
+ });
+}
+
+</script>
+
+</body>
+</html>
+