ln.skyspot/www/js/sky.dhcp.js

97 lines
2.4 KiB
JavaScript

function editIPPool(ippool, editable)
{
var content = $(`<div>
<fieldset>
<label>Bezeichnung</label>
<input type="text" id="Name">
<label>Erste IP</label>
<input type="text" id="FirstIP">
<label>Letzte IP</label>
<input type="text" id="LastIP">
<label>Standard Gültigkeit</label>
<input type="text" id="DefaultLeaseTime">
</fieldset>
</div>`);
skyapi().getJson( "/DHCP/collections/IPPool/" + ippool, function(ippool){
PopulateForm( ippool, {
top: content,
});
content.dialog( "open" );
} );
content.dialog({
modal: true,
closeOnEscape: true,
draggable: false,
title: "IP Pool",
minWidth: 600,
autoOpen: false,
buttons: [
{
text: "abbrechen",
click: function(){ $(this).dialog( "close" ); },
},
{
text: "OK",
click: function(){ $(this).dialog( "close" ); },
},
]
});
}
function editDHCPServerInterface(intf, editable)
{
var content = $(`<div>
<fieldset>
<label>Bezeichnung</label>
<input type="text" id="Name">
<label>Interface IP</label>
<input type="text" id="InterfaceAddress">
<label>IP Pool</label>
<select id="Pool"></select>
</fieldset>
</div>`);
var pools = skyapi().getJson("/DHCP/collections/IPPool");
pools.forEach( function(e){
$("<option></option>")
.attr("id", e.Name)
.text( e.Name )
.appendTo( $("#Pool", content) );
} );
skyapi().getJson( "/DHCP/collections/DHCPServerInterface/" + intf, function(intf){
PopulateForm( intf, {
top: content,
properties: {
"Pool": { transform: function(d){ return d.Name; }, },
}
} );
content.dialog( "open" );
} );
content.dialog({
modal: true,
closeOnEscape: true,
draggable: false,
title: "DHCP Server Interface",
minWidth: 600,
autoOpen: false,
buttons: [
{
text: "abbrechen",
click: function(){ $(this).dialog( "close" ); },
},
{
text: "OK",
click: function(){ $(this).dialog( "close" ); },
},
]
});
}