From 8cf28c1b7adc6a234f10e1f52688b31abd7093ac Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Thu, 1 Aug 2024 09:13:32 +0200 Subject: [PATCH] fix(editor): Rename store getter --- packages/editor-ui/src/components/CredentialCard.test.ts | 2 +- packages/editor-ui/src/components/CredentialCard.vue | 2 +- .../src/components/Projects/ProjectNavigation.vue | 8 +++++--- packages/editor-ui/src/components/WorkflowCard.test.ts | 2 +- packages/editor-ui/src/components/WorkflowCard.vue | 2 +- packages/editor-ui/src/stores/projects.store.ts | 6 +++--- 6 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/editor-ui/src/components/CredentialCard.test.ts b/packages/editor-ui/src/components/CredentialCard.test.ts index 4c0ed633d23a0..9ca589923d59e 100644 --- a/packages/editor-ui/src/components/CredentialCard.test.ts +++ b/packages/editor-ui/src/components/CredentialCard.test.ts @@ -63,7 +63,7 @@ describe('CredentialCard', () => { }); it('should show Move action only if there is resource permission and not on community plan', async () => { - vi.spyOn(projectsStore, 'isTeamProjectsAvailable', 'get').mockReturnValue(true); + vi.spyOn(projectsStore, 'isTeamProjectFeatureEnabled', 'get').mockReturnValue(true); const data = createCredential({ scopes: ['credential:move'], diff --git a/packages/editor-ui/src/components/CredentialCard.vue b/packages/editor-ui/src/components/CredentialCard.vue index 325f2418797b9..d9ac12ffd9a54 100644 --- a/packages/editor-ui/src/components/CredentialCard.vue +++ b/packages/editor-ui/src/components/CredentialCard.vue @@ -64,7 +64,7 @@ const actions = computed(() => { }); } - if (credentialPermissions.value.move && projectsStore.isTeamProjectsAvailable) { + if (credentialPermissions.value.move && projectsStore.isTeamProjectFeatureEnabled) { items.push({ label: locale.baseText('credentials.item.move'), value: CREDENTIAL_LIST_ITEM_ACTIONS.MOVE, diff --git a/packages/editor-ui/src/components/Projects/ProjectNavigation.vue b/packages/editor-ui/src/components/Projects/ProjectNavigation.vue index 447970e93484a..2b4909e0f2f95 100644 --- a/packages/editor-ui/src/components/Projects/ProjectNavigation.vue +++ b/packages/editor-ui/src/components/Projects/ProjectNavigation.vue @@ -116,7 +116,7 @@ onMounted(async () => {
@@ -137,7 +137,9 @@ onMounted(async () => { @@ -171,7 +173,7 @@ onMounted(async () => {
diff --git a/packages/editor-ui/src/components/WorkflowCard.test.ts b/packages/editor-ui/src/components/WorkflowCard.test.ts index 129171857c3b8..735b20ada5f0b 100644 --- a/packages/editor-ui/src/components/WorkflowCard.test.ts +++ b/packages/editor-ui/src/components/WorkflowCard.test.ts @@ -144,7 +144,7 @@ describe('WorkflowCard', () => { }); it('should show Move action only if there is resource permission and team projects available', async () => { - vi.spyOn(projectsStore, 'isTeamProjectsAvailable', 'get').mockReturnValue(true); + vi.spyOn(projectsStore, 'isTeamProjectFeatureEnabled', 'get').mockReturnValue(true); const data = createWorkflow({ scopes: ['workflow:move'], diff --git a/packages/editor-ui/src/components/WorkflowCard.vue b/packages/editor-ui/src/components/WorkflowCard.vue index cf4f2adbc9b3c..6cc73db627817 100644 --- a/packages/editor-ui/src/components/WorkflowCard.vue +++ b/packages/editor-ui/src/components/WorkflowCard.vue @@ -95,7 +95,7 @@ const actions = computed(() => { }); } - if (workflowPermissions.value.move && projectsStore.isTeamProjectsAvailable) { + if (workflowPermissions.value.move && projectsStore.isTeamProjectFeatureEnabled) { items.push({ label: locale.baseText('workflows.item.move'), value: WORKFLOW_LIST_ITEM_ACTIONS.MOVE, diff --git a/packages/editor-ui/src/stores/projects.store.ts b/packages/editor-ui/src/stores/projects.store.ts index bdc84f4a7e6f0..6bc61d246c7c9 100644 --- a/packages/editor-ui/src/stores/projects.store.ts +++ b/packages/editor-ui/src/stores/projects.store.ts @@ -49,7 +49,7 @@ export const useProjectsStore = defineStore('projects', () => { ); const teamProjects = computed(() => projects.value.filter((p) => p.type === ProjectTypes.Team)); const teamProjectsLimit = computed(() => settingsStore.settings.enterprise.projects.team.limit); - const isTeamProjectsAvailable = computed( + const isTeamProjectFeatureEnabled = computed( () => settingsStore.settings.enterprise.projects.team.limit !== 0, ); const hasUnlimitedProjects = computed( @@ -61,7 +61,7 @@ export const useProjectsStore = defineStore('projects', () => { const canCreateProjects = computed( () => hasUnlimitedProjects.value || - (isTeamProjectsAvailable.value && !isTeamProjectLimitExceeded.value), + (isTeamProjectFeatureEnabled.value && !isTeamProjectLimitExceeded.value), ); const hasPermissionToCreateProjects = computed(() => hasPermission(['rbac'], { rbac: { scope: 'project:create' } }), @@ -199,7 +199,7 @@ export const useProjectsStore = defineStore('projects', () => { hasUnlimitedProjects, canCreateProjects, hasPermissionToCreateProjects, - isTeamProjectsAvailable, + isTeamProjectFeatureEnabled, projectNavActiveId, setCurrentProject, getAllProjects,