Przeglądaj źródła

Restore old RRD images for now (#3246)

New ChartJS is a bit broken and looks terrible
Jaap Marcus 3 lat temu
rodzic
commit
79559033b5
2 zmienionych plików z 14 dodań i 5 usunięć
  1. 9 0
      web/list/rrd/index.php
  2. 5 5
      web/templates/pages/list_rrd.php

+ 9 - 0
web/list/rrd/index.php

@@ -16,6 +16,7 @@ exec(HESTIA_CMD . "v-list-sys-rrd json", $output, $return_var);
 $data = json_decode(implode("", $output), true);
 unset($output);
 
+/*
 if (empty($_GET["period"])) {
 	$period = "day";
 } elseif (!in_array($_GET["period"], ["day", "week", "month", "year"])) {
@@ -23,6 +24,14 @@ if (empty($_GET["period"])) {
 } else {
 	$period = $_GET["period"];
 }
+*/
+if (empty($_GET["period"])) {
+	$period = "daily";
+} elseif (!in_array($_GET["period"], ["daily", "weekly", "monthly", "yearly"])) {
+	$period = "daily";
+} else {
+	$period = $_GET["period"];
+}
 
 // Render page
 render_page($user, $TAB, "list_rrd");

+ 5 - 5
web/templates/pages/list_rrd.php

@@ -23,11 +23,11 @@
 				<h2 class="l-unit__name separate">
 					<?= _($data[$key]["TITLE"]) ?>
 				</h2>
-				<?php if ($data[$key]["TYPE"] != "net") { ?>
-				<canvas id="<?= $data[$key]["RRD"] ?>" class="js-chart" width="800" height="200" period="<?php echo htmlentities($period); ?>"></canvas>
-				<?php } else { ?>
-				<canvas id="net_<?= $data[$key]["RRD"] ?>" class="js-chart" width="800" height="200" period="<?php echo htmlentities($period); ?>"></canvas>
-				<?php } ?>
+				<div>
+				   <a href="/list/rrd/image.php?/rrd/<?=$data[$key]['TYPE']."/".$period."-".$data[$key]['RRD'].".png"?>" class="u-block" target="_blank">
+					 <img class="graph-rounded" src="/list/rrd/image.php?/rrd/<?=$data[$key]['TYPE']."/".$period."-".$data[$key]['RRD'].".png"?>" alt="">
+				   </a>
+				</div>
 			</div>
 		<?php } ?>
 	</div>