|
21 | 21 | </el-button>
|
22 | 22 | </template>
|
23 | 23 | </el-popconfirm>
|
| 24 | + <el-button @click="cloneProfileDialog(scope.row.name)"> |
| 25 | + {{ $t('settings.profile.dialog.clone') }} |
| 26 | + </el-button> |
24 | 27 | </template>
|
25 | 28 | </el-table-column>
|
26 | 29 | </el-table>
|
@@ -140,6 +143,7 @@ import LanguageSelector from "../components/LanguageSelector.vue";
|
140 | 143 | const persistentStore = new Store('flight-core-settings.json');
|
141 | 144 | import { open } from '@tauri-apps/api/shell';
|
142 | 145 | import { i18n } from '../main';
|
| 146 | +import { ElMessageBox } from 'element-plus' |
143 | 147 |
|
144 | 148 | export default defineComponent({
|
145 | 149 | name: "SettingsView",
|
@@ -274,6 +278,34 @@ export default defineComponent({
|
274 | 278 | showErrorNotification(error);
|
275 | 279 | });
|
276 | 280 | },
|
| 281 | + async cloneProfileDialog(profile: string) { |
| 282 | + ElMessageBox.prompt( |
| 283 | + i18n.global.tc("settings.profile.dialog.new_profile_name"), |
| 284 | + i18n.global.tc("settings.profile.dialog.title"), |
| 285 | + { |
| 286 | + confirmButtonText: i18n.global.tc("generic.confirm"), |
| 287 | + cancelButtonText: i18n.global.tc("generic.cancel"), |
| 288 | + } |
| 289 | + ).then(async ({ value }) => { |
| 290 | + await this.cloneProfile(profile, value); |
| 291 | + }).catch(() => { |
| 292 | + // Nothing to do here |
| 293 | + }) |
| 294 | + }, |
| 295 | + async cloneProfile(old_profile: string, new_profile: string) { |
| 296 | + let store = this.$store; |
| 297 | + await invoke("clone_profile", { |
| 298 | + gameInstall: store.state.game_install, |
| 299 | + oldProfile: old_profile, |
| 300 | + newProfile: new_profile |
| 301 | + }).then(async (message) => { |
| 302 | + store.commit('fetchProfiles'); |
| 303 | + showNotification('Success'); |
| 304 | + }).catch((error) => { |
| 305 | + console.error(error); |
| 306 | + showErrorNotification(error); |
| 307 | + }); |
| 308 | + }, |
277 | 309 | async deleteProfile(profile: string) {
|
278 | 310 | let store = this.$store;
|
279 | 311 | await invoke("delete_profile", {
|
|
0 commit comments