parent
f7498566f8
commit
fcf952a176
|
@ -0,0 +1,47 @@
|
|||
<div class="flex hmax">
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function load__instance(args) {
|
||||
const hargs = parse_hash_arguments(args[1]);
|
||||
|
||||
const _error400 = function(msg) {
|
||||
msg = msg || 'Parameters are not correct';
|
||||
console.log('TODO: handle error correctly');
|
||||
};
|
||||
|
||||
const _paint = function() {
|
||||
console.log(window.vars['current_instance']);
|
||||
console.log('TODO: handle UI and stuff here');
|
||||
};
|
||||
|
||||
const _main = function() {
|
||||
if (hargs['software'] === undefined ||
|
||||
!window.vars['instance_config']['supported_ap_software']
|
||||
.includes(hargs['software']))
|
||||
return _error400();
|
||||
if (hargs['instance'] === undefined)
|
||||
return _error400();
|
||||
var found = false;
|
||||
for (var i = 0; i < window.vars['instance_config']['hosts'][hargs['software']].length; i++)
|
||||
{
|
||||
const item = window.vars['instance_config']['hosts'][hargs['software']][i];
|
||||
if (item['instance'] === hargs['instance']) {
|
||||
window.vars['current_instance'] = item;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
return _error400();
|
||||
_paint();
|
||||
};
|
||||
|
||||
if (window.vars['instance_config'] === undefined) {
|
||||
http.get('api/v1/config/get',{},function(data) {
|
||||
window.vars['instance_config'] = JSON.parse(data);
|
||||
_main();
|
||||
});
|
||||
} else { _main() }
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue