Fix actions computed

This commit is contained in:
wvffle 2022-06-30 01:00:03 +00:00 committed by Georg Krause
parent 9e1e2bfa18
commit 7121d514fb
11 changed files with 42 additions and 41 deletions

View File

@ -36,7 +36,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
const { $pgettext } = useGettext() const { $pgettext } = useGettext()
const actionFilters = computed(() => ({ q: query.value, ...props.filters })) const actionFilters = computed(() => ({ q: query.value, ...props.filters }))
const actions = [ const actions = computed(() => [
{ {
name: 'delete', name: 'delete',
label: $pgettext('*/*/*/Verb', 'Delete'), label: $pgettext('*/*/*/Verb', 'Delete'),
@ -45,7 +45,7 @@ const actions = [
allowAll: false, allowAll: false,
confirmColor: 'danger' confirmColor: 'danger'
} }
] ])
const isLoading = ref(false) const isLoading = ref(false)
const fetchData = async () => { const fetchData = async () => {

View File

@ -34,7 +34,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
] ]
const actionFilters = computed(() => ({ q: query.value, ...props.filters })) const actionFilters = computed(() => ({ q: query.value, ...props.filters }))
const actions = () => [ const actions = computed(() => [
{ {
name: 'delete', name: 'delete',
label: $pgettext('*/*/*/Verb', 'Delete'), label: $pgettext('*/*/*/Verb', 'Delete'),
@ -43,7 +43,7 @@ const actions = () => [
allowAll: false, allowAll: false,
confirmColor: 'danger' confirmColor: 'danger'
} }
] ])
const isLoading = ref(false) const isLoading = ref(false)
const fetchData = async () => { const fetchData = async () => {

View File

@ -36,7 +36,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
const { $pgettext } = useGettext() const { $pgettext } = useGettext()
const actionFilters = computed(() => ({ q: query.value, ...props.filters })) const actionFilters = computed(() => ({ q: query.value, ...props.filters }))
const actions = [ const actions = computed(() => [
{ {
name: 'delete', name: 'delete',
label: $pgettext('*/*/*/Verb', 'Delete'), label: $pgettext('*/*/*/Verb', 'Delete'),
@ -45,7 +45,7 @@ const actions = [
allowAll: false, allowAll: false,
confirmColor: 'danger' confirmColor: 'danger'
} }
] ])
const isLoading = ref(false) const isLoading = ref(false)
const fetchData = async () => { const fetchData = async () => {

View File

@ -39,7 +39,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
const { $pgettext } = useGettext() const { $pgettext } = useGettext()
const actionFilters = computed(() => ({ q: query.value, ...props.filters })) const actionFilters = computed(() => ({ q: query.value, ...props.filters }))
const actions = [ const actions = computed(() => [
{ {
name: 'delete', name: 'delete',
label: $pgettext('*/*/*/Verb', 'Delete'), label: $pgettext('*/*/*/Verb', 'Delete'),
@ -48,7 +48,7 @@ const actions = [
allowAll: false, allowAll: false,
confirmColor: 'danger' confirmColor: 'danger'
} }
] ])
const isLoading = ref(false) const isLoading = ref(false)
const fetchData = async () => { const fetchData = async () => {

View File

@ -34,7 +34,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
const { $pgettext } = useGettext() const { $pgettext } = useGettext()
const actionFilters = computed(() => ({ q: query.value, ...props.filters })) const actionFilters = computed(() => ({ q: query.value, ...props.filters }))
const actions = [ const actions = computed(() => [
{ {
name: 'delete', name: 'delete',
label: $pgettext('*/*/*/Verb', 'Delete'), label: $pgettext('*/*/*/Verb', 'Delete'),
@ -43,7 +43,7 @@ const actions = [
allowAll: false, allowAll: false,
confirmColor: 'danger' confirmColor: 'danger'
} }
] ])
const isLoading = ref(false) const isLoading = ref(false)
const fetchData = async () => { const fetchData = async () => {

View File

@ -42,7 +42,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
const { $pgettext } = useGettext() const { $pgettext } = useGettext()
const actionFilters = computed(() => ({ q: query.value, ...props.filters })) const actionFilters = computed(() => ({ q: query.value, ...props.filters }))
const actions = [ const actions = computed(() => [
{ {
name: 'delete', name: 'delete',
label: $pgettext('*/*/*/Verb', 'Delete'), label: $pgettext('*/*/*/Verb', 'Delete'),
@ -51,7 +51,7 @@ const actions = [
allowAll: false, allowAll: false,
confirmColor: 'danger' confirmColor: 'danger'
} }
] ])
const isLoading = ref(false) const isLoading = ref(false)
const fetchData = async () => { const fetchData = async () => {

View File

@ -38,13 +38,13 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
const { $pgettext } = useGettext() const { $pgettext } = useGettext()
const actionFilters = computed(() => ({ q: query.value, ...props.filters })) const actionFilters = computed(() => ({ q: query.value, ...props.filters }))
const actions = [ const actions = computed(() => [
{ {
name: 'purge', name: 'purge',
label: $pgettext('*/*/*/Verb', 'Purge'), label: $pgettext('*/*/*/Verb', 'Purge'),
isDangerous: true isDangerous: true
} }
] ])
const isLoading = ref(false) const isLoading = ref(false)
const fetchData = async () => { const fetchData = async () => {

View File

@ -37,7 +37,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
const { $pgettext } = useGettext() const { $pgettext } = useGettext()
const query = ref('') const query = ref('')
const actionFilters = computed(() => ({ q: query.value, ...props.filters })) const actionFilters = computed(() => ({ q: query.value, ...props.filters }))
const actions = [ const actions = computed(() => [
{ {
name: 'purge', name: 'purge',
label: $pgettext('*/*/*/Verb', 'Purge'), label: $pgettext('*/*/*/Verb', 'Purge'),
@ -57,7 +57,7 @@ const actions = [
return obj.allowed return obj.allowed
} }
} }
] ])
const allowed = ref(null) const allowed = ref(null)
const isLoading = ref(false) const isLoading = ref(false)
@ -70,7 +70,7 @@ const fetchData = async () => {
ordering: orderingString.value, ordering: orderingString.value,
allowed: allowed.value, allowed: allowed.value,
...props.filters ...props.filters
} } as Record<string, unknown>
if (params.allowed === null) { if (params.allowed === null) {
delete params.allowed delete params.allowed

View File

@ -35,7 +35,7 @@ const query = ref('')
const isOpen = ref(false) const isOpen = ref(false)
const { $pgettext } = useGettext() const { $pgettext } = useGettext()
const actionFilters = computed(() => ({ q: query.value, ...props.filters })) const actionFilters = computed(() => ({ q: query.value, ...props.filters }))
const actions = [ const actions = computed(() => [
{ {
name: 'delete', name: 'delete',
label: $pgettext('*/*/*/Verb', 'Delete'), label: $pgettext('*/*/*/Verb', 'Delete'),
@ -43,7 +43,7 @@ const actions = [
return obj.users.length === 0 && moment().isBefore(obj.expiration_date) return obj.users.length === 0 && moment().isBefore(obj.expiration_date)
} }
} }
] ])
const isLoading = ref(false) const isLoading = ref(false)
const fetchData = async () => { const fetchData = async () => {

View File

@ -1,3 +1,22 @@
<script setup lang="ts">
import ArtistsTable from '~/components/manage/library/ArtistsTable.vue'
import { useGettext } from 'vue3-gettext'
import { computed } from 'vue'
interface Props {
defaultQuery?: string
}
withDefaults(defineProps<Props>(), {
defaultQuery: ''
})
const { $pgettext } = useGettext()
const labels = computed(() => ({
title: $pgettext('*/*/*/Noun', 'Artists')
}))
</script>
<template> <template>
<main v-title="labels.title"> <main v-title="labels.title">
<section class="ui vertical stripe segment"> <section class="ui vertical stripe segment">
@ -5,30 +24,12 @@
{{ labels.title }} {{ labels.title }}
</h2> </h2>
<div class="ui hidden divider" /> <div class="ui hidden divider" />
<artists-table <artists-table
:update-url="true" :update-url="true"
:default-query="defaultQuery" :default-query="defaultQuery"
:ordering-config-name="null"
/> />
</section> </section>
</main> </main>
</template> </template>
<script>
import ArtistsTable from '~/components/manage/library/ArtistsTable.vue'
export default {
components: {
ArtistsTable
},
props: {
defaultQuery: { type: String, required: false, default: '' }
},
computed: {
labels () {
return {
title: this.$pgettext('*/*/*/Noun', 'Artists')
}
}
}
}
</script>

View File

@ -48,7 +48,7 @@ const orderingOptions: [OrderingField, keyof typeof sharedLabels.filters][] = [
const { $pgettext } = useGettext() const { $pgettext } = useGettext()
const actionFilters = computed(() => ({ q: query.value, ...props.filters })) const actionFilters = computed(() => ({ q: query.value, ...props.filters }))
const actions = [ const actions = computed(() => [
{ {
name: 'delete', name: 'delete',
label: $pgettext('*/*/*/Verb', 'Delete'), label: $pgettext('*/*/*/Verb', 'Delete'),
@ -66,7 +66,7 @@ const actions = [
return filter.import_status !== 'finished' return filter.import_status !== 'finished'
} }
} }
] ])
const emit = defineEmits(['fetch-start']) const emit = defineEmits(['fetch-start'])