diff options
author | GeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com> | 2024-04-03 17:46:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-03 17:46:11 +0200 |
commit | 7e42fd13ba2bffd38f9d15bd77bf270198b224e3 (patch) | |
tree | 670270e377a63b10a544fef6916c44efe822c7e9 /src-vue/src/views/mods | |
parent | eafcc1709fda1bbbffce806f21ece4ac8602866b (diff) | |
download | FlightCore-7e42fd13ba2bffd38f9d15bd77bf270198b224e3.tar.gz FlightCore-7e42fd13ba2bffd38f9d15bd77bf270198b224e3.zip |
feat: Add disable all mods button to local mod view (#871)
Adds a button to LocalModView to disable all but core mods.
Re-uses existing backend logic
Co-authored-by: Remy Raes <contact@remyraes.com>
Diffstat (limited to 'src-vue/src/views/mods')
-rw-r--r-- | src-vue/src/views/mods/LocalModsView.vue | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src-vue/src/views/mods/LocalModsView.vue b/src-vue/src/views/mods/LocalModsView.vue index 38f7a914..3979ca14 100644 --- a/src-vue/src/views/mods/LocalModsView.vue +++ b/src-vue/src/views/mods/LocalModsView.vue @@ -5,14 +5,19 @@ </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({ @@ -41,6 +46,16 @@ export default defineComponent({ }; }, 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'); @@ -49,5 +64,9 @@ export default defineComponent({ </script> <style scoped> - +.disableModsBtn { + margin-bottom: 10px; + top: 10px; + position: sticky; +} </style> |