dev #60

Merged
sbcrumb merged 42 commits from dev into main 2025-10-22 21:27:04 -04:00
2 changed files with 5 additions and 78 deletions
Showing only changes of commit 864934d66e - Show all commits
-32
View File
@@ -380,38 +380,6 @@
</form>
</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">
<h3><i class="fas fa-database"></i> Database Statistics</h3>
+5 -46
View File
@@ -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) {