Merge pull request #426 from ToxykAuBleu/feat/scheduled-downtime

Add maintenance visibility to monitor' status
This commit is contained in:
Raj Nandan Sharma
2025-06-02 09:31:36 +05:30
committed by GitHub
32 changed files with 166 additions and 29 deletions

View File

@@ -41,6 +41,7 @@ Copy and update the translation file in the `locales` folder. The translation fi
"All Systems are Degraded": "All Systems are Degraded",
"All Systems are Down": "All Systems are Down",
"All Systems are Operational": "All Systems are Operational",
"All Systems are in Maintenance": "All Systems are in Maintenance",
"Back": "Back",
"Badge Copied": "Badge Copied",
"Badge": "Badge",
@@ -91,6 +92,7 @@ Copy and update the translation file in the `locales` folder. The translation fi
"Some Systems are not working as expected": "Some Systems are not working as expected",
"Some Systems Degraded": "Some Systems Degraded",
"Some Systems Down": "Some Systems Down",
"Some Systems in Maintenance": "Some Systems in Maintenance",
"Standard": "Standard",
"Started %startedAt, lasted for %lastedFor": "Started %startedAt, lasted for %lastedFor",
"Started %startedAt, still ongoing": "Started %startedAt, still ongoing",

View File

@@ -73,7 +73,7 @@ To close an incident, you need to add a message and set the status to `RESOLVED`
## Add Monitors
To add monitors to the incident, you need to add the monitor tag to the incident. This will automatically add the monitor to the incident. You will also get the status of the monitor in the incident. This can be `DEGRADED` or `DOWN`.
To add monitors to the incident, you need to add the monitor tag to the incident. This will automatically add the monitor to the incident. You will also get the status of the monitor in the incident. For any event type, this can be `DEGRADED` or `DOWN`. For maintenance event type, this can also be `MAINTENANCE`.
## Maintenance

View File

@@ -75,7 +75,7 @@ Shows the day's impact. Example: If it was down at 10:00 AM and it is 11:00 AM,
## Colors
You can change the colors of UP/DEGRADED/DOWN states of the monitor. You show have a shade of green, yellow, and red respectively.
You can change the colors of UP/DEGRADED/DOWN/MAINTENANCE states of the monitor. By default, it shows a shade of green, yellow, red and blue respectively.
---

View File

@@ -0,0 +1,19 @@
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
export function up(knex) {
return knex("site_data")
.where("key", "colors")
.update({ value: knex.jsonInsert("value", "$.MAINTENANCE", "#6699cc") });
}
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
export function down(knex) {
return knex("site_data")
.where("key", "colors")
.update({ value: knex.jsonRemove("value", "$.MAINTENANCE") });
}

View File

@@ -10,6 +10,7 @@ section {
--up-color: #4ead94;
--down-color: #ca3038;
--degraded-color: #e6ca61;
--maintenance-color: #6679cc;
}
/*Colors for something UP*/
@@ -82,6 +83,33 @@ section {
background: linear-gradient(0deg, var(--degraded-color) 90%, var(--up-color) 1%);
}
/*Colors for something in maintenance*/
.bg-api-maintenance {
background-color: var(--maintenance-color);
}
.text-api-maintenance {
color: var(--maintenance-color);
}
.bg-api-maintenance-10 {
background: linear-gradient(0deg, var(--maintenance-color) 10%, var(--up-color) 1%);
}
.bg-api-maintenance-20 {
background: linear-gradient(0deg, var(--maintenance-color) 20%, var(--up-color) 1%);
}
.bg-api-maintenance-40 {
background: linear-gradient(0deg, var(--maintenance-color) 40%, var(--up-color) 1%);
}
.bg-api-maintenance-60 {
background: linear-gradient(0deg, var(--maintenance-color) 60%, var(--up-color) 1%);
}
.bg-api-maintenance-80 {
background: linear-gradient(0deg, var(--maintenance-color) 80%, var(--up-color) 1%);
}
.bg-api-maintenance-90 {
background: linear-gradient(0deg, var(--maintenance-color) 90%, var(--up-color) 1%);
}
/*Needed to show markdown properly*/
.prose :where(code):not(:where([class~="not-prose"], [class~="not-prose"] *))::before {
content: "";

View File

@@ -7,6 +7,7 @@ async function StatusColor(status) {
UP: site.colors?.UP || "#00dfa2",
DEGRADED: site.colors?.DEGRADED || "#e6ca61",
DOWN: site.colors?.DOWN || "#ca3038",
MAINTENANCE: site.colors?.MAINTENANCE || "#6679cc",
NO_DATA: "#f1f5f8"
};
}

