feat: add Ombi requests tab and webhook panel integration
- Add Ombi requests tab UI with movie/TV request display - Add showAll parameter support for Ombi requests (API and SSE) - Add Ombi webhook panel with enable/test functionality - Add Ombi webhook status endpoint with metrics - Add Ombi webhook test endpoint - Change GET /api/ombi/requests to use OmbiRetriever instead of cache - Add Ombi webhook state and API functions to frontend - Update SSE payload to include Ombi baseUrl and requests
This commit is contained in:
+29
-9
@@ -2,42 +2,62 @@
|
||||
|
||||
import { getActiveTab, saveActiveTab } from '../utils/storage.js';
|
||||
import { loadHistory } from './history.js';
|
||||
import { setupRequestsTab } from './requests.js';
|
||||
|
||||
export function initTabs() {
|
||||
const downloadsTab = document.querySelector('[data-tab="downloads"]');
|
||||
const requestsTab = document.querySelector('[data-tab="requests"]');
|
||||
const historyTab = document.querySelector('[data-tab="history"]');
|
||||
|
||||
if (!downloadsTab || !historyTab) return;
|
||||
|
||||
// Load saved tab
|
||||
const savedTab = getActiveTab();
|
||||
if (savedTab === 'history') {
|
||||
if (savedTab === 'requests') {
|
||||
activateTab('requests');
|
||||
} else if (savedTab === 'history') {
|
||||
activateTab('history');
|
||||
} else {
|
||||
activateTab('downloads');
|
||||
}
|
||||
|
||||
downloadsTab.addEventListener('click', () => activateTab('downloads'));
|
||||
if (requestsTab) {
|
||||
requestsTab.addEventListener('click', () => activateTab('requests'));
|
||||
}
|
||||
historyTab.addEventListener('click', () => activateTab('history'));
|
||||
}
|
||||
|
||||
export function activateTab(tab) {
|
||||
const downloadsTab = document.querySelector('[data-tab="downloads"]');
|
||||
const requestsTab = document.querySelector('[data-tab="requests"]');
|
||||
const historyTab = document.querySelector('[data-tab="history"]');
|
||||
const downloadsSection = document.getElementById('tab-downloads');
|
||||
const requestsSection = document.getElementById('tab-requests');
|
||||
const historySection = document.getElementById('tab-history');
|
||||
|
||||
// Remove active class from all tabs
|
||||
if (downloadsTab) downloadsTab.classList.remove('active');
|
||||
if (requestsTab) requestsTab.classList.remove('active');
|
||||
if (historyTab) historyTab.classList.remove('active');
|
||||
|
||||
// Hide all sections
|
||||
if (downloadsSection) downloadsSection.classList.add('hidden');
|
||||
if (requestsSection) requestsSection.classList.add('hidden');
|
||||
if (historySection) historySection.classList.add('hidden');
|
||||
|
||||
if (tab === 'downloads') {
|
||||
downloadsTab.classList.add('active');
|
||||
historyTab.classList.remove('active');
|
||||
downloadsSection.classList.remove('hidden');
|
||||
historySection.classList.add('hidden');
|
||||
if (downloadsTab) downloadsTab.classList.add('active');
|
||||
if (downloadsSection) downloadsSection.classList.remove('hidden');
|
||||
saveActiveTab('downloads');
|
||||
} else if (tab === 'requests') {
|
||||
if (requestsTab) requestsTab.classList.add('active');
|
||||
if (requestsSection) requestsSection.classList.remove('hidden');
|
||||
saveActiveTab('requests');
|
||||
setupRequestsTab();
|
||||
} else if (tab === 'history') {
|
||||
historyTab.classList.add('active');
|
||||
downloadsTab.classList.remove('active');
|
||||
historySection.classList.remove('hidden');
|
||||
downloadsSection.classList.add('hidden');
|
||||
if (historyTab) historyTab.classList.add('active');
|
||||
if (historySection) historySection.classList.remove('hidden');
|
||||
saveActiveTab('history');
|
||||
loadHistory();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user