WIP edit records
This commit is contained in:
		
							parent
							
								
									7118cb6852
								
							
						
					
					
						commit
						4612f2cbad
					
				
							
								
								
									
										3
									
								
								lib/public/css/style.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								lib/public/css/style.css
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					input[class*="js-record-"] {
 | 
				
			||||||
 | 
					  text-align: right
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -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>
 | 
				
			||||||
 | 
				
			|||||||
@ -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 = '';
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user