From 21e5d8ddf0a7b6d6f8dbf9ed5c77a296990d0a0e Mon Sep 17 00:00:00 2001 From: wvffle Date: Fri, 24 Jun 2022 21:58:33 +0000 Subject: [PATCH] Fix actions not being arrays in components using smart search --- front/src/components/manage/ChannelsTable.vue | 2 +- .../components/manage/library/AlbumsTable.vue | 26 +-- .../manage/library/ArtistsTable.vue | 24 +- .../manage/library/EditsCardList.vue | 84 ++++--- .../manage/library/LibrariesTable.vue | 218 ++++++++---------- .../composables/moderation/useEditConfigs.ts | 6 +- front/src/store/ui.ts | 2 +- 7 files changed, 164 insertions(+), 198 deletions(-) diff --git a/front/src/components/manage/ChannelsTable.vue b/front/src/components/manage/ChannelsTable.vue index e3613601a..781fd73c1 100644 --- a/front/src/components/manage/ChannelsTable.vue +++ b/front/src/components/manage/ChannelsTable.vue @@ -34,7 +34,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [ ] const actionFilters = computed(() => ({ q: query.value, ...props.filters })) -const actions = () => [] +const actions = [] const isLoading = ref(false) const fetchData = async () => { diff --git a/front/src/components/manage/library/AlbumsTable.vue b/front/src/components/manage/library/AlbumsTable.vue index ac9d5ab6f..99417c69b 100644 --- a/front/src/components/manage/library/AlbumsTable.vue +++ b/front/src/components/manage/library/AlbumsTable.vue @@ -34,21 +34,18 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [ ['name', 'name'] ] +const { $pgettext } = useGettext() const actionFilters = computed(() => ({ q: query.value, ...props.filters })) -const actions = () => { - const deleteLabel = $pgettext('*/*/*/Verb', 'Delete') - const confirmationMessage = $pgettext('Popup/*/Paragraph', 'The selected albums will be removed, as well as associated tracks, uploads, favorites and listening history. This action is irreversible.') - return [ - { - name: 'delete', - label: deleteLabel, - confirmationMessage: confirmationMessage, - isDangerous: true, - allowAll: false, - confirmColor: 'danger' - } - ] -} +const actions = [ + { + name: 'delete', + label: $pgettext('*/*/*/Verb', 'Delete'), + confirmationMessage: $pgettext('Popup/*/Paragraph', 'The selected albums will be removed, as well as associated tracks, uploads, favorites and listening history. This action is irreversible.'), + isDangerous: true, + allowAll: false, + confirmColor: 'danger' + } +] const isLoading = ref(false) const fetchData = async () => { @@ -89,7 +86,6 @@ onOrderingUpdate(fetchData) fetchData() const sharedLabels = useSharedLabels() -const { $pgettext } = useGettext() const labels = computed(() => ({ searchPlaceholder: $pgettext('Content/Search/Input.Placeholder', 'Search by domain, title, artist, MusicBrainz ID…'), openModeration: $pgettext('Content/Moderation/Verb', 'Open in moderation interface') diff --git a/front/src/components/manage/library/ArtistsTable.vue b/front/src/components/manage/library/ArtistsTable.vue index fb0bf8987..f312164cd 100644 --- a/front/src/components/manage/library/ArtistsTable.vue +++ b/front/src/components/manage/library/ArtistsTable.vue @@ -34,20 +34,16 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [ ] const actionFilters = computed(() => ({ q: query.value, ...props.filters })) -const actions = () => { - const deleteLabel = $pgettext('*/*/*/Verb', 'Delete') - const confirmationMessage = $pgettext('Popup/*/Paragraph', 'The selected artist will be removed, as well as associated uploads, tracks, albums, favorites and listening history. This action is irreversible.') - return [ - { - name: 'delete', - label: deleteLabel, - confirmationMessage: confirmationMessage, - isDangerous: true, - allowAll: false, - confirmColor: 'danger' - } - ] -} +const actions = () => [ + { + name: 'delete', + label: $pgettext('*/*/*/Verb', 'Delete'), + confirmationMessage: $pgettext('Popup/*/Paragraph', 'The selected artist will be removed, as well as associated uploads, tracks, albums, favorites and listening history. This action is irreversible.'), + isDangerous: true, + allowAll: false, + confirmColor: 'danger' + } +] const isLoading = ref(false) const fetchData = async () => { diff --git a/front/src/components/manage/library/EditsCardList.vue b/front/src/components/manage/library/EditsCardList.vue index 5ded0db29..b328ec966 100644 --- a/front/src/components/manage/library/EditsCardList.vue +++ b/front/src/components/manage/library/EditsCardList.vue @@ -1,16 +1,15 @@