]> source.dussan.org Git - nextcloud-server.git/commitdiff
polish AI admin settings UI
authorJulien Veyssier <julien-nc@posteo.net>
Tue, 1 Aug 2023 09:59:10 +0000 (11:59 +0200)
committerMarcel Klehr <mklehr@gmx.net>
Wed, 9 Aug 2023 08:28:01 +0000 (10:28 +0200)
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
(cherry picked from commit 0ace67c762c3c7e8af792bd0635a071269faa4ad)

apps/settings/src/components/AdminAI.vue

index 51e5c5cede6dc0092a1a4faa8188c1ebf5a184f6..0e969ea58f20463f26546ded209e9bd1826511e9 100644 (file)
@@ -5,8 +5,16 @@
                        <draggable v-model="settings['ai.translation_provider_preferences']" @change="saveChanges">
                                <div v-for="(providerClass, i) in settings['ai.translation_provider_preferences']" :key="providerClass" class="draggable__item">
                                        <DragVerticalIcon /> <span class="draggable__number">{{ i + 1 }}</span> {{ translationProviders.find(p => p.class === providerClass)?.name }}
-                                       <NcButton aria-label="Move up" type="tertiary" @click="moveUp(i)"><template #icon><ArrowUpIcon /></template></NcButton>
-                                       <NcButton aria-label="Move down" type="tertiary" @click="moveDown(i)"><template #icon><ArrowDownIcon /></template></NcButton>
+                                       <NcButton aria-label="Move up" type="tertiary" @click="moveUp(i)">
+                                               <template #icon>
+                                                       <ArrowUpIcon />
+                                               </template>
+                                       </NcButton>
+                                       <NcButton aria-label="Move down" type="tertiary" @click="moveDown(i)">
+                                               <template #icon>
+                                                       <ArrowDownIcon />
+                                               </template>
+                                       </NcButton>
                                </div>
                        </draggable>
                </NcSettingsSection>
@@ -22,7 +30,7 @@
                                        {{ provider.name }}
                                </NcCheckboxRadioSwitch>
                        </template>
-                       <template v-if="sttProviders.length === 0">
+                       <template v-if="!hasStt">
                                <NcCheckboxRadioSwitch disabled type="radio">
                                        {{ t('settings', 'None of your currently installed apps provide Speech-To-Text functionality') }}
                                </NcCheckboxRadioSwitch>
@@ -49,7 +57,7 @@
                                        <p>&nbsp;</p>
                                </div>
                        </template>
-                       <template v-if="Object.keys(settings['ai.textprocessing_provider_preferences']).length === 0 || !Array.isArray(textProcessingTaskTypes)">
+                       <template v-if="!hasTextProcessing">
                                <p>{{ t('settings', 'None of your currently installed apps provide Text processing functionality') }}</p>
                        </template>
                </NcSettingsSection>
@@ -95,6 +103,14 @@ export default {
                        settings: loadState('settings', 'ai-settings'),
                }
        },
+       computed: {
+               hasStt() {
+                       return this.sttProviders.length > 0
+               },
+               hasTextProcessing() {
+                       return Object.keys(this.settings['ai.textprocessing_provider_preferences']).length > 0 && Array.isArray(this.textProcessingTaskTypes)
+               },
+       },
        methods: {
          moveUp(i) {
                        this.settings['ai.translation_provider_preferences'].splice(