diff options
author | RaindropsSys <raindrops@equestria.dev> | 2024-03-30 23:40:33 +0100 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2024-03-30 23:40:33 +0100 |
commit | 6b796258d413f00e498ce7f80f73a9f6c061f29c (patch) | |
tree | 49e64a5dd4cde2acff7f0a93ed3f8e20e1cb2dc8 /pages/jobs.inc | |
parent | 5860551daa0f60103ad24e93da29f401a653f144 (diff) | |
download | pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.gz pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.bz2 pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.zip |
Updated 5 files, added 2 files, deleted 495 files and renamed 7 files (automated)
Diffstat (limited to 'pages/jobs.inc')
-rw-r--r-- | pages/jobs.inc | 138 |
1 files changed, 0 insertions, 138 deletions
diff --git a/pages/jobs.inc b/pages/jobs.inc deleted file mode 100644 index 3c0bb3d..0000000 --- a/pages/jobs.inc +++ /dev/null @@ -1,138 +0,0 @@ -<?php - -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages; -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"]); - header("Location: /-/jobs/?enqueued"); - die(); -} - -require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc'; - -?> - -<style> - <?php global $use2023UI; if (!$use2023UI): ?> - .list-group-item { - color: #fff; - background-color: #222; - border: 1px solid rgba(255, 255, 255, .125); - } - - .list-group-item.disabled { - color: #fff; - background-color: #222; - border-color: rgba(255, 255, 255, .125); - opacity: .75; - } - - .list-group-item:hover { - background-color: #252525; - color: #ddd; - } - - .list-group-item:active, .list-group-item:focus { - background-color: #272727; - color: #bbb; - } - - <?php endif; ?> - - details[open] summary { - font-weight: bold; - } - - <?php if ($use2023UI): ?> - pre { - background: var(--palette-4); - color: var(--palette-6); - padding: 10px 20px; - margin-top: 10px; - } - <?php else: ?> - pre { - background: #000000; - color: #ffffff; - padding: 10px 20px; - margin-top: 10px; - } - <?php endif; ?> - - pre.last { - margin-bottom: 0; - } - - .tracking li { - margin-bottom: 5px; - } - - .tracking li:nth-last-child(1), .tracking { - margin-bottom: 0 !important; - } -</style> - -<br> -<div class="container"> - <div id="page-content"> - <h2>Jobs history</h2> - - <?php if (isset($_GET["enqueued"])): ?> - <div class="alert alert-success">Successfully enqueued a new job, it will be run shortly and appear on this page once it has finished.</div> - <?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);"> - <div><?= $item["name"] ?></div> - <div><?= timeAgo($item["tracking"]["queue"]) ?></div> - <div><?php if ($item["completed"]): ?><span class="text-success" style="filter: invert(1) hue-rotate(180deg);">Completed</span><?php else: ?><span class="text-danger" style="filter: invert(1) hue-rotate(180deg);">Failed</span><?php endif; ?></div> - </summary> - - <div class="list-group" style="margin-top: 10px;"> - <div class="list-group-item"> - <p> - <b>Duration:</b> <?= $item["time"] ?>ms · <a href="/-/jobs/?enqueue=<?= $index ?>">Enqueue again</a> - <b></b> - </p> - - <b>Console output:</b> - <pre><?= $item["output"] ?></pre> - - <?php if (isset($item["error"])): ?> - <b>Server error message:</b> - <pre><?= $item["error"] ?></pre> - <?php endif; ?> - - <b>Job lifetime:</b> - <ul class="tracking"> - <li><b>Queued by PHP</b><br><?= date('M jS Y, G:i:s', strtotime($item["tracking"]["queue"])) ?></li> - <?php if (isset($item["tracking"]["pickup"])): ?><li><b>Picked up by the runner</b><br><?= date('M jS Y, G:i:s', strtotime($item["tracking"]["pickup"])) ?></li><?php endif; ?> - <?php if (isset($item["tracking"]["start"])): ?><li><b>Started</b><br><?= date('M jS Y, G:i:s', strtotime($item["tracking"]["start"])) ?></li><?php endif; ?> - <?php if (isset($item["tracking"]["end"])): ?><li><b><?= $item["completed"] ? "Finished" : "Failed" ?></b><br><?= date('M jS Y, G:i:s', strtotime($item["tracking"]["end"])) ?></li><?php endif; ?> - <?php if (isset($item["tracking"]["logged"])): ?><li><b>Tracking logged</b><br><?= date('M jS Y, G:i:s', strtotime($item["tracking"]["logged"])) ?></li><?php endif; ?> - </ul> - </div> - </div> - </details> - <?php endforeach; ?> - </div> - </div> -</div> - -<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/footer.inc'; ?>
\ No newline at end of file |