Lines 561-573
Link Here
|
561 |
n.append("<legend>" + _("Interface details") + "</legend>"); |
561 |
n.append("<legend>" + _("Interface details") + "</legend>"); |
562 |
n.append(`<input type="hidden" name="interface_counter" value="${i}" />`); |
562 |
n.append(`<input type="hidden" name="interface_counter" value="${i}" />`); |
563 |
let ol = $('<ol class="interface-form"></ol>'); |
563 |
let ol = $('<ol class="interface-form"></ol>'); |
564 |
ol.append(`<li><label for="interface_name_${i}">` + _("Name: ") + `</label><input type="text" size="40" id="interface_name_${i}" name="interface_name_${i}" value="${interface.name}" /></li>`); |
564 |
let attributes = [ |
565 |
ol.append(`<li><label for="interface_type_${i}">` + _("Type: ") + `</label><input type="text" size="40" id="interface_type_${i}" name="interface_type_${i}" value="${interface.type}" /></li>`); |
565 |
{ label: _("Name"), name: 'name', node: 'input' }, |
566 |
ol.append(`<li><label for="interface_uri_${i}">` + _("URI: ") + `</label><input type="text" size="40" id="interface_uri_${i}" name="interface_uri_${i}" value="${interface.uri}" /></li>`); |
566 |
{ label: _("Type"), name: 'type', node: 'input' }, |
567 |
ol.append(`<li><label for="interface_login_${i}">` + _("Login: ") + `</label><input type="text" size="40" id="interface_login_${i}" name="interface_login_${i}" value="${interface.login}" /></li>`); |
567 |
{ label: _("URI"), name: 'uri', node: 'input' }, |
568 |
ol.append(`<li><label for="interface_password_${i}">` + _("Password: ") + `</label><input type="text" size="40" id="interface_password_${i}" name="interface_password_${i}" value="${interface.password}" /></li>`); |
568 |
{ label: _("Login"), name: 'login', node: 'input' }, |
569 |
ol.append(`<li><label for="interface_account_email_${i}">` + _("Account email: ") + `</label><input type="text" size="40" id="interface_account_email_${i}" name="interface_account_email_${i}" value="${interface.account_email}" /></li>`); |
569 |
{ label: _("Password"), name: 'password', node: 'input' }, |
570 |
ol.append(`<li><label for="interface_notes_${i}">` + _("Notes: ") + `</label><textarea cols="40" rows="3" id="interface_notes_${i}" name="interface_notes_${i}">${interface.notes}</textarea></li>`); |
570 |
{ label: _("Account email"), name: 'account_email', node: 'input' }, |
|
|
571 |
{ label: _("Notes"), name: 'notes', node: 'textarea' } |
572 |
]; |
573 |
attributes.forEach((attribute, ii) => { |
574 |
let li = $('<li></li>'); |
575 |
li.append(`<label for="interface_${attribute.name}_${i}">${attribute.label}</label>`); |
576 |
if( attribute.node == 'input' ) { |
577 |
li.append(`<input type="text" size="40" id="interface_${attribute.name}_${i}" name="interface_${attribute.name}_${i}" value="${interface[attribute.name]}" />`); |
578 |
} else if ( attribute.node == 'textarea' ) { |
579 |
li.append(`<textarea cols="40" rows="3" id="interface_${attribute.name}_${i}" name="interface_${attribute.name}_${i}">${interface[attribute.name]}</textarea>`); |
580 |
} |
581 |
ol.append(li); |
582 |
}); |
571 |
ol.append(`<li><button class="btn btn-default" onclick="remove_interface(${i});"><i class="fa fa-trash"></i> Delete interface</li>`); |
583 |
ol.append(`<li><button class="btn btn-default" onclick="remove_interface(${i});"><i class="fa fa-trash"></i> Delete interface</li>`); |
572 |
n.append(ol); |
584 |
n.append(ol); |
573 |
nodes.append(n); |
585 |
nodes.append(n); |
574 |
- |
|
|