mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-12-10 00:30:23 -06:00
feat: Add toggle to hide the uptime percentage on a statuspage (#4587)
Co-authored-by: Bas Wieringa <bas.wieringa@waterplatformcompany.com> Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
parent
eb783897da
commit
5c83b17992
@ -0,0 +1,15 @@
|
|||||||
|
exports.up = function (knex) {
|
||||||
|
// Add new column status_page.show_only_last_heartbeat
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("status_page", function (table) {
|
||||||
|
table.boolean("show_only_last_heartbeat").notNullable().defaultTo(false);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function (knex) {
|
||||||
|
// Drop column status_page.show_only_last_heartbeat
|
||||||
|
return knex.schema
|
||||||
|
.alterTable("status_page", function (table) {
|
||||||
|
table.dropColumn("show_only_last_heartbeat");
|
||||||
|
});
|
||||||
|
};
|
||||||
@ -409,6 +409,7 @@ class StatusPage extends BeanModel {
|
|||||||
showPoweredBy: !!this.show_powered_by,
|
showPoweredBy: !!this.show_powered_by,
|
||||||
googleAnalyticsId: this.google_analytics_tag_id,
|
googleAnalyticsId: this.google_analytics_tag_id,
|
||||||
showCertificateExpiry: !!this.show_certificate_expiry,
|
showCertificateExpiry: !!this.show_certificate_expiry,
|
||||||
|
showOnlyLastHeartbeat: !!this.show_only_last_heartbeat
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,6 +433,7 @@ class StatusPage extends BeanModel {
|
|||||||
showPoweredBy: !!this.show_powered_by,
|
showPoweredBy: !!this.show_powered_by,
|
||||||
googleAnalyticsId: this.google_analytics_tag_id,
|
googleAnalyticsId: this.google_analytics_tag_id,
|
||||||
showCertificateExpiry: !!this.show_certificate_expiry,
|
showCertificateExpiry: !!this.show_certificate_expiry,
|
||||||
|
showOnlyLastHeartbeat: !!this.show_only_last_heartbeat
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -164,6 +164,7 @@ module.exports.statusPageSocketHandler = (socket) => {
|
|||||||
statusPage.footer_text = config.footerText;
|
statusPage.footer_text = config.footerText;
|
||||||
statusPage.custom_css = config.customCSS;
|
statusPage.custom_css = config.customCSS;
|
||||||
statusPage.show_powered_by = config.showPoweredBy;
|
statusPage.show_powered_by = config.showPoweredBy;
|
||||||
|
statusPage.show_only_last_heartbeat = config.showOnlyLastHeartbeat;
|
||||||
statusPage.show_certificate_expiry = config.showCertificateExpiry;
|
statusPage.show_certificate_expiry = config.showCertificateExpiry;
|
||||||
statusPage.modified_date = R.isoDateTime();
|
statusPage.modified_date = R.isoDateTime();
|
||||||
statusPage.google_analytics_tag_id = config.googleAnalyticsId;
|
statusPage.google_analytics_tag_id = config.googleAnalyticsId;
|
||||||
|
|||||||
@ -46,6 +46,7 @@
|
|||||||
<div class="info">
|
<div class="info">
|
||||||
<font-awesome-icon v-if="editMode" icon="arrows-alt-v" class="action drag me-3" />
|
<font-awesome-icon v-if="editMode" icon="arrows-alt-v" class="action drag me-3" />
|
||||||
<font-awesome-icon v-if="editMode" icon="times" class="action remove me-3" @click="removeMonitor(group.index, monitor.index)" />
|
<font-awesome-icon v-if="editMode" icon="times" class="action remove me-3" @click="removeMonitor(group.index, monitor.index)" />
|
||||||
|
|
||||||
<font-awesome-icon
|
<font-awesome-icon
|
||||||
v-if="editMode"
|
v-if="editMode"
|
||||||
icon="cog"
|
icon="cog"
|
||||||
@ -54,7 +55,8 @@
|
|||||||
data-testid="monitor-settings"
|
data-testid="monitor-settings"
|
||||||
@click="$refs.monitorSettingDialog.show(group, monitor)"
|
@click="$refs.monitorSettingDialog.show(group, monitor)"
|
||||||
/>
|
/>
|
||||||
<Uptime :monitor="monitor.element" type="24" :pill="true" />
|
<Status v-if="showOnlyLastHeartbeat" :status="statusOfLastHeartbeat(monitor.element.id)" />
|
||||||
|
<Uptime v-else :monitor="monitor.element" type="24" :pill="true" />
|
||||||
<a
|
<a
|
||||||
v-if="showLink(monitor)"
|
v-if="showLink(monitor)"
|
||||||
:href="monitor.element.url"
|
:href="monitor.element.url"
|
||||||
@ -96,6 +98,7 @@ import Draggable from "vuedraggable";
|
|||||||
import HeartbeatBar from "./HeartbeatBar.vue";
|
import HeartbeatBar from "./HeartbeatBar.vue";
|
||||||
import Uptime from "./Uptime.vue";
|
import Uptime from "./Uptime.vue";
|
||||||
import Tag from "./Tag.vue";
|
import Tag from "./Tag.vue";
|
||||||
|
import Status from "./Status.vue";
|
||||||
import GroupSortDropdown from "./GroupSortDropdown.vue";
|
import GroupSortDropdown from "./GroupSortDropdown.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -105,6 +108,7 @@ export default {
|
|||||||
HeartbeatBar,
|
HeartbeatBar,
|
||||||
Uptime,
|
Uptime,
|
||||||
Tag,
|
Tag,
|
||||||
|
Status,
|
||||||
GroupSortDropdown,
|
GroupSortDropdown,
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@ -120,7 +124,11 @@ export default {
|
|||||||
/** Should expiry be shown? */
|
/** Should expiry be shown? */
|
||||||
showCertificateExpiry: {
|
showCertificateExpiry: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
}
|
},
|
||||||
|
/** Should only the last heartbeat be shown? */
|
||||||
|
showOnlyLastHeartbeat: {
|
||||||
|
type: Boolean,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -192,6 +200,17 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the status of the last heartbeat
|
||||||
|
* @param {number} monitorId Id of the monitor to get status for
|
||||||
|
* @returns {number} Status of the last heartbeat
|
||||||
|
*/
|
||||||
|
statusOfLastHeartbeat(monitorId) {
|
||||||
|
let heartbeats = this.$root.heartbeatList[monitorId] ?? [];
|
||||||
|
let lastHeartbeat = heartbeats[heartbeats.length - 1];
|
||||||
|
return lastHeartbeat?.status;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns certificate expiry color based on days remaining
|
* Returns certificate expiry color based on days remaining
|
||||||
* @param {object} monitor Monitor to show expiry for
|
* @param {object} monitor Monitor to show expiry for
|
||||||
|
|||||||
@ -950,6 +950,7 @@
|
|||||||
"nostrRecipients": "Recipients Public Keys (npub)",
|
"nostrRecipients": "Recipients Public Keys (npub)",
|
||||||
"nostrRecipientsHelp": "npub format, one per line",
|
"nostrRecipientsHelp": "npub format, one per line",
|
||||||
"showCertificateExpiry": "Show Certificate Expiry",
|
"showCertificateExpiry": "Show Certificate Expiry",
|
||||||
|
"showOnlyLastHeartbeat": "Show Only Last Heartbeat",
|
||||||
"noOrBadCertificate": "No/Bad Certificate",
|
"noOrBadCertificate": "No/Bad Certificate",
|
||||||
"cacheBusterParam": "Add the {0} parameter",
|
"cacheBusterParam": "Add the {0} parameter",
|
||||||
"cacheBusterParamDescription": "Randomly generated parameter to skip caches.",
|
"cacheBusterParamDescription": "Randomly generated parameter to skip caches.",
|
||||||
|
|||||||
@ -68,6 +68,12 @@
|
|||||||
<label class="form-check-label" for="show-certificate-expiry">{{ $t("showCertificateExpiry") }}</label>
|
<label class="form-check-label" for="show-certificate-expiry">{{ $t("showCertificateExpiry") }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- Show only last heartbeat -->
|
||||||
|
<div class="my-3 form-check form-switch">
|
||||||
|
<input id="show-only-last-heartbeat" v-model="config.showOnlyLastHeartbeat" class="form-check-input" type="checkbox">
|
||||||
|
<label class="form-check-label" for="show-only-last-heartbeat">{{ $t("showOnlyLastHeartbeat") }}</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-if="false" class="my-3">
|
<div v-if="false" class="my-3">
|
||||||
<label for="password" class="form-label">{{ $t("Password") }} <sup>{{ $t("Coming Soon") }}</sup></label>
|
<label for="password" class="form-label">{{ $t("Password") }} <sup>{{ $t("Coming Soon") }}</sup></label>
|
||||||
<input id="password" v-model="config.password" disabled type="password" autocomplete="new-password" class="form-control">
|
<input id="password" v-model="config.password" disabled type="password" autocomplete="new-password" class="form-control">
|
||||||
@ -328,7 +334,7 @@
|
|||||||
👀 {{ $t("statusPageNothing") }}
|
👀 {{ $t("statusPageNothing") }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<PublicGroupList :edit-mode="enableEditMode" :show-tags="config.showTags" :show-certificate-expiry="config.showCertificateExpiry" />
|
<PublicGroupList :edit-mode="enableEditMode" :show-tags="config.showTags" :show-certificate-expiry="config.showCertificateExpiry" :show-only-last-heartbeat="config.showOnlyLastHeartbeat" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer class="mt-5 mb-4">
|
<footer class="mt-5 mb-4">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user