diff --git a/nfoguard-web/static/index.html b/nfoguard-web/static/index.html
index 5d7d777..7238955 100644
--- a/nfoguard-web/static/index.html
+++ b/nfoguard-web/static/index.html
@@ -380,38 +380,6 @@
-
Database Statistics
diff --git a/nfoguard-web/static/js/app.js b/nfoguard-web/static/js/app.js
index f37e9f5..317535b 100644
--- a/nfoguard-web/static/js/app.js
+++ b/nfoguard-web/static/js/app.js
@@ -5,6 +5,7 @@ let currentTab = 'dashboard';
let currentMoviesPage = 1;
let currentSeriesPage = 1;
let dashboardData = null;
+let seriesSourcesLoaded = false;
// Initialize app
document.addEventListener('DOMContentLoaded', function() {
@@ -12,7 +13,6 @@ document.addEventListener('DOMContentLoaded', function() {
initializeEventListeners();
checkAuthStatus(); // Check authentication status on page load
loadDashboard();
- loadSeriesSources();
});
// Tab management
@@ -49,6 +49,9 @@ function switchTab(tabName) {
break;
case 'tv':
loadSeries();
+ if (!seriesSourcesLoaded) {
+ loadSeriesSources();
+ }
break;
case 'reports':
loadReport();
@@ -75,7 +78,6 @@ function initializeEventListeners() {
// Forms
document.getElementById('edit-form').addEventListener('submit', handleEditSubmit);
- document.getElementById('bulk-update-form').addEventListener('submit', handleBulkUpdate);
// Manual scan forms
document.getElementById('manual-scan-form').addEventListener('submit', handleManualScan);
@@ -122,9 +124,6 @@ async function loadDashboard() {
function updateDashboardStats() {
if (!dashboardData) return;
- // Debug: Log dashboard data to see what fields are available
- console.log('Dashboard data received:', dashboardData);
-
const moviesTotal = dashboardData.movies_total || 0;
const moviesWithDates = dashboardData.movies_with_dates || 0;
const moviesWithoutDates = dashboardData.movies_without_dates || (moviesTotal - moviesWithDates);
@@ -360,6 +359,7 @@ async function loadSeriesSources() {
});
select.value = currentValue;
+ seriesSourcesLoaded = true;
} catch (error) {
console.error('Failed to load series sources:', error);
}
@@ -854,47 +854,6 @@ async function loadDetailedStats() {
}
}
-async function handleBulkUpdate(event) {
- event.preventDefault();
-
- const mediaType = document.getElementById('bulk-media-type').value;
- const oldSource = document.getElementById('bulk-old-source').value;
- const newSource = document.getElementById('bulk-new-source').value;
-
- if (!mediaType || !oldSource || !newSource) {
- showToast('Please fill in all fields', 'warning');
- return;
- }
-
- if (!confirm(`This will update all ${mediaType} with source "${oldSource}" to "${newSource}". Continue?`)) {
- return;
- }
-
- try {
- const result = await apiCall('/api/bulk/update-source', {
- method: 'POST',
- body: JSON.stringify({
- media_type: mediaType,
- old_source: oldSource,
- new_source: newSource
- })
- });
-
- showToast(result.message, 'success');
-
- // Reset form
- document.getElementById('bulk-update-form').reset();
-
- // Refresh current tab
- if (currentTab === 'movies') loadMovies(currentMoviesPage);
- if (currentTab === 'tv') loadSeries(currentSeriesPage);
- if (currentTab === 'reports') loadReport();
- if (currentTab === 'dashboard') loadDashboard();
-
- } catch (error) {
- console.error('Bulk update failed:', error);
- }
-}
// Edit modal functions
async function editMovie(imdbId, dateadded, source) {