5 <meta charset="UTF-8" />
6 <meta http-equiv="X-UA-Compatible" content="IE=edge">
7 <% include ../partials/head %>
8 <% include ../partials/header %>
9 <script type="text/javascript" src="/javascripts/admportal.js" async></script>
10 <title>SDNC-MLC AdminPortal</title>
14 $(document).ready(function() {
15 $('#linkMaster').DataTable( {
16 "order": [[ 0, "asc" ]]
24 <div class="well well-sm">
28 <% if ( typeof result != 'undefined' ) {
29 if (result.code.length > 0) {
30 if ( result.code == 'success' ) { %>
31 <div class='alert alert-success' role='alert'>
33 for ( x in result.msg ){ %>
34 <div><%= result.msg[x] %></div>
38 <div class='alert alert-danger' role='danger'>
40 for ( x in result.msg ){ %>
41 <div><%= result.msg[x] %></div>
48 <% if( typeof privilege != 'undefined'){
49 var priv = privilege.privilege;
55 <div class="container-fluid">
57 <% if(priv == 'A'){ %>
58 <div class="actions" style="padding:15px 0px;">
59 <button class="btn btn-primary btn-md" data-toggle="modal" data-target="#add_link_master">Add Link</button>
63 <table id="linkMaster" class="table table-hover table-condensed">
66 <th>*Link Interface IP</th>
67 <th>Source CRS Name</th>
68 <th>Destination CRS Name</th>
69 <th>Max Reserved BW</th>
73 <% if(priv == 'A'){ %>
79 <% rows.forEach( function(row) { %>
81 <td><%= row.link_interface_ip %></td>
82 <td><%= row.source_crs_name %></td>
83 <td><%= row.destination_crs_name %></td>
84 <td><%= row.link_speed %></td>
85 <td><%= row.default_cost %></td>
86 <td><%= row.bundle_name %></td>
87 <td><%= row.shutdown %></td>
88 <% if(priv == 'A') { %>
90 <button type="button" class="btn btn-default btn-xs" onclick="updateLinkMaster('<%= row.link_interface_ip %>',
91 '<%= row.source_crs_name %>', '<%= row.destination_crs_name %>', '<%= row.link_speed %>', '<%= row.default_cost %>',
92 '<%= row.bundle_name %>', '<%= row.shutdown %>');">Update</button>
93 <button type="button" class="btn btn-default btn-xs" onclick="deleteLinkMaster('<%= row.link_interface_ip %>');">Delete</button>
102 <% include ../partials/link_master %>
104 <% include ../partials/footer %>
107 <script type="text/javascript">
108 function saveLinkMaster(form)
111 var link_interface_ip = '';
112 var source_crs_name = '';
113 var destination_crs_name = '';
115 var default_cost = '';
116 var bundle_name = '';
119 if ( form.name == 'addForm' )
121 link_interface_ip = form.nf_link_interface_ip;
122 source_crs_name = form.nf_source_crs_name;
123 destination_crs_name = form.nf_destination_crs_name;
124 link_speed = form.nf_link_speed;
125 default_cost = form.nf_default_cost;
126 bundle_name = form.nf_bundle_name;
127 shutdown = form.nf_shutdown;
131 link_interface_ip = form.uf_link_interface_ip;
132 source_crs_name = form.uf_source_crs_name;
133 destination_crs_name = form.uf_destination_crs_name;
134 link_speed = form.uf_link_speed;
135 default_cost = form.uf_default_cost;
136 bundle_name = form.uf_bundle_name;
137 shutdown = form.uf_shutdown;
141 if ( (link_interface_ip.value == null) || (link_interface_ip.value == "") || isblank(link_interface_ip.value) )
143 errorMsg += 'Link Interface IP is required.<br>';
145 if ( (source_crs_name.value == null) || (source_crs_name.value == "") || isblank(source_crs_name.value) )
147 errorMsg += 'Source CRS Name is required.<br>';
149 if ( (destination_crs_name.value == null) || (destination_crs_name.value == "") || isblank(destination_crs_name.value) )
151 errorMsg += 'Destination CRS Name is required.<br>';
153 if( errorMsg.length > 0 ) {
154 bootbox.alert(errorMsg);
158 if ( link_speed.value.length >0 && !isDigit(link_speed.value) )
160 bootbox.alert('Max Reserved BW must be a number.');
163 if ( default_cost.value.length >0 && !isDigit(default_cost.value) )
165 bootbox.alert('Default Cost must be a number.');
171 function updateLinkMaster(link_interface_ip,source_crs_name,destination_crs_name,link_speed,default_cost,bundle_name,shutdown) {
173 document.getElementById('uf_link_interface_ip').value=link_interface_ip;
174 document.getElementById('uf_source_crs_name').value=source_crs_name;
175 document.getElementById('uf_destination_crs_name').value=destination_crs_name;
176 document.getElementById('uf_link_speed').value=link_speed;
177 document.getElementById('uf_default_cost').value=default_cost;
178 document.getElementById('uf_bundle_name').value=bundle_name;
179 document.getElementById('uf_shutdown').value=shutdown;
180 document.getElementById('uf_key_link_interface_ip').value=link_interface_ip;
182 $('#update_link_master').modal('show');
185 function deleteLinkMaster(link_interface_ip) {
187 var url_string = encodeURI("/tunnel/deleteLinkMaster?link_interface_ip=" + link_interface_ip);
190 message: "Are you sure you want to delete this Link [" + link_interface_ip + "]",
191 callback: function(result) {
194 location.assign(url_string);