This commit is contained in:
@@ -380,38 +380,6 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tool-card">
|
|
||||||
<h3><i class="fas fa-exchange-alt"></i> Bulk Source Update</h3>
|
|
||||||
<p>Change source for multiple items at once</p>
|
|
||||||
<form id="bulk-update-form">
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Media Type:</label>
|
|
||||||
<select id="bulk-media-type" required>
|
|
||||||
<option value="">Select type...</option>
|
|
||||||
<option value="movies">Movies</option>
|
|
||||||
<option value="episodes">Episodes</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>From Source:</label>
|
|
||||||
<input type="text" id="bulk-old-source" placeholder="e.g., no_valid_date_source" required>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>To Source:</label>
|
|
||||||
<select id="bulk-new-source" required>
|
|
||||||
<option value="">Select new source...</option>
|
|
||||||
<option value="airdate">Air Date</option>
|
|
||||||
<option value="digital_release">Digital Release</option>
|
|
||||||
<option value="manual">Manual</option>
|
|
||||||
<option value="radarr:db.history.import">Radarr Import</option>
|
|
||||||
<option value="sonarr:history.import">Sonarr Import</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-warning">
|
|
||||||
<i class="fas fa-exchange-alt"></i> Update Sources
|
|
||||||
</button>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="tool-card">
|
<div class="tool-card">
|
||||||
<h3><i class="fas fa-database"></i> Database Statistics</h3>
|
<h3><i class="fas fa-database"></i> Database Statistics</h3>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ let currentTab = 'dashboard';
|
|||||||
let currentMoviesPage = 1;
|
let currentMoviesPage = 1;
|
||||||
let currentSeriesPage = 1;
|
let currentSeriesPage = 1;
|
||||||
let dashboardData = null;
|
let dashboardData = null;
|
||||||
|
let seriesSourcesLoaded = false;
|
||||||
|
|
||||||
// Initialize app
|
// Initialize app
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
@@ -12,7 +13,6 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
initializeEventListeners();
|
initializeEventListeners();
|
||||||
checkAuthStatus(); // Check authentication status on page load
|
checkAuthStatus(); // Check authentication status on page load
|
||||||
loadDashboard();
|
loadDashboard();
|
||||||
loadSeriesSources();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Tab management
|
// Tab management
|
||||||
@@ -49,6 +49,9 @@ function switchTab(tabName) {
|
|||||||
break;
|
break;
|
||||||
case 'tv':
|
case 'tv':
|
||||||
loadSeries();
|
loadSeries();
|
||||||
|
if (!seriesSourcesLoaded) {
|
||||||
|
loadSeriesSources();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'reports':
|
case 'reports':
|
||||||
loadReport();
|
loadReport();
|
||||||
@@ -75,7 +78,6 @@ function initializeEventListeners() {
|
|||||||
|
|
||||||
// Forms
|
// Forms
|
||||||
document.getElementById('edit-form').addEventListener('submit', handleEditSubmit);
|
document.getElementById('edit-form').addEventListener('submit', handleEditSubmit);
|
||||||
document.getElementById('bulk-update-form').addEventListener('submit', handleBulkUpdate);
|
|
||||||
|
|
||||||
// Manual scan forms
|
// Manual scan forms
|
||||||
document.getElementById('manual-scan-form').addEventListener('submit', handleManualScan);
|
document.getElementById('manual-scan-form').addEventListener('submit', handleManualScan);
|
||||||
@@ -122,9 +124,6 @@ async function loadDashboard() {
|
|||||||
function updateDashboardStats() {
|
function updateDashboardStats() {
|
||||||
if (!dashboardData) return;
|
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 moviesTotal = dashboardData.movies_total || 0;
|
||||||
const moviesWithDates = dashboardData.movies_with_dates || 0;
|
const moviesWithDates = dashboardData.movies_with_dates || 0;
|
||||||
const moviesWithoutDates = dashboardData.movies_without_dates || (moviesTotal - moviesWithDates);
|
const moviesWithoutDates = dashboardData.movies_without_dates || (moviesTotal - moviesWithDates);
|
||||||
@@ -360,6 +359,7 @@ async function loadSeriesSources() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
select.value = currentValue;
|
select.value = currentValue;
|
||||||
|
seriesSourcesLoaded = true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to load series sources:', 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
|
// Edit modal functions
|
||||||
async function editMovie(imdbId, dateadded, source) {
|
async function editMovie(imdbId, dateadded, source) {
|
||||||
|
|||||||
Reference in New Issue
Block a user