Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display information about mod list updating being prevented #1646

Open
wants to merge 2 commits into
base: status-indicator-data
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Collaborator Author

@VilppeRiskidev VilppeRiskidev Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: This part will probably be something like "The mod list will try to refresh after the downloads are finished.", or be completely refactored in the future.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd think it will make sense to handle the update before this box is rendered, perhaps in a separate step before the preview. Then in this step we'll either say that some mods can't be imported, or list all the mods normally if they're all known by the manager.

</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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too it might make sense to prefer to show the current status of update if mod downloads and mod list refresh are going on at the same time. Note that while the refresh can't be started while mods are downloading, user can still start downloads while the refresh is in progress, so both can be happening in the same time.

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
4 changes: 2 additions & 2 deletions src/store/modules/TsModsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,8 @@ export const TsModsModule = {
* Full update process of the mod list, to be used after
* passing the splash screen.
*/
async syncPackageList({commit, dispatch, state}): Promise<void> {
if (state.isThunderstoreModListUpdateInProgress) {
async syncPackageList({commit, dispatch, state, rootGetters}): Promise<void> {
if (state.isThunderstoreModListUpdateInProgress || rootGetters['download/activeDownloadCount'] > 0) {
return;
}

Expand Down
Loading