add reload button
This commit is contained in:
1 parent
910555f363
commit
b642f2af7d
4 files changed
+217
-9
No files matched your search
@@ -29,6 +29,28 @@ function getLinkedOUs(string $gpo): array|false
|
||||
//return implode("\n", $decoded);
|
||||
}
|
||||
|
||||
# helper to reload OUs
|
||||
if (isset($_GET['reload'])) {
|
||||
// Call the Flask endpoint that reloads the YAML index
|
||||
$reloadUrl = "http://172.17.0.1:5000/reload_index";
|
||||
|
||||
$ch = curl_init($reloadUrl);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10); // 10‑second timeout
|
||||
$rawResponse = curl_exec($ch);
|
||||
|
||||
if ($rawResponse === false) {
|
||||
error_log('cURL error [' . curl_errno($ch) . ']: ' . curl_error($ch));
|
||||
} else {
|
||||
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
if ($httpCode !== 200) {
|
||||
error_log("API returned HTTP {$httpCode} for reload_index");
|
||||
}
|
||||
// Optionally inspect $rawResponse if you want to show a message
|
||||
}
|
||||
curl_close($ch);
|
||||
}
|
||||
|
||||
$yaml_timestamp = json_decode(file_get_contents('http://172.17.0.1:5000/timestamp'), true);
|
||||
$gpo_links = json_decode(file_get_contents('http://172.17.0.1:5000/gpo_links'), true);
|
||||
$index_duration = json_decode(file_get_contents('http://172.17.0.1:5000/index_duration'), true);
|
||||
@@ -180,6 +202,10 @@ else {
|
||||
<label for="group">Group Name:</label>
|
||||
<input type="text" id="group" name="group" required>
|
||||
<button type="submit">Query</button>
|
||||
</form>
|
||||
<form action="index.php" method="GET" style="display:inline;">
|
||||
<input type="hidden" name="reload" value="1">
|
||||
<button type="submit">Reload Index</button>
|
||||
</form><p>
|
||||
Data indexed at '.$yaml_timestamp['timestamp'].' after '.$index_duration['duration'].' minutes<br>
|
||||
Total Linked GPOs: '.$gpo_links['gpo_links'].'<p>
|
||||
|
||||
Reference in new issue
Block a user