diff options
Diffstat (limited to 'modules-available/dnbd3/templates')
5 files changed, 256 insertions, 57 deletions
diff --git a/modules-available/dnbd3/templates/page-client-loclist.html b/modules-available/dnbd3/templates/page-client-loclist.html new file mode 100644 index 00000000..67c90683 --- /dev/null +++ b/modules-available/dnbd3/templates/page-client-loclist.html @@ -0,0 +1,27 @@ +<div class="col-md-6"> + <h2>{{lang_clientsByLocation}}</h2> + + <table class="table table-condensed"> + <tr> + <th>{{lang_location}}</th> + <th class="text-right">{{lang_count}}</th> + <th class="text-right">{{lang_recursiveCount}}</th> + </tr> + {{#list}} + <tr> + <td> + {{#depth}} + <div style="display:inline-block;width:{{depth}}em"></div> + {{/depth}} + {{locationname}} + </td> + <td class="text-right"> + {{clientCount}} + </td> + <td class="text-right"> + {{recCount}} + </td> + </tr> + {{/list}} + </table> +</div>
\ No newline at end of file diff --git a/modules-available/dnbd3/templates/page-clientlist.html b/modules-available/dnbd3/templates/page-clientlist.html index 3fd4442c..9e7cec4c 100644 --- a/modules-available/dnbd3/templates/page-clientlist.html +++ b/modules-available/dnbd3/templates/page-clientlist.html @@ -1,12 +1,20 @@ -<table class="table"> - {{#clients}} +<div class="col-md-6"> + <h2>{{lang_clientList}}</h2> + + <table class="table table-condensed"> <tr> - <td> - {{address}} - </td> - <td class="text-right"> - {{bytesSent_s}} - </td> + <th>{{lang_client}}</th> + <th class="text-right">{{lang_bytesSent}}</th> </tr> - {{/clients}} -</table>
\ No newline at end of file + {{#clients}} + <tr> + <td> + {{address}} + </td> + <td data-sort="int" data-sort-value="{{bytesSent}}" class="text-right"> + {{bytesSent_s}} + </td> + </tr> + {{/clients}} + </table> +</div>
\ No newline at end of file diff --git a/modules-available/dnbd3/templates/page-header-servername.html b/modules-available/dnbd3/templates/page-header-servername.html new file mode 100644 index 00000000..6f3f1b7f --- /dev/null +++ b/modules-available/dnbd3/templates/page-header-servername.html @@ -0,0 +1 @@ +<h1>{{ip}}</h1>
\ No newline at end of file diff --git a/modules-available/dnbd3/templates/page-server-locations.html b/modules-available/dnbd3/templates/page-server-locations.html new file mode 100644 index 00000000..8e76a68d --- /dev/null +++ b/modules-available/dnbd3/templates/page-server-locations.html @@ -0,0 +1,96 @@ +<h1>{{lang_manageAccessTo}} {{ip}}</h1> + +<p><i>{{lang_proxyLocationText}}</i></p> + +<form method="post" action="?do=dnbd3"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="server" value="{{serverid}}"> + + <div class="buttonbar text-right"> + <button type="submit" class="btn btn-success" name="action" value="savelocations"> + <span class="glyphicon glyphicon-floppy-disk"></span> + {{lang_save}} + </button> + </div> + + <div class="row"> + <div class="col-md-6"> + <h3>{{lang_allowedSubnets}}</h3> + <div id="subnet-list"> + + </div> + </div> + <div class="col-md-6"> + <h3>{{lang_locations}}</h3> + {{#locations}} + <div class="checkbox"> + {{#depth}} + <div style="display:inline-block;width:{{depth}}em"></div> + {{/depth}} + <input id="cb-{{locationid}}" class="loc-check" type="checkbox" name="location[]" value="{{locationid}}" {{checked_s}}> + <label for="cb-{{locationid}}">{{locationname}}</label> + </div> + {{/locations}} + </div> + </div> + + <div class="buttonbar text-right"> + <button type="submit" class="btn btn-success" name="action" value="savelocations"> + <span class="glyphicon glyphicon-floppy-disk"></span> + {{lang_save}} + </button> + </div> +</form> + +<script type="application/javascript"><!-- +document.addEventListener('DOMContentLoaded', function() { + + const locData = {{{jsonLocations}}}; + const $snList = $('#subnet-list'); + + function updateLocations() { + var allLocs = []; + $('.loc-check:checked').each(function () { + var lid = parseInt(this.value); + var locs = getAllLocs(lid); + for (var i = 0; i < locs.length; ++i) { + if (allLocs.indexOf(locs[i]) === -1) allLocs.push(locs[i]); + } + }); + var subnets = []; + $snList.empty(); + for (var i = 0; i < allLocs.length; ++i) { + var loc = locData['l'+allLocs[i]]; + if (!loc || !loc.subnets) continue; + for (var j = 0; j < loc.subnets.length; ++j) { + var line = long2ip(loc.subnets[j].startaddr) + ' - ' + long2ip(loc.subnets[j].endaddr); + if (subnets.indexOf(line) === -1) { + subnets.push(line); + $snList.append($('<div>').text(line)); + } + } + } + if (subnets.length === 0) { + $snList.text('{{lang_global}}'); + } + } + + function getAllLocs(lid) { + var e = locData['l'+lid]; + if (!e || !e.children) return []; + var ret = e.children; + ret.push(lid); + return ret; + } + + function long2ip(ip) { + // discuss at: http://locutus.io/php/long2ip/ + // original by: Waldo Malqui Silva (http://waldo.malqui.info) + if (!isFinite(ip)) return false; + return [ip >>> 24, ip >>> 16 & 0xFF, ip >>> 8 & 0xFF, ip & 0xFF].join('.'); + } + + $('.loc-check').change(updateLocations); + updateLocations(); +}); +//--></script>
\ No newline at end of file diff --git a/modules-available/dnbd3/templates/page-serverlist.html b/modules-available/dnbd3/templates/page-serverlist.html index b7fe9038..e50c6bcb 100644 --- a/modules-available/dnbd3/templates/page-serverlist.html +++ b/modules-available/dnbd3/templates/page-serverlist.html @@ -1,51 +1,118 @@ +<h1>{{lang_dnbd3Management}}</h1> +<p><i>{{lang_dnbd3IntroText}}</i></p> + <form method="post"> <input type="hidden" name="token" value="{{token}}"> - <button name="re" value="bla">Refresh</button> + <h2> + {{lang_serverList}} + <button type="submit" class="btn btn-default" name="action" value="refresh"><span class="glyphicon glyphicon-refresh"></span></button> + </h2> +</form> +<form method="post" action="?do=dnbd3"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="delserver"> + <table class="table"> + <tr> + <th>{{lang_proxyServerTHead}}</th> + <th class="text-right">{{lang_clientCount}}</th> + <th class="text-right">{{lang_lastSeen}}</th> + <th class="text-right">{{lang_uptime}}</th> + <th class="text-right">{{lang_txTotal}}</th> + <th class="text-right">{{lang_rxTotal}}</th> + <th class="text-right">{{lang_locations}}</th> + <th> </th> + </tr> + {{#list}} + <tr> + <td class="{{#self}}slx-bold{{/self}}"> + {{#uptime}} + <span class="glyphicon glyphicon-ok text-success"></span> + {{/uptime}} + {{^uptime}} + <span class="glyphicon glyphicon-off"></span> + {{/uptime}} + {{fixedip}} + {{#machineuuid}} + <a href="?do=Statistics&uuid={{machineuuid}}">{{clientip}}</a> + <div class="small">{{hostname}}</div> + {{/machineuuid}} + </td> + <td data-sort="int" data-sort-default="desc" class="text-right"> + {{#uptime}} + <a href="?do=dnbd3&show=clients&server={{serverid}}">{{clientcount}}</a> + {{/uptime}} + {{^uptime}} + - + {{/uptime}} + </td> + <td data-sort="int" data-sort-default="desc" data-sort-value="{{lastseen}}" class="text-right text-nowrap"> + {{lastseen_s}} + </td> + <td data-sort="int" data-sort-default="desc" data-sort-value="{{uptime}}" class="text-right text-nowrap"> + {{uptime_s}} + </td> + <td data-sort="int" data-sort-default="desc" data-sort-value="{{totalup}}" class="text-right text-nowrap"> + {{totalup_s}} + </td> + <td data-sort="int" data-sort-default="desc" data-sort-value="{{totaldown}}" class="text-right text-nowrap"> + {{totaldown_s}} + </td> + <td class="text-right text-nowrap"> + {{^self}} + {{^locations}} + <i>{{lang_global}}</i> + {{/locations}} + {{#locations}} + {{locations}} + {{/locations}} + <a href="?do=dnbd3&show=locations&server={{serverid}}" class="btn btn-default btn-xs"> + <span class="glyphicon glyphicon-map-marker"></span> + </a> + {{/self}} + </td> + <td> + {{^self}} + <button class="btn btn-danger btn-xs" name="serverid" value="{{serverid}}"><span class="glyphicon glyphicon-trash"></span></button> + {{/self}} + </td> + </tr> + {{/list}} + </table> </form> -<table class="table"> - <tr> - <th>{{lang_proxyServerTHead}}</th> - <th class="text-right">{{lang_lastSeen}}</th> - <th class="text-right">{{lang_uptime}}</th> - <th class="text-right">{{lang_txTotal}}</th> - <th class="text-right">{{lang_rxTotal}}</th> - <th class="text-right">{{lang_clientCount}}</th> - </tr> - {{#list}} - <tr> - <td> - {{#uptime}} - <span class="glyphicon glyphicon-ok text-success"></span> - {{/uptime}} - {{^uptime}} - <span class="glyphicon glyphicon-off"></span> - {{/uptime}} - {{fixedip}} - {{#machineuuid}} - <a href="?do=Statistics&uuid={{machineuuid}}">{{hostname}} ({{clientip}})</a> - {{/machineuuid}} - </td> - <td data-sort="int" data-sort-default="desc" data-sort-value="{{lastseen}}" class="text-right"> - {{lastseen_s}} - </td> - <td data-sort="int" data-sort-default="desc" data-sort-value="{{uptime}}" class="text-right"> - {{uptime_s}} - </td> - <td data-sort="int" data-sort-default="desc" data-sort-value="{{totalup}}" class="text-right"> - {{totalup_s}} - </td> - <td data-sort="int" data-sort-default="desc" data-sort-value="{{totaldown}}" class="text-right"> - {{totaldown_s}} - </td> - <td data-sort="int" data-sort-default="desc" class="text-right"> - {{#uptime}} - <a href="?do=dnbd3&show=clients&server={{serverid}}">{{clientcount}}</a> - {{/uptime}} - {{^uptime}} - - - {{/uptime}} - </td> - </tr> - {{/list}} -</table>
\ No newline at end of file +<div class="buttonbar pull-right"> + <button type="button" class="btn btn-success" data-toggle="modal" data-target="#add-modal"> + <span class="glyphicon glyphicon-plus"></span> + {{lang_addExternalServer}} + </button> + <a class="btn btn-success" href="?do=runmode&module=dnbd3&modeid=proxy&redirect=?do=dnbd3"> + <span class="glyphicon glyphicon-plus"></span> + {{lang_addManagedProxy}} + </a> +</div> + +<div id="add-modal" class="modal fade" role="dialog"> + <div class="modal-dialog"> + + <div class="modal-content"> + <div class="modal-header"> + <button type="button" class="close" data-dismiss="modal">×</button> + <h4 class="modal-title"><b>{{lang_addServer}}</b></h4> + </div> + <div class="modal-body"> + <p>{{lang_enterIpOfServer}}</p> + <form method="post"> + <input type="hidden" name="token" value="{{token}}"> + <input type="text" class="form-control" name="newip"> + <br> + <button type="submit" class="btn btn-default btn-success pull-right" name="action" value="addserver">{{lang_save}}</button> + </form> + <div class="clearfix"></div> + </div> + <div class="modal-footer"> + </div> + </div> + </div> +</div> + +<div class="clearfix"></div>
\ No newline at end of file |