4aa3590017
Build and Push Docker Image / build (push) Successful in 53s
Docs Check / Markdown lint (push) Successful in 1m36s
Licence Check / Licence compatibility and copyright header verification (push) Failing after 2m31s
CI / Security audit (push) Successful in 2m55s
Docs Check / Mermaid diagram parse check (push) Successful in 3m24s
CI / Swagger Validation & Coverage (push) Successful in 3m30s
CI / Tests & coverage (push) Successful in 3m50s
- Deleted redundant unit test file tests/unit/dashboard.test.js - Enabled skipped frontend DOM state and API tests in tests/frontend/state.test.js - Fixed Supertest client socket abort exception in SSE stream integration tests using new graceful testClose parameter - Consolidated duplicate helpers in server/routes/history.js and server/utils/arrRetrievers.js to unified services TagMatcher and DownloadAssembler - Added comprehensive unit tests for loadSecrets.js, PollingSonarrRetriever.js, PollingRadarrRetriever.js, and ombiHelpers.js - Achieved a 100% Vitest pass rate (834/834 tests) with robust code coverage
69 lines
2.5 KiB
JavaScript
69 lines
2.5 KiB
JavaScript
// Copyright (c) 2026 Gordon Bolton. MIT License.
|
|
|
|
import { getActiveTab, saveActiveTab } from '../utils/storage.js';
|
|
import { loadHistory } from './history.js';
|
|
import { renderRequests } 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 === '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') {
|
|
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');
|
|
renderRequests();
|
|
} else if (tab === 'history') {
|
|
if (historyTab) historyTab.classList.add('active');
|
|
if (historySection) historySection.classList.remove('hidden');
|
|
saveActiveTab('history');
|
|
loadHistory();
|
|
}
|
|
}
|
|
|
|
export function goHome() {
|
|
activateTab('downloads');
|
|
}
|