From 681f3fced081e19669b84468929fdaee79982daf Mon Sep 17 00:00:00 2001 From: upsiflu Date: Fri, 14 Mar 2025 12:54:43 +0100 Subject: [PATCH] fix(upload): use the selected channel for the file upload in channel upload form --- front/src/components/channels/UploadForm.vue | 25 +++++++++---------- .../components/library/FileUploadWidget.vue | 10 +++++++- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/front/src/components/channels/UploadForm.vue b/front/src/components/channels/UploadForm.vue index 06ca83f40..7261579a4 100644 --- a/front/src/components/channels/UploadForm.vue +++ b/front/src/components/channels/UploadForm.vue @@ -66,7 +66,11 @@ const store = useStore() const errors = ref([] as string[]) -const values = reactive({ +const values = reactive<{ + channel: string; // Channel UUID + license: unknown; + album: unknown; +}>({ channel: props.channel?.uuid ?? null, license: null, album: null @@ -108,9 +112,9 @@ const isLoading = ref(false) const selectedChannel = computed(() => props.channel ? props.channel - : availableChannels.value.count === 0 + : availableChannels.value.length === 0 ? (createEmptyChannel(), null) - : availableChannels.value.count === 1 + : availableChannels.value.length === 1 ? availableChannels.value[0] : availableChannels.value.find(({ artist }) => artist.id === channelDropdownId.value) ) @@ -224,12 +228,6 @@ const beforeFileUpload = (newFile: VueUploadItem) => { } } -const baseImportMetadata = computed(() => ({ - channel: values.channel, - import_status: 'draft', - import_metadata: { license: values.license, album: values.album } -})) - // // Uploaded files // @@ -561,7 +559,7 @@ ChannelCreateRequest: { @@ -697,11 +695,12 @@ ChannelCreateRequest: { {{ t('components.channels.UploadForm.description.extensions', {extensions: store.state.ui.supportedExtensions.join(', ')}) }} -
@@ -719,6 +718,6 @@ ChannelCreateRequest: { class="divider" :size="32" /> - + diff --git a/front/src/components/library/FileUploadWidget.vue b/front/src/components/library/FileUploadWidget.vue index c6c56e67a..e70b356f7 100644 --- a/front/src/components/library/FileUploadWidget.vue +++ b/front/src/components/library/FileUploadWidget.vue @@ -1,12 +1,18 @@