From 017e0c7344794c46ff18b83843f359bd908b1e61 Mon Sep 17 00:00:00 2001 From: Robert Kerr Date: Wed, 28 Nov 2018 21:19:38 +0000 Subject: [PATCH] Fix case where TTL not in ttl_options If PowerDNS-Admin is working on a database created by another tool or ttl_options is changed the current TTL might be missing from the valid list, fix this --- app/static/custom/js/custom.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/static/custom/js/custom.js b/app/static/custom/js/custom.js index 759cdee..4f295bb 100644 --- a/app/static/custom/js/custom.js +++ b/app/static/custom/js/custom.js @@ -112,18 +112,33 @@ function restoreRow(oTable, nRow) { oTable.draw(); } +function sec2str(t){ + var d = Math.floor(t/86400), + h = Math.floor(t/3600) % 24, + m = Math.floor(t/60) % 60, + s = t % 60; + return (d>0?d+' days ':'')+(h>0?h+' hours ':'')+(m>0?m+' minutes ':'')+(s>0?s+' seconds':''); +} + function editRow(oTable, nRow) { var isDisabled = 'true'; var aData = oTable.row(nRow).data(); var jqTds = oTable.cells(nRow,'').nodes(); var record_types = ""; var ttl_opts = ""; + var ttl_not_found = true; for(var i = 0; i < records_allow_edit.length; i++) { var record_type = records_allow_edit[i]; record_types += ""; } for(var i = 0; i < ttl_options.length; i++) { ttl_opts += ""; + if (ttl_options[i][0] == aData[3]) { + ttl_not_found = false; + } + } + if (ttl_not_found) { + ttl_opts += ""; } jqTds[0].innerHTML = ''; jqTds[1].innerHTML = '';