fix: hide create project/model buttons on receive flow (#101)
* Hide "Create Project/Model" Buttons in Load Flow * simplify * add isSender to modelselector * chore: run linting on ModelSelector --------- Co-authored-by: Oğuzhan Koral <45078678+oguzhankoral@users.noreply.github.com> Co-authored-by: Björn Steinhagen <steinhagen.bjoern@gmail.com>
This commit is contained in:
committed by
GitHub
parent
2ca577fe60
commit
a38a699123
@@ -14,6 +14,7 @@
|
|||||||
color="foundation"
|
color="foundation"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
|
v-if="isSender"
|
||||||
v-tippy="
|
v-tippy="
|
||||||
canCreateModelResult?.project.permissions.canCreateModel.authorized
|
canCreateModelResult?.project.permissions.canCreateModel.authorized
|
||||||
? 'Create new model'
|
? 'Create new model'
|
||||||
@@ -83,6 +84,7 @@
|
|||||||
v-if="
|
v-if="
|
||||||
models?.length === 0 &&
|
models?.length === 0 &&
|
||||||
!!searchText &&
|
!!searchText &&
|
||||||
|
isSender &&
|
||||||
canCreateModelResult?.project.permissions.canCreateModel?.authorized
|
canCreateModelResult?.project.permissions.canCreateModel?.authorized
|
||||||
"
|
"
|
||||||
full-width
|
full-width
|
||||||
@@ -104,6 +106,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<CommonDialog
|
<CommonDialog
|
||||||
|
v-if="isSender"
|
||||||
v-model:open="showNewModelDialog"
|
v-model:open="showNewModelDialog"
|
||||||
title="Create new model"
|
title="Create new model"
|
||||||
fullscreen="none"
|
fullscreen="none"
|
||||||
@@ -163,10 +166,9 @@ const props = withDefaults(
|
|||||||
workspaceId?: string
|
workspaceId?: string
|
||||||
workspaceSlug?: string
|
workspaceSlug?: string
|
||||||
accountId: string
|
accountId: string
|
||||||
showNewModel?: boolean
|
|
||||||
isSender?: boolean
|
isSender?: boolean
|
||||||
}>(),
|
}>(),
|
||||||
{ showNewModel: true, isSender: false }
|
{ isSender: false }
|
||||||
)
|
)
|
||||||
|
|
||||||
const accountStore = useAccountStore()
|
const accountStore = useAccountStore()
|
||||||
@@ -196,8 +198,7 @@ const handleModelSelect = (model: ModelListModelItemFragment) => {
|
|||||||
if (existingModelProblem.value) {
|
if (existingModelProblem.value) {
|
||||||
existingModelName.value = model.name
|
existingModelName.value = model.name
|
||||||
}
|
}
|
||||||
hasNonZeroVersionsProblem.value =
|
hasNonZeroVersionsProblem.value = model.versions.totalCount !== 0 && props.isSender
|
||||||
model.versions.totalCount !== 0 && props.showNewModel // NOTE: we're using the showNewModel prop as a giveaway of whether we're in the send wizard - we do not need this extra check in the receive wizard
|
|
||||||
|
|
||||||
if (!existingModelProblem.value && !hasNonZeroVersionsProblem.value) {
|
if (!existingModelProblem.value && !hasNonZeroVersionsProblem.value) {
|
||||||
return emit('next', model)
|
return emit('next', model)
|
||||||
|
|||||||
@@ -78,6 +78,7 @@
|
|||||||
color="foundation"
|
color="foundation"
|
||||||
/>
|
/>
|
||||||
<div class="flex justify-between items-center space-x-2">
|
<div class="flex justify-between items-center space-x-2">
|
||||||
|
<template v-if="isSender">
|
||||||
<div v-if="canCreateProject" v-tippy="'Create new project'">
|
<div v-if="canCreateProject" v-tippy="'Create new project'">
|
||||||
<FormButton
|
<FormButton
|
||||||
color="outline"
|
color="outline"
|
||||||
@@ -140,6 +141,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</CommonDialog>
|
</CommonDialog>
|
||||||
|
</template>
|
||||||
<div v-if="!workspacesEnabled || !workspaces" class="mt-1">
|
<div v-if="!workspacesEnabled || !workspaces" class="mt-1">
|
||||||
<AccountsMenu
|
<AccountsMenu
|
||||||
:current-selected-account-id="accountId"
|
:current-selected-account-id="accountId"
|
||||||
@@ -168,6 +170,7 @@
|
|||||||
v-if="
|
v-if="
|
||||||
projects?.length === 0 &&
|
projects?.length === 0 &&
|
||||||
!!searchText &&
|
!!searchText &&
|
||||||
|
isSender &&
|
||||||
canCreateProjectPermissionCheck?.authorized
|
canCreateProjectPermissionCheck?.authorized
|
||||||
"
|
"
|
||||||
full-width
|
full-width
|
||||||
@@ -236,7 +239,6 @@ const emit = defineEmits<{
|
|||||||
const props = withDefaults(
|
const props = withDefaults(
|
||||||
defineProps<{
|
defineProps<{
|
||||||
isSender: boolean
|
isSender: boolean
|
||||||
showNewProject?: boolean
|
|
||||||
/**
|
/**
|
||||||
* For the send wizard - not allowing selecting projects we can't write to.
|
* For the send wizard - not allowing selecting projects we can't write to.
|
||||||
*/
|
*/
|
||||||
@@ -244,7 +246,6 @@ const props = withDefaults(
|
|||||||
urlParseError?: string
|
urlParseError?: string
|
||||||
}>(),
|
}>(),
|
||||||
{
|
{
|
||||||
showNewProject: true,
|
|
||||||
disableNoWriteAccessProjects: false
|
disableNoWriteAccessProjects: false
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user