fix(dui): prevents invalidate selection filter across not just selection
This commit is contained in:
@@ -119,7 +119,7 @@
|
||||
</ModelCardBase>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import ModelCardBase from '~/components/model/CardBase.vue'
|
||||
import { Square3Stack3DIcon } from '@heroicons/vue/20/solid'
|
||||
import type { ModelCardNotification } from '~/lib/models/card/notification'
|
||||
@@ -212,21 +212,16 @@ const sendOrCancel = () => {
|
||||
}
|
||||
|
||||
const newFilter = ref<ISendFilter>()
|
||||
|
||||
const updateFilter = (filter: ISendFilter) => {
|
||||
newFilter.value = filter
|
||||
}
|
||||
|
||||
const isSaveDisabled = computed(() => {
|
||||
const f = newFilter.value || props.modelCard.sendFilter
|
||||
return (
|
||||
f?.name === 'Selection' &&
|
||||
(!f.selectedObjectIds || f.selectedObjectIds.length === 0)
|
||||
)
|
||||
return !store.validateSendFilter(newFilter.value || props.modelCard.sendFilter).valid
|
||||
})
|
||||
|
||||
const saveFilter = async () => {
|
||||
if (!newFilter.value) return
|
||||
if (!newFilter.value) return // Safety check
|
||||
void trackEvent('DUI3 Action', {
|
||||
name: 'Publish Card Filter Change',
|
||||
filter: newFilter.value.typeDiscriminator
|
||||
|
||||
+11
-11
@@ -42,10 +42,7 @@
|
||||
}
|
||||
"
|
||||
/>
|
||||
<div
|
||||
v-tippy="!canPublish && !isLoadingPermissions ? publishLimitMessage : ''"
|
||||
class="mt-2"
|
||||
>
|
||||
<div v-tippy="publishTooltipMessage" class="mt-2">
|
||||
<FormButton
|
||||
full-width
|
||||
:disabled="isPublishDisabled"
|
||||
@@ -62,7 +59,6 @@
|
||||
</CommonDialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { useSubscription } from '@vue/apollo-composable'
|
||||
import type {
|
||||
@@ -108,15 +104,19 @@ const isLoadingPermissions = ref(false)
|
||||
const hostAppStore = useHostAppStore()
|
||||
const selectionStore = useSelectionStore()
|
||||
|
||||
const isSelectionEmpty = computed(() => {
|
||||
const publishValidation = computed(() => hostAppStore.validateSendFilter(filter.value))
|
||||
|
||||
const isPublishDisabled = computed(() => {
|
||||
return (
|
||||
filter.value?.name === 'Selection' &&
|
||||
(!selectionStore.selectionInfo.selectedObjectIds ||
|
||||
selectionStore.selectionInfo.selectedObjectIds.length === 0)
|
||||
!canPublish.value || isLoadingPermissions.value || !publishValidation.value.valid
|
||||
)
|
||||
})
|
||||
const isPublishDisabled = computed(() => {
|
||||
return !canPublish.value || isLoadingPermissions.value || isSelectionEmpty.value
|
||||
|
||||
const publishTooltipMessage = computed(() => {
|
||||
if (!publishValidation.value.valid) return publishValidation.value.reason
|
||||
if (!canPublish.value && !isLoadingPermissions.value)
|
||||
return publishLimitMessage.value || ''
|
||||
return ''
|
||||
})
|
||||
|
||||
const updateSearchText = (text: string | undefined) => {
|
||||
|
||||
Reference in New Issue
Block a user