Skip to content

Commit

Permalink
fix(editor): Rename store getter
Browse files Browse the repository at this point in the history
  • Loading branch information
cstuncsik committed Aug 1, 2024
1 parent c4315ba commit 8cf28c1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/editor-ui/src/components/CredentialCard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/components/CredentialCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ onMounted(async () => {
<hr
v-if="
displayProjects.length ||
(projectsStore.hasPermissionToCreateProjects && projectsStore.isTeamProjectsAvailable)
(projectsStore.hasPermissionToCreateProjects && projectsStore.isTeamProjectFeatureEnabled)
"
class="mt-m mb-m"
/>
Expand All @@ -137,7 +137,9 @@ onMounted(async () => {
</ElMenu>
<N8nTooltip placement="right" :disabled="projectsStore.canCreateProjects">
<ElMenu
v-if="projectsStore.hasPermissionToCreateProjects && projectsStore.isTeamProjectsAvailable"
v-if="
projectsStore.hasPermissionToCreateProjects && projectsStore.isTeamProjectFeatureEnabled
"
:collapse="props.collapsed"
class="pl-xs pr-xs"
>
Expand Down Expand Up @@ -171,7 +173,7 @@ onMounted(async () => {
<hr
v-if="
displayProjects.length ||
(projectsStore.hasPermissionToCreateProjects && projectsStore.isTeamProjectsAvailable)
(projectsStore.hasPermissionToCreateProjects && projectsStore.isTeamProjectFeatureEnabled)
"
class="mt-m mb-m"
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/components/WorkflowCard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/src/components/WorkflowCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions packages/editor-ui/src/stores/projects.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<boolean>(
const isTeamProjectFeatureEnabled = computed<boolean>(
() => settingsStore.settings.enterprise.projects.team.limit !== 0,
);
const hasUnlimitedProjects = computed<boolean>(
Expand All @@ -61,7 +61,7 @@ export const useProjectsStore = defineStore('projects', () => {
const canCreateProjects = computed<boolean>(
() =>
hasUnlimitedProjects.value ||
(isTeamProjectsAvailable.value && !isTeamProjectLimitExceeded.value),
(isTeamProjectFeatureEnabled.value && !isTeamProjectLimitExceeded.value),
);
const hasPermissionToCreateProjects = computed(() =>
hasPermission(['rbac'], { rbac: { scope: 'project:create' } }),
Expand Down Expand Up @@ -199,7 +199,7 @@ export const useProjectsStore = defineStore('projects', () => {
hasUnlimitedProjects,
canCreateProjects,
hasPermissionToCreateProjects,
isTeamProjectsAvailable,
isTeamProjectFeatureEnabled,
projectNavActiveId,
setCurrentProject,
getAllProjects,
Expand Down

0 comments on commit 8cf28c1

Please sign in to comment.