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

105 lines
2.7 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>`);
$("#FirstIP", content).ipAddress();
$("#LastIP", content).ipAddress();
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){
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" },
]
} );
} );
}
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" ); },
},
]
});
}