mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-06 20:17:21 +08:00
Added toggle for tag visibility
This commit is contained in:
@@ -101,6 +101,10 @@ router.get("/api/status-page/config", async (_request, response) => {
|
||||
config.statusPagePublished = true;
|
||||
}
|
||||
|
||||
if (! config.statusPageTags) {
|
||||
config.statusPageTags = "hidden";
|
||||
}
|
||||
|
||||
if (! config.title) {
|
||||
config.title = "Uptime Kuma";
|
||||
}
|
||||
@@ -143,11 +147,15 @@ router.get("/api/status-page/monitor-list", cache("5 minutes"), async (_request,
|
||||
let list = await R.find("group", " public = 1 ORDER BY weight ");
|
||||
for (let groupBean of list) {
|
||||
let monitorGroup = await groupBean.toPublicJSON()
|
||||
monitorGroup.monitorList = await Promise.all(monitorGroup.monitorList.map( async (monitor)=>{
|
||||
// Includes tags as an array in response, allows for tags to be displayed on public status page
|
||||
let tags = await R.getAll("SELECT mt.monitor_id,mt.value, tag.name, tag.color FROM monitor_tag mt JOIN tag ON mt.tag_id = tag.id WHERE mt.monitor_id = ?", [monitor.id]);
|
||||
return {...monitor,tags: tags}
|
||||
}))
|
||||
console.log("\n\nsettings", await getSettings("statusPage"))
|
||||
if ((await getSettings("statusPage")).statusPageTags=="visible") {
|
||||
monitorGroup.monitorList = await Promise.all(monitorGroup.monitorList.map( async (monitor)=>{
|
||||
// Includes tags as an array in response, allows for tags to be displayed on public status page
|
||||
let tags = await R.getAll("SELECT mt.monitor_id,mt.value, tag.name, tag.color FROM monitor_tag mt JOIN tag ON mt.tag_id = tag.id WHERE mt.monitor_id = ?", [monitor.id]);
|
||||
return {...monitor,tags: tags}
|
||||
}))
|
||||
}
|
||||
|
||||
publicGroupList.push(monitorGroup);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user