feat(wizard): add canCreateVersion permission check to publish wizard

This commit is contained in:
Björn
2026-01-28 16:08:01 +02:00
parent 8770816635
commit e77c1b43c5
+31 -1
View File
@@ -45,7 +45,17 @@
"
/>
<div class="mt-2">
<FormButton full-width @click="addModel">Publish</FormButton>
<div
v-tippy="canCreateVersion?.authorized ? undefined : canCreateVersion?.message"
>
<FormButton
full-width
:disabled="!canCreateVersion?.authorized"
@click="addModel"
>
Publish
</FormButton>
</div>
</div>
</div>
<div v-if="urlParseError" class="p-2 text-danger">
@@ -67,6 +77,8 @@ import { useMixpanel } from '~/lib/core/composables/mixpanel'
import { useSettingsTracking } from '~/lib/core/composables/trackSettings'
import type { CardSetting } from '~/lib/models/card/setting'
import { useAddByUrl } from '~/lib/core/composables/addByUrl'
import { useQuery } from '@vue/apollo-composable'
import { canCreateVersionQuery } from '~/lib/graphql/mutationsAndQueries'
const { trackEvent } = useMixpanel()
const { trackSettingsChange } = useSettingsTracking()
@@ -139,6 +151,24 @@ watch(step, (newVal, oldVal) => {
const hostAppStore = useHostAppStore()
// check canCreateVersion permission when model is selected
const { result: canCreateVersionResult } = useQuery(
canCreateVersionQuery,
() => ({
projectId: selectedProject.value?.id as string,
modelId: selectedModel.value?.id as string
}),
() => ({
enabled: !!selectedProject.value?.id && !!selectedModel.value?.id,
clientId: selectedAccountId.value,
fetchPolicy: 'network-only'
})
)
const canCreateVersion = computed(() => {
return canCreateVersionResult.value?.project.model.permissions.canCreateVersion
})
// accountId, serverUrl, projectId, modelId, sendFilter, settings
const addModel = async () => {
void trackEvent('DUI3 Action', {