diff --git a/resources/web/epg_mapping.js b/resources/web/epg_mapping.js index 20b8c6d..4911d72 100644 --- a/resources/web/epg_mapping.js +++ b/resources/web/epg_mapping.js @@ -219,7 +219,22 @@ class EPGMappingManager { async loadProviderData(providerName) { try { - this.showLoading(true); + // Show loading in the channel list area only + const controlsContainer = document.getElementById('epg-controls'); + const channelList = document.getElementById('channel-list'); + const bulkActions = document.getElementById('bulk-actions'); + + if (controlsContainer) controlsContainer.style.display = 'none'; + if (channelList) { + channelList.style.display = 'block'; + channelList.innerHTML = ` +
+ +

Loading EPG data...

+
+ `; + } + if (bulkActions) bulkActions.style.display = 'none'; // First check EPG status let epgStatusResponse; @@ -231,11 +246,11 @@ class EPGMappingManager { throw new Error('EPG URL not configured. Please configure a valid EPG URL in the Advanced tab first.'); } if (!epgStatus.cache_valid) { - console.log('EPG cache not valid, will attempt to download...'); // ← CHANGED TO console.log + console.log('EPG cache not valid, will attempt to download...'); } } } catch (statusError) { - console.warn('Could not check EPG status:', statusError); // ← CHANGED TO console.warn + console.warn('Could not check EPG status:', statusError); } // Load all data in parallel @@ -278,17 +293,15 @@ class EPGMappingManager { }; }); - document.getElementById('epg-controls').style.display = 'flex'; - document.getElementById('channel-list').style.display = 'block'; - document.getElementById('bulk-actions').style.display = 'flex'; + if (controlsContainer) controlsContainer.style.display = 'flex'; + if (channelList) channelList.style.display = 'block'; + if (bulkActions) bulkActions.style.display = 'flex'; this.updateStats(); this.renderChannelList(); - this.showLoading(false); } catch (error) { this.showError('Failed to load provider data', error); - this.showLoading(false); } } @@ -314,12 +327,14 @@ class EPGMappingManager { renderChannelList() { const container = document.getElementById('channel-list'); if (!container || this.channelData.length === 0) { - container.innerHTML = ` -
- -

No channels found for this provider.

-
- `; + if (container) { + container.innerHTML = ` +
+ +

No channels found for this provider.

+
+ `; + } return; } @@ -752,20 +767,6 @@ class EPGMappingManager { } } - showLoading(show) { - const container = document.getElementById('epg-mapping-container'); - if (!container) return; - - if (show) { - container.innerHTML = ` -
- -

Loading EPG data...

-
- `; - } - } - showError(message, error) { const container = document.getElementById('epg-mapping-container'); if (container) {