aboutsummaryrefslogtreecommitdiff
path: root/src-vue
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-01-04 23:42:05 +0100
committerGitHub <noreply@github.com>2023-01-04 23:42:05 +0100
commit4951a7e9048b6538a72294184639f6590f78384e (patch)
tree4490516fabc1c6097fcd23d9e5fa7f35f0966d0f /src-vue
parent4a63e92ea30fc65cf945b163d2757f17dd3c68cd (diff)
downloadFlightCore-4951a7e9048b6538a72294184639f6590f78384e.tar.gz
FlightCore-4951a7e9048b6538a72294184639f6590f78384e.zip
feat: Add button to delete Northstar mod (#110)
* feat: Expose installed NS mod directory This allows other functions to get a mod directory directly which is useful for e.g. deleting a mod. * feat: Add button to delete Northstar mod * refactor: Return vector of NorthstarMod instead of unnamed Tuples * refactor: Remove leftover print statement * chore: Remove leftover todo comment * feat: Show confirm warning before deleting mod * refactor: Call func directly instead of proxy Removes the `func_caller` pattern * fix: Call reloading mods after attempted delete
Diffstat (limited to 'src-vue')
-rw-r--r--src-vue/src/views/ModsView.vue36
1 files changed, 35 insertions, 1 deletions
diff --git a/src-vue/src/views/ModsView.vue b/src-vue/src/views/ModsView.vue
index af3b58a3..2f352ded 100644
--- a/src-vue/src/views/ModsView.vue
+++ b/src-vue/src/views/ModsView.vue
@@ -7,7 +7,15 @@
<el-card v-else shadow="hover" v-for="mod in installedMods" v-bind:key="mod.name">
<el-switch style="--el-switch-on-color: #13ce66; --el-switch-off-color: #8957e5" v-model="mod.enabled"
:before-change="() => updateWhichModsEnabled(mod)" :loading="global_load_indicator" />
- {{mod.name}}
+ <el-popconfirm
+ title="Are you sure to delete this mod?"
+ @confirm="deleteMod(mod)"
+ >
+ <template #reference>
+ <el-button type="danger">Delete</el-button>
+ </template>
+ </el-popconfirm>
+ {{ mod.name }}
</el-card>
</div>
</el-scrollbar>
@@ -69,6 +77,32 @@ export default defineComponent({
this.global_load_indicator = false;
return true;
+ },
+ async deleteMod(mod: NorthstarMod) {
+ let game_install = {
+ game_path: this.$store.state.game_path,
+ install_type: this.$store.state.install_type
+ } as GameInstall;
+ await invoke("delete_northstar_mod", { gameInstall: game_install, nsmodName: mod.name })
+ .then((message) => {
+ // Just a visual indicator that it worked
+ ElNotification({
+ title: `Success deleting ${mod.name}`,
+ type: 'success',
+ position: 'bottom-right'
+ });
+ })
+ .catch((error) => {
+ ElNotification({
+ title: 'Error',
+ message: error,
+ type: 'error',
+ position: 'bottom-right'
+ });
+ })
+ .finally(() => {
+ this.$store.commit('loadInstalledMods');
+ });
}
}
});