@ -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 ) ;