Skip to content

Commit

Permalink
Fix retrying the profile import and Improve displaying information ab…
Browse files Browse the repository at this point in the history
…out failed profile import
  • Loading branch information
VilppeRiskidev committed Mar 6, 2025
1 parent 8da452d commit 24d245b
Showing 1 changed file with 28 additions and 9 deletions.
37 changes: 28 additions & 9 deletions src/components/profiles-modals/ImportProfileModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default class ImportProfileModal extends mixins(ProfilesMixin) {
| 'IMPORT_FILE'
| 'IMPORT_CODE'
| 'REFRESH_MOD_LIST'
| 'IMPORT_FAILED'
| 'REVIEW_IMPORT'
| 'IMPORT_UPDATE_SELECTION'
| 'ADDING_PROFILE'
Expand Down Expand Up @@ -125,7 +126,7 @@ export default class ImportProfileModal extends mixins(ProfilesMixin) {
}
// Check that selected profile zip is valid and proceed.
async validateProfileFile(files: string[] | null) {
async validateProfileFile(files: string[] | null, isRetry: boolean = false) {
if (files === null || files.length === 0) {
this.closeModal();
return;
Expand All @@ -148,8 +149,21 @@ export default class ImportProfileModal extends mixins(ProfilesMixin) {
this.profileImportFilePath = files[0];
if (this.profileMods.known.length === 0 || this.profileMods.unknown.length > 0) {
this.activeStep = 'REFRESH_MOD_LIST';
await this.$store.dispatch('tsMods/syncPackageList');
// Sometimes the reason some packages are unknown is that the mod is out of date,
// so let's try refreshing it
try {
this.activeStep = 'REFRESH_MOD_LIST';
await this.$store.dispatch('tsMods/syncPackageList');
this.profileMods = await ProfileUtils.exportModsToCombos(
this.profileImportContent.getMods(),
this.$store.state.activeGame
);
} catch (e: unknown) {
const err = R2Error.fromThrownValue(e);
this.$store.commit('error/handleError', err);
this.closeModal();
return;
}
}
this.activeStep = 'REVIEW_IMPORT';
Expand Down Expand Up @@ -311,10 +325,8 @@ export default class ImportProfileModal extends mixins(ProfilesMixin) {
</template>
<template v-slot:footer>
<div>
<p v-if="profileMods.known.length === 0">
At least some of the packages were not found. We're trying to fix this by refreshing the online mod list:
</p>
<p>
At least some of the packages were not found. We're trying to fix this by refreshing the online mod list:</br>
{{$store.state.tsMods.thunderstoreModListUpdateStatus}}
</p>
</div>
Expand All @@ -326,13 +338,20 @@ export default class ImportProfileModal extends mixins(ProfilesMixin) {
<h2 class="modal-title">Packages to be installed</h2>
</template>
<template v-slot:body>
<OnlineModList :paged-mod-list="knownProfileMods" :read-only="true" />
<OnlineModList
v-if="profileMods.known.length > 0"
:paged-mod-list="knownProfileMods"
:read-only="true"
/>
<p v-else>
None of the packages in the profile were found on Thunderstore.
</p>
<div v-if="profileMods.known.length === 0 || profileMods.unknown.length > 0" class="notification is-warning margin-top">
<p v-if="profileMods.known.length === 0">
None of the packages in the profile were found on Thunderstore:
These packages were not found:
</p>
<p v-else>
Some of the packages in the profile were not found on Thunderstore:
These packages in the profile were found on Thunderstore:
</p>

<p class="margin-top">{{ unknownProfileModNames }}</p>
Expand Down

0 comments on commit 24d245b

Please sign in to comment.