48 lines
1010 B
TypeScript
48 lines
1010 B
TypeScript
import {Api} from "~/api/Api";
|
|
|
|
export class Group
|
|
{
|
|
constructor (
|
|
public key: string,
|
|
public displayName: string,
|
|
public targets: Target[],
|
|
) {}
|
|
|
|
static get(onSuccess: (groups: Group[]) => void)
|
|
{
|
|
Api.get<Group[]>("/groups")
|
|
.then((response) => {
|
|
onSuccess(response.data)
|
|
});
|
|
}
|
|
}
|
|
|
|
export class Target
|
|
{
|
|
constructor (
|
|
public key: string,
|
|
public displayName: string,
|
|
public status: string,
|
|
public pings: Ping[],
|
|
public last1Hour: number,
|
|
public last24Hour: number
|
|
) {}
|
|
|
|
static getByKey(key: string, onSuccess: (_target: Target) => void)
|
|
{
|
|
Api.get<Target>("/healthchecks/" + key)
|
|
.then((response) => {
|
|
onSuccess(response.data)
|
|
});
|
|
}
|
|
}
|
|
|
|
export class Ping
|
|
{
|
|
constructor (
|
|
public result: string,
|
|
public timestamp: Date,
|
|
public code: string,
|
|
public body: string
|
|
) {}
|
|
} |