blob: 4dc739871ca122dcc7e295d804f01affa2a76c93 [file] [log] [blame]
Timoney, Daniel (dt5972)324ee362017-02-15 10:37:53 -05001<!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 $('#vnf_data').DataTable( {
13 "order": [[ 0, "asc" ]]
14 } );
15} );
16</script>
17
18
19</head>
20<body>
21
22<div class="well well-sm">
23<h3>Pre-load VNF Data</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
55 <table id="vnf_data" class="table table-hover table-condensed">
56 <thead>
57 <tr>
58 <th>ID</th>
59 <th>SVC_REQUEST_ID</th>
60 <th>VNF_NAME</th>
61 <th>VNF_TYPE</th>
62 <th>SVC_ACTION</th>
63 <th>UPLOAD STATUS</th>
64 <th>FILENAME</th>
65 <th>IMPORT/UPLOAD TIMESTAMP</th>
66 <% if(priv == 'A'){ %>
67 <th>Action</th>
68 <% } %>
69 </tr>
70 </thead>
71 <tbody>
72 <% var i=0; retData.forEach( function(rowObj) { %>
73 <tr>
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>
80 <td>
81 <a data-toggle="collapse"
82 href="#collapseExample<%= i %>" aria-expanded="false"
83 aria-controls="collapseExample"><%= rowObj.row.filename %>
84 </a>
85 <div class="collapse" id="collapseExample<%= i %>">
86 <div class="well">
87 <pre><%= JSON.stringify(rowObj.filecontent,null,4) %></pre>
88 </div>
89 </div>
90 </td>
91
92 <td><%= rowObj.row.ts %></td>
93 <% if(priv == 'A' ) { %>
94 <td>
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>
100 <% } %>
101 </td>
102 <% } %>
103 </tr>
104 <% i++; }); %>
105 </tbody>
106 </table>
107
108 <% if(priv == 'A'){ %>
109 <div class="row">
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">
Rotundo, Al (ar3165)18dcbec2019-07-31 14:46:56 +0000113 <input type="hidden" name="_csrf" value="<%= privilege.csrfToken %>" />
Timoney, Daniel (dt5972)324ee362017-02-15 10:37:53 -0500114 <label for="dest">Upload pre processed JSON file.</label>
Rotundo, Al (ar3165)18dcbec2019-07-31 14:46:56 +0000115 <input name="filename" type="file" id="dest" />
Timoney, Daniel (dt5972)324ee362017-02-15 10:37:53 -0500116 <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>
121 </div>
122 </form>
123 </div>
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">
Rotundo, Al (ar3165)18dcbec2019-07-31 14:46:56 +0000127 <input type="hidden" name="_csrf" value="<%= privilege.csrfToken %>" />
Timoney, Daniel (dt5972)324ee362017-02-15 10:37:53 -0500128 <label for="dest">Upload Worksheet CSV files from the <%= preloadImportDirectory %> directory.</label>
Rotundo, Al (ar3165)18dcbec2019-07-31 14:46:56 +0000129 <input name="filename" type="file" id="dest" multiple />
Timoney, Daniel (dt5972)324ee362017-02-15 10:37:53 -0500130 <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
135 </button>
136 </div>
137 </form>
138 </div>
139 </div>
140 <% } %>
141</div>
142
143<% include ../partials/add_service_homing %>
144<% include ../partials/update_service_homing %>
145<footer>
146 <% include ../partials/footer %>
147</footer>
148
149<script type="text/javascript">
150
151function importWorksheet(form)
152{
153 if ( form.filename.value.length == 0)
154 {
155 bootbox.alert('Must select a file.');
156 return false;
157 }
158 else {
159
160 bootbox.confirm({
161 message: "Are you sure you want to import VNF WORKSHEET .csv files from <%= preloadImportDirectory %>",
162 callback: function(result) {
163 if ( result )
164 {
165 form.submit();
166 }
167 return;
168 },
169 buttons: {
170 cancel: {
171 label: "Cancel"
172 },
173 confirm: {
174 label: "Yes"
175 }
176 }
177 });
178 }
179}
180
181
182function getVnfData(vnf_name,vnf_type,svc_request_id)
183{
184 location.assign("/mobility/viewVnfData?vnf_name=" + vnf_name + "&vnf_type=" + vnf_type );
185 return;
186}
187function loadVnfData(id,svc_request_id,svc_action,status,filename,ts)
188{
189 if ( status != 'pending' )
190 {
191 bootbox.alert("Upload Status must be in 'pending' state.");
192 return;
193 }
194 bootbox.confirm({
195 message: "Are you sure you want to load file [" + filename + "]? ",
196 callback: function(result) {
197 if ( result )
198 {
199 location.assign("/mobility/loadVnfData?id=" + id + "&svc_request_id=" + svc_request_id + "&filename=" + filename + "&status=" + status);
200 }
201 return;
202 },
203 buttons: {
204 cancel: {
205 label: "Cancel"
206 },
207 confirm: {
208 label: "Yes"
209 }
210 }
211 });
212}
213
214function deleteVnfData(id,svc_request_id,filename,status,vnf_name,vnf_type) {
215
216 bootbox.confirm({
217 message: "Are you sure you want to delete uploaded file [" + filename + "]? ",
218 callback: function(result) {
219 if ( result )
220 {
221 location.assign("/mobility/deleteVnfData?id="
222 + id
223 + "&svc_request_id=" + svc_request_id
224 + "&filename=" + filename
225 + "&status=" + status
226 + "&vnf_name=" + vnf_name
227 + "&vnf_type=" + vnf_type);
228 }
229 return;
230 },
231 buttons: {
232 cancel: {
233 label: "Cancel"
234 },
235 confirm: {
236 label: "Yes"
237 }
238 }
239 });
240}
241
242</script>
243
244</body>
245</html>
246