aboutsummaryrefslogtreecommitdiff
path: root/src-vue
diff options
context:
space:
mode:
authorGeckoEidechse <40122905+GeckoEidechse@users.noreply.github.com>2023-10-10 18:21:12 +0200
committerGitHub <noreply@github.com>2023-10-10 18:21:12 +0200
commit255ce14f3c36f5e1f2bf5e8242070d0129f15ac1 (patch)
tree390f740edd697b205dd643fb425df4106020ccdf /src-vue
parent1815aa8c99deb25bee576c39f3758a1f42e7f4b0 (diff)
downloadFlightCore-255ce14f3c36f5e1f2bf5e8242070d0129f15ac1.tar.gz
FlightCore-255ce14f3c36f5e1f2bf5e8242070d0129f15ac1.zip
feat: Add button to delete profile (#603)
This adds a button and corresponding logic to delete an existing profile Spliced out from #444 Co-authored-by: Jan <sentrycraft123@gmail.com>
Diffstat (limited to 'src-vue')
-rw-r--r--src-vue/src/i18n/lang/en.json6
-rw-r--r--src-vue/src/views/SettingsView.vue35
2 files changed, 40 insertions, 1 deletions
diff --git a/src-vue/src/i18n/lang/en.json b/src-vue/src/i18n/lang/en.json
index 2b056655..2bf18c2e 100644
--- a/src-vue/src/i18n/lang/en.json
+++ b/src-vue/src/i18n/lang/en.json
@@ -11,6 +11,7 @@
"yes": "Yes",
"no": "No",
"error": "Error",
+ "confirm": "Confirm",
"cancel": "Cancel",
"informationShort": "Info",
"downloading": "Downloading",
@@ -115,7 +116,10 @@
"edit": "Edit Profiles",
"dialog": {
- "title": "Profiles"
+ "title": "Profiles",
+ "delete_confirm": "Are you sure to delete this profile?",
+ "delete": "Delete",
+ "clone": "Clone"
}
},
diff --git a/src-vue/src/views/SettingsView.vue b/src-vue/src/views/SettingsView.vue
index 2219498c..70bffbc5 100644
--- a/src-vue/src/views/SettingsView.vue
+++ b/src-vue/src/views/SettingsView.vue
@@ -6,6 +6,23 @@
>
<el-table :data="availableProfiles" >
<el-table-column prop="name" label="Name" />
+ <el-table-column align="right">
+ <template #default="scope">
+ <el-popconfirm
+ v-if="scope.row.name != 'R2Northstar'"
+ :title="$t('settings.profile.dialog.delete_confirm')"
+ :confirm-button-text="$t('generic.yes')"
+ :cancel-button-text="$t('generic.no')"
+ @confirm="deleteProfile(scope.row.name)"
+ >
+ <template #reference>
+ <el-button type="danger">
+ {{ $t('settings.profile.dialog.delete') }}
+ </el-button>
+ </template>
+ </el-popconfirm>
+ </template>
+ </el-table-column>
</el-table>
</el-dialog>
@@ -257,6 +274,24 @@ export default defineComponent({
showErrorNotification(error);
});
},
+ async deleteProfile(profile: string) {
+ let store = this.$store;
+ await invoke("delete_profile", {
+ gameInstall: store.state.game_install,
+ profile: profile,
+ }).then(async (message) => {
+ if (profile == store.state.game_install.profile)
+ {
+ // trying to delete the active profile, lets switch to the default profile
+ await this.switchProfile("R2Northstar");
+ }
+ store.commit('fetchProfiles');
+ showNotification('Success');
+ }).catch((error) => {
+ console.error(error);
+ showErrorNotification(error);
+ });
+ },
},
mounted() {
document.querySelector('input')!.disabled = true;