Removed export methods & small improvements
This commit is contained in:
parent
49f92dcdef
commit
0a8cb0f686
|
@ -6,7 +6,7 @@ require_once(__DIR__ . "/filters.php");
|
|||
|
||||
class UptimeStatus {
|
||||
|
||||
private $data;
|
||||
private array $data;
|
||||
|
||||
public function load_data() {
|
||||
$page = json_decode(file_get_contents(UPTIME_KUMA_URL . "/api/status-page/" . UPTIME_KUMA_PAGE), true);
|
||||
|
|
|
@ -4,9 +4,9 @@ require_once(__DIR__ . "/monitor.php");
|
|||
|
||||
class Group {
|
||||
|
||||
private string $name;
|
||||
private int $online = 0;
|
||||
private array $monitors = [];
|
||||
public string $name;
|
||||
public int $online = 0;
|
||||
public array $monitors = [];
|
||||
|
||||
public function __construct(string $name) {
|
||||
$this->name = $name;
|
||||
|
@ -25,18 +25,6 @@ class Group {
|
|||
return count($this->monitors);
|
||||
}
|
||||
|
||||
public function export(): array {
|
||||
$monitors = [];
|
||||
foreach($this->monitors as $monitor) {
|
||||
array_push($monitors, $monitor->export());
|
||||
}
|
||||
return [
|
||||
"name" => $this->name,
|
||||
"online" => $this->online,
|
||||
"monitors" => $monitors
|
||||
];
|
||||
}
|
||||
|
||||
public static function convert(array $oldGroup, array $heartbeat): Group {
|
||||
$group = new Group($oldGroup["name"]);
|
||||
foreach ($oldGroup["monitorList"] as $oldMonitor) {
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
class Monitor {
|
||||
|
||||
private string $name;
|
||||
private float $uptime;
|
||||
private array $last;
|
||||
private array $heartbeats;
|
||||
private array $opt;
|
||||
public string $name;
|
||||
public float $uptime;
|
||||
public array $last;
|
||||
public array $heartbeats;
|
||||
public array $opt;
|
||||
|
||||
public function __construct(string $name, float $uptime, array $heartbeats, array $opt = []) {
|
||||
$this->name = $name;
|
||||
|
@ -20,16 +20,6 @@ class Monitor {
|
|||
return $this->last["status"] == 1;
|
||||
}
|
||||
|
||||
public function export(): array {
|
||||
return [
|
||||
"name" => $this->name,
|
||||
"uptime" => $this->uptime,
|
||||
"last" => $this->last,
|
||||
"heartbeats" => $this->heartbeats,
|
||||
"opt" => $this->opt
|
||||
];
|
||||
}
|
||||
|
||||
public static function convert(array $oldMonitor, array $heartbeat): Monitor {
|
||||
|
||||
$id = $oldMonitor["id"];
|
||||
|
|
|
@ -24,15 +24,11 @@ class Page {
|
|||
}
|
||||
|
||||
public function export(): array {
|
||||
$groups = [];
|
||||
foreach($this->groups as $group) {
|
||||
array_push($groups, $group->export());
|
||||
}
|
||||
return [
|
||||
"page" => $this->page,
|
||||
"online" => $this->online,
|
||||
"total" => $this->total,
|
||||
"groups" => $groups,
|
||||
"groups" => $this->groups,
|
||||
"date_format" => $this->date_format,
|
||||
"timezone" => $this->timezone
|
||||
];
|
||||
|
|
|
@ -90,7 +90,9 @@ header .icon svg {
|
|||
filter: drop-shadow(0 0 10px var(--bg-color));
|
||||
}
|
||||
|
||||
header p {font-size: .9rem;}
|
||||
header p {
|
||||
font-size: .9rem;
|
||||
}
|
||||
|
||||
|
||||
/* GROUP */
|
||||
|
|
Loading…
Reference in a new issue