diff options
author | GeckoEidechse <gecko.eidechse+git@pm.me> | 2024-01-27 22:21:12 +0100 |
---|---|---|
committer | GeckoEidechse <gecko.eidechse+git@pm.me> | 2024-01-27 22:21:12 +0100 |
commit | 5284445cab89bb5af6d415c825a2cfa45cb92592 (patch) | |
tree | 5880b3ab4b48fdf28c7c5189a874494fcac31b97 /src-vue/src/views | |
parent | bcb77c2f326450e0cac78dd965cd6cb4dceaa736 (diff) | |
parent | 83ed4bedc183975f2f1a65b9cd38881410605904 (diff) | |
download | FlightCore-5284445cab89bb5af6d415c825a2cfa45cb92592.tar.gz FlightCore-5284445cab89bb5af6d415c825a2cfa45cb92592.zip |
Merge branch 'main' into refactor/pass-launch-options-object
Diffstat (limited to 'src-vue/src/views')
-rw-r--r-- | src-vue/src/views/SettingsView.vue | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src-vue/src/views/SettingsView.vue b/src-vue/src/views/SettingsView.vue index 70bffbc5..16b894d5 100644 --- a/src-vue/src/views/SettingsView.vue +++ b/src-vue/src/views/SettingsView.vue @@ -21,6 +21,9 @@ </el-button> </template> </el-popconfirm> + <el-button @click="cloneProfileDialog(scope.row.name)"> + {{ $t('settings.profile.dialog.clone') }} + </el-button> </template> </el-table-column> </el-table> @@ -140,6 +143,7 @@ import LanguageSelector from "../components/LanguageSelector.vue"; const persistentStore = new Store('flight-core-settings.json'); import { open } from '@tauri-apps/api/shell'; import { i18n } from '../main'; +import { ElMessageBox } from 'element-plus' export default defineComponent({ name: "SettingsView", @@ -274,6 +278,34 @@ export default defineComponent({ showErrorNotification(error); }); }, + async cloneProfileDialog(profile: string) { + ElMessageBox.prompt( + i18n.global.tc("settings.profile.dialog.new_profile_name"), + i18n.global.tc("settings.profile.dialog.title"), + { + confirmButtonText: i18n.global.tc("generic.confirm"), + cancelButtonText: i18n.global.tc("generic.cancel"), + } + ).then(async ({ value }) => { + await this.cloneProfile(profile, value); + }).catch(() => { + // Nothing to do here + }) + }, + async cloneProfile(old_profile: string, new_profile: string) { + let store = this.$store; + await invoke("clone_profile", { + gameInstall: store.state.game_install, + oldProfile: old_profile, + newProfile: new_profile + }).then(async (message) => { + store.commit('fetchProfiles'); + showNotification('Success'); + }).catch((error) => { + console.error(error); + showErrorNotification(error); + }); + }, async deleteProfile(profile: string) { let store = this.$store; await invoke("delete_profile", { |