master
Harald Wolff 2019-04-25 00:30:32 +02:00
parent 8ac23dc688
commit 703a21859f
13 changed files with 202 additions and 38 deletions

View File

@ -80,6 +80,7 @@
<Folder Include="www\css\" />
<Folder Include="www\dist\" />
<Folder Include="www\system\" />
<Folder Include="www\js\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
@ -152,9 +153,6 @@
<None Include="www\index.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="www\skyapi.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="www\topnav.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
@ -179,6 +177,15 @@
<None Include="www\dhcp\IPPool.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="www\css\bootstrap-reboot.min.css" />
<None Include="www\js\popper.min.js" />
<None Include="www\js\bootstrap.bundle.min.js" />
<None Include="www\js\sky.dhcp.js" />
<None Include="www\js\sky.base.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="www\js\chosen.jquery.min.js" />
<None Include="www\css\chosen.min.css" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,8 @@
/*!
* Bootstrap Reboot v4.3.1 (https://getbootstrap.com/)
* Copyright 2011-2019 The Bootstrap Authors
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important}
/*# sourceMappingURL=bootstrap-reboot.min.css.map */

11
www/css/chosen.min.css vendored 100644

File diff suppressed because one or more lines are too long

View File

@ -2,22 +2,12 @@
padding: 0px;
margin: 0px;
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
display: block;
position: absolute;
top: 0px;
bottom: 0px;
left: 0px;
right: 0px;
}
div {
margin: 0px;
padding: 0px;
flex-grow: 0;
right: 0px;
}
div#body {
@ -25,9 +15,19 @@ div#body {
height: 100%;
width: 100%;
flex-direction: column;
flex-direction: column;
}
/*!
div {
margin: 0px;
padding: 0px;
flex-grow: 0;
}
h1,h2,h3,h4,h5,h6 {
margin: 0px;
padding:2px;
@ -54,7 +54,7 @@ a {
text-decoration: none;
color: inherit;
}
*/
/*!
button {
border: 1px solid black;
@ -426,7 +426,7 @@ span#nWARN, span#nCRITICAL {
}
#content a::before {
#content a:not([class])::before {
content: '\25B8';
color: blue;
padding-right: 2px;

View File

@ -14,6 +14,7 @@
{ title: "Client MAC", data: "ClientMAC.Bytes", render: function(d,t,r){ return DecodeMAC(d); } },
{ title: "Client IP", data: "ClientIP" },
{ title: "Client Name", data: "ClientName" },
{ title: "Server Interface", data: "ServerInterface", render: function(d,t,r){ return `<a href="javascript:editDHCPServerInterface('${d}');">${d}</a>`; } },
{ title: "Status", data: "LeaseState" },
{ title: "Erstellt", data: "Created" },
{ title: "Gültig bis", data: "ValidThrough" },

View File

@ -11,7 +11,8 @@
$("#IPPools").DataTable({
columns: [
{ title: "Bezeichnung", data: "Name", render: function(d,t,r){ return `<a href="/dhcp/IPPool.html/${d}">${d}</a>`; } },
//{ title: "Bezeichnung", data: "Name", render: function(d,t,r){ return `<a href="/dhcp/IPPool.html/${d}">${d}</a>`; } },
{ title: "Bezeichnung", data: "Name", render: function(d,t,r){ return `<a href="javascript:editIPPool('${d}');">${d}</a>`; } },
{ title: "Erste IP", data: "FirstIP" },
{ title: "Letzte IP", data: "LastIP" },
{ title: "Nächste IP", data: "NextIP" },

View File

@ -11,9 +11,9 @@
$("#serverInterfaces").DataTable({
columns: [
{ title: "Bezeichnung", data: "Name" },
{ title: "Bezeichnung", data: "Name", render: function(d,t,r){ return `<a href="javascript:editDHCPServerInterface('${d}');">${d}</a>`; } },
{ title: "Interface IP", data: "InterfaceAddress" },
{ title: "Pool", data: "Pool.Name", render: function(d,t,r){ return `<a href="/dhcp/IPPool.html/${d}">${d}</a>`; } },
{ title: "Pool", data: "Pool.Name", render: function(d,t,r){ return `<a href="javascript:editIPPool('${d}');">${d}</a>`; } },
],
columnDefs: [
],

View File

@ -4,24 +4,31 @@
<meta charset="utf-8" />
<title>SkySpot WebUI (Alpha)</title>
<link href="/css/bootstrap-reboot.min.css" rel="stylesheet" />
<link href="/css/jquery-ui.min.css" rel="stylesheet" />
<link href="/css/datatables.min.css" rel="stylesheet" />
<link href="/css/Chart.min.css" rel="stylesheet" />
<link href="/css/style.css" rel="stylesheet" />
<script type="text/javascript" src="/skyapi.js"></script>
<link href="/css/chosen.min.css" rel="stylesheet" />
<script type="text/javascript" src="/dist/jquery.min.js"></script>
<script type="text/javascript" src="/dist/jquery-ui.min.js"></script>
<script type="text/javascript" src="/js/chosen.jquery.min.js"></script>
<script type="text/javascript" src="/js/popper.min.js"></script>
<script type="text/javascript" src="/js/bootstrap.bundle.min.js"></script>
<script type="text/javascript" src="/dist/moment-with-locales.js"></script>
<script type="text/javascript" src="/dist/datatables.min.js"></script>
<script type="text/javascript" src="/dist/percentageBars.js"></script>
<script type="text/javascript" src="/dist/Chart.min.js"></script>
<link href="/css/style.css" rel="stylesheet" />
<script type="text/javascript" src="/js/sky.base.js"></script>
<script type="text/javascript" src="/js/sky.dhcp.js"></script>
</head>
<body>
<script type="text/javascript">
$( document ).tooltip();
//$( document ).tooltip();
</script>
<div id="body">

7
www/js/bootstrap.bundle.min.js vendored 100644

File diff suppressed because one or more lines are too long

3
www/js/chosen.jquery.min.js vendored 100644

File diff suppressed because one or more lines are too long

5
www/js/popper.min.js vendored 100644

File diff suppressed because one or more lines are too long

View File

@ -26,9 +26,10 @@ function SKYAPI(baseurl){
this.__request = function(method, page, json, handler = null){
if (page[0] == '/')
page = page.substr(1);
var async = (handler) ? true : false;
var x = new XMLHttpRequest();
if (handler != null)
if (async)
{
x.onload = function(){
var responseText = x.responseText;
@ -38,19 +39,28 @@ function SKYAPI(baseurl){
handler( responseText );
}
}
x.open(method, this.baseurl + page);
x.open(method, this.baseurl + page, async );
if (json)
x.send(JSON.stringify(json));
else
x.send();
if (!async)
return x.responseText;
return null;
}
this.getJson = function(page, handler){
var j = function(t){
handler(JSON.parse(t));
};
return this.get( page, null, j );
if (handler)
{
var j = function(t){
handler(JSON.parse(t));
};
return this.get( page, null, j );
}
var r = this.get( page );
return JSON.parse(r);
}
this.call = function(endpoint,method,parameters = [], receiver = null){
@ -165,15 +175,23 @@ function DecodeMAC(b64mac)
return BytesToString(smac);
}
function PopulateForm( o )
function PopulateForm( o, options = {} )
{
var opt = Object.assign( {
top: null,
transform: function(v){ return v; },
properties: {},
}, options );
for (const key in o)
{
var i = $("#" + key);
var po = Object.assign( {
transform: opt.transform,
}, opt.properties[key]);
var i = $("#" + key, opt.top);
if (i.length)
{
i.val(o[key]);
}
i.val( po.transform(o[key]) );
}
}

96
www/js/sky.dhcp.js 100644
View File

@ -0,0 +1,96 @@

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" ); },
},
]
});
}