Timoney, Daniel (dt5972) | 324ee36 | 2017-02-15 10:37:53 -0500 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | |
| 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> |
| 11 | |
| 12 | |
| 13 | <script class="init"> |
| 14 | $(document).ready(function() { |
| 15 | $('#linkLatencyMaster').DataTable( { |
| 16 | "order": [[ 0, "asc" ]] |
| 17 | } ); |
| 18 | } ); |
| 19 | </script> |
| 20 | </head> |
| 21 | |
| 22 | <body> |
| 23 | |
| 24 | <div class="well well-sm"> |
| 25 | <h3>Link Latency Master</h3> |
| 26 | </div> |
| 27 | |
| 28 | <% if ( typeof result != 'undefined' ) { |
| 29 | if (result.code.length > 0) { |
| 30 | if ( result.code == 'success' ) { %> |
| 31 | <div class='alert alert-success' role='alert'> |
| 32 | <% |
| 33 | for ( x in result.msg ){ %> |
| 34 | <div><%= result.msg[x] %></div> |
| 35 | <% } %> |
| 36 | </div> |
| 37 | <% } else { %> |
| 38 | <div class='alert alert-danger' role='danger'> |
| 39 | <% |
| 40 | for ( x in result.msg ){ %> |
| 41 | <div><%= result.msg[x] %></div> |
| 42 | <% } %> |
| 43 | </div> |
| 44 | <% } %> |
| 45 | <% } %> |
| 46 | <% } %> |
| 47 | |
| 48 | <% if( typeof privilege != 'undefined'){ |
| 49 | var priv = privilege.privilege; |
| 50 | } else { |
| 51 | var priv = 'A'; |
| 52 | } %> |
| 53 | |
| 54 | |
| 55 | <div class="container-fluid"> |
| 56 | |
| 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_latency_master">Add Link Latency</button> |
| 60 | </div> |
| 61 | <% } %> |
| 62 | |
| 63 | <table id="linkLatencyMaster" class="table table-hover table-condensed"> |
| 64 | <thead> |
| 65 | <tr> |
| 66 | <th>*Src CRS Name</th> |
| 67 | <th>*Dest CRS Name</th> |
| 68 | <th>*Bundle Name</th> |
| 69 | <th>*Latency</th> |
| 70 | <th>*Intra Inter SNRC</th> |
| 71 | <th>*Final Latency</th> |
| 72 | <th>*Augmentable</th> |
| 73 | <% if(priv == 'A'){ %> |
| 74 | <th>Action</th> |
| 75 | <% } %> |
| 76 | </tr> |
| 77 | </thead> |
| 78 | <tbody> |
| 79 | <% rows.forEach( function(row) { %> |
| 80 | <tr> |
| 81 | <td><%= row.source_crs_name %></td> |
| 82 | <td><%= row.destination_crs_name %></td> |
| 83 | <td><%= row.bundle_name %></td> |
| 84 | <td><%= row.latency %></td> |
| 85 | <td><%= row.intra_inter_snrc %></td> |
| 86 | <td><%= row.final_latency %></td> |
| 87 | <td><%= row.augmentable %></td> |
| 88 | <% if(priv == 'A') { %> |
| 89 | <td> |
| 90 | <button type="button" class="btn btn-default btn-xs" onclick="updateLinkLatencyMaster('<%= row.source_crs_name %>', '<%= row.destination_crs_name %>', '<%= row.bundle_name %>', '<%= row.latency %>', '<%= row.intra_inter_snrc %>', '<%= row.final_latency %>', '<%= row.augmentable %>');">Update</button> |
| 91 | <button type="button" class="btn btn-default btn-xs" onclick="deleteLinkLatencyMaster('<%= row.source_crs_name %>','<%= row.destination_crs_name %>','<%= row.bundle_name %>');">Delete</button> |
| 92 | </td> |
| 93 | <% } %> |
| 94 | </tr> |
| 95 | <% }); %> |
| 96 | </tbody> |
| 97 | </table> |
| 98 | |
| 99 | <% if(priv == 'A'){ %> |
| 100 | <div class="actions" style="padding:0px 25px;"> |
| 101 | <form method="POST" action="/tunnel/uploadLinkLatencyMaster" enctype="multipart/form-data"> |
| 102 | <div class="form-group"> |
| 103 | <label for="dest">File input</label> |
| 104 | <input name="filename" type="file" id="dest"> |
| 105 | <p class="help-block">Choose a file to upload.</p> |
| 106 | </div> |
| 107 | <button type="button" class="btn btn-default" onclick="uploadFile(this.form);">Upload File</button> |
| 108 | </form> |
| 109 | </div> |
| 110 | <% } %> |
| 111 | |
| 112 | </div> |
| 113 | |
| 114 | <% include ../partials/link_latency_master %> |
| 115 | <footer> |
| 116 | <% include ../partials/footer %> |
| 117 | </footer> |
| 118 | |
| 119 | <script type="text/javascript"> |
| 120 | function submitLinkLatencyMaster(form) |
| 121 | { |
| 122 | var errorMsg=''; |
| 123 | var source_crs_name = ''; |
| 124 | var destination_crs_name = ''; |
| 125 | var bundle_name = ''; |
| 126 | var latency = ''; |
| 127 | var intra_inter_snrc = ''; |
| 128 | var final_latency = ''; |
| 129 | var augmentable = ''; |
| 130 | |
| 131 | if ( form.name == 'addForm' ) |
| 132 | { |
| 133 | source_crs_name = form.nf_source_crs_name; |
| 134 | destination_crs_name = form.nf_destination_crs_name; |
| 135 | bundle_name = form.nf_bundle_name; |
| 136 | latency = form.nf_latency; |
| 137 | intra_inter_snrc = form.nf_intra_inter_snrc; |
| 138 | final_latency = form.nf_final_latency; |
| 139 | augmentable = form.nf_augmentable; |
| 140 | } |
| 141 | else |
| 142 | { |
| 143 | source_crs_name = form.uf_source_crs_name; |
| 144 | destination_crs_name = form.uf_destination_crs_name; |
| 145 | bundle_name = form.uf_bundle_name; |
| 146 | latency = form.uf_latency; |
| 147 | intra_inter_snrc = form.uf_intra_inter_snrc; |
| 148 | final_latency = form.uf_final_latency; |
| 149 | augmentable = form.uf_augmentable; |
| 150 | } |
| 151 | |
| 152 | if ( (source_crs_name.value == null) || (source_crs_name.value == "") || isblank(source_crs_name.value) ) |
| 153 | { |
| 154 | errorMsg += 'Source CRS Name is required.<br>'; |
| 155 | } |
| 156 | if ( (destination_crs_name.value == null) || (destination_crs_name.value == "") || isblank(destination_crs_name.value) ) |
| 157 | { |
| 158 | errorMsg += 'Destination CRS Name is required.<br>'; |
| 159 | } |
| 160 | if ( (bundle_name.value == null) || (bundle_name.value == "") || isblank(bundle_name.value) ) |
| 161 | { |
| 162 | errorMsg += 'Bundle Name is required.<br>'; |
| 163 | } |
| 164 | if ( (latency.value == null) || (latency.value == "") || isblank(latency.value) ) |
| 165 | { |
| 166 | errorMsg += 'Latency is required.<br>'; |
| 167 | } |
| 168 | if ( (intra_inter_snrc.value == null) || (intra_inter_snrc.value == "") || isblank(intra_inter_snrc.value) ) |
| 169 | { |
| 170 | errorMsg += 'Intra Inter SNRC is required.<br>'; |
| 171 | } |
| 172 | if ( (final_latency.value == null) || (final_latency.value == "") || isblank(final_latency.value) ) |
| 173 | { |
| 174 | errorMsg += 'Final Latency is required.<br>'; |
| 175 | } |
| 176 | if ( (augmentable.value == null) || (augmentable.value == "") || isblank(augmentable.value) ) |
| 177 | { |
| 178 | errorMsg += 'Augmentable is required.<br>'; |
| 179 | } |
| 180 | if( errorMsg.length > 0 ) { |
| 181 | bootbox.alert(errorMsg); |
| 182 | return; |
| 183 | } |
| 184 | |
| 185 | if (augmentable.value != 'Y' && augmentable.value != 'N'){ |
| 186 | bootbox.alert('Augmentable must be Y or N'); |
| 187 | return; |
| 188 | } |
| 189 | |
| 190 | form.submit(); |
| 191 | } |
| 192 | |
| 193 | function updateLinkLatencyMaster(source_crs_name,destination_crs_name,bundle_name,latency,intra_inter_snrc,final_latency,augmentable) { |
| 194 | |
| 195 | document.getElementById('uf_source_crs_name').value=source_crs_name; |
| 196 | document.getElementById('uf_destination_crs_name').value=destination_crs_name; |
| 197 | document.getElementById('uf_bundle_name').value=bundle_name; |
| 198 | document.getElementById('uf_latency').value=latency; |
| 199 | document.getElementById('uf_intra_inter_snrc').value=intra_inter_snrc; |
| 200 | document.getElementById('uf_final_latency').value=final_latency; |
| 201 | document.getElementById('uf_augmentable').value=augmentable; |
| 202 | |
| 203 | document.getElementById('uf_key_source_crs_name').value=source_crs_name; |
| 204 | document.getElementById('uf_key_destination_crs_name').value=destination_crs_name; |
| 205 | document.getElementById('uf_key_bundle_name').value=bundle_name; |
| 206 | |
| 207 | $('#update_link_latency_master').modal('show'); |
| 208 | } |
| 209 | |
| 210 | function deleteLinkLatencyMaster(source_crs_name,destination_crs_name,bundle_name) { |
| 211 | |
| 212 | var url_string = encodeURI("/tunnel/deleteLinkLatencyMaster?source_crs_name=" + source_crs_name |
| 213 | + "&destination_crs_name=" + destination_crs_name |
| 214 | + "&bundle_name=" + bundle_name); |
| 215 | |
| 216 | bootbox.confirm({ |
| 217 | message: "Are you sure you want to delete this Link Latency entry? [" + source_crs_name + ":" + destination_crs_name + ":" + bundle_name + "]", |
| 218 | callback: function(result) { |
| 219 | if ( result ) |
| 220 | { |
| 221 | location.assign(url_string); |
| 222 | } |
| 223 | return; |
| 224 | }, |
| 225 | buttons: { |
| 226 | cancel: { |
| 227 | label: "Cancel" |
| 228 | }, |
| 229 | confirm: { |
| 230 | label: "Yes" |
| 231 | } |
| 232 | } |
| 233 | }); |
| 234 | } |
| 235 | |
| 236 | </script> |
| 237 | |
| 238 | </body> |
| 239 | </html> |
| 240 | |