summaryrefslogtreecommitdiff
path: root/pages/jobs.inc
diff options
context:
space:
mode:
Diffstat (limited to 'pages/jobs.inc')
-rw-r--r--pages/jobs.inc11
1 files changed, 11 insertions, 0 deletions
diff --git a/pages/jobs.inc b/pages/jobs.inc
index 6723175..c00e35c 100644
--- a/pages/jobs.inc
+++ b/pages/jobs.inc
@@ -4,6 +4,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; gl
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/util/functions.inc';
$history = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/history.json"), true);
+$running = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/running.json"), true);
if (isset($_GET["enqueue"]) && isset($history[(int)$_GET["enqueue"]])) {
createJob(explode("(", $history[(int)$_GET["enqueue"]]["name"])[0], $history[(int)$_GET["enqueue"]]["options"]);
@@ -73,6 +74,16 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
<?php endif; ?>
<div class="list-group">
+ <?php foreach (array_reverse(array_filter(scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/data/jobs"), function ($i) {
+ return !str_starts_with($i, ".");
+ })) as $index => $file): $item = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/jobs/" . $file), true); ?>
+ <div class="list-group-item disabled" style="list-style: none; display: grid; grid-template-columns: 3fr repeat(2, 1fr);">
+ <div><?= $item["name"] ?>(<?php foreach ($item["options"] as $name => $value): echo($name . "=" . json_encode($value)); endforeach; ?>)</div>
+ <div><?= timeAgo($item["date"]) ?></div>
+ <div><?php if (isset($running) && $file === $running): ?><span class="text-info">Running</span><?php else: ?><span class="text-warning">Pending</span><?php endif; ?></div>
+ </div>
+ <?php endforeach; ?>
+
<?php foreach ($history as $index => $item): ?>
<details class="list-group-item">
<summary style="list-style: none; display: grid; grid-template-columns: 3fr repeat(2, 1fr);">