From a840e8c6e5a0d7b7c3a371776fd395976b2c2fdf Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Mon, 24 Jul 2023 14:47:15 +0200 Subject: AI admin settings: Add save mechanism Signed-off-by: Marcel Klehr --- apps/settings/src/components/AdminAI.vue | 45 ++++++++++++++++---------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'apps/settings/src') diff --git a/apps/settings/src/components/AdminAI.vue b/apps/settings/src/components/AdminAI.vue index f11cb0c3da0..649c484c70a 100644 --- a/apps/settings/src/components/AdminAI.vue +++ b/apps/settings/src/components/AdminAI.vue @@ -2,8 +2,10 @@
- -
{{i+1}} {{ translationProviders.find(p => p.class === providerClass)?.name }}
+ +
+ {{ i+1 }} {{ translationProviders.find(p => p.class === providerClass)?.name }} +
+ type="radio" + @update:checked="saveChanges"> {{ provider.name }} @@ -29,9 +32,16 @@

{{ t('settings', 'Task:') }} {{ getTaskType(type).name }}

{{ getTaskType(type).description }}

 

- - - + + +

 

@@ -74,24 +84,15 @@ export default { } }, methods: { - saveChanges() { + async saveChanges() { this.loading = true - - const data = { - enforced: this.enforced, - enforcedGroups: this.enforcedGroups, - excludedGroups: this.excludedGroups, + const data = this.settings + try { + await axios.put(generateUrl('/settings/api/admin/ai'), data) + } catch (err) { + console.error('could not save changes', err) } - axios.put(generateUrl('/settings/api/admin/twofactorauth'), data) - .then(resp => resp.data) - .then(state => { - this.state = state - this.dirty = false - }) - .catch(err => { - console.error('could not save changes', err) - }) - .then(() => { this.loading = false }) + this.loading = false }, getTaskType(type) { if (!Array.isArray(this.textProcessingTaskTypes)) { -- cgit v1.2.3