diff --git a/lib/public/css/style.css b/lib/public/css/style.css new file mode 100644 index 0000000..a8bc4f6 --- /dev/null +++ b/lib/public/css/style.css @@ -0,0 +1,3 @@ +input[class*="js-record-"] { + text-align: right +} diff --git a/lib/public/index.html b/lib/public/index.html index 4fad2e3..4705516 100644 --- a/lib/public/index.html +++ b/lib/public/index.html @@ -2,6 +2,7 @@ ADNS +

ADNS Zones and Records

diff --git a/lib/public/js/app.js b/lib/public/js/app.js index 46bb97c..3fe33c1 100644 --- a/lib/public/js/app.js +++ b/lib/public/js/app.js @@ -250,6 +250,33 @@ console.log(id); var record = cache.recordsMap[id]; 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 = '';