d3d085d614
Build and Push Docker Image / build (push) Successful in 1m29s
Docs Check / Markdown lint (push) Successful in 1m51s
Licence Check / Licence compatibility and copyright header verification (push) Failing after 2m3s
CI / Security audit (push) Successful in 2m54s
CI / Swagger Validation & Coverage (push) Successful in 3m6s
Docs Check / Mermaid diagram parse check (push) Successful in 3m13s
CI / Tests & coverage (push) Successful in 3m31s
- Add request filters UI (type, status, sort, search) - Implement dual-layer filtering (server + client) - Add ombiFilters utility for consistent filtering logic - Persist filter preferences in localStorage - Add SSE support for real-time Ombi request updates - Add webhook endpoints for Ombi integration - Update OpenAPI spec for new endpoints - Add unit tests for filter logic and UI - Add integration tests for Ombi routes
48 lines
2.0 KiB
JavaScript
48 lines
2.0 KiB
JavaScript
// Copyright (c) 2026 Gordon Bolton. MIT License.
|
|
|
|
// Global state (using objects for mutability across modules)
|
|
export const state = {
|
|
currentUser: null,
|
|
downloads: [],
|
|
downloadClients: [], // List of download clients from server (for ordering/filtering)
|
|
selectedDownloadClients: [], // Array of selected client IDs for multi-select filter
|
|
isAdmin: false,
|
|
showAll: false,
|
|
csrfToken: null, // double-submit CSRF token, sent as X-CSRF-Token on mutating requests
|
|
ombiBaseUrl: null, // Ombi base URL for generating links
|
|
ombiRequests: null, // Ombi requests data
|
|
|
|
// History section state
|
|
historyDays: 7, // Default value, will be loaded from localStorage
|
|
historyRefreshHandle: null,
|
|
ignoreAvailable: false, // Default value, will be loaded from localStorage
|
|
lastHistoryItems: [], // raw items from last fetch, for re-filtering without a network round-trip
|
|
|
|
// SSE stream state
|
|
sseSource: null,
|
|
sseReconnectTimer: null,
|
|
|
|
// Status panel state
|
|
statusRefreshHandle: null,
|
|
|
|
// Webhooks state
|
|
webhookSectionExpanded: false,
|
|
webhookLoading: false,
|
|
sonarrWebhook: { enabled: false, triggers: { onGrab: false, onDownload: false, onImport: false, onUpgrade: false }, stats: null },
|
|
radarrWebhook: { enabled: false, triggers: { onGrab: false, onDownload: false, onImport: false, onUpgrade: false }, stats: null },
|
|
ombiWebhook: { enabled: false, triggers: { requestAvailable: false, requestApproved: false, requestDeclined: false, requestPending: false, requestProcessing: false }, stats: null },
|
|
webhookMetrics: null,
|
|
|
|
// Request filter state
|
|
selectedRequestTypes: ['movie', 'tv'],
|
|
selectedRequestStatuses: [],
|
|
requestSortMode: 'requestedDate_desc',
|
|
requestSearchQuery: ''
|
|
};
|
|
|
|
// Constants
|
|
export const SPLASH_MIN_MS = 1200; // minimum splash display time
|
|
export const HISTORY_REFRESH_MS = 5 * 60 * 1000; // auto-refresh history every 5 min
|
|
export const SSE_RECONNECT_MS = 3000; // browser already retries, but we add explicit backoff too
|
|
export const STATUS_REFRESH_MS = 5000;
|