Skip to content

Commit 98bc6cd

Browse files
authored
Add BIENNIALLY & TRIENNIALLY stats on TaskMonitor (hestiacp#3721)
* Add BIENNIALLY & TRIENNIALLY stats on TaskMonitor * Fixed Prettier on previous commit JS files. * Amend. Applying prettier on JS and PHP files.
1 parent 6843f11 commit 98bc6cd

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

bin/v-export-rrd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ elif [ "$timespan" = "monthly" ]; then
132132
elif [ "$timespan" = "yearly" ]; then
133133
start=$(date -d "1 year ago" +%s)
134134
step=172800
135+
elif [ "$timespan" = "biennially" ]; then
136+
start=$(date -d "2 year ago" +%s)
137+
step=345600
138+
elif [ "$timespan" = "triennially" ]; then
139+
start=$(date -d "3 year ago" +%s)
140+
step=518400
135141
else
136142
start=$(date -d "1 day ago" +%s)
137143
# every 5min

web/js/src/rrdCharts.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ function formatLabel(date, period) {
6161
weekly: { weekday: 'short', day: 'numeric' },
6262
monthly: { month: 'short', day: 'numeric' },
6363
yearly: { month: 'long' },
64+
biennially: { month: 'long', year: 'numeric' },
65+
triennially: { month: 'long', year: 'numeric' },
6466
};
6567

6668
return date.toLocaleString([], options[period]);

web/list/rrd/ajax.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
$requestPayload = json_decode(file_get_contents("php://input"), true);
1313

14-
$allowedPeriods = ["daily", "weekly", "monthly", "yearly"];
14+
$allowedPeriods = ["daily", "weekly", "monthly", "yearly", "biennially", "triennially"];
1515

1616
if (!empty($requestPayload["period"]) && in_array($requestPayload["period"], $allowedPeriods)) {
1717
$period = $requestPayload["period"];

web/list/rrd/index.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,16 @@
2727
*/
2828
if (empty($_GET["period"])) {
2929
$period = "daily";
30-
} elseif (!in_array($_GET["period"], ["daily", "weekly", "monthly", "yearly"])) {
30+
} elseif (
31+
!in_array($_GET["period"], [
32+
"daily",
33+
"weekly",
34+
"monthly",
35+
"yearly",
36+
"biennially",
37+
"triennially",
38+
])
39+
) {
3140
$period = "daily";
3241
} else {
3342
$period = $_GET["period"];

web/templates/pages/list_rrd.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
<a class="toolbar-link<?php if ((!empty($period)) && ($period == 'weekly')) echo " selected" ?>" href="?period=weekly"><?= _("Weekly") ?></a>
1515
<a class="toolbar-link<?php if ((!empty($period)) && ($period == 'monthly')) echo " selected" ?>" href="?period=monthly"><?= _("Monthly") ?></a>
1616
<a class="toolbar-link<?php if ((!empty($period)) && ($period == 'yearly')) echo " selected" ?>" href="?period=yearly"><?= _("Yearly") ?></a>
17+
<a class="toolbar-link<?php if ((!empty($period)) && ($period == 'biennially')) echo " selected" ?>" href="?period=biennially"><?= _("Biennially") ?></a>
18+
<a class="toolbar-link<?php if ((!empty($period)) && ($period == 'triennially')) echo " selected" ?>" href="?period=triennially"><?= _("Trienially") ?></a>
1719
</div>
1820
</div>
1921
</div>

0 commit comments

Comments
 (0)