From 133c5a9508eca321e4cd13f34317ddb019409fd8 Mon Sep 17 00:00:00 2001 From: Vili Manninen Date: Wed, 26 Feb 2025 22:27:02 +0200 Subject: [PATCH] Display information about mod list updating being prevented while there are downloads in progress --- src/components/ModListUpdateBanner.vue | 11 +++-- .../profiles-modals/ImportProfileModal.vue | 49 +++++++++++-------- .../settings-components/SettingsView.vue | 7 ++- src/store/modules/DownloadModule.ts | 22 +++++++-- 4 files changed, 61 insertions(+), 28 deletions(-) diff --git a/src/components/ModListUpdateBanner.vue b/src/components/ModListUpdateBanner.vue index eb65cdf31..d446d7431 100644 --- a/src/components/ModListUpdateBanner.vue +++ b/src/components/ModListUpdateBanner.vue @@ -37,13 +37,18 @@ export default class ModListUpdateBanner extends Vue { {{ $store.state.tsMods.thunderstoreModListUpdateStatus }} - Error updating the mod list. + Error refreshing the mod list. View error details.
- The manager will keep trying to update the mod list in the background. + The manager will keep trying to refresh the mod list in the background. +
+ + An error occurred when refreshing the mod list from Thunderstore.
+ However, the mod list can't be refreshed while the are mod downloads in progress.
+ Please wait for the downloads to finish before continuing.
- An error occurred when updating the mod list from Thunderstore. + An error occurred when refreshing the mod list from Thunderstore. Would you like to try again now? diff --git a/src/components/profiles-modals/ImportProfileModal.vue b/src/components/profiles-modals/ImportProfileModal.vue index 70ef23421..beda81d4e 100644 --- a/src/components/profiles-modals/ImportProfileModal.vue +++ b/src/components/profiles-modals/ImportProfileModal.vue @@ -324,26 +324,35 @@ export default class ImportProfileModal extends mixins(ProfilesMixin) {

- Updating the mod list from Thunderstore might solve this issue. - - - The mod list was last updated on {{ valueToReadableDate($store.state.tsMods.modsLastUpdated) }}. - - -
- - - {{ $store.state.tsMods.thunderstoreModListUpdateStatus }} - - - Error updating the mod list: - {{ $store.state.tsMods.thunderstoreModListUpdateError.message }}. - Retry? - - - Would you like to - update now? - + Refreshing the mod list from Thunderstore might solve this issue. + +

+ + However, the mod list can't be refreshed while the are mod downloads in progress. + Please wait for the downloads to finish before continuing. + +
+ +
+ + The mod list was last refreshed on {{ valueToReadableDate($store.state.tsMods.modsLastUpdated) }}. + + +
+ + + {{ $store.state.tsMods.thunderstoreModListUpdateStatus }} + + + Error refreshing the mod list: + {{ $store.state.tsMods.thunderstoreModListUpdateError.message }}. + Retry? + + + Would you like to + refresh now? + +

diff --git a/src/components/settings-components/SettingsView.vue b/src/components/settings-components/SettingsView.vue index 5ade507ba..0576f971c 100644 --- a/src/components/settings-components/SettingsView.vue +++ b/src/components/settings-components/SettingsView.vue @@ -314,12 +314,15 @@ import CdnProvider from '../../providers/generic/connection/CdnProvider'; 'Refresh online mod list', 'Check for any new mod releases.', async () => { - if (this.$store.state.tsMods.isThunderstoreModListUpdateInProgress) { - return this.$store.state.tsMods.thunderstoreModListUpdateStatus || "Updating..."; + if (this.$store.getters['download/activeDownloadCount'] > 0) { + return "Updating the mod list is disabled while there are active downloads."; } if (this.$store.state.tsMods.thunderstoreModListUpdateError) { return `Error updating the mod list: ${this.$store.state.tsMods.thunderstoreModListUpdateError.message}`; } + if (this.$store.state.tsMods.isThunderstoreModListUpdateInProgress) { + return this.$store.state.tsMods.thunderstoreModListUpdateStatus || "Updating..."; + } if (this.$store.state.tsMods.modsLastUpdated !== undefined) { return "Cache date: " + moment(this.$store.state.tsMods.modsLastUpdated).format("MMMM Do YYYY, h:mm:ss a"); } diff --git a/src/store/modules/DownloadModule.ts b/src/store/modules/DownloadModule.ts index f38741f4b..3e9058e19 100644 --- a/src/store/modules/DownloadModule.ts +++ b/src/store/modules/DownloadModule.ts @@ -52,17 +52,33 @@ export const DownloadModule = { }, getters: >{ - activeDownloadCount(state) { - const active = state.allDownloads.filter( + activeDownloadCount(_state, getters) { + return getters.activeDownloads.length; + }, + activeDownloads(state) { + return state.allDownloads.filter( dl => !dl.failed && !(dl.downloadProgress >= 100 && dl.installProgress >= 100) ); - return active.length; + }, + conciseDownloadStatus(_state, getters) { + if (getters.activeDownloadCount === 1 && getters.newestActiveDownload) { + if (getters.newestActiveDownload.downloadProgress < 100) { + return `Downloading mods (${getters.newestActiveDownload.downloadProgress}%)`; + } else { + return `Installing mods (${getters.newestActiveDownload.installProgress}%)`; + } + } else if (getters.activeDownloadCount > 1) { + return `Downloading and installing ${getters.activeDownloadCount} mods...`; + } }, currentDownload(state) { return state.allDownloads[state.allDownloads.length-1] || null; }, + newestActiveDownload(_state, getters) { + return getters.activeDownloads[getters.activeDownloads.length-1] || null; + }, newestFirst(state) { return Array.from(state.allDownloads).reverse(); },