mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-06 19:46:52 +03:00
feat: add visibility change event listener for diagnostics updates
This commit is contained in:
@@ -97,7 +97,8 @@ function createConfigSection(section, map, network) {
|
|||||||
|
|
||||||
if (activeConfig) {
|
if (activeConfig) {
|
||||||
if (activeConfig.includes('#')) {
|
if (activeConfig.includes('#')) {
|
||||||
const label = activeConfig.split('#').pop() || 'unnamed';
|
const label = activeConfig.split('#').pop();
|
||||||
|
if (label && label.trim()) {
|
||||||
const decodedLabel = decodeURIComponent(label);
|
const decodedLabel = decodeURIComponent(label);
|
||||||
const descDiv = E('div', { 'class': 'cbi-value-description' }, _('Current config: ') + decodedLabel);
|
const descDiv = E('div', { 'class': 'cbi-value-description' }, _('Current config: ') + decodedLabel);
|
||||||
container.appendChild(descDiv);
|
container.appendChild(descDiv);
|
||||||
@@ -105,6 +106,10 @@ function createConfigSection(section, map, network) {
|
|||||||
const descDiv = E('div', { 'class': 'cbi-value-description' }, _('Config without description'));
|
const descDiv = E('div', { 'class': 'cbi-value-description' }, _('Config without description'));
|
||||||
container.appendChild(descDiv);
|
container.appendChild(descDiv);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
const descDiv = E('div', { 'class': 'cbi-value-description' }, _('Config without description'));
|
||||||
|
container.appendChild(descDiv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error parsing config label:', e);
|
console.error('Error parsing config label:', e);
|
||||||
@@ -1250,11 +1255,15 @@ return view.extend({
|
|||||||
|
|
||||||
if (activeConfig) {
|
if (activeConfig) {
|
||||||
if (activeConfig.includes('#')) {
|
if (activeConfig.includes('#')) {
|
||||||
const label = activeConfig.split('#').pop() || 'unnamed';
|
const label = activeConfig.split('#').pop();
|
||||||
|
if (label && label.trim()) {
|
||||||
configName = _('Config: ') + decodeURIComponent(label);
|
configName = _('Config: ') + decodeURIComponent(label);
|
||||||
} else {
|
} else {
|
||||||
configName = _('Main config');
|
configName = _('Main config');
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
configName = _('Main config');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -1321,6 +1330,15 @@ return view.extend({
|
|||||||
const titleDiv = E('h2', { 'class': 'cbi-map-title' }, _('Podkop'));
|
const titleDiv = E('h2', { 'class': 'cbi-map-title' }, _('Podkop'));
|
||||||
node.insertBefore(titleDiv, node.firstChild);
|
node.insertBefore(titleDiv, node.firstChild);
|
||||||
|
|
||||||
|
document.addEventListener('visibilitychange', function () {
|
||||||
|
const diagnosticsContainer = document.getElementById('diagnostics-status');
|
||||||
|
if (document.hidden) {
|
||||||
|
stopDiagnosticsUpdates();
|
||||||
|
} else if (diagnosticsContainer && diagnosticsContainer.hasAttribute('data-loading')) {
|
||||||
|
startDiagnosticsUpdates();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const diagnosticsContainer = document.getElementById('diagnostics-status');
|
const diagnosticsContainer = document.getElementById('diagnostics-status');
|
||||||
if (diagnosticsContainer) {
|
if (diagnosticsContainer) {
|
||||||
|
|||||||
Reference in New Issue
Block a user