Skip to content

Commit

Permalink
polish AI admin settings UI
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
  • Loading branch information
julien-nc committed Aug 1, 2023
1 parent 5bbeca3 commit d2e75af
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions apps/settings/src/components/AdminAI.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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>
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit d2e75af

Please sign in to comment.