fix(fe): Plan limit reached modal not triggered when model limit reached

fix(fe): Plan limit reached modal not triggered when model limit reached
This commit is contained in:
andrewwallacespeckle
2025-04-23 14:48:59 +01:00
committed by GitHub
6 changed files with 40 additions and 21 deletions
@@ -36,6 +36,7 @@
<WorkspaceMoveProjectManager
v-model:open="showMoveProjectDialog"
:workspace-slug="workspaceSlug"
:workspace-id="workspace?.id"
/>
<WorkspacePlanProjectModelLimitReachedDialog
v-model:open="showLimitDialog"
@@ -5,6 +5,7 @@
v-if="!selectedProject"
:workspace="workspaceResult?.workspaceBySlug"
:project-permissions="projectResult?.project.permissions.canMoveToWorkspace"
:workspace-id="workspaceId"
@project-selected="onProjectSelected"
/>
@@ -74,7 +75,7 @@ graphql(`
fragment WorkspaceMoveProjectManager_Project on Project {
...WorkspaceMoveProjectManager_ProjectBase
permissions {
canMoveToWorkspace {
canMoveToWorkspace(workspaceId: $workspaceId) {
...FullPermissionCheckResult
}
}
@@ -127,6 +128,7 @@ graphql(`
const props = defineProps<{
projectId?: string
workspaceSlug?: string
workspaceId?: string
}>()
const open = defineModel<boolean>('open', { required: true })
@@ -148,7 +150,8 @@ const activeDialog = computed(() => {
const { result: projectResult } = useQuery(
workspaceMoveProjectManagerProjectQuery,
() => ({
projectId: props.projectId || ''
projectId: props.projectId || '',
workspaceId: props.workspaceId || ''
}),
() => ({
enabled: !!props.projectId
@@ -160,7 +163,8 @@ const { result: workspaceResult } = useQuery(
workspaceMoveProjectManagerWorkspaceQuery,
() => ({
workspaceSlug: props.workspaceSlug || '',
projectId: props.projectId
projectId: props.projectId,
workspaceId: props.workspaceId || ''
}),
() => ({
enabled: !!props.workspaceSlug
@@ -96,9 +96,10 @@ const emit = defineEmits<{
(e: 'project-selected', project: WorkspaceMoveProjectManager_ProjectFragment): void
}>()
defineProps<{
const props = defineProps<{
workspace?: WorkspaceMoveProjectManager_WorkspaceFragment
projectPermissions?: PermissionCheckResult
workspaceId?: string
}>()
const {
@@ -112,7 +113,8 @@ const {
filter: {
search: search.value?.length ? search.value : null,
personalOnly: true
}
},
workspaceId: props.workspaceId || ''
})),
resolveKey: (vars) => [vars.filter?.search || ''],
resolveCurrentResult: (res) => res?.activeUser?.projects,
@@ -131,7 +133,10 @@ const hasMoveableProjects = computed(() => moveableProjects.value.length > 0)
const isProjectDisabled = computed(
() => (project: WorkspaceMoveProjectManager_ProjectFragment) => {
if (project.permissions.canMoveToWorkspace.authorized) {
if (
project.permissions.canMoveToWorkspace.authorized ||
project.permissions.canMoveToWorkspace.code === 'WorkspaceLimitsReached'
) {
return false
}
return true
@@ -140,7 +145,10 @@ const isProjectDisabled = computed(
const getProjectTooltip = computed(
() => (project: WorkspaceMoveProjectManager_ProjectFragment) => {
if (project.permissions.canMoveToWorkspace.authorized) {
if (
project.permissions.canMoveToWorkspace.authorized ||
project.permissions.canMoveToWorkspace.code === 'WorkspaceLimitsReached'
) {
return undefined
}
if (project.permissions.canMoveToWorkspace.code === 'ProjectNotEnoughPermissions') {
@@ -141,7 +141,7 @@ type Documents = {
"\n fragment WorkspaceInviteBlock_PendingWorkspaceCollaborator on PendingWorkspaceCollaborator {\n id\n workspaceId\n workspaceName\n token\n user {\n id\n name\n ...LimitedUserAvatar\n }\n title\n email\n ...UseWorkspaceInviteManager_PendingWorkspaceCollaborator\n }\n": typeof types.WorkspaceInviteBlock_PendingWorkspaceCollaboratorFragmentDoc,
"\n fragment WorkspaceJoinRequestApproveDialog_WorkspaceJoinRequest on WorkspaceJoinRequest {\n id\n user {\n id\n name\n }\n workspace {\n id\n }\n }\n": typeof types.WorkspaceJoinRequestApproveDialog_WorkspaceJoinRequestFragmentDoc,
"\n fragment WorkspaceMoveProjectManager_ProjectBase on Project {\n id\n name\n modelCount: models(limit: 0) {\n totalCount\n }\n versions(limit: 0) {\n totalCount\n }\n }\n": typeof types.WorkspaceMoveProjectManager_ProjectBaseFragmentDoc,
"\n fragment WorkspaceMoveProjectManager_Project on Project {\n ...WorkspaceMoveProjectManager_ProjectBase\n permissions {\n canMoveToWorkspace {\n ...FullPermissionCheckResult\n }\n }\n workspace {\n id\n slug\n permissions {\n canMoveProjectToWorkspace(projectId: $projectId) {\n ...FullPermissionCheckResult\n }\n }\n }\n }\n": typeof types.WorkspaceMoveProjectManager_ProjectFragmentDoc,
"\n fragment WorkspaceMoveProjectManager_Project on Project {\n ...WorkspaceMoveProjectManager_ProjectBase\n permissions {\n canMoveToWorkspace(workspaceId: $workspaceId) {\n ...FullPermissionCheckResult\n }\n }\n workspace {\n id\n slug\n permissions {\n canMoveProjectToWorkspace(projectId: $projectId) {\n ...FullPermissionCheckResult\n }\n }\n }\n }\n": typeof types.WorkspaceMoveProjectManager_ProjectFragmentDoc,
"\n fragment WorkspaceMoveProjectManager_Workspace on Workspace {\n id\n role\n name\n logo\n slug\n plan {\n name\n usage {\n projectCount\n modelCount\n }\n }\n permissions {\n canMoveProjectToWorkspace(projectId: $projectId) {\n ...FullPermissionCheckResult\n }\n }\n projects {\n totalCount\n }\n team {\n items {\n user {\n id\n name\n avatar\n }\n }\n }\n }\n": typeof types.WorkspaceMoveProjectManager_WorkspaceFragmentDoc,
"\n fragment WorkspaceMoveProjectSelectWorkspace_User on User {\n workspaces {\n items {\n ...WorkspaceMoveProjectManager_Workspace\n }\n }\n projects(cursor: $cursor, filter: $filter) {\n items {\n ...WorkspaceMoveProjectManager_Project\n }\n cursor\n totalCount\n }\n }\n": typeof types.WorkspaceMoveProjectSelectWorkspace_UserFragmentDoc,
"\n fragment WorkspaceSidebarAbout_Workspace on Workspace {\n id\n name\n description\n }\n": typeof types.WorkspaceSidebarAbout_WorkspaceFragmentDoc,
@@ -400,9 +400,9 @@ type Documents = {
"\n query WorkspaceLastAdminCheck($slug: String!) {\n workspaceBySlug(slug: $slug) {\n teamByRole {\n admins {\n totalCount\n }\n }\n }\n }\n": typeof types.WorkspaceLastAdminCheckDocument,
"\n query WorkspaceLimits($slug: String!) {\n workspaceBySlug(slug: $slug) {\n ...WorkspacePlanLimits_Workspace\n }\n }\n": typeof types.WorkspaceLimitsDocument,
"\n query WorkspaceUsage($slug: String!) {\n workspaceBySlug(slug: $slug) {\n ...WorkspaceUsage_Workspace\n }\n }\n": typeof types.WorkspaceUsageDocument,
"\n query WorkspaceMoveProjectManagerProject($projectId: String!) {\n project(id: $projectId) {\n ...WorkspaceMoveProjectManager_Project\n }\n }\n": typeof types.WorkspaceMoveProjectManagerProjectDocument,
"\n query WorkspaceMoveProjectManagerProject($projectId: String!, $workspaceId: String) {\n project(id: $projectId) {\n ...WorkspaceMoveProjectManager_Project\n }\n }\n": typeof types.WorkspaceMoveProjectManagerProjectDocument,
"\n query WorkspaceMoveProjectManagerWorkspace(\n $workspaceSlug: String!\n $projectId: String\n ) {\n workspaceBySlug(slug: $workspaceSlug) {\n ...WorkspaceMoveProjectManager_Workspace\n }\n }\n": typeof types.WorkspaceMoveProjectManagerWorkspaceDocument,
"\n query WorkspaceMoveProjectManagerUser(\n $cursor: String\n $filter: UserProjectsFilter\n $projectId: String\n ) {\n activeUser {\n ...WorkspaceMoveProjectSelectWorkspace_User\n }\n }\n": typeof types.WorkspaceMoveProjectManagerUserDocument,
"\n query WorkspaceMoveProjectManagerUser(\n $cursor: String\n $filter: UserProjectsFilter\n $projectId: String\n $workspaceId: String\n ) {\n activeUser {\n ...WorkspaceMoveProjectSelectWorkspace_User\n }\n }\n": typeof types.WorkspaceMoveProjectManagerUserDocument,
"\n subscription onWorkspaceUpdated(\n $workspaceId: String\n $workspaceSlug: String\n $invitesFilter: PendingWorkspaceCollaboratorsFilter\n ) {\n workspaceUpdated(workspaceId: $workspaceId, workspaceSlug: $workspaceSlug) {\n id\n workspace {\n id\n ...WorkspaceDashboard_Workspace\n ...WorkspaceDashboardProjectList_Workspace\n }\n }\n }\n": typeof types.OnWorkspaceUpdatedDocument,
"\n query LegacyBranchRedirectMetadata($streamId: String!, $branchName: String!) {\n project(id: $streamId) {\n modelByName(name: $branchName) {\n id\n }\n }\n }\n": typeof types.LegacyBranchRedirectMetadataDocument,
"\n query LegacyViewerCommitRedirectMetadata($streamId: String!, $commitId: String!) {\n project(id: $streamId) {\n version(id: $commitId) {\n id\n model {\n id\n }\n }\n }\n }\n": typeof types.LegacyViewerCommitRedirectMetadataDocument,
@@ -557,7 +557,7 @@ const documents: Documents = {
"\n fragment WorkspaceInviteBlock_PendingWorkspaceCollaborator on PendingWorkspaceCollaborator {\n id\n workspaceId\n workspaceName\n token\n user {\n id\n name\n ...LimitedUserAvatar\n }\n title\n email\n ...UseWorkspaceInviteManager_PendingWorkspaceCollaborator\n }\n": types.WorkspaceInviteBlock_PendingWorkspaceCollaboratorFragmentDoc,
"\n fragment WorkspaceJoinRequestApproveDialog_WorkspaceJoinRequest on WorkspaceJoinRequest {\n id\n user {\n id\n name\n }\n workspace {\n id\n }\n }\n": types.WorkspaceJoinRequestApproveDialog_WorkspaceJoinRequestFragmentDoc,
"\n fragment WorkspaceMoveProjectManager_ProjectBase on Project {\n id\n name\n modelCount: models(limit: 0) {\n totalCount\n }\n versions(limit: 0) {\n totalCount\n }\n }\n": types.WorkspaceMoveProjectManager_ProjectBaseFragmentDoc,
"\n fragment WorkspaceMoveProjectManager_Project on Project {\n ...WorkspaceMoveProjectManager_ProjectBase\n permissions {\n canMoveToWorkspace {\n ...FullPermissionCheckResult\n }\n }\n workspace {\n id\n slug\n permissions {\n canMoveProjectToWorkspace(projectId: $projectId) {\n ...FullPermissionCheckResult\n }\n }\n }\n }\n": types.WorkspaceMoveProjectManager_ProjectFragmentDoc,
"\n fragment WorkspaceMoveProjectManager_Project on Project {\n ...WorkspaceMoveProjectManager_ProjectBase\n permissions {\n canMoveToWorkspace(workspaceId: $workspaceId) {\n ...FullPermissionCheckResult\n }\n }\n workspace {\n id\n slug\n permissions {\n canMoveProjectToWorkspace(projectId: $projectId) {\n ...FullPermissionCheckResult\n }\n }\n }\n }\n": types.WorkspaceMoveProjectManager_ProjectFragmentDoc,
"\n fragment WorkspaceMoveProjectManager_Workspace on Workspace {\n id\n role\n name\n logo\n slug\n plan {\n name\n usage {\n projectCount\n modelCount\n }\n }\n permissions {\n canMoveProjectToWorkspace(projectId: $projectId) {\n ...FullPermissionCheckResult\n }\n }\n projects {\n totalCount\n }\n team {\n items {\n user {\n id\n name\n avatar\n }\n }\n }\n }\n": types.WorkspaceMoveProjectManager_WorkspaceFragmentDoc,
"\n fragment WorkspaceMoveProjectSelectWorkspace_User on User {\n workspaces {\n items {\n ...WorkspaceMoveProjectManager_Workspace\n }\n }\n projects(cursor: $cursor, filter: $filter) {\n items {\n ...WorkspaceMoveProjectManager_Project\n }\n cursor\n totalCount\n }\n }\n": types.WorkspaceMoveProjectSelectWorkspace_UserFragmentDoc,
"\n fragment WorkspaceSidebarAbout_Workspace on Workspace {\n id\n name\n description\n }\n": types.WorkspaceSidebarAbout_WorkspaceFragmentDoc,
@@ -816,9 +816,9 @@ const documents: Documents = {
"\n query WorkspaceLastAdminCheck($slug: String!) {\n workspaceBySlug(slug: $slug) {\n teamByRole {\n admins {\n totalCount\n }\n }\n }\n }\n": types.WorkspaceLastAdminCheckDocument,
"\n query WorkspaceLimits($slug: String!) {\n workspaceBySlug(slug: $slug) {\n ...WorkspacePlanLimits_Workspace\n }\n }\n": types.WorkspaceLimitsDocument,
"\n query WorkspaceUsage($slug: String!) {\n workspaceBySlug(slug: $slug) {\n ...WorkspaceUsage_Workspace\n }\n }\n": types.WorkspaceUsageDocument,
"\n query WorkspaceMoveProjectManagerProject($projectId: String!) {\n project(id: $projectId) {\n ...WorkspaceMoveProjectManager_Project\n }\n }\n": types.WorkspaceMoveProjectManagerProjectDocument,
"\n query WorkspaceMoveProjectManagerProject($projectId: String!, $workspaceId: String) {\n project(id: $projectId) {\n ...WorkspaceMoveProjectManager_Project\n }\n }\n": types.WorkspaceMoveProjectManagerProjectDocument,
"\n query WorkspaceMoveProjectManagerWorkspace(\n $workspaceSlug: String!\n $projectId: String\n ) {\n workspaceBySlug(slug: $workspaceSlug) {\n ...WorkspaceMoveProjectManager_Workspace\n }\n }\n": types.WorkspaceMoveProjectManagerWorkspaceDocument,
"\n query WorkspaceMoveProjectManagerUser(\n $cursor: String\n $filter: UserProjectsFilter\n $projectId: String\n ) {\n activeUser {\n ...WorkspaceMoveProjectSelectWorkspace_User\n }\n }\n": types.WorkspaceMoveProjectManagerUserDocument,
"\n query WorkspaceMoveProjectManagerUser(\n $cursor: String\n $filter: UserProjectsFilter\n $projectId: String\n $workspaceId: String\n ) {\n activeUser {\n ...WorkspaceMoveProjectSelectWorkspace_User\n }\n }\n": types.WorkspaceMoveProjectManagerUserDocument,
"\n subscription onWorkspaceUpdated(\n $workspaceId: String\n $workspaceSlug: String\n $invitesFilter: PendingWorkspaceCollaboratorsFilter\n ) {\n workspaceUpdated(workspaceId: $workspaceId, workspaceSlug: $workspaceSlug) {\n id\n workspace {\n id\n ...WorkspaceDashboard_Workspace\n ...WorkspaceDashboardProjectList_Workspace\n }\n }\n }\n": types.OnWorkspaceUpdatedDocument,
"\n query LegacyBranchRedirectMetadata($streamId: String!, $branchName: String!) {\n project(id: $streamId) {\n modelByName(name: $branchName) {\n id\n }\n }\n }\n": types.LegacyBranchRedirectMetadataDocument,
"\n query LegacyViewerCommitRedirectMetadata($streamId: String!, $commitId: String!) {\n project(id: $streamId) {\n version(id: $commitId) {\n id\n model {\n id\n }\n }\n }\n }\n": types.LegacyViewerCommitRedirectMetadataDocument,
@@ -1371,7 +1371,7 @@ export function graphql(source: "\n fragment WorkspaceMoveProjectManager_Projec
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n fragment WorkspaceMoveProjectManager_Project on Project {\n ...WorkspaceMoveProjectManager_ProjectBase\n permissions {\n canMoveToWorkspace {\n ...FullPermissionCheckResult\n }\n }\n workspace {\n id\n slug\n permissions {\n canMoveProjectToWorkspace(projectId: $projectId) {\n ...FullPermissionCheckResult\n }\n }\n }\n }\n"): (typeof documents)["\n fragment WorkspaceMoveProjectManager_Project on Project {\n ...WorkspaceMoveProjectManager_ProjectBase\n permissions {\n canMoveToWorkspace {\n ...FullPermissionCheckResult\n }\n }\n workspace {\n id\n slug\n permissions {\n canMoveProjectToWorkspace(projectId: $projectId) {\n ...FullPermissionCheckResult\n }\n }\n }\n }\n"];
export function graphql(source: "\n fragment WorkspaceMoveProjectManager_Project on Project {\n ...WorkspaceMoveProjectManager_ProjectBase\n permissions {\n canMoveToWorkspace(workspaceId: $workspaceId) {\n ...FullPermissionCheckResult\n }\n }\n workspace {\n id\n slug\n permissions {\n canMoveProjectToWorkspace(projectId: $projectId) {\n ...FullPermissionCheckResult\n }\n }\n }\n }\n"): (typeof documents)["\n fragment WorkspaceMoveProjectManager_Project on Project {\n ...WorkspaceMoveProjectManager_ProjectBase\n permissions {\n canMoveToWorkspace(workspaceId: $workspaceId) {\n ...FullPermissionCheckResult\n }\n }\n workspace {\n id\n slug\n permissions {\n canMoveProjectToWorkspace(projectId: $projectId) {\n ...FullPermissionCheckResult\n }\n }\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
@@ -2407,7 +2407,7 @@ export function graphql(source: "\n query WorkspaceUsage($slug: String!) {\n
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query WorkspaceMoveProjectManagerProject($projectId: String!) {\n project(id: $projectId) {\n ...WorkspaceMoveProjectManager_Project\n }\n }\n"): (typeof documents)["\n query WorkspaceMoveProjectManagerProject($projectId: String!) {\n project(id: $projectId) {\n ...WorkspaceMoveProjectManager_Project\n }\n }\n"];
export function graphql(source: "\n query WorkspaceMoveProjectManagerProject($projectId: String!, $workspaceId: String) {\n project(id: $projectId) {\n ...WorkspaceMoveProjectManager_Project\n }\n }\n"): (typeof documents)["\n query WorkspaceMoveProjectManagerProject($projectId: String!, $workspaceId: String) {\n project(id: $projectId) {\n ...WorkspaceMoveProjectManager_Project\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
@@ -2415,7 +2415,7 @@ export function graphql(source: "\n query WorkspaceMoveProjectManagerWorkspace(
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
export function graphql(source: "\n query WorkspaceMoveProjectManagerUser(\n $cursor: String\n $filter: UserProjectsFilter\n $projectId: String\n ) {\n activeUser {\n ...WorkspaceMoveProjectSelectWorkspace_User\n }\n }\n"): (typeof documents)["\n query WorkspaceMoveProjectManagerUser(\n $cursor: String\n $filter: UserProjectsFilter\n $projectId: String\n ) {\n activeUser {\n ...WorkspaceMoveProjectSelectWorkspace_User\n }\n }\n"];
export function graphql(source: "\n query WorkspaceMoveProjectManagerUser(\n $cursor: String\n $filter: UserProjectsFilter\n $projectId: String\n $workspaceId: String\n ) {\n activeUser {\n ...WorkspaceMoveProjectSelectWorkspace_User\n }\n }\n"): (typeof documents)["\n query WorkspaceMoveProjectManagerUser(\n $cursor: String\n $filter: UserProjectsFilter\n $projectId: String\n $workspaceId: String\n ) {\n activeUser {\n ...WorkspaceMoveProjectSelectWorkspace_User\n }\n }\n"];
/**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/
File diff suppressed because one or more lines are too long
@@ -180,7 +180,7 @@ export const workspaceUsageQuery = graphql(`
`)
export const workspaceMoveProjectManagerProjectQuery = graphql(`
query WorkspaceMoveProjectManagerProject($projectId: String!) {
query WorkspaceMoveProjectManagerProject($projectId: String!, $workspaceId: String) {
project(id: $projectId) {
...WorkspaceMoveProjectManager_Project
}
@@ -203,6 +203,7 @@ export const workspaceMoveProjectManagerUserQuery = graphql(`
$cursor: String
$filter: UserProjectsFilter
$projectId: String
$workspaceId: String
) {
activeUser {
...WorkspaceMoveProjectSelectWorkspace_User