From 2fe5c090aa9c3f0ad67f7880dcaef59bf0335aa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Kr=C3=BDda?= Date: Sun, 8 May 2022 20:50:08 +0200 Subject: [PATCH] small fixes --- server/routers/api-router.js | 2 +- src/languages/en.js | 1 + src/pages/EditMaintenance.vue | 5 +++++ src/pages/StatusPage.vue | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/server/routers/api-router.js b/server/routers/api-router.js index da036ee2..84fc8c55 100644 --- a/server/routers/api-router.js +++ b/server/routers/api-router.js @@ -180,7 +180,7 @@ async function getMaintenanceList(statusPageId) { return publicMaintenanceList; } catch (error) { - return null; + return []; } } diff --git a/src/languages/en.js b/src/languages/en.js index b235904e..2653b029 100644 --- a/src/languages/en.js +++ b/src/languages/en.js @@ -20,6 +20,7 @@ export default { End: "End", affectedMonitorsDescription: "Select monitors that are affected by current maintenance", atLeastOneMonitor: "Select at least one affected monitor", + maintenanceInvalidDate: "Invalid maintenance end date entered", selectedStatusPagesDescription: "Select status pages to display maintenance info on", atLeastOneStatusPage: "Select at least one status page", maintenanceTitleExample: "Network infrastructure maintenance", diff --git a/src/pages/EditMaintenance.vue b/src/pages/EditMaintenance.vue index 26aa857f..281f1241 100644 --- a/src/pages/EditMaintenance.vue +++ b/src/pages/EditMaintenance.vue @@ -260,6 +260,11 @@ export default { return this.processing = false; } + if (this.maintenance.start_date >= this.maintenance.end_date) { + toast.error(this.$t("maintenanceInvalidDate")); + return this.processing = false; + } + if (!this.showOnAllPages && this.selectedStatusPages.length === 0) { toast.error(this.$t("atLeastOneStatusPage")); return this.processing = false; diff --git a/src/pages/StatusPage.vue b/src/pages/StatusPage.vue index 4d021dc4..85f3803b 100644 --- a/src/pages/StatusPage.vue +++ b/src/pages/StatusPage.vue @@ -595,7 +595,7 @@ export default { } this.incident = res.data.incident; - this.maintenance = res.data.maintenance || []; + this.maintenance = res.data.maintenance; this.$root.publicGroupList = res.data.publicGroupList; });