Skip to content

Commit d8d7846

Browse files
authored
Merge pull request #1646 from ebkr/mod-list-update-prevent-info
Display information about mod list updating being prevented
2 parents ca7e0fc + ee98e1e commit d8d7846

File tree

5 files changed

+63
-30
lines changed

5 files changed

+63
-30
lines changed

src/components/ModListUpdateBanner.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,18 @@ export default class ModListUpdateBanner extends Vue {
3737
{{ $store.state.tsMods.thunderstoreModListUpdateStatus }}
3838
</span>
3939
<span v-else-if="updateError">
40-
Error updating the mod list.
40+
Error refreshing the mod list.
4141
<a @click="openErrorModal">View error details</a>.
4242
<br />
43-
The manager will keep trying to update the mod list in the background.
43+
The manager will keep trying to refresh the mod list in the background.
44+
</span>
45+
<span v-else-if="$store.getters['download/activeDownloadCount'] > 0">
46+
An error occurred when refreshing the mod list from Thunderstore.<br />
47+
However, the mod list can't be refreshed while the are mod downloads in progress.<br />
48+
Please wait for the downloads to finish before continuing.
4449
</span>
4550
<span v-else>
46-
An error occurred when updating the mod list from Thunderstore.
51+
An error occurred when refreshing the mod list from Thunderstore.
4752
Would you like to
4853
<a @click="updateModList">try again now</a>?
4954
</span>

src/components/profiles-modals/ImportProfileModal.vue

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -321,26 +321,35 @@ export default class ImportProfileModal extends mixins(ProfilesMixin) {
321321
</p>
322322

323323
<p class="margin-top">
324-
Updating the mod list from Thunderstore might solve this issue.
325-
326-
<span v-if="$store.state.tsMods.modsLastUpdated">
327-
The mod list was last updated on {{ valueToReadableDate($store.state.tsMods.modsLastUpdated) }}.
328-
</span>
329-
330-
<br />
331-
332-
<span v-if="$store.state.tsMods.isThunderstoreModListUpdateInProgress">
333-
{{ $store.state.tsMods.thunderstoreModListUpdateStatus }}
334-
</span>
335-
<span v-else-if="$store.state.tsMods.thunderstoreModListUpdateError">
336-
Error updating the mod list:
337-
{{ $store.state.tsMods.thunderstoreModListUpdateError.message }}.
338-
<a @click="$store.dispatch('tsMods/syncPackageList')">Retry</a>?
339-
</span>
340-
<span v-else>
341-
Would you like to
342-
<a @click="$store.dispatch('tsMods/syncPackageList')">update now</a>?
343-
</span>
324+
Refreshing the mod list from Thunderstore might solve this issue.
325+
326+
<div v-if="$store.getters['download/activeDownloadCount'] > 0">
327+
<span>
328+
However, the mod list can't be refreshed while the are mod downloads in progress.
329+
Please wait for the downloads to finish before continuing.
330+
</span>
331+
</div>
332+
333+
<div v-else>
334+
<span v-if="$store.state.tsMods.modsLastUpdated">
335+
The mod list was last refreshed on {{ valueToReadableDate($store.state.tsMods.modsLastUpdated) }}.
336+
</span>
337+
338+
<br />
339+
340+
<span v-if="$store.state.tsMods.isThunderstoreModListUpdateInProgress">
341+
{{ $store.state.tsMods.thunderstoreModListUpdateStatus }}
342+
</span>
343+
<span v-else-if="$store.state.tsMods.thunderstoreModListUpdateError">
344+
Error refreshing the mod list:
345+
{{ $store.state.tsMods.thunderstoreModListUpdateError.message }}.
346+
<a @click="$store.dispatch('tsMods/syncPackageList')">Retry</a>?
347+
</span>
348+
<span v-else>
349+
Would you like to
350+
<a @click="$store.dispatch('tsMods/syncPackageList')">refresh now</a>?
351+
</span>
352+
</div>
344353
</p>
345354
</div>
346355
</template>

src/components/settings-components/SettingsView.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,13 @@ import CdnProvider from '../../providers/generic/connection/CdnProvider';
315315
'Check for any new mod releases.',
316316
async () => {
317317
if (this.$store.state.tsMods.isThunderstoreModListUpdateInProgress) {
318-
return this.$store.state.tsMods.thunderstoreModListUpdateStatus || "Updating...";
318+
return this.$store.state.tsMods.thunderstoreModListUpdateStatus || "Refreshing...";
319319
}
320320
if (this.$store.state.tsMods.thunderstoreModListUpdateError) {
321-
return `Error updating the mod list: ${this.$store.state.tsMods.thunderstoreModListUpdateError.message}`;
321+
return `Error refreshing the mod list: ${this.$store.state.tsMods.thunderstoreModListUpdateError.message}`;
322+
}
323+
if (this.$store.getters['download/activeDownloadCount'] > 0) {
324+
return "Refreshing the mod list is disabled while there are active downloads.";
322325
}
323326
if (this.$store.state.tsMods.modsLastUpdated !== undefined) {
324327
return "Cache date: " + moment(this.$store.state.tsMods.modsLastUpdated).format("MMMM Do YYYY, h:mm:ss a");

src/store/modules/DownloadModule.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,33 @@ export const DownloadModule = {
5252
},
5353

5454
getters: <GetterTree<State, RootState>>{
55-
activeDownloadCount(state) {
56-
const active = state.allDownloads.filter(
55+
activeDownloadCount(_state, getters) {
56+
return getters.activeDownloads.length;
57+
},
58+
activeDownloads(state) {
59+
return state.allDownloads.filter(
5760
dl =>
5861
!dl.failed &&
5962
!(dl.downloadProgress >= 100 && dl.installProgress >= 100)
6063
);
61-
return active.length;
64+
},
65+
conciseDownloadStatus(_state, getters) {
66+
if (getters.activeDownloadCount === 1 && getters.newestActiveDownload) {
67+
if (getters.newestActiveDownload.downloadProgress < 100) {
68+
return `Downloading mods (${getters.newestActiveDownload.downloadProgress}%)`;
69+
} else {
70+
return `Installing mods (${getters.newestActiveDownload.installProgress}%)`;
71+
}
72+
} else if (getters.activeDownloadCount > 1) {
73+
return `Downloading and installing ${getters.activeDownloadCount} mods...`;
74+
}
6275
},
6376
currentDownload(state) {
6477
return state.allDownloads[state.allDownloads.length-1] || null;
6578
},
79+
newestActiveDownload(_state, getters) {
80+
return getters.activeDownloads[getters.activeDownloads.length-1] || null;
81+
},
6682
newestFirst(state) {
6783
return Array.from(state.allDownloads).reverse();
6884
},

src/store/modules/TsModsModule.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ export const TsModsModule = {
200200
* Full update process of the mod list, to be used after
201201
* passing the splash screen.
202202
*/
203-
async syncPackageList({commit, dispatch, state}): Promise<void> {
204-
if (state.isThunderstoreModListUpdateInProgress) {
203+
async syncPackageList({commit, dispatch, state, rootGetters}): Promise<void> {
204+
if (state.isThunderstoreModListUpdateInProgress || rootGetters['download/activeDownloadCount'] > 0) {
205205
return;
206206
}
207207

0 commit comments

Comments
 (0)