Skip to content

Commit 9d22cbc

Browse files
committed
WIP: Tag auto-clears when all packages have been resolved
1 parent 1df9d84 commit 9d22cbc

7 files changed

Lines changed: 40 additions & 17 deletions

File tree

src/components/banner/ManagerUpdateBanner.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,9 @@ onMounted(async () => {
4242
</p>
4343
</div>
4444
</template>
45+
46+
<style scoped lang="scss">
47+
.notification {
48+
margin-bottom: 0.5rem;
49+
}
50+
</style>

src/components/banner/VulnerablePackageBanner.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,8 @@ function addUnlinkedFilter() {
2121
background-color: var(--notification-concern-background-color);
2222
color: var(--notification-concern-text-color);
2323
}
24+
25+
.notification {
26+
margin-bottom: 0.5rem;
27+
}
2428
</style>

src/components/composables/VulnerablePackageComposable.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ const onlineModList = computed<Map<string, ThunderstoreMod>>(() => {
1616
});
1717

1818
const vulnerablePackages = computed<ManifestV2[]>(() => {
19-
// TODO - Fix logic (post dev testing)
20-
return localModList.value.filter(value => !value.isOnlineSource() && !value.isTrustedPackage() && onlineModList.value.has(value.getName()));
19+
return localModList.value.filter(value => !value.isTrustedPackage() && (value.isOnlineSource() && !onlineModList.value.has(value.getName())));
2120
});
2221

2322
export function useVulnerablePackageComposable() {

src/components/modals/VulnerablePackageReviewModal.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,27 @@ async function removeMod() {
2727
2828
async function trustPackage() {
2929
const mods = await ProfileModList.getModList(profile.value.asImmutableProfile());
30+
if (mods instanceof R2Error) {
31+
console.error(mods);
32+
store.commit('error/handleError', mods);
33+
return;
34+
}
3035
const mod = mods.find(value => value.getName() === modToReview.value?.getName());
3136
if (mod) {
3237
mod.setTrustedPackage(true);
3338
}
3439
try {
35-
await store.dispatch(
36-
'profile/saveModListToDisk',
37-
{mods: mods, profile: profile.value}
38-
);
40+
const err = await ProfileModList.saveModList(profile.value.asImmutableProfile(), mods);
41+
if (err instanceof R2Error) {
42+
store.commit('error/handleError', err);
43+
return;
44+
}
45+
await store.dispatch('profile/updateModList', mods);
3946
} catch (e) {
4047
store.commit('error/handleError', R2Error.fromThrownValue(e));
48+
} finally {
49+
close();
4150
}
42-
await close();
4351
}
4452
</script>
4553

src/components/views/LocalModList.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@
44
<SearchAndSort />
55
</div>
66

7+
<DisableModModal />
8+
<UninstallModModal />
9+
<AssociatedModsModal />
10+
11+
<ManagerUpdateBanner/>
12+
<VulnerablePackageBanner v-if="hasVulnerablePackages"/>
13+
14+
<slot name="above-list"></slot>
15+
716
<div class="tags has-addons" v-if="filters.size > 0">
817
<span class="margin-right" v-for="filter in filters">
918
<a href="#" @click="removeFilter(filter)">
@@ -15,15 +24,6 @@
1524
</span>
1625
</div>
1726

18-
<DisableModModal />
19-
<UninstallModModal />
20-
<AssociatedModsModal />
21-
22-
<ManagerUpdateBanner/>
23-
<VulnerablePackageBanner v-if="hasVulnerablePackages"/>
24-
25-
<slot name="above-list"></slot>
26-
2727
<div class="mod-list-content">
2828
<div class="draggable-content">
2929
<Suspense>

src/components/views/LocalModList/LocalModDraggableList.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ function applyVisibleList() {
4747
watch([visibleModList, store.state.profile.filters], applyVisibleList);
4848
onMounted(applyVisibleList);
4949
50+
watch(internalVisibleList, (newList) => {
51+
if (newList.length === 0) {
52+
store.commit('profile/removeFilter', 'Unlinked');
53+
}
54+
})
55+
5056
const draggableList = computed({
5157
get() {
5258
return internalVisibleList.value;

src/store/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ export const store = {
138138

139139
// enable strict mode (adds overhead!)
140140
// for dev mode only
141-
strict: import.meta.env.MODE === 'development',
141+
strict: import.meta.env.MODE === 'development1',
142142
};
143143

144144
/*

0 commit comments

Comments
 (0)