|
|
@ -96,11 +96,15 @@ class Monitor extends BeanModel {
|
|
|
|
screenshot = "/screenshots/" + jwt.sign(this.id, UptimeKumaServer.getInstance().jwtSecret) + ".png";
|
|
|
|
screenshot = "/screenshots/" + jwt.sign(this.id, UptimeKumaServer.getInstance().jwtSecret) + ".png";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const path = await this.getPath();
|
|
|
|
|
|
|
|
const pathName = path.join(" / ");
|
|
|
|
|
|
|
|
|
|
|
|
let data = {
|
|
|
|
let data = {
|
|
|
|
id: this.id,
|
|
|
|
id: this.id,
|
|
|
|
name: this.name,
|
|
|
|
name: this.name,
|
|
|
|
description: this.description,
|
|
|
|
description: this.description,
|
|
|
|
pathName: await this.getPathName(),
|
|
|
|
path,
|
|
|
|
|
|
|
|
pathName,
|
|
|
|
parent: this.parent,
|
|
|
|
parent: this.parent,
|
|
|
|
childrenIDs: await Monitor.getAllChildrenIDs(this.id),
|
|
|
|
childrenIDs: await Monitor.getAllChildrenIDs(this.id),
|
|
|
|
url: this.url,
|
|
|
|
url: this.url,
|
|
|
@ -1527,11 +1531,11 @@ class Monitor extends BeanModel {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Gets Full Path-Name (Groups and Name)
|
|
|
|
* Gets the full path
|
|
|
|
* @returns {Promise<string>} Full path name of this monitor
|
|
|
|
* @returns {Promise<string[]>} Full path (includes groups and the name) of the monitor
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
async getPathName() {
|
|
|
|
async getPath() {
|
|
|
|
let path = this.name;
|
|
|
|
const path = [ this.name ];
|
|
|
|
|
|
|
|
|
|
|
|
if (this.parent === null) {
|
|
|
|
if (this.parent === null) {
|
|
|
|
return path;
|
|
|
|
return path;
|
|
|
@ -1539,7 +1543,7 @@ class Monitor extends BeanModel {
|
|
|
|
|
|
|
|
|
|
|
|
let parent = await Monitor.getParent(this.id);
|
|
|
|
let parent = await Monitor.getParent(this.id);
|
|
|
|
while (parent !== null) {
|
|
|
|
while (parent !== null) {
|
|
|
|
path = `${parent.name} / ${path}`;
|
|
|
|
path.unshift(parent.name);
|
|
|
|
parent = await Monitor.getParent(parent.id);
|
|
|
|
parent = await Monitor.getParent(parent.id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|