mirror of
https://github.com/infinition/Bjorn.git
synced 2026-03-15 17:01:58 +00:00
Add Loki and Sentinel utility classes for web API endpoints
- Implemented LokiUtils class with GET and POST endpoints for managing scripts, jobs, and payloads. - Added SentinelUtils class with GET and POST endpoints for managing events, rules, devices, and notifications. - Both classes include error handling and JSON response formatting.
This commit is contained in:
@@ -214,13 +214,17 @@ function updateStaticI18n() {
|
||||
async function loadAllFiles() {
|
||||
setStatus(L('common.loading', 'Loading...'));
|
||||
try {
|
||||
const response = await fetch('/list_files');
|
||||
const ac = tracker ? tracker.trackAbortController() : new AbortController();
|
||||
const response = await fetch('/list_files', { signal: ac.signal });
|
||||
if (tracker) tracker.removeAbortController(ac);
|
||||
if (!tracker) return; /* unmounted while awaiting */
|
||||
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
||||
const data = await response.json();
|
||||
allFiles = Array.isArray(data) ? data : [];
|
||||
absoluteBasePath = inferAbsoluteBasePath(allFiles) || '/home/bjorn';
|
||||
renderCurrentFolder();
|
||||
} catch (err) {
|
||||
if (err.name === 'AbortError') return;
|
||||
console.error(`[${PAGE}] loadAllFiles:`, err);
|
||||
allFiles = [];
|
||||
renderCurrentFolder();
|
||||
|
||||
Reference in New Issue
Block a user