View File

@@ -35,7 +35,8 @@
colorsJ: {
UP: "#4ead94",
DOWN: "#ca3038",
DEGRADED: "#e6ca61"
DEGRADED: "#e6ca61",
MAINTENANCE: "#6679cc",
},
fontJ: {
cssSrc:
@@ -296,7 +297,7 @@
<div>
<p class="font-medium">Status Colors</p>
<p class=" text-xs font-semibold text-muted-foreground">
Choose the colors for the monitor. You can choose between UP, DEGRADED, and DOWN.
Choose the colors for the monitor. You can choose between UP, DEGRADED, DOWN and MAINTENANCE.
</p>
</div>
@@ -343,6 +344,20 @@
}}
/>
</div>
<div class="relative">
<ColorPicker
bind:hex={themeData.colorsJ.MAINTENANCE}
position="responsive"
isAlpha={false}
isDark={$mode == "dark"}
--input-size="16px"
isTextInput={true}
label="MAINTENANCE"
on:input={(event) => {
themeData.colorsJ.MAINTENANCE = event.detail.hex;
}}
/>
</div>
</div>
<hr />
<p class="font-medium">

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "Alle Systeme sind eingeschränkt",
"All Systems are Down": "Alle Systeme sind ausgefallen",
"All Systems are Operational": "Alle Systeme sind betriebsbereit",
"All Systems are in Maintenance": "Alle Systeme sind in Wartung",
"Back": "Zurück",
"Badge Copied": "Abzeichen kopiert",
"Badge": "Abzeichen",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "Einige Systeme funktionieren nicht wie erwartet",
"Some Systems Degraded": "Einige Systeme eingeschränkt",
"Some Systems Down": "Einige Systeme ausgefallen",
"Some Systems in Maintenance": "Einige Systeme sind in Wartung",
"Standard": "Standard",
"Started %startedAt, lasted for %lastedFor": "Begann vor etwa %startedAt und dauerte etwa %lastedFor",
"Started %startedAt, still ongoing": "Begann vor etwa %startedAt und dauert noch an",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "Alle Systemer er Forringet",
"All Systems are Down": "Alle Systemer er Nede",
"All Systems are Operational": "Alle Systemer er Operationelle",
"All Systems are in Maintenance": "Alle systemer er i vedligeholdelse",
"Back": "Tilbage",
"Badge Copied": "Mærke Kopieret",
"Badge": "Mærke",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "Nogle Systemer fungerer ikke som forventet",
"Some Systems Degraded": "Nogle Systemer er Forringet",
"Some Systems Down": "Nogle Systemer er Nede",
"Some Systems in Maintenance": "Nogle Systemer er i Vedligeholdelse",
"Standard": "Standard",
"Started %startedAt, lasted for %lastedFor": "Startede for cirka %startedAt siden, varede i cirka %lastedFor",
"Started %startedAt, still ongoing": "Startede for cirka %startedAt siden, stadig igangværende",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "All Systems are Degraded",
"All Systems are Down": "All Systems are Down",
"All Systems are Operational": "All Systems are Operational",
"All Systems are in Maintenance": "All Systems are in Maintenance",
"Back": "Back",
"Badge Copied": "Badge Copied",
"Badge": "Badge",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "Some Systems are not working as expected",
"Some Systems Degraded": "Some Systems Degraded",
"Some Systems Down": "Some Systems Down",
"Some Systems in Maintenance": "Some Systems in Maintenance",
"Standard": "Standard",
"Started %startedAt, lasted for %lastedFor": "Started %startedAt, lasted for %lastedFor",
"Started %startedAt, still ongoing": "Started %startedAt, still ongoing",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "Tous les systèmes sont dégradés",
"All Systems are Down": "Tous les systèmes sont hors ligne",
"All Systems are Operational": "Tous les systèmes sont opérationnels",
"All Systems are in Maintenance": "Tous les systèmes sont en maintenance",
"Back": "Retour",
"Badge Copied": "Badge copié",
"Badge": "Badge",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "Certains systèmes ne fonctionnent pas comme prévu",
"Some Systems Degraded": "Certains systèmes sont dégradés",
"Some Systems Down": "Certains systèmes sont hors ligne",
"Some Systems in Maintenance": "Certains systèmes sont en maintenance",
"Standard": "Standard",
"Started %startedAt, lasted for %lastedFor": "Commencé il y a environ %startedAt, a duré environ %lastedFor",
"Started %startedAt, still ongoing": "Commencé il y a environ %startedAt, toujours en cours",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "सभी सिस्टम क्षीण हैं",
"All Systems are Down": "सभी सिस्टम डाउन हैं",
"All Systems are Operational": "सभी सिस्टम कार्यरत हैं",
"All Systems are in Maintenance": "सभी सिस्टम रखरखाव में हैं",
"Back": "वापस",
"Badge Copied": "बैज कॉपी किया गया",
"Badge": "बैज",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "कुछ सिस्टम अपेक्षित रूप से काम नहीं कर रहे हैं",
"Some Systems Degraded": "कुछ सिस्टम क्षीण हैं",
"Some Systems Down": "कुछ सिस्टम डाउन हैं",
"Some Systems in Maintenance": "कुछ सिस्टम रखरखाव में हैं",
"Standard": "मानक",
"Started %startedAt, lasted for %lastedFor": "%startedAt शुरू हुआ, %lastedFor तक चला",
"Started %startedAt, still ongoing": "%startedAt शुरू हुआ, अभी भी जारी है",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "すべてのシステムが劣化しています",
"All Systems are Down": "すべてのシステムがダウンしています",
"All Systems are Operational": "すべてのシステムが正常に稼働しています",
"All Systems are in Maintenance": "すべてのシステムがメンテナンス中です",
"Back": "戻る",
"Badge Copied": "バッジがコピーされました",
"Badge": "バッジ",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "一部のシステムが期待通りに動作していません",
"Some Systems Degraded": "一部のシステムが劣化しています",
"Some Systems Down": "一部のシステムがダウンしています",
"Some Systems in Maintenance": "いくつかのシステムがメンテナンス中です",
"Standard": "標準",
"Started %startedAt, lasted for %lastedFor": "%startedAt 前に開始し、約 %lastedFor 続きました",
"Started %startedAt, still ongoing": "%startedAt 前に開始し、まだ進行中です",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "모든 시스템이 성능 저하 상태입니다",
"All Systems are Down": "모든 시스템이 중단되었습니다",
"All Systems are Operational": "모든 시스템이 정상 작동 중입니다",
"All Systems are in Maintenance": "모든 시스템이 유지보수 중입니다",
"Back": "뒤로",
"Badge Copied": "배지 복사됨",
"Badge": "배지",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "일부 시스템이 예상대로 작동하지 않습니다",
"Some Systems Degraded": "일부 시스템이 성능 저하 상태입니다",
"Some Systems Down": "일부 시스템이 중단되었습니다",
"Some Systems in Maintenance": "일부 시스템이 유지보수 중입니다",
"Standard": "기본",
"Started %startedAt, lasted for %lastedFor": "%startedAt 전에 시작되었으며, %lastedFor 동안 지속되었습니다",
"Started %startedAt, still ongoing": "%startedAt 전에 시작되었으며, 아직 진행중입니다",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "Alle systemer har nedsatt ytelse",
"All Systems are Down": "Alle systemer er nede",
"All Systems are Operational": "Alle systemer er operative",
"All Systems are in Maintenance": "Alle systemer er til vedlikehold",
"Back": "Tilbake",
"Badge Copied": "Merke kopiert",
"Badge": "Merke",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "Noen systemer fungerer ikke som forventet",
"Some Systems Degraded": "Noen systemer har nedsatt ytelse",
"Some Systems Down": "Noen systemer er nede",
"Some Systems in Maintenance": "Noen systemer er til vedlikehold",
"Standard": "Standard",
"Started %startedAt, lasted for %lastedFor": "Startet %startedAt, varte i %lastedFor",
"Started %startedAt, still ongoing": "Startet %startedAt, fortsatt pågår",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "Alle systemen werken met beperkte functionaliteit",
"All Systems are Down": "Alle systemen zijn niet bereikbaar",
"All Systems are Operational": "Alle systemen zijn operationeel",
"All Systems are in Maintenance": "Alle systemen zijn in onderhoud",
"Back": "Terug",
"Badge Copied": "Badge gekopieerd",
"Badge": "Badge",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "Sommige systemen werken niet zoals verwacht",
"Some Systems Degraded": "Sommige systemen werken met beperkte functionaliteit",
"Some Systems Down": "Sommige systemen zijn niet bereikbaar",
"Some Systems in Maintenance": "Sommige systemen zijn in onderhoud",
"Standard": "Standaard",
"Started %startedAt, lasted for %lastedFor": "Begonnen ongeveer %startedAt geleden, duurde ongeveer %lastedFor",
"Started %startedAt, still ongoing": "Begonnen ongeveer %startedAt geleden, nog steeds bezig",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "Wszystkie systemy działają z ograniczeniami",
"All Systems are Down": "Wszystkie systemy są niedostępne",
"All Systems are Operational": "Wszystkie systemy działają poprawnie",
"All Systems are in Maintenance": "Wszystkie systemy są w konserwacji",
"Back": "Wstecz",
"Badge Copied": "Odznaka skopiowana",
"Badge": "Odznaka",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "Niektóre systemy nie działają zgodnie z oczekiwaniami",
"Some Systems Degraded": "Niektóre systemy działają z ograniczeniami",
"Some Systems Down": "Niektóre systemy są niedostępne",
"Some Systems in Maintenance": "Niektóre systemy są w konserwacji",
"Standard": "Standardowy",
"Started %startedAt, lasted for %lastedFor": "Rozpoczęto %startedAt, trwało %lastedFor",
"Started %startedAt, still ongoing": "Rozpoczęto %startedAt, nadal trwa",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "Todos os Sistemas estão com Falhas",
"All Systems are Down": "Todos os Sistemas estão Indisponíveis",
"All Systems are Operational": "Todos os Sistemas estão Operacionais",
"All Systems are in Maintenance": "Todos os Sistemas estão em Manutenção",
"Back": "Voltar",
"Badge Copied": "Emblema Copiado",
"Badge": "Emblema",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "Alguns Sistemas não estão funcionando como esperado",
"Some Systems Degraded": "Alguns Sistemas estão com Falhas",
"Some Systems Down": "Alguns Sistemas estão Indisponíveis",
"Some Systems in Maintenance": "Alguns Sistemas estão em Manutenção",
"Standard": "Padrão",
"Started %startedAt, lasted for %lastedFor": "Ocorreu faz %startedAt e durou %lastedFor",
"Started %startedAt, still ongoing": "Iniciou faz %startedAt, ainda em andamento",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "Все системы работают с ухудшенной производительностью",
"All Systems are Down": "Все системы недоступны",
"All Systems are Operational": "Все системы работают нормально",
"All Systems are in Maintenance": "Все системы на обслуживании",
"Back": "Назад",
"Badge Copied": "Значок скопирован",
"Badge": "Значок",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "Некоторые системы работают не так, как ожидалось",
"Some Systems Degraded": "Некоторые системы работают с ухудшенной производительностью",
"Some Systems Down": "Некоторые системы недоступны",
"Some Systems in Maintenance": "Некоторые системы на обслуживании",
"Standard": "Стандартная",
"Started %startedAt, lasted for %lastedFor": "Началось около %startedAt назад, длилось около %lastedFor",
"Started %startedAt, still ongoing": "Началось около %startedAt назад, все еще продолжается",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "Tüm Sistemler Bozuk Durumda",
"All Systems are Down": "Tüm Sistemler Çalışmıyor",
"All Systems are Operational": "Tüm Sistemler Çalışıyor",
"All Systems are in Maintenance": "Tüm Sistemler Bakımda",
"Back": "Geri",
"Badge Copied": "Rozet Kopyalandı",
"Badge": "Rozet",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "Bazı Sistemler Beklendiği Gibi Çalışmıyor",
"Some Systems Degraded": "Bazı Sistemler Bozuk Durumda",
"Some Systems Down": "Bazı Sistemler Çalışmıyor",
"Some Systems in Maintenance": "Bazı Sistemler Bakımda",
"Standard": "Standart",
"Started %startedAt, lasted for %lastedFor": "%startedAt başladı, %lastedFor sürdü",
"Started %startedAt, still ongoing": "%startedAt başladı, devam ediyor",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "Tất cả hệ thống đang suy giảm hiệu suất",
"All Systems are Down": "Tất cả hệ thống đang ngừng hoạt động",
"All Systems are Operational": "Tất cả hệ thống đang hoạt động bình thường",
"All Systems are in Maintenance": "Tất cả hệ thống đang bảo trì",
"Back": "Quay lại",
"Badge Copied": "Huy hiệu đã được sao chép",
"Badge": "Huy hiệu",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "Một số hệ thống không hoạt động như mong đợi",
"Some Systems Degraded": "Một số hệ thống đang suy giảm hiệu suất",
"Some Systems Down": "Một số hệ thống đang ngừng hoạt động",
"Some Systems in Maintenance": "Một số hệ thống đang bảo trì",
"Standard": "Tiêu chuẩn",
"Started %startedAt, lasted for %lastedFor": "Bắt đầu khoảng %startedAt trước, kéo dài khoảng %lastedFor",
"Started %startedAt, still ongoing": "Bắt đầu khoảng %startedAt trước, vẫn đang diễn ra",

