Most hacked in POC

This commit is contained in:
Jasper Miller-Waugh 2021-10-27 23:06:06 +13:00
parent ba93129b18
commit 5e6d945095
No known key found for this signature in database
GPG key ID: 02A5F6F15443A805
2 changed files with 9 additions and 2 deletions

View file

@ -141,9 +141,13 @@ router.get("/api/status-page/monitor-list", cache("5 minutes"), async (_request,
await checkPublished(); await checkPublished();
const publicGroupList = []; const publicGroupList = [];
let list = await R.find("group", " public = 1 ORDER BY weight "); let list = await R.find("group", " public = 1 ORDER BY weight ");
for (let groupBean of list) { for (let groupBean of list) {
publicGroupList.push(await groupBean.toPublicJSON()); let monitor_info = await groupBean.toPublicJSON()
monitor_info.monitorList = await Promise.all(monitor_info.monitorList.map( async (monitor)=>{
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(monitor_info);
} }
response.json(publicGroupList); response.json(publicGroupList);

View file

@ -40,6 +40,7 @@
<Uptime :monitor="monitor.element" type="24" :pill="true" /> <Uptime :monitor="monitor.element" type="24" :pill="true" />
{{ monitor.element.name }} {{ monitor.element.name }}
<Tag v-for="tag in monitor.element.tags" :key="tag" :item="tag" :size="'sm'" />
</div> </div>
</div> </div>
<div :key="$root.userHeartbeatBar" class="col-3 col-md-4"> <div :key="$root.userHeartbeatBar" class="col-3 col-md-4">
@ -59,12 +60,14 @@
import Draggable from "vuedraggable"; 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";
export default { export default {
components: { components: {
Draggable, Draggable,
HeartbeatBar, HeartbeatBar,
Uptime, Uptime,
Tag,
}, },
props: { props: {
editMode: { editMode: {