Skip to content

Commit

Permalink
Display information about mod list updating being prevented while the…
Browse files Browse the repository at this point in the history
…re are downloads in progress
  • Loading branch information
VilppeRiskidev committed Mar 3, 2025
1 parent 5d0995b commit 133c5a9
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 28 deletions.
11 changes: 8 additions & 3 deletions src/components/ModListUpdateBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,18 @@ export default class ModListUpdateBanner extends Vue {
{{ $store.state.tsMods.thunderstoreModListUpdateStatus }}
</span>
<span v-else-if="updateError">
Error updating the mod list.
Error refreshing the mod list.
<a @click="openErrorModal">View error details</a>.
<br />
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.
</span>
<span v-else-if="$store.getters['download/activeDownloadCount'] > 0">
An error occurred when refreshing the mod list from Thunderstore.<br />
However, the mod list can't be refreshed while the are mod downloads in progress.<br />
Please wait for the downloads to finish before continuing.
</span>
<span v-else>
An error occurred when updating the mod list from Thunderstore.
An error occurred when refreshing the mod list from Thunderstore.
Would you like to
<a @click="updateModList">try again now</a>?
</span>
Expand Down
49 changes: 29 additions & 20 deletions src/components/profiles-modals/ImportProfileModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -324,26 +324,35 @@ export default class ImportProfileModal extends mixins(ProfilesMixin) {
</p>

<p class="margin-top">
Updating the mod list from Thunderstore might solve this issue.

<span v-if="$store.state.tsMods.modsLastUpdated">
The mod list was last updated on {{ valueToReadableDate($store.state.tsMods.modsLastUpdated) }}.
</span>

<br />

<span v-if="$store.state.tsMods.isThunderstoreModListUpdateInProgress">
{{ $store.state.tsMods.thunderstoreModListUpdateStatus }}
</span>
<span v-else-if="$store.state.tsMods.thunderstoreModListUpdateError">
Error updating the mod list:
{{ $store.state.tsMods.thunderstoreModListUpdateError.message }}.
<a @click="$store.dispatch('tsMods/syncPackageList')">Retry</a>?
</span>
<span v-else>
Would you like to
<a @click="$store.dispatch('tsMods/syncPackageList')">update now</a>?
</span>
Refreshing the mod list from Thunderstore might solve this issue.

<div v-if="$store.getters['download/activeDownloadCount'] > 0">
<span>
However, the mod list can't be refreshed while the are mod downloads in progress.
Please wait for the downloads to finish before continuing.
</span>
</div>

<div v-else>
<span v-if="$store.state.tsMods.modsLastUpdated">
The mod list was last refreshed on {{ valueToReadableDate($store.state.tsMods.modsLastUpdated) }}.
</span>

<br />

<span v-if="$store.state.tsMods.isThunderstoreModListUpdateInProgress">
{{ $store.state.tsMods.thunderstoreModListUpdateStatus }}
</span>
<span v-else-if="$store.state.tsMods.thunderstoreModListUpdateError">
Error refreshing the mod list:
{{ $store.state.tsMods.thunderstoreModListUpdateError.message }}.
<a @click="$store.dispatch('tsMods/syncPackageList')">Retry</a>?
</span>
<span v-else>
Would you like to
<a @click="$store.dispatch('tsMods/syncPackageList')">refresh now</a>?
</span>
</div>
</p>
</div>
</template>
Expand Down
7 changes: 5 additions & 2 deletions src/components/settings-components/SettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
22 changes: 19 additions & 3 deletions src/store/modules/DownloadModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,33 @@ export const DownloadModule = {
},

getters: <GetterTree<State, RootState>>{
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();
},
Expand Down

0 comments on commit 133c5a9

Please sign in to comment.