fix(metablogizer): Fix require path and async hosting status load
- Fix qrcode require path (slash to dot notation) - Load hosting status asynchronously to prevent XHR timeout - Dashboard now loads instantly with sites, HAProxy/IP populate after Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
6e247800a4
commit
60ed796b5a
@ -202,13 +202,12 @@ return baseclass.extend({
|
|||||||
var self = this;
|
var self = this;
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
self.getStatus(),
|
self.getStatus(),
|
||||||
self.listSites(),
|
self.listSites()
|
||||||
self.getHostingStatus().catch(function() { return {}; })
|
|
||||||
]).then(function(results) {
|
]).then(function(results) {
|
||||||
return {
|
return {
|
||||||
status: results[0] || {},
|
status: results[0] || {},
|
||||||
sites: results[1] || [],
|
sites: results[1] || [],
|
||||||
hosting: results[2] || {}
|
hosting: {}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
'require ui';
|
'require ui';
|
||||||
'require fs';
|
'require fs';
|
||||||
'require metablogizer.api as api';
|
'require metablogizer.api as api';
|
||||||
'require metablogizer/qrcode as qrcode';
|
'require metablogizer.qrcode as qrcode';
|
||||||
|
|
||||||
return view.extend({
|
return view.extend({
|
||||||
status: {},
|
status: {},
|
||||||
@ -27,6 +27,22 @@ return view.extend({
|
|||||||
var sites = this.sites;
|
var sites = this.sites;
|
||||||
var hosting = this.hosting;
|
var hosting = this.hosting;
|
||||||
|
|
||||||
|
// Load hosting status asynchronously after render
|
||||||
|
api.getHostingStatus().then(function(h) {
|
||||||
|
self.hosting = h || {};
|
||||||
|
var haproxyEl = document.getElementById('haproxy-status');
|
||||||
|
var ipEl = document.getElementById('public-ip');
|
||||||
|
if (haproxyEl) {
|
||||||
|
haproxyEl.innerHTML = '';
|
||||||
|
haproxyEl.appendChild(h.haproxy_status === 'running' ?
|
||||||
|
E('span', { 'style': 'color:#0a0' }, _('Running')) :
|
||||||
|
E('span', { 'style': 'color:#a00' }, _('Stopped')));
|
||||||
|
}
|
||||||
|
if (ipEl) {
|
||||||
|
ipEl.textContent = h.public_ip || '-';
|
||||||
|
}
|
||||||
|
}).catch(function() {});
|
||||||
|
|
||||||
return E('div', { 'class': 'cbi-map' }, [
|
return E('div', { 'class': 'cbi-map' }, [
|
||||||
E('h2', {}, _('MetaBlogizer')),
|
E('h2', {}, _('MetaBlogizer')),
|
||||||
E('div', { 'class': 'cbi-map-descr' }, _('Static site publisher with HAProxy vhosts and SSL')),
|
E('div', { 'class': 'cbi-map-descr' }, _('Static site publisher with HAProxy vhosts and SSL')),
|
||||||
@ -41,13 +57,11 @@ return view.extend({
|
|||||||
]),
|
]),
|
||||||
E('tr', { 'class': 'tr' }, [
|
E('tr', { 'class': 'tr' }, [
|
||||||
E('td', { 'class': 'td' }, _('HAProxy')),
|
E('td', { 'class': 'td' }, _('HAProxy')),
|
||||||
E('td', { 'class': 'td' }, hosting.haproxy_status === 'running' ?
|
E('td', { 'class': 'td', 'id': 'haproxy-status' }, E('em', {}, _('Loading...')))
|
||||||
E('span', { 'style': 'color:#0a0' }, _('Running')) :
|
|
||||||
E('span', { 'style': 'color:#a00' }, _('Stopped')))
|
|
||||||
]),
|
]),
|
||||||
E('tr', { 'class': 'tr' }, [
|
E('tr', { 'class': 'tr' }, [
|
||||||
E('td', { 'class': 'td' }, _('Public IP')),
|
E('td', { 'class': 'td' }, _('Public IP')),
|
||||||
E('td', { 'class': 'td' }, hosting.public_ip || '-')
|
E('td', { 'class': 'td', 'id': 'public-ip' }, _('Loading...'))
|
||||||
]),
|
]),
|
||||||
E('tr', { 'class': 'tr' }, [
|
E('tr', { 'class': 'tr' }, [
|
||||||
E('td', { 'class': 'td' }, _('Sites')),
|
E('td', { 'class': 'td' }, _('Sites')),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user