blob: 1a49498543685d6acf6b730ebf62e1fa9e9d7a07 [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_profile').DataTable( {
13 "order": [[ 0, "asc" ]]
14 } );
15} );
16</script>
17
18</head>
19<body>
20
21<div class="well well-sm">
22<h3>VNF Profile </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
52<div class="container-fluid">
53
54 <% if (priv == 'A'){ %>
55 <div class="actions" style="padding:15px 0px;">
56 <button class="btn btn-primary btn-md" data-toggle="modal" data-target="#add_vnf_profile">
57 Add VNF Profile
58 </button>
59 </div>
60 <% } %>
61
62 <table id="vnf_profile" class="table table-hover table-condensed">
63 <thead>
64 <tr>
65 <th>*VNF_TYPE</th>
66 <th>AVAILABILITY_ZONE_COUNT</th>
67 <th>EQUIPMENT_ROLE</th>
68 <% if(priv == 'A'){ %>
69 <th>Action</th>
70 <% } %>
71 </tr>
72 </thead>
73 <tbody>
74 <% rows.forEach( function(row) { %>
75 <tr>
76 <td><%= row.vnf_type %></td>
77 <td><%= row.availability_zone_count %></td>
78 <td><%= row.equipment_role %></td>
79 <% if(priv == 'A' ) { %>
80 <td>
81 <button type="button" class="btn btn-default btn-xs"
82 onclick="deleteVnfProfile('<%= row.vnf_type %>');">Delete</button>
83 </td>
84 <% } %>
85 </tr>
86 <% }); %>
87 </tbody>
88 </table>
89
90 <% if(priv == 'A'){ %>
91 <div class="actions" style="padding:0px 25px;">
92 <form method="POST" action="/mobility/uploadVnfProfile" enctype="multipart/form-data">
93 <div class="form-group">
94 <label for="dest">File input</label>
95 <input name="filename" type="file" id="dest">
96 <p class="help-block">Choose a file to upload.</p>
97 </div>
98 <button type="button" class="btn btn-default"
99 onclick="uploadFile(this.form);">Upload File</button>
100 </form>
101 </div>
102 <% } %>
103</div>
104
105<% include ../partials/vnf_profile %>
106<footer>
107 <% include ../partials/footer %>
108</footer>
109
110<script type="text/javascript">
111
112function addVnfProfile(form)
113{
114 var errorMsg='';
115 var vnf_type='';
116 var availability_zone_count='';
117 var equipment_role='';
118
119 if ( form.name == 'addForm' )
120 {
121 vnf_type = form.nf_vnf_type;
122 availability_zone_count = form.nf_availability_zone_count;
123 equipment_role = form.nf_equipment_role;
124 }
125
126 if ( (vnf_type.value == null) || (vnf_type.value == "") || isblank(vnf_type.value) )
127 {
128 errorMsg += 'VNF Type is required.<br>';
129 }
130 if ( (availability_zone_count.value == null) || (availability_zone_count.value == "") || isblank(availability_zone_count.value) )
131 {
132 errorMsg += 'Availability Zone Count is a required field.<br>';
133 }
134 if ( (equipment_role.value == null) || (equipment_role.value == "") || isblank(equipment_role.value) )
135 {
136 errorMsg += 'Equipment Role is a required field.<br>';
137 }
138 if( errorMsg.length > 0 ) {
139 bootbox.alert(errorMsg);
140 return;
141 }
142 if ( availability_zone_count.value.length > 0 && !isDigit(availability_zone_count.value) )
143 {
144 bootbox.alert('Availability Zone Count must be a number.');
145 return;
146 }
147 form.submit();
148}
149
150function deleteVnfProfile(vnf_type) {
151
152 bootbox.confirm({
153 message: "Are you sure you want to delete VNF_PROFILE [" + vnf_type + "]",
154 callback: function(result) {
155 if ( result )
156 {
157 location.assign("/mobility/deleteVnfProfile?vnf_type=" + vnf_type);
158
159 }
160 return;
161 },
162 buttons: {
163 cancel: {
164 label: "Cancel"
165 },
166 confirm: {
167 label: "Yes"
168 }
169 }
170 });
171}
172
173</script>
174
175</body>
176</html>
177