Skip to content

Commit 7955903

Browse files
authored
Restore old RRD images for now (hestiacp#3246)
New ChartJS is a bit broken and looks terrible
1 parent 56d42f7 commit 7955903

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

web/list/rrd/index.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,22 @@
1616
$data = json_decode(implode("", $output), true);
1717
unset($output);
1818

19+
/*
1920
if (empty($_GET["period"])) {
2021
$period = "day";
2122
} elseif (!in_array($_GET["period"], ["day", "week", "month", "year"])) {
2223
$period = "day";
2324
} else {
2425
$period = $_GET["period"];
2526
}
27+
*/
28+
if (empty($_GET["period"])) {
29+
$period = "daily";
30+
} elseif (!in_array($_GET["period"], ["daily", "weekly", "monthly", "yearly"])) {
31+
$period = "daily";
32+
} else {
33+
$period = $_GET["period"];
34+
}
2635

2736
// Render page
2837
render_page($user, $TAB, "list_rrd");

web/templates/pages/list_rrd.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
<h2 class="l-unit__name separate">
2424
<?= _($data[$key]["TITLE"]) ?>
2525
</h2>
26-
<?php if ($data[$key]["TYPE"] != "net") { ?>
27-
<canvas id="<?= $data[$key]["RRD"] ?>" class="js-chart" width="800" height="200" period="<?php echo htmlentities($period); ?>"></canvas>
28-
<?php } else { ?>
29-
<canvas id="net_<?= $data[$key]["RRD"] ?>" class="js-chart" width="800" height="200" period="<?php echo htmlentities($period); ?>"></canvas>
30-
<?php } ?>
26+
<div>
27+
<a href="/list/rrd/image.php?/rrd/<?=$data[$key]['TYPE']."/".$period."-".$data[$key]['RRD'].".png"?>" class="u-block" target="_blank">
28+
<img class="graph-rounded" src="/list/rrd/image.php?/rrd/<?=$data[$key]['TYPE']."/".$period."-".$data[$key]['RRD'].".png"?>" alt="">
29+
</a>
30+
</div>
3131
</div>
3232
<?php } ?>
3333
</div>

0 commit comments

Comments
 (0)