htdocs: expand RR in interface

This commit is contained in:
nemunaire 2019-07-16 17:59:37 +02:00
parent 213e2c286f
commit 7d1a8a319f
3 changed files with 140 additions and 5 deletions

View File

@ -71,6 +71,115 @@ angular.module("LibreDNSApp")
return input.capitalize();
}
})
.filter("nsclass", function() {
return function(input) {
switch(input) {
case 1:
return "IN";
case 3:
return "CH";
case 4:
return "HS";
case 254:
return "NONE";
default:
return "##";
}
}
})
.filter("nsrrtype", function() {
return function(input) {
switch(input) {
case 1: return "A";
case 2: return "NS";
case 3: return "MD";
case 4: return "MF";
case 5: return "CNAME";
case 6: return "SOA";
case 7: return "MB";
case 8: return "MG";
case 9: return "MR";
case 10: return "NULL";
case 11: return "WKS";
case 12: return "PTR";
case 13: return "HINFO";
case 14: return "MINFO";
case 15: return "MX";
case 16: return "TXT";
case 17: return "RP";
case 18: return "AFSDB";
case 19: return "X25";
case 20: return "ISDN";
case 21: return "RT";
case 22: return "NSAP";
case 23: return "NSAP-PTR";
case 24: return "SIG";
case 25: return "KEY";
case 26: return "PX";
case 27: return "GPOS";
case 28: return "AAAA";
case 29: return "LOC";
case 30: return "NXT";
case 31: return "EID";
case 32: return "NIMLOC";
case 33: return "SRV";
case 34: return "ATMA";
case 35: return "NAPTR";
case 36: return "KX";
case 37: return "CERT";
case 38: return "A6";
case 39: return "DNAME";
case 40: return "SINK";
case 41: return "OPT";
case 42: return "APL";
case 43: return "DS";
case 44: return "SSHFP";
case 45: return "IPSECKEY";
case 46: return "RRSIG";
case 47: return "NSEC";
case 48: return "DNSKEY";
case 49: return "DHCID";
case 50: return "NSEC3";
case 51: return "NSEC3PARAM";
case 52: return "TLSA";
case 53: return "SMIMEA";
case 55: return "HIP";
case 56: return "NINFO";
case 57: return "RKEY";
case 58: return "TALINK";
case 59: return "CDS";
case 60: return "CDNSKEY";
case 61: return "OPENPGPKEY";
case 62: return "CSYNC";
case 63: return "ZONEMD";
case 99: return "SPF";
case 100: return "UINFO";
case 101: return "UID";
case 102: return "GID";
case 103: return "UNSPEC";
case 104: return "NID";
case 105: return "L32";
case 106: return "L64";
case 107: return "LP";
case 108: return "EUI48";
case 109: return "EUI64";
case 249: return "TKEY";
case 250: return "TSIG";
case 251: return "IXFR";
case 252: return "AXFR";
case 253: return "MAILB";
case 254: return "MAILA";
case 256: return "URI";
case 257: return "CAA";
case 258: return "AVC";
case 259: return "DOA";
case 260: return "AMTRELAY";
case 32768: return "TA";
case 32769: return "DLV";
default: return "#";
}
}
})
.directive('integer', function() {
return {
require: 'ngModel',
@ -145,6 +254,9 @@ angular.module("LibreDNSApp")
.controller("RRController", function($scope, RR, $routeParams, $location) {
$scope.rrs = RR.query({ zoneId: $routeParams.zoneId });
$scope.toogleRR = function() {
this.rr.expand = !this.rr.expand;
}
$scope.addRR = function() {
var rr = new RR();
rr.edit = true;

View File

@ -16,7 +16,7 @@
</thead>
<tbody>
<tr ng-repeat="zone in zones | filter: query">
<td ng-click="show(zone)">
<td ng-click="show(zone)" class="text-monospace">
{{ zone | stripHTML }}
</td>
<td>

View File

@ -7,15 +7,38 @@
</h3>
<p><input type="search" class="form-control form-control-sm" placeholder="Search" ng-model="query" autofocus></p>
<table class="table table-hover table-bordered table-striped table-sm">
<table class="table table-hover table-bordered table-striped table-sm" style="table-layout: fixed;">
<thead>
<tr>
<th>resource records</th>
<th style="width: 5%;">act</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="rr in rrs | filter: query">
<td ng-if="!rr.edit">
{{ rr.string }}
<td ng-if="!rr.edit" style="overflow:hidden; text-overflow: ellipsis;white-space: nowrap;">
<span ng-click="toogleRR()" class="glyphicon glyphicon-chevron-right" ng-if="!rr.expand"></span>
<span ng-click="toogleRR()" class="glyphicon glyphicon-chevron-down" ng-if="rr.expand"></span>
<span ng-click="toogleRR()" class="text-monospace" title="{{ rr.string }}">{{ rr.string }}</span>
<div class="row" ng-show="rr.expand">
<dl class="col-sm-6 row">
<dt class="col-sm-3 text-right">Class</dt>
<dd class="col-sm-9 text-muted text-monospace">{{ rr.fields.Hdr.Class | nsclass }}</dd>
<dt class="col-sm-3 text-right">TTL</dt>
<dd class="col-sm-9 text-muted text-monospace">{{ rr.fields.Hdr.Ttl }}</dd>
<dt class="col-sm-3 text-right">RRType</dt>
<dd class="col-sm-9 text-muted text-monospace">{{ rr.fields.Hdr.Rrtype | nsrrtype }}</dd>
</dl>
<ul class="col-sm-6" style="list-style: none">
<li ng-repeat="(k,v) in rr.fields" ng-if="k != 'Hdr'">
<strong class="float-left mr-2">{{ k }}</strong> <span class="text-muted text-monospace" style="display:block;overflow:hidden; text-overflow: ellipsis;white-space: nowrap;" title="{{v}}">{{ v }}</span>
</li>
</ul>
</div>
</td>
<td ng-if="rr.edit">
<form ng-submit="newRR(rr)">
<input class="form-control" ng-model="rr.string">
<input class="form-control text-monospace" ng-model="rr.string">
</form>
</td>
<td>