1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
<template>
<!-- Message displayed if no mod matched searched words -->
<div v-if="mods.length === 0" class="noModMessage">
{{ $t('mods.local.no_mods') }}
</div>
<el-scrollbar v-else>
<el-button class="disableModsBtn" type="primary" @click="disableAllModsButCore">
{{ $t('settings.repair.window.disable_all_but_core') }}
</el-button>
<local-mod-card v-for="mod of mods" v-bind:key="mod.name" :mod="mod" />
</el-scrollbar>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import { invoke } from "@tauri-apps/api";
import { NorthstarMod } from "../../../../src-tauri/bindings/NorthstarMod";
import { fuzzy_filter } from "../../utils/filter";
import { showErrorNotification, showNotification } from "../../utils/ui";
import LocalModCard from "../../components/LocalModCard.vue";
export default defineComponent({
name: 'LocalModsView',
components: { LocalModCard },
computed: {
installedMods(): NorthstarMod[] {
return this.$store.state.installed_mods;
},
searchValue(): string {
return this.$store.getters.searchWords;
},
mods(): NorthstarMod[] {
if (this.searchValue.length === 0) {
return this.installedMods;
}
return this.installedMods.filter((mod: NorthstarMod) => {
return fuzzy_filter(mod.name, this.searchValue);
});
}
},
data() {
return {
global_load_indicator: false,
};
},
methods: {
async disableAllModsButCore() {
await invoke("disable_all_but_core", { gameInstall: this.$store.state.game_install })
.then((message) => {
showNotification(this.$t('generic.success'), this.$t('settings.repair.window.disable_all_but_core_success'));
this.$store.commit('loadInstalledMods');
})
.catch((error) => {
showErrorNotification(error);
});
},
},
mounted() {
this.$store.commit('loadInstalledMods');
}
})
</script>
<style scoped>
.disableModsBtn {
margin-bottom: 10px;
top: 10px;
position: sticky;
}
</style>
|