chore(front): upload modal channel form #2081

This commit is contained in:
ArneBo 2025-02-14 18:00:59 +01:00
parent 9aacc8a256
commit 22e64c8a9b
3 changed files with 32 additions and 33 deletions

View File

@ -3,7 +3,7 @@ import type { Channel, BackendError } from '~/types'
import axios from 'axios' import axios from 'axios'
import { watch, ref, emit } from 'vue' import { watch, ref } from 'vue'
import { useI18n } from 'vue-i18n' import { useI18n } from 'vue-i18n'
import { useModal } from '~/ui/composables/useModal.ts' import { useModal } from '~/ui/composables/useModal.ts'
@ -24,8 +24,6 @@ const errors = ref<string[]>([])
const {isOpen:show} = useModal('album') const {isOpen:show} = useModal('album')
defineEmits(['created'])
watch(show, () => { watch(show, () => {
isLoading.value = false isLoading.value = false
submittable.value = false submittable.value = false

View File

@ -22,7 +22,7 @@ const fetchAlbums = async () => {
isLoading.value = true isLoading.value = true
const response = await axios.get('albums/', { const response = await axios.get('albums/', {
params: { params: {
artist: model.value.channel.artist.id, artist: model.value.channel.artist?.id,
include_channels: 'true' include_channels: 'true'
} }
}) })
@ -41,7 +41,7 @@ watch(albums, (value) => {
<template> <template>
<label for="album-dropdown"> <label for="album-dropdown">
<span v-if="model.channel.artist.content_category === 'podcast'"> <span v-if="model.channel.artist?.content_category === 'podcast'">
{{ t('components.channels.AlbumSelect.label.series') }} {{ t('components.channels.AlbumSelect.label.series') }}
</span> </span>
<span v-else> <span v-else>

View File

@ -521,13 +521,16 @@ ChannelCreateRequest: {
<template> <template>
<form <Layout
form
gap-8
:class="['ui', { loading: isLoading }, 'form component-file-upload']" :class="['ui', { loading: isLoading }, 'form component-file-upload']"
@submit.stop.prevent @submit.stop.prevent
> >
<!-- Error message --> <!-- Error message -->
<Alert <Alert
v-if="errors.length > 0" v-if="errors.length > 0"
red
> >
<h4 class="header"> <h4 class="header">
{{ t('components.channels.UploadForm.header.error') }} {{ t('components.channels.UploadForm.header.error') }}
@ -561,18 +564,16 @@ ChannelCreateRequest: {
</option> </option>
</select> </select>
</div> </div>
<Layout flex>
<album-select <album-select
v-if="selectedChannel" v-if="selectedChannel"
v-model="albumSelection" v-model="albumSelection"
:class="['ui', 'field']" :class="['ui', 'field']"
/> />
</Layout> <div>
<license-select <license-select
v-model="values.license" v-model="values.license"
:class="['ui', 'field']" :class="['ui', 'field']"
/> />
<div :class="['ui', 'message']">
<div class="content"> <div class="content">
<p> <p>
<i class="copyright icon" /> <i class="copyright icon" />
@ -688,19 +689,18 @@ ChannelCreateRequest: {
v-model:values="uploadImportData[selectedUploadId]" v-model:values="uploadImportData[selectedUploadId]"
:upload="selectedUpload" :upload="selectedUpload"
/> />
<div <Alert blue
class="ui message" class="ui message"
> >
<div class="content"> <Layout flex gap-8>
<p> <i class="bi bi-info-circle-fill" />
<i class="info icon" />
{{ t('components.channels.UploadForm.description.extensions', {extensions: store.state.ui.supportedExtensions.join(', ')}) }} {{ t('components.channels.UploadForm.description.extensions', {extensions: store.state.ui.supportedExtensions.join(', ')}) }}
</p> </Layout>
</div> </Alert>
</div>
<file-upload-widget <file-upload-widget
ref="upload" ref="upload"
v-model="files" v-model="files"
:class="['ui', 'button', 'channels']"
:data="baseImportMetadata" :data="baseImportMetadata"
@input-file="beforeFileUpload" @input-file="beforeFileUpload"
> >
@ -709,9 +709,10 @@ ChannelCreateRequest: {
{{ t('components.channels.UploadForm.message.dragAndDrop') }} {{ t('components.channels.UploadForm.message.dragAndDrop') }}
</div> </div>
<div class="ui very small divider" /> <div class="ui very small divider" />
<div> <Button primary icon="bi-folder2-open">
{{ t('components.channels.UploadForm.label.openBrowser') }} {{ t('components.channels.UploadForm.label.openBrowser') }}
</div> </Button>
<Spacer class="divider" :size="32" />
</file-upload-widget> </file-upload-widget>
</form> </Layout>
</template> </template>