diff options
Diffstat (limited to 'src-vue/src/views')
-rw-r--r-- | src-vue/src/views/ModsView.vue | 36 |
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'); + }); } } }); |