From 201ac9245b61fd702459c1cc5a456a7a1b291293 Mon Sep 17 00:00:00 2001 From: Bas Wieringa Date: Fri, 15 Mar 2024 15:54:29 +0100 Subject: [PATCH 1/9] Add toggle to hide the uptime percentage on a statuspage --- db/patch-add-hide-uptime-percentage.sql | 7 +++++ server/database.js | 1 + server/model/status_page.js | 2 ++ .../status-page-socket-handler.js | 1 + src/components/PublicGroupList.vue | 26 ++++++++++++++++--- src/lang/en.json | 1 + src/pages/StatusPage.vue | 8 +++++- 7 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 db/patch-add-hide-uptime-percentage.sql diff --git a/db/patch-add-hide-uptime-percentage.sql b/db/patch-add-hide-uptime-percentage.sql new file mode 100644 index 000000000..263a90adb --- /dev/null +++ b/db/patch-add-hide-uptime-percentage.sql @@ -0,0 +1,7 @@ +-- You should not modify if this have pushed to Github, unless it does serious wrong with the db. +BEGIN TRANSACTION; + +ALTER TABLE status_page + ADD hide_uptime_percentage BOOLEAN default 0 NOT NULL; + +COMMIT; diff --git a/server/database.js b/server/database.js index cfe14fe71..01bbc2004 100644 --- a/server/database.js +++ b/server/database.js @@ -106,6 +106,7 @@ class Database { "patch-notification-config.sql": true, "patch-fix-kafka-producer-booleans.sql": true, "patch-timeout.sql": true, // The last file so far converted to a knex migration file + "patch-add-hide-uptime-percentage.sql": true }; /** diff --git a/server/model/status_page.js b/server/model/status_page.js index 235582981..01e4297da 100644 --- a/server/model/status_page.js +++ b/server/model/status_page.js @@ -246,6 +246,7 @@ class StatusPage extends BeanModel { showPoweredBy: !!this.show_powered_by, googleAnalyticsId: this.google_analytics_tag_id, showCertificateExpiry: !!this.show_certificate_expiry, + hideUptimePercentage: !!this.hide_uptime_percentage }; } @@ -268,6 +269,7 @@ class StatusPage extends BeanModel { showPoweredBy: !!this.show_powered_by, googleAnalyticsId: this.google_analytics_tag_id, showCertificateExpiry: !!this.show_certificate_expiry, + hideUptimePercentage: !!this.hide_uptime_percentage }; } diff --git a/server/socket-handlers/status-page-socket-handler.js b/server/socket-handlers/status-page-socket-handler.js index ee1c68d3b..d44b710a4 100644 --- a/server/socket-handlers/status-page-socket-handler.js +++ b/server/socket-handlers/status-page-socket-handler.js @@ -163,6 +163,7 @@ module.exports.statusPageSocketHandler = (socket) => { statusPage.footer_text = config.footerText; statusPage.custom_css = config.customCSS; statusPage.show_powered_by = config.showPoweredBy; + statusPage.hide_uptime_percentage = config.hideUptimePercentage; statusPage.show_certificate_expiry = config.showCertificateExpiry; statusPage.modified_date = R.isoDateTime(); statusPage.google_analytics_tag_id = config.googleAnalyticsId; diff --git a/src/components/PublicGroupList.vue b/src/components/PublicGroupList.vue index d1c1f4c52..3a24ac7f2 100644 --- a/src/components/PublicGroupList.vue +++ b/src/components/PublicGroupList.vue @@ -37,8 +37,9 @@
- - + + + {{ $t("showCertificateExpiry") }}
+ +
+ + +
+
@@ -319,7 +325,7 @@ 👀 {{ $t("statusPageNothing") }}
- +