fix: ts errors in subscription
This commit is contained in:
parent
3f893fb16d
commit
24b7821c50
4 changed files with 36 additions and 51 deletions
|
@ -56,6 +56,7 @@
|
||||||
{{ $t('menu.archive') }}
|
{{ $t('menu.archive') }}
|
||||||
</dropdown-item>
|
</dropdown-item>
|
||||||
<task-subscription
|
<task-subscription
|
||||||
|
v-if="subscription"
|
||||||
class="dropdown-item has-no-shadow"
|
class="dropdown-item has-no-shadow"
|
||||||
:is-button="false"
|
:is-button="false"
|
||||||
entity="list"
|
entity="list"
|
||||||
|
@ -74,39 +75,32 @@
|
||||||
</dropdown>
|
</dropdown>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup lang="ts">
|
||||||
|
import {ref, computed, watchEffect} from 'vue'
|
||||||
|
import {useStore} from 'vuex'
|
||||||
|
|
||||||
import {getSavedFilterIdFromListId} from '@/helpers/savedFilter'
|
import {getSavedFilterIdFromListId} from '@/helpers/savedFilter'
|
||||||
import Dropdown from '@/components/misc/dropdown.vue'
|
import Dropdown from '@/components/misc/dropdown.vue'
|
||||||
import DropdownItem from '@/components/misc/dropdown-item.vue'
|
import DropdownItem from '@/components/misc/dropdown-item.vue'
|
||||||
import TaskSubscription from '@/components/misc/subscription.vue'
|
import TaskSubscription from '@/components/misc/subscription.vue'
|
||||||
|
import ListModel from '@/models/list'
|
||||||
|
import SubscriptionModel from '@/models/subscription'
|
||||||
|
|
||||||
export default {
|
const props = defineProps({
|
||||||
name: 'list-settings-dropdown',
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
subscription: null,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
TaskSubscription,
|
|
||||||
DropdownItem,
|
|
||||||
Dropdown,
|
|
||||||
},
|
|
||||||
props: {
|
|
||||||
list: {
|
list: {
|
||||||
|
type: ListModel,
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
},
|
})
|
||||||
mounted() {
|
|
||||||
this.subscription = this.list.subscription
|
const subscription = ref<SubscriptionModel>()
|
||||||
},
|
watchEffect(() => {
|
||||||
computed: {
|
if (props.list.subscription) {
|
||||||
backgroundsEnabled() {
|
subscription.value = props.list.subscription
|
||||||
return this.$store.state.config.enabledBackgroundProviders?.length > 0
|
|
||||||
},
|
|
||||||
isSavedFilter() {
|
|
||||||
return getSavedFilterIdFromListId(this.list.id) > 0
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const store = useStore()
|
||||||
|
const backgroundsEnabled = computed(() => store.state.config.enabledBackgroundProviders?.length > 0)
|
||||||
|
const isSavedFilter = computed(() => getSavedFilterIdFromListId(props.list.id) > 0)
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
<template>
|
<template>
|
||||||
<x-button
|
<x-button
|
||||||
|
v-if="isButton"
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
:icon="iconName"
|
:icon="iconName"
|
||||||
v-tooltip="tooltipText"
|
v-tooltip="tooltipText"
|
||||||
@click="changeSubscription"
|
@click="changeSubscription"
|
||||||
:disabled="disabled || null"
|
:disabled="disabled || null"
|
||||||
v-if="isButton"
|
|
||||||
>
|
>
|
||||||
{{ buttonText }}
|
{{ buttonText }}
|
||||||
</x-button>
|
</x-button>
|
||||||
<a
|
<a
|
||||||
|
v-else
|
||||||
v-tooltip="tooltipText"
|
v-tooltip="tooltipText"
|
||||||
@click="changeSubscription"
|
@click="changeSubscription"
|
||||||
:class="{'is-disabled': disabled}"
|
:class="{'is-disabled': disabled}"
|
||||||
v-else
|
|
||||||
>
|
>
|
||||||
<span class="icon">
|
<span class="icon">
|
||||||
<icon :icon="iconName"/>
|
<icon :icon="iconName"/>
|
||||||
|
@ -31,26 +31,15 @@ import SubscriptionModel from '@/models/subscription'
|
||||||
|
|
||||||
import {success} from '@/message'
|
import {success} from '@/message'
|
||||||
|
|
||||||
const props = defineProps({
|
interface Props {
|
||||||
entity: {
|
entity: string
|
||||||
required: true,
|
entityId: number
|
||||||
type: String,
|
subscription: SubscriptionModel
|
||||||
},
|
isButton: boolean
|
||||||
subscription: {
|
}
|
||||||
required: true,
|
|
||||||
type: Object,
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
validator(value) {
|
isButton: true,
|
||||||
return value instanceof SubscriptionModel || value === null
|
|
||||||
},
|
|
||||||
},
|
|
||||||
entityId: {
|
|
||||||
required: true,
|
|
||||||
type: Number,
|
|
||||||
},
|
|
||||||
isButton: {
|
|
||||||
type: Boolean,
|
|
||||||
default: true,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
const subscriptionEntity = computed<string>(() => props.subscription.entity)
|
const subscriptionEntity = computed<string>(() => props.subscription.entity)
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
{{ $t('menu.archive') }}
|
{{ $t('menu.archive') }}
|
||||||
</dropdown-item>
|
</dropdown-item>
|
||||||
<task-subscription
|
<task-subscription
|
||||||
|
v-if="subscription"
|
||||||
class="dropdown-item has-no-shadow"
|
class="dropdown-item has-no-shadow"
|
||||||
:is-button="false"
|
:is-button="false"
|
||||||
entity="namespace"
|
entity="namespace"
|
||||||
|
|
|
@ -263,6 +263,7 @@
|
||||||
{{ task.done ? $t('task.detail.undone') : $t('task.detail.done') }}
|
{{ task.done ? $t('task.detail.undone') : $t('task.detail.done') }}
|
||||||
</x-button>
|
</x-button>
|
||||||
<task-subscription
|
<task-subscription
|
||||||
|
v-if="subscription"
|
||||||
entity="task"
|
entity="task"
|
||||||
:entity-id="task.id"
|
:entity-id="task.id"
|
||||||
:subscription="task.subscription"
|
:subscription="task.subscription"
|
||||||
|
|
Loading…
Reference in a new issue