soselo/views/home.php

38 lines
1.1 KiB
PHP
Raw Normal View History

<div class="flex hmax">
<div id="instances" class="center">
</div>
<div id="instances-item">
<a href="#instance/software={software};instance={instance}">
<div class="flex">
<img data-src="img/software-{software}.png"/>
<div class="flex" style="padding: 0 2em">
<span class="center">{instance}</span>
</div>
</div>
</a>
</div>
</div>
<script>
function load__home() {
http.get('api/v1/config/get',{},function(data) {
window.vars['instance_config'] = JSON.parse(data);
E.template('instances', function(TPL) {
var html = '';
for (var i = 0; i < window.vars.instance_config['supported_ap_software'].length; i++) {
var tpl = TPL;
const soft = window.vars.instance_config['supported_ap_software'][i];
for (var j = 0; j < window.vars.instance_config['hosts'][soft].length; j++) {
const hostcfg = window.vars.instance_config['hosts'][soft][j];
tpl = tpl.replaceAll('{software}', soft);
tpl = tpl.replaceAll('{software:cap}', capitalize(soft));
tpl = tpl.replaceAll('{instance}', hostcfg['instance']);
html += tpl;
}
}
return html;
});
});
}
</script>