From e856cb6007dd1cd6e8e33bf8813fde232a7237cb Mon Sep 17 00:00:00 2001 From: Laurent Aupse Date: Sun, 19 May 2024 21:56:55 +0200 Subject: [PATCH] Make auto refresh interval customizable (#4260) Co-authored-by: Frank Elsinga --- .../2023-12-20-0000-alter-status-page.js | 12 ++++++++++ server/model/status_page.js | 2 ++ .../status-page-socket-handler.js | 2 ++ src/lang/en.json | 2 ++ src/pages/StatusPage.vue | 24 ++++++++++++------- 5 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 db/knex_migrations/2023-12-20-0000-alter-status-page.js diff --git a/db/knex_migrations/2023-12-20-0000-alter-status-page.js b/db/knex_migrations/2023-12-20-0000-alter-status-page.js new file mode 100644 index 00000000..61ef5d60 --- /dev/null +++ b/db/knex_migrations/2023-12-20-0000-alter-status-page.js @@ -0,0 +1,12 @@ +exports.up = function (knex) { + return knex.schema + .alterTable("status_page", function (table) { + table.integer("auto_refresh_interval").defaultTo(300).unsigned(); + }); +}; + +exports.down = function (knex) { + return knex.schema.alterTable("status_page", function (table) { + table.dropColumn("auto_refresh_interval"); + }); +}; diff --git a/server/model/status_page.js b/server/model/status_page.js index 23558298..528d1dd4 100644 --- a/server/model/status_page.js +++ b/server/model/status_page.js @@ -238,6 +238,7 @@ class StatusPage extends BeanModel { description: this.description, icon: this.getIcon(), theme: this.theme, + autoRefreshInterval: this.autoRefreshInterval, published: !!this.published, showTags: !!this.show_tags, domainNameList: this.getDomainNameList(), @@ -260,6 +261,7 @@ class StatusPage extends BeanModel { title: this.title, description: this.description, icon: this.getIcon(), + autoRefreshInterval: this.autoRefreshInterval, theme: this.theme, published: !!this.published, showTags: !!this.show_tags, diff --git a/server/socket-handlers/status-page-socket-handler.js b/server/socket-handlers/status-page-socket-handler.js index 53128914..0804da15 100644 --- a/server/socket-handlers/status-page-socket-handler.js +++ b/server/socket-handlers/status-page-socket-handler.js @@ -155,6 +155,7 @@ module.exports.statusPageSocketHandler = (socket) => { statusPage.title = config.title; statusPage.description = config.description; statusPage.icon = config.logo; + statusPage.autoRefreshInterval = config.autoRefreshInterval, statusPage.theme = config.theme; //statusPage.published = ; //statusPage.search_engine_index = ; @@ -280,6 +281,7 @@ module.exports.statusPageSocketHandler = (socket) => { statusPage.title = title; statusPage.theme = "auto"; statusPage.icon = ""; + statusPage.autoRefreshInterval = 300; await R.store(statusPage); callback({ diff --git a/src/lang/en.json b/src/lang/en.json index 2c6e7887..2a3e6628 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -361,6 +361,8 @@ "Proxy": "Proxy", "Date Created": "Date Created", "Footer Text": "Footer Text", + "Refresh Interval": "Refresh Interval", + "Refresh Interval Description": "The status page will do a full site refresh every {0} seconds", "Show Powered By": "Show Powered By", "Domain Names": "Domain Names", "signedInDisp": "Signed in as {0}", diff --git a/src/pages/StatusPage.vue b/src/pages/StatusPage.vue index af2f028d..1f67c22e 100644 --- a/src/pages/StatusPage.vue +++ b/src/pages/StatusPage.vue @@ -34,6 +34,14 @@ +
+ + +
+ {{ $t("Refresh Interval Description", [config.autoRefreshInterval]) }} +
+
+