Fixes agent buttons

main
Yasen Pramatarov 2024-09-30 19:48:00 +03:00
parent 37b0a289b2
commit b6c42fd4ec
1 changed files with 10 additions and 3 deletions

View File

@ -10,10 +10,17 @@
<br /> <br />
endpoint: <strong><?= htmlspecialchars($agent['url']) ?><?= htmlspecialchars($agent['agent_endpoint']) ?></strong> endpoint: <strong><?= htmlspecialchars($agent['url']) ?><?= htmlspecialchars($agent['agent_endpoint']) ?></strong>
<br /> <br />
<button onclick="fetchData('<?= htmlspecialchars($agent['id']) ?>', '<?= htmlspecialchars($agent['url']) ?>', '<?= htmlspecialchars($agent['agent_endpoint']) ?>')">fetch data</button> <?php if (isset($_SESSION["{$agent['id']}_cache"])) { ?>
<button onclick="fetchData('<?= htmlspecialchars($agent['id']) ?>', '<?= htmlspecialchars($agent['url']) ?>', '<?= htmlspecialchars($agent['agent_endpoint']) ?>', true)">force refresh</button> <button class="btn btn-primary" data-toggle="tooltip" data-placement="bottom" title="load recently cached data" onclick="fetchData('<?= htmlspecialchars($agent['id']) ?>', '<?= htmlspecialchars($agent['url']) ?>', '<?= htmlspecialchars($agent['agent_endpoint']) ?>')">load cache</button>
<button class="btn btn-primary" data-toggle="tooltip" data-placement="bottom" title="get fresh data from agent" onclick="fetchData('<?= htmlspecialchars($agent['id']) ?>', '<?= htmlspecialchars($agent['url']) ?>', '<?= htmlspecialchars($agent['agent_endpoint']) ?>', true)">force refresh</button>
<?php } else { ?>
<button class="btn btn-primary" data-toggle="tooltip" data-placement="bottom" title="get data from the agent" onclick="fetchData('<?= htmlspecialchars($agent['id']) ?>', '<?= htmlspecialchars($agent['url']) ?>', '<?= htmlspecialchars($agent['agent_endpoint']) ?>')">fetch data</button>
<button class="btn btn-light" data-toggle="tooltip" data-placement="bottom" title="no cache to refresh">force refresh</button>
<?php } ?>
</p> </p>
<p>Result:</p> <p>Result:</p>
<pre id="result<?= htmlspecialchars($agent['id']) ?>">click a button to fetch data from the agent.</pre> <pre id="result<?= htmlspecialchars($agent['id']) ?>">click a button to fetch data from the agent.</pre>
<?php
print_r($_SESSION);
?>
<?php } ?> <?php } ?>