develop #4

Merged
Arnike merged 10 commits from develop into main 2026-02-12 20:32:19 +03:00
Showing only changes of commit 572274333c - Show all commits

View File

@@ -107,13 +107,27 @@
var promEl = document.getElementById('source-status-prometheus');
var osEl = document.getElementById('source-status-openstack');
if (!promEl || !osEl) return;
fetch('/api/source-status/').then(function(r) { return r.ok ? r.json() : {}; }).then(function(data) {
updateSourceStatus(promEl, 'Prometheus', data.prometheus);
updateSourceStatus(osEl, 'OpenStack', data.openstack);
}).catch(function() {
updateSourceStatus(promEl, 'Prometheus', { status: 'error', message: 'Failed to fetch status' });
updateSourceStatus(osEl, 'OpenStack', { status: 'error', message: 'Failed to fetch status' });
});
fetch('/api/source-status/')
.then(function(r) {
if (r.ok) return r.json().then(function(data) { return { data: data }; });
return r.json().catch(function() { return {}; }).then(function(body) {
return { error: true, message: (body && body.message) || 'Failed to fetch status' };
});
})
.then(function(result) {
if (result && result.error) {
updateSourceStatus(promEl, 'Prometheus', { status: 'error', message: result.message });
updateSourceStatus(osEl, 'OpenStack', { status: 'error', message: result.message });
} else {
var data = result && result.data;
updateSourceStatus(promEl, 'Prometheus', data && data.prometheus);
updateSourceStatus(osEl, 'OpenStack', data && data.openstack);
}
})
.catch(function() {
updateSourceStatus(promEl, 'Prometheus', { status: 'error', message: 'Failed to fetch status' });
updateSourceStatus(osEl, 'OpenStack', { status: 'error', message: 'Failed to fetch status' });
});
});
})();
</script>