WIP edit records

This commit is contained in:
AJ ONeal 2018-01-20 21:08:29 -07:00
parent 7118cb6852
commit 4612f2cbad
3 changed files with 31 additions and 0 deletions

3
lib/public/css/style.css Normal file
View File

@ -0,0 +1,3 @@
input[class*="js-record-"] {
text-align: right
}

View File

@ -2,6 +2,7 @@
<html> <html>
<head> <head>
<title>ADNS</title> <title>ADNS</title>
<link href="css/style.css" rel="stylesheet" />
</head> </head>
<body> <body>
<h1>ADNS Zones and Records</h1> <h1>ADNS Zones and Records</h1>

View File

@ -250,6 +250,33 @@
console.log(id); console.log(id);
var record = cache.recordsMap[id]; var record = cache.recordsMap[id];
console.log(record); console.log(record);
var formTpl;
formTpl = tpls.formsMap[record.type.toLowerCase()];
if (!formTpl) {
record.typex = 'typex';
formTpl = tpls.formsMap.typex;
}
formTpl = tpls.formsMap[record.typex || record.type.toLowerCase()];
$qs('select.js-record-form-type').value = record.typex || record.type;
$qs('select.js-record-form-type').dispatchEvent(new Event('change', { bubbles: true }));
$qs('.js-record-form-tpl').innerHTML = formTpl || '';
record.host = record.name.replace(new RegExp('\\.?' + record.zone.replace(/\./g, '\\.') + '$'), '');
console.log('record.type:');
console.log(record.type.toLowerCase());
Object.keys(record).forEach(function (key) {
var $el = $qs('.js-record-' + key, $qs('.js-record-form-tpl'));
if (!$el) {
return;
}
$el.value = record[key];
});
if (!record.host) {
$qs('.js-record-host').placeholder = '@';
}
}); });
$qs('select.js-record-form-type').value = ''; $qs('select.js-record-form-type').value = '';