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

Profile import auto refresh when some or all packages are not found #1655

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

VilppeRiskidev
Copy link
Collaborator

No description provided.

Verified

This commit was signed with the committer’s verified signature.
jameslamb James Lamb
…t, not all of the mods are known

Verified

This commit was signed with the committer’s verified signature.
jameslamb James Lamb

Verified

This commit was signed with the committer’s verified signature.
jameslamb James Lamb
…out failed profile import
@VilppeRiskidev VilppeRiskidev requested a review from anttimaki March 6, 2025 18:54
@VilppeRiskidev VilppeRiskidev self-assigned this Mar 6, 2025
@VilppeRiskidev VilppeRiskidev marked this pull request as ready for review March 6, 2025 18:56
@@ -123,7 +125,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) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

isRetry is never used.

@@ -144,6 +146,25 @@ export default class ImportProfileModal extends mixins(ProfilesMixin) {
}

this.profileImportFilePath = files[0];

if (this.profileMods.known.length === 0 || this.profileMods.unknown.length > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: I think we're only interested in the number of unknown mods here? Checking number of known mods won't probably hurt, but at the same time refreshing the mod list can only solve issues with unknown mods.

@@ -144,6 +146,25 @@ export default class ImportProfileModal extends mixins(ProfilesMixin) {
}

this.profileImportFilePath = files[0];

if (this.profileMods.known.length === 0 || this.profileMods.unknown.length > 0) {
// Sometimes the reason some packages are unknown is that the mod is out of date,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: should "mod is out of date" say "mod list is out of date"?

try {
this.activeStep = 'REFRESH_MOD_LIST';
await this.$store.dispatch('tsMods/syncPackageList');
this.profileMods = await ProfileUtils.exportModsToCombos(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question: Is this needed? syncPackageList should update the mod list in Vuex, and that's watched by updateProfileModsOnOnlineModListRefresh, which does the same thing as this line? Seems to me we do this thing twice now?

<ModalCard v-else-if="activeStep === 'REVIEW_IMPORT'" key="REVIEW_IMPORT" :is-active="isOpen" @close-modal="closeModal">
<template v-slot:header>
<h2 class="modal-title">Packages to be installed</h2>
</template>
<template v-slot:body>
<OnlineModList :paged-mod-list="knownProfileMods" :read-only="true" />
<OnlineModList
Copy link
Collaborator

Choose a reason for hiding this comment

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

A bit unrelated to the changes, but I would probably change the order so that warning box is shown on top and the OnlineModList below it. The rationale is that for large profiles user might not scroll the list to the bottom and don't then see the warning.

<ModalCard v-else-if="activeStep === 'REVIEW_IMPORT'" key="REVIEW_IMPORT" :is-active="isOpen" @close-modal="closeModal">
<template v-slot:header>
<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"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: I think this should check knownProfileMods.length as that's what gets passed to the component.

Comment on lines +345 to 354
<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>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would perhaps reconsider how these three paragraphs work together. First saying no packages were found and then listing all the packages seems redundant. Saying "These packages in the profile were found on Thunderstore" and then listing unknownProfileModNames seems like a bug?

Should this perhaps just say "These packages in the profile were not found on Thunderstore" (notice the "not") inside the yellow box and then list the unknown mods for all cases?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants