Add service status indicator to service cards
This commit is contained in:
@@ -54,6 +54,7 @@
|
|||||||
const port = s.getAttribute('port') || '';
|
const port = s.getAttribute('port') || '';
|
||||||
const logo = s.getAttribute('logo') || '';
|
const logo = s.getAttribute('logo') || '';
|
||||||
const hostAttr = s.getAttribute('host'); // optional public hostname or full URL
|
const hostAttr = s.getAttribute('host'); // optional public hostname or full URL
|
||||||
|
const status = s.getAttribute('status'); // optional: 'online', 'offline', 'maintenance'
|
||||||
|
|
||||||
// Build href: prefer explicit host attribute when present.
|
// Build href: prefer explicit host attribute when present.
|
||||||
// Rules:
|
// Rules:
|
||||||
@@ -101,6 +102,14 @@
|
|||||||
a.appendChild(img);
|
a.appendChild(img);
|
||||||
a.appendChild(span);
|
a.appendChild(span);
|
||||||
|
|
||||||
|
// Add status indicator if status attribute is set
|
||||||
|
if(status){
|
||||||
|
const statusDot = document.createElement('span');
|
||||||
|
statusDot.className = `status-dot status-${status}`;
|
||||||
|
statusDot.title = `Status: ${status}`;
|
||||||
|
a.appendChild(statusDot);
|
||||||
|
}
|
||||||
|
|
||||||
// Add info button if both hostname and port are available
|
// Add info button if both hostname and port are available
|
||||||
if((hostAttr || host) && port){
|
if((hostAttr || host) && port){
|
||||||
const infoBtn = document.createElement('button');
|
const infoBtn = document.createElement('button');
|
||||||
|
|||||||
Reference in New Issue
Block a user