diff --git a/src/assets/app.scss b/src/assets/app.scss index 0d3f0454..f8d5e1c8 100644 --- a/src/assets/app.scss +++ b/src/assets/app.scss @@ -609,6 +609,18 @@ $shadow-box-padding: 20px; } } +@media (max-width: 770px) { + .toast-container { + margin-bottom: 100px !important; + } +} + +@media (max-width: 550px) { + .toast-container { + margin-bottom: 126px !important; + } +} + // Localization @import "localization.scss"; diff --git a/src/components/settings/Notifications.vue b/src/components/settings/Notifications.vue index 4a9dc5aa..6819cece 100644 --- a/src/components/settings/Notifications.vue +++ b/src/components/settings/Notifications.vue @@ -20,6 +20,39 @@ +
+
{{ $t("monitorToastMessagesLabel") }}
+

{{ $t("monitorToastMessagesDescription") }}

+ +
+ + +
+ +
+ + +
+
+
{{ $t("settingsCertificateExpiry") }}

{{ $t("certificationExpiryDescription") }}

@@ -58,6 +91,8 @@ export default { data() { return { + toastSuccessTimeoutSecs: 20, + toastErrorTimeoutSecs: -1, /** * Variable to store the input for new certificate expiry day. */ @@ -77,6 +112,26 @@ export default { }, }, + watch: { + // Parse, store and apply new timeout settings. + toastSuccessTimeoutSecs(newTimeout) { + const parsedTimeout = parseInt(newTimeout); + if (parsedTimeout != null && !Number.isNaN(parsedTimeout)) { + localStorage.toastSuccessTimeout = newTimeout > 0 ? newTimeout * 1000 : newTimeout; + } + }, + toastErrorTimeoutSecs(newTimeout) { + const parsedTimeout = parseInt(newTimeout); + if (parsedTimeout != null && !Number.isNaN(parsedTimeout)) { + localStorage.toastErrorTimeout = newTimeout > 0 ? newTimeout * 1000 : newTimeout; + } + } + }, + + mounted() { + this.loadToastTimeoutSettings(); + }, + methods: { /** * Remove a day from expiry notification days. @@ -108,6 +163,27 @@ export default { } } }, + + /** + * Loads toast timeout settings from storage to component data. + */ + loadToastTimeoutSettings() { + const successTimeout = localStorage.toastSuccessTimeout; + if (successTimeout !== undefined) { + const parsedTimeout = parseInt(successTimeout); + if (parsedTimeout != null && !Number.isNaN(parsedTimeout)) { + this.toastSuccessTimeoutSecs = parsedTimeout > 0 ? parsedTimeout / 1000 : parsedTimeout; + } + } + + const errorTimeout = localStorage.toastErrorTimeout; + if (errorTimeout !== undefined) { + const parsedTimeout = parseInt(errorTimeout); + if (parsedTimeout != null && !Number.isNaN(parsedTimeout)) { + this.toastErrorTimeoutSecs = parsedTimeout > 0 ? parsedTimeout / 1000 : parsedTimeout; + } + } + }, }, }; diff --git a/src/lang/en.json b/src/lang/en.json index d75954a0..93f505db 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -785,6 +785,10 @@ "Badge URL": "Badge URL", "Group": "Group", "Monitor Group": "Monitor Group", + "monitorToastMessagesLabel": "Monitor Toast notifications", + "monitorToastMessagesDescription": "Toast notifications for monitors disappear after given time in seconds. Set to -1 disables timeout. Set to 0 disables toast notifications.", + "toastErrorTimeout": "Timeout for Error Notifications", + "toastSuccessTimeout": "Timeout for Success Notifications", "Kafka Brokers": "Kafka Brokers", "Enter the list of brokers": "Enter the list of brokers", "Press Enter to add broker": "Press Enter to add broker", diff --git a/src/layouts/Layout.vue b/src/layouts/Layout.vue index 49c3dfe5..034fe40c 100644 --- a/src/layouts/Layout.vue +++ b/src/layouts/Layout.vue @@ -117,12 +117,23 @@ {{ $t("Settings") }} + +