Compare commits

...

3 commits

Author SHA1 Message Date
Manavpreet Singh
e5fcee260d
Merge a951fabf69 into 7dc6191b0a 2025-01-24 17:49:44 +00:00
Elliot Matson
7dc6191b0a
fix: add notification-fallback for better google chat popups (#5476)
Some checks failed
Auto Test / armv7-simple-test (18, ARMv7) (push) Has been cancelled
Auto Test / armv7-simple-test (20, ARMv7) (push) Has been cancelled
Auto Test / check-linters (push) Has been cancelled
Auto Test / e2e-test (push) Has been cancelled
CodeQL / Analyze (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
validate / json-yaml-validate (push) Has been cancelled
validate / validate (push) Has been cancelled
Auto Test / auto-test (18, ARM64) (push) Has been cancelled
Auto Test / auto-test (18, macos-latest) (push) Has been cancelled
Auto Test / auto-test (18, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (18, windows-latest) (push) Has been cancelled
Auto Test / auto-test (20, ARM64) (push) Has been cancelled
Auto Test / auto-test (20, macos-latest) (push) Has been cancelled
Auto Test / auto-test (20, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (20, windows-latest) (push) Has been cancelled
Co-authored-by: Frank Elsinga <frank@elsinga.de>
2025-01-24 18:49:29 +01:00
Manavpreet Singh
a951fabf69 Fix#3601: Added support for hours, mins and seconds 2024-11-27 21:36:55 +05:30
2 changed files with 28 additions and 3 deletions

View file

@ -72,6 +72,7 @@ class GoogleChat extends NotificationProvider {
// construct json data
let data = {
fallbackText: chatHeader["title"],
cardsV2: [
{
card: {

View file

@ -129,7 +129,7 @@
<label for="push-url" class="form-label">{{ $t("PushUrl") }}</label>
<CopyableInput id="push-url" v-model="pushURL" type="url" disabled="disabled" />
<div class="form-text">
{{ $t("needPushEvery", [monitor.interval]) }}<br />
{{ $t("needPushEvery", [formatTime(monitor.interval)]) }}<br />
{{ $t("pushOptionalParams", ["status, msg, ping"]) }}
</div>
<button class="btn btn-primary" type="button" @click="resetToken">
@ -575,7 +575,7 @@
<!-- Interval -->
<div class="my-3">
<label for="interval" class="form-label">{{ $t("Heartbeat Interval") }} ({{ $t("checkEverySecond", [ monitor.interval ]) }})</label>
<label for="interval" class="form-label">{{ $t("Heartbeat Interval") }} ({{ $t("checkEverySecond", [ formatTime(monitor.interval) ]) }})</label>
<input id="interval" v-model="monitor.interval" type="number" class="form-control" required :min="minInterval" step="1" :max="maxInterval" @blur="finishUpdateInterval">
</div>
@ -590,7 +590,7 @@
<div class="my-3">
<label for="retry-interval" class="form-label">
{{ $t("Heartbeat Retry Interval") }}
<span>({{ $t("retryCheckEverySecond", [ monitor.retryInterval ]) }})</span>
<span>({{ $t("retryCheckEverySecond", [ formatTime(monitor.retryInterval) ]) }})</span>
</label>
<input id="retry-interval" v-model="monitor.retryInterval" type="number" class="form-control" required :min="minInterval" step="1">
</div>
@ -1647,6 +1647,30 @@ message HealthCheckResponse {
this.monitor.rabbitmqNodes.push(newNode);
},
/**
* Format seconds to a human readable string
* @param {number} seconds The number of seconds
* @returns {string} in the form of "X hours, Y minutes, Z seconds"
*/
formatTime(seconds) {
const hours = Math.floor(seconds / 3600);
const minutes = Math.floor((seconds % 3600) / 60);
const remainingSeconds = seconds % 60;
let result = "";
if (hours > 0) {
result += hours + " hour, ";
}
if (minutes > 0) {
result += minutes + " minutes, ";
}
if (remainingSeconds > 0) {
result += remainingSeconds + " ";
}
return result;
},
/**
* Validate form input
* @returns {boolean} Is the form input valid?