sky.js/sky.dhcp.js

78 lines
2.2 KiB
JavaScript

function editIPPool(ippool, editable)
{
skyapi().getJson( "/DHCP/collections/IPPool/" + ippool, function(pool){
$.skyForm( pool, {
title: "DHCP IP Pool",
fields: [
{ key: "Name", label: "Bezeichnung", },
{ key: "FirstIP", label: "Erste IP", type: "IPv4", },
{ key: "LastIP", label: "Letzte IP", type: "IPv4", },
{ key: "DefaultLeaseTime", label: "Standard Gültigkeit", }
],
accept: function(pool){
alert("OK: " + pool);
},
} );
} );
}
function editDHCPServerInterface(intf, editable){
skyapi().getJson( "/DHCP/collections/DHCPServerInterface/" + intf, function(intf){
$.skyForm( intf, {
title: "DHCP Server Interface",
fields: [
{ key: "Name", label: "Bezeichnung", },
{ key: "InterfaceAddress", label: "Interface IP", },
{ key: "IPPool", label: "IP Pool", type: "IPPool", toEditor: function(p){ return p.Name; } },
]
} );
} );
}
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) );
} );
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" ); },
},
]
});
}