View File

@@ -12,6 +12,7 @@
"All Systems are Degraded": "所有系统性能下降",
"All Systems are Down": "所有系统不可用",
"All Systems are Operational": "所有系统运行正常",
"All Systems are in Maintenance": "所有系统正在维护",
"Back": "返回",
"Badge Copied": "徽章已复制",
"Badge": "徽章",
@@ -62,6 +63,7 @@
"Some Systems are not working as expected": "部分系统运行异常",
"Some Systems Degraded": "部分系统性能下降",
"Some Systems Down": "部分系统不可用",
"Some Systems in Maintenance": "部分系统正在维护",
"Standard": "标准",
"Started %startedAt, lasted for %lastedFor": "大约 %startedAt 前开始,持续了约 %lastedFor",
"Started %startedAt, still ongoing": "大约 %startedAt 前开始,目前仍在进行中",

View File

@@ -8,6 +8,7 @@ const SITE = "./config/site.yaml";
const UP = "UP";
const DOWN = "DOWN";
const DEGRADED = "DEGRADED";
const MAINTENANCE = "MAINTENANCE";
const NO_DATA = "NO_DATA";
const API_TIMEOUT = 10 * 1000; // 10 seconds
const AnalyticsProviders = {

View File

@@ -206,6 +206,7 @@ export const SystemDataMessage = async () => {
let upsCount = 0;
let degradedCount = 0;
let downCount = 0;
let maintenanceCount = 0;
for (let i = 0; i < monitors.length; i++) {
let status = await db.getLatestMonitoringData(monitors[i].tag);
if (status) {
@@ -215,11 +216,13 @@ export const SystemDataMessage = async () => {
degradedCount++;
} else if (status.status === "DOWN") {
downCount++;
} else if (status.status === "MAINTENANCE") {
maintenanceCount++;
}
}
}
const total = upsCount + degradedCount + downCount;
const total = upsCount + degradedCount + downCount + maintenanceCount;
if (total === 0) {
return {
@@ -227,48 +230,56 @@ export const SystemDataMessage = async () => {
upsPercentage: 0,
degradedPercentage: 0,
downsPercentage: 0,
maintenancePercentage: 0,
};
}
let upsPercentage = Math.round((upsCount / total) * 100);
let degradedPercentage = Math.round((degradedCount / total) * 100);
let downsPercentage = Math.round((downCount / total) * 100);
let maintenancePercentage = Math.round((maintenanceCount / total) * 100);
let message = "";
// Determine message based on the combination of system states
if (upsCount > 0 && degradedCount === 0 && downCount === 0) {
// UP=1|DOWN=0|DEGRADED=0
if (upsCount > 0 && degradedCount === 0 && downCount === 0 && maintenanceCount == 0) {
// UP=1|DOWN=0|DEGRADED=0|MAINTENANCE=0
message = "All Systems are Operational";
} else if (upsCount === 0 && degradedCount > 0 && downCount === 0) {
// UP=0|DOWN=0|DEGRADED=1
} else if (upsCount === 0 && degradedCount > 0 && downCount === 0 && maintenanceCount == 0) {
// UP=0|DOWN=0|DEGRADED=1|MAINTENANCE=0
message = "All Systems are Degraded";
} else if (upsCount === 0 && degradedCount === 0 && downCount > 0) {
// UP=0|DOWN=1|DEGRADED=0
} else if (upsCount === 0 && degradedCount === 0 && downCount > 0 && maintenanceCount == 0) {
// UP=0|DOWN=1|DEGRADED=0|MAINTENANCE=0
message = "All Systems are Down";
} else if (upsCount === 0 && degradedCount === 0 && downCount === 0 && maintenanceCount > 0) {
message = "All Systems are in Maintenance";
} else if (
(upsCount > 0 && degradedCount > 0 && downCount > 0) ||
(upsCount === 0 && degradedCount > 0 && downCount > 0)
(upsCount > 0 && degradedCount > 0 && downCount > 0 && maintenanceCount > 0) ||
(upsCount === 0 && degradedCount > 0 && downCount > 0 && maintenanceCount > 0)
) {
// UP=1|DOWN=1|DEGRADED=1 or UP=0|DOWN=1|DEGRADED=1
// UP=1|DOWN=1|DEGRADED=1|MAINTENANCE=1 or UP=0|DOWN=1|DEGRADED=1|MAINTENANCE=1
message = "Some Systems are not working as expected";
} else if (upsCount > 0 && degradedCount === 0 && downCount > 0) {
// UP=1|DOWN=1|DEGRADED=0
} else if (upsCount > 0 && degradedCount === 0 && downCount > 0 && maintenanceCount == 0) {
// UP=1|DOWN=1|DEGRADED=0|MAINTENANCE=0
message = "Some Systems Down";
} else if (upsCount > 0 && degradedCount > 0 && downCount === 0) {
// UP=1|DOWN=0|DEGRADED=1
} else if (upsCount > 0 && degradedCount > 0 && downCount === 0 && maintenanceCount == 0) {
// UP=1|DOWN=0|DEGRADED=1|MAINTENANCE=0
message = "Some Systems Degraded";
} else if (upsCount > 0 && degradedCount === 0 && downCount === 0 && maintenanceCount > 0) {
// UP=1|DOWN=0|DEGRADED=0|MAINTENANCE=1
message = "Some Systems in Maintenance";
}
//if percentage is not 100 sum, then add remaining to up
if (upsPercentage + degradedPercentage + downsPercentage < 100) {
upsPercentage = 100 - (degradedPercentage + downsPercentage);
if (upsPercentage + degradedPercentage + downsPercentage + maintenancePercentage < 100) {
upsPercentage = 100 - (degradedPercentage + downsPercentage + maintenancePercentage);
}
return {
text: message,
upsPercentage,
degradedPercentage,
downsPercentage,
maintenancePercentage
};
};
@@ -722,6 +733,7 @@ export const GetDataGroupByDayAlternative = async (monitor_tag, start, end, time
UP: 0,
DOWN: 0,
DEGRADED: 0,
MAINTENANCE: 0,
NO_DATA: 0,
};
}
@@ -740,6 +752,7 @@ export const GetDataGroupByDayAlternative = async (monitor_tag, start, end, time
UP: group.UP,
DOWN: group.DOWN,
DEGRADED: group.DEGRADED,
MAINTENANCE: group.MAINTENANCE,
NO_DATA: group.NO_DATA,
}));
};
@@ -863,9 +876,9 @@ export const RemoveIncidentMonitor = async (incident_id, monitor_tag) => {
};
export const AddIncidentMonitor = async (incident_id, monitor_tag, monitor_impact) => {
//monitor_impact must be DOWN or DEGRADED or NONE
if (!["DOWN", "DEGRADED"].includes(monitor_impact)) {
throw new Error("Monitor impact must be either DOWN, DEGRADED ");
//monitor_impact must be DOWN or DEGRADED or MAINTENANCE or NONE
if (!["DOWN", "DEGRADED", "MAINTENANCE"].includes(monitor_impact)) {
throw new Error("Monitor impact must be either DOWN, DEGRADED, MAINTENANCE");
}
//check if monitor exists

View File

@@ -109,7 +109,7 @@ export function IsValidColors(colors) {
return false;
}
if (typeof colors !== "object") return false;
const validColorKeys = ["UP", "DOWN", "DEGRADED"];
const validColorKeys = ["UP", "DOWN", "DEGRADED", "MAINTENANCE"];
for (const key of validColorKeys) {
if (typeof colors[key] !== "string" || !/^#[0-9A-Fa-f]{6}$/.test(colors[key])) return false;
}

View File

@@ -42,6 +42,10 @@ async function manualIncident(monitor) {
for (let i = 0; i < impactArr.length; i++) {
const element = impactArr[i];
if (element.monitor_impact === "MAINTENANCE") {
impact = "MAINTENANCE";
break;
}
if (element.monitor_impact === "DOWN") {
impact = "DOWN";
break;

View File

@@ -92,6 +92,7 @@ const seedSiteData = {
UP: "#67ab95",
DOWN: "#ca3038",
DEGRADED: "#e6ca61",
MAINTENANCE: "#6679cc",
},
font: {
cssSrc: "",

View File

@@ -125,6 +125,11 @@ const FetchData = async function (site, monitor, localTz, selectedLang, lang, is
summaryDuration = getSummaryDuration(dayData.DOWN, selectedLang);
summaryStatus = "DOWN";
}
if (dayData.MAINTENANCE > 0) {
cssClass = returnStatusClass(dayData.MAINTENANCE, dayData.total, StatusObj.MAINTENANCE, site.barStyle);
summaryDuration = getSummaryDuration(dayData.MAINTENANCE, selectedLang);
summaryStatus = "MAINTENANCE";
}
if (dayData.NO_DATA === dayData.total) {
cssClass = StatusObj.NO_DATA;
summaryStatus = NO_DATA;
@@ -178,6 +183,11 @@ const FetchData = async function (site, monitor, localTz, selectedLang, lang, is
summaryStatus = "DOWN";
summaryColorClass = "api-down";
}
if (!!lastRow && lastRow.status == "MAINTENANCE") {
summaryDuration = getSummaryDuration(getCountOfSimilarStatuesEnd(todayDataDb, "MAINTENANCE"), selectedLang);
summaryStatus = "MAINTENANCE";
summaryColorClass = "api-maintenance";
}
if (lastRow.status === "NO_DATA") {
summaryStatus = NO_DATA;
summaryColorClass = "api-nodata";

View File

@@ -149,6 +149,7 @@ const StatusObj = {
UP: "api-up",
DEGRADED: "api-degraded",
DOWN: "api-down",
MAINTENANCE: "api-maintenance",
NO_DATA: "api-nodata",
};
// @ts-ignore

View File

@@ -109,7 +109,8 @@
--bg-custom: {data.bgc};
--up-color: {data.site.colors.UP};
--down-color: {data.site.colors.DOWN};
--degraded-color: {data.site.colors.DEGRADED}
--degraded-color: {data.site.colors.DEGRADED};
--maintenance-color: {data.site.colors.MAINTENANCE};
"
class="kener-theme-{kenerTheme}"
>

View File

@@ -117,6 +117,7 @@
<div class="bg-api-up h-4" style="width: {data.systemDataMessage.upsPercentage}%;"></div>
<div class="bg-api-degraded h-4" style="width: {data.systemDataMessage.degradedPercentage}%;"></div>
<div class="bg-api-down h-4" style="width: {data.systemDataMessage.downsPercentage}%;"></div>
<div class="bg-api-maintenance h-4" style="width: {data.systemDataMessage.maintenancePercentage}%;"></div>
</div>
</div>
{/if}
@@ -216,13 +217,13 @@
class="section-legend mx-auto mb-2 flex w-full flex-1 flex-col items-start justify-center bg-transparent md:w-[655px]"
id=""
>
<div class="grid w-full grid-cols-2 gap-4">
<div class="col-span-2 text-center md:col-span-1 md:text-left">
<div class="flex flex-col md:flex-row w-full gap-4 justify-between">
<div class="flex justify-center md:content-left">
<Badge class="border-0 md:pl-0" variant="outline">
{l(data.lang, "Availability per Component")}
</Badge>
</div>
<div class="col-span-2 text-center md:col-span-1 md:text-right">
<div class="flex justify-center md:justify-end">
<Badge variant="outline" class="border-0 md:pr-0">
<span class="bg-api-up mr-1 inline-flex h-[8px] w-[8px] rounded-full opacity-75"></span>
<span class="mr-3">
@@ -235,9 +236,14 @@
</span>
<span class="bg-api-down mr-1 inline-flex h-[8px] w-[8px] rounded-full opacity-75"></span>
<span class="">
<span class="mr-3">
{l(data.lang, "DOWN")}
</span>
<span class="bg-api-maintenance mr-1 inline-flex h-[8px] w-[8px] rounded-full opacity-75"></span>
<span class="">
{l(data.lang, "MAINTENANCE")}
</span>
</Badge>
</div>
</div>

View File

@@ -1092,6 +1092,11 @@
<Select.Content>
<Select.Group>
<Select.Label>Impact</Select.Label>
{#if currentIncident.incident_type == "MAINTENANCE"}
<Select.Item value="MAINTENANCE" label="MAINTENANCE" class="text-api-maintenance text-sm font-medium">
MAINTENANCE
</Select.Item>
{/if}
<Select.Item value="DOWN" label="DOWN" class="text-api-down text-sm font-medium">
DOWN
</Select.Item>