Skip to content

Commit 7aa259c

Browse files
authored
Updates
1 parent a032259 commit 7aa259c

4 files changed

Lines changed: 66 additions & 17 deletions

File tree

config/var/www/admin/control-panel/external-services/external-services-api.php

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ function parseStatusFeed($feedUrl, $filter = null) {
133133
$entryDate = strtotime((string)$latestEntry->published);
134134
}
135135

136-
// Check if entry is within 48 hours (172800 seconds)
137-
$isRecent = ($entryDate && (time() - $entryDate) <= 172800);
136+
// Check if entry is within 24 hours (86400 seconds)
137+
$isRecent = ($entryDate && (time() - $entryDate) <= 86400);
138138

139139
// For Brevo and similar feeds, prefer title only
140140
$description = !empty($title) ? $title : (!empty($content) ? $content : $summary);
141141

142-
// Only show status if entry is within 48 hours, otherwise show operational
142+
// Only show status if entry is within 24 hours, otherwise show operational
143143
if (!$isRecent || preg_match('/operational|resolved|completed|fixed|normal/i', $title)) {
144144
$status['indicator'] = 'none';
145145
$status['description'] = 'All Systems Operational';
@@ -186,10 +186,10 @@ function parseStatusFeed($feedUrl, $filter = null) {
186186
$itemDate = strtotime((string)$latestItem->children('http://purl.org/dc/elements/1.1/')->date);
187187
}
188188

189-
// Check if item is within 48 hours (172800 seconds)
190-
$isRecent = ($itemDate && (time() - $itemDate) <= 172800);
189+
// Check if item is within 24 hours (86400 seconds)
190+
$isRecent = ($itemDate && (time() - $itemDate) <= 86400);
191191

192-
// Only show status if item is within 48 hours, otherwise show operational
192+
// Only show status if item is within 24 hours, otherwise show operational
193193
if (!$isRecent || preg_match('/operational|resolved|completed|fixed|normal/i', $title)) {
194194
$status['indicator'] = 'none';
195195
$status['description'] = 'All Systems Operational';
@@ -275,6 +275,26 @@ function parseGoogleWorkspaceIncidents($apiUrl) {
275275
];
276276
}
277277

278+
// Determine recency (if timestamp available) and severity
279+
$incidentDate = null;
280+
if (isset($latestIncident['start_time'])) {
281+
$incidentDate = strtotime($latestIncident['start_time']);
282+
} elseif (isset($latestIncident['created_at'])) {
283+
$incidentDate = strtotime($latestIncident['created_at']);
284+
} elseif (isset($latestIncident['updated_at'])) {
285+
$incidentDate = strtotime($latestIncident['updated_at']);
286+
} elseif (isset($latestIncident['time'])) {
287+
$incidentDate = strtotime($latestIncident['time']);
288+
}
289+
290+
// If incident has a timestamp and it's older than 24 hours, treat as operational
291+
if ($incidentDate && (time() - $incidentDate) > 86400) {
292+
return [
293+
'indicator' => 'none',
294+
'description' => 'All Systems Operational'
295+
];
296+
}
297+
278298
// Determine severity
279299
$indicator = 'minor';
280300
if (isset($latestIncident['severity'])) {

config/var/www/admin/control-panel/external-services/external-services.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,21 @@
280280
opacity: 1;
281281
}
282282

283+
/* Card-level status coloring */
284+
.external-service-card.status-success {
285+
border-color: var(--success-color);
286+
}
287+
288+
.external-service-card.status-warning {
289+
border-color: var(--warning-color);
290+
background: rgba(255, 184, 0, 0.02);
291+
}
292+
293+
.external-service-card.status-error {
294+
border-color: var(--error-color);
295+
background: rgba(244, 68, 68, 0.03);
296+
}
297+
283298
/* Service Header */
284299
.service-header {
285300
display: flex;

config/var/www/admin/control-panel/external-services/external-services.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,21 @@ export class ExternalServicesManager {
466466
/**
467467
* Extract and determine status display values
468468
*/
469-
getStatusDisplayValues(statusIndicator) {
469+
getStatusDisplayValues(statusIndicator, isFeed = false) {
470470
const statusClass = statusIndicator === "none" ? "operational" : statusIndicator;
471-
const statusIcon = statusClass === "operational" ? "check-circle" : "exclamation-triangle";
472-
const statusColor = statusClass === "operational" ? "success" : statusClass === "minor" ? "warning" : "error";
471+
// Map icons per status
472+
let statusIcon = 'exclamation-triangle';
473+
if (statusClass === 'operational') statusIcon = 'check-circle';
474+
else if (statusClass === 'major') statusIcon = 'times-circle';
475+
else if (statusClass === 'minor') statusIcon = 'exclamation-triangle';
476+
477+
// For Atom/RSS feeds, map major->error, minor->warning
478+
if (isFeed) {
479+
const statusColor = statusClass === 'operational' ? 'success' : (statusClass === 'major' ? 'error' : 'warning');
480+
return { statusClass, statusIcon, statusColor };
481+
}
482+
483+
const statusColor = statusClass === 'operational' ? 'success' : statusClass === 'minor' ? 'warning' : 'error';
473484
return { statusClass, statusIcon, statusColor };
474485
}
475486

@@ -478,7 +489,7 @@ export class ExternalServicesManager {
478489
*/
479490
updateServiceCardStatus(serviceCard, statusDescription, statusClass, statusIcon, statusColor) {
480491
// Update card class
481-
serviceCard.classList.remove("loading", "error");
492+
serviceCard.classList.remove("loading", "error", "status-success", "status-warning", "status-error");
482493

483494
// Update status span
484495
const statusSpan = serviceCard.querySelector(".service-status");
@@ -487,6 +498,9 @@ export class ExternalServicesManager {
487498
statusSpan.innerHTML = `<i class="fas fa-${statusIcon}"></i> `;
488499
statusSpan.appendChild(document.createTextNode(this.utils.sanitizeInput(statusDescription)));
489500
}
501+
502+
// Add card-level status class for visual emphasis
503+
serviceCard.classList.add(`status-${statusColor}`);
490504
}
491505

492506
/**
@@ -550,7 +564,7 @@ export class ExternalServicesManager {
550564
return;
551565
}
552566

553-
const { statusClass, statusIcon, statusColor } = this.getStatusDisplayValues(data.status.indicator);
567+
const { statusClass, statusIcon, statusColor } = this.getStatusDisplayValues(data.status.indicator, true);
554568
this.updateServiceCardStatus(serviceCard, data.status.description, statusClass, statusIcon, statusColor);
555569
} catch (error) {
556570
console.error(`Failed to load ${serviceDef.name} feed status:`, error);
@@ -580,7 +594,7 @@ export class ExternalServicesManager {
580594
return;
581595
}
582596

583-
const { statusClass, statusIcon, statusColor } = this.getStatusDisplayValues(data.status.indicator);
597+
const { statusClass, statusIcon, statusColor } = this.getStatusDisplayValues(data.status.indicator, false);
584598
this.updateServiceCardStatus(serviceCard, data.status.description, statusClass, statusIcon, statusColor);
585599
} catch (error) {
586600
console.error(`Failed to load ${serviceDef.name} status:`, error);

config/var/www/admin/control-panel/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/{FONTAWESOME_VER}/css/all.min.css" rel="stylesheet" crossorigin="anonymous">
1313

1414
<!-- Custom Styles -->
15-
<link rel="stylesheet" href="dashboard.css?v=2025.11.21.12">
16-
<link rel="stylesheet" href="external-services/external-services.css?v=2025.11.21.12">
15+
<link rel="stylesheet" href="dashboard.css?v=2025.11.21.15">
16+
<link rel="stylesheet" href="external-services/external-services.css?v=2025.11.21.15">
1717

1818
<!-- Preload Critical Resources -->
19-
<link rel="modulepreload" href="dashboard.js?v=2025.11.21.12" crossorigin="use-credentials">
20-
<link rel="modulepreload" href="modules/api.js?v=2025.11.21.12" crossorigin="use-credentials">
19+
<link rel="modulepreload" href="dashboard.js?v=2025.11.21.15" crossorigin="use-credentials">
20+
<link rel="modulepreload" href="modules/api.js?v=2025.11.21.15" crossorigin="use-credentials">
2121
</head>
2222
<body>
2323
<!-- Loading Screen -->
@@ -374,6 +374,6 @@ <h3>Uptime Robot</h3>
374374
</div>
375375

376376
<!-- Scripts -->
377-
<script type="module" src="dashboard.js?v=2025.11.21.12" data-cfasync="false"></script>
377+
<script type="module" src="dashboard.js?v=2025.11.21.15" data-cfasync="false"></script>
378378
</body>
379379
</html>

0 commit comments

Comments
 (0)