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>
11 $(document).ready(function() {
12 $('#vnf_data').DataTable( {
13 "order": [[ 0, "asc" ]]
22 <div class="well well-sm">
23 <h3>Pre-load VNF Data</h3>
26 <% if ( typeof result != 'undefined' ) {
27 if (result.code.length > 0) {
28 if ( result.code == 'success' ) { %>
29 <div class='alert alert-success' role='alert'>
31 for ( x in result.msg ){ %>
32 <div><%= result.msg[x] %></div>
36 <div class='alert alert-danger' role='danger'>
38 for ( x in result.msg ){ %>
39 <div><%= result.msg[x] %></div>
46 <% if( typeof privilege != 'undefined'){
47 var priv = privilege.privilege;
53 <div class="container-fluid">
55 <table id="vnf_data" class="table table-hover table-condensed">
59 <th>SVC_REQUEST_ID</th>
63 <th>UPLOAD STATUS</th>
65 <th>IMPORT/UPLOAD TIMESTAMP</th>
66 <% if(priv == 'A'){ %>
72 <% var i=0; retData.forEach( function(rowObj) { %>
74 <td><%= rowObj.row.id %></td>
75 <td><a href="javascript:getVnfData('<%= rowObj.vnf_name %>','<%= rowObj.vnf_type %>');"><%= rowObj.row.svc_request_id %></a></td>
76 <td><%= rowObj.vnf_name %></td>
77 <td><%= rowObj.vnf_type %></td>
78 <td><%= rowObj.row.svc_action %></td>
79 <td><%= rowObj.row.status %></td>
81 <a data-toggle="collapse"
82 href="#collapseExample<%= i %>" aria-expanded="false"
83 aria-controls="collapseExample"><%= rowObj.row.filename %>
85 <div class="collapse" id="collapseExample<%= i %>">
87 <pre><%= JSON.stringify(rowObj.filecontent,null,4) %></pre>
92 <td><%= rowObj.row.ts %></td>
93 <% if(priv == 'A' ) { %>
95 <button type="button" class="btn btn-default btn-xs"
96 onclick="deleteVnfData('<%= rowObj.row.id %>','<%= rowObj.row.svc_request_id %>','<%= rowObj.row.filename %>','<%= rowObj.row.status %>','<%= rowObj.vnf_name %>','<%= rowObj.vnf_type %>');">Delete</button>
97 <% if (typeof rowObj.vnf_name != 'undefined' || typeof rowObj.vnf_type != 'undefined'){ %>
98 <button type="button" class="btn btn-default btn-xs"
99 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>
108 <% if(priv == 'A'){ %>
110 <div class="col-md-8 col-md-push-4">
111 <form method="POST" action="/mobility/uploadVnfData" enctype="multipart/form-data">
112 <div class="form-group">
113 <input type="hidden" name="_csrf" value="<%= privilege.csrfToken %>" />
114 <label for="dest">Upload pre processed JSON file.</label>
115 <input name="filename" type="file" id="dest" />
116 <p class="help-block">Choose a JSON file to upload.</p>
117 <button type="button" class="btn btn-default"
118 data-toggle="tooltip" data-placement="bottom"
119 title="Upload a JSON file that has already been pre processed."
120 onclick="uploadFile(this.form);">Upload JSON File</button>
124 <div class="col-md-4 col-md-pull-8">
125 <form method="POST" action="/preload/uploadVnfCsv" enctype="multipart/form-data">
126 <div class="form-group">
127 <input type="hidden" name="_csrf" value="<%= privilege.csrfToken %>" />
128 <label for="dest">Upload Worksheet CSV files from the <%= preloadImportDirectory %> directory.</label>
129 <input name="filename" type="file" id="dest" multiple />
130 <p class="help-block">Choose Worksheet CSV files to upload.</p>
131 <button type="button" class="btn btn-default"
132 data-toggle="tooltip" data-placement="bottom"
133 title="Must upload all the VNF CSV files from <%= preloadImportDirectory %>"
134 onclick="importWorksheet(this.form);">Upload VNF Worksheet CSV files
143 <% include ../partials/add_service_homing %>
144 <% include ../partials/update_service_homing %>
146 <% include ../partials/footer %>
149 <script type="text/javascript">
151 function importWorksheet(form)
153 if ( form.filename.value.length == 0)
155 bootbox.alert('Must select a file.');
161 message: "Are you sure you want to import VNF WORKSHEET .csv files from <%= preloadImportDirectory %>",
162 callback: function(result) {
182 function getVnfData(vnf_name,vnf_type,svc_request_id)
184 location.assign("/mobility/viewVnfData?vnf_name=" + vnf_name + "&vnf_type=" + vnf_type );
187 function loadVnfData(id,svc_request_id,svc_action,status,filename,ts)
189 if ( status != 'pending' )
191 bootbox.alert("Upload Status must be in 'pending' state.");
195 message: "Are you sure you want to load file [" + filename + "]? ",
196 callback: function(result) {
199 location.assign("/mobility/loadVnfData?id=" + id + "&svc_request_id=" + svc_request_id + "&filename=" + filename + "&status=" + status);
214 function deleteVnfData(id,svc_request_id,filename,status,vnf_name,vnf_type) {
217 message: "Are you sure you want to delete uploaded file [" + filename + "]? ",
218 callback: function(result) {
221 location.assign("/mobility/deleteVnfData?id="
223 + "&svc_request_id=" + svc_request_id
224 + "&filename=" + filename
225 + "&status=" + status
226 + "&vnf_name=" + vnf_name
227 + "&vnf_type=" + vnf_type);