From b9b49fd98801ac61fd07761ae647f3c161546f97 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Tue, 1 Aug 2023 11:43:13 +0200 Subject: [PATCH] move long click handlers into methods Signed-off-by: Julien Veyssier --- apps/settings/src/components/AdminAI.vue | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/apps/settings/src/components/AdminAI.vue b/apps/settings/src/components/AdminAI.vue index 70c9c548615c7..51e5c5cede6dc 100644 --- a/apps/settings/src/components/AdminAI.vue +++ b/apps/settings/src/components/AdminAI.vue @@ -4,9 +4,9 @@ :description="t('settings', 'Machine translation can be implemented by different apps. Here you can define the precedence of the machine translation apps you have installed at the moment.')">
- {{ i+1 }} {{ translationProviders.find(p => p.class === providerClass)?.name }} - - + {{ i + 1 }} {{ translationProviders.find(p => p.class === providerClass)?.name }} + +
@@ -96,6 +96,22 @@ export default { } }, methods: { + moveUp(i) { + this.settings['ai.translation_provider_preferences'].splice( + Math.min(i - 1, 0), + 0, + ...this.settings['ai.translation_provider_preferences'].splice(i, 1) + ) + this.saveChanges() + }, + moveDown(i) { + this.settings['ai.translation_provider_preferences'].splice( + i + 1, + 0, + ...this.settings['ai.translation_provider_preferences'].splice(i, 1) + ) + this.saveChanges() + }, async saveChanges() { this.loading = true const data = { settings: this.settings }