diff --git a/frontend/src/mixins/Features.js b/frontend/src/mixins/Features.js index 9060e332ef..c091109926 100644 --- a/frontend/src/mixins/Features.js +++ b/frontend/src/mixins/Features.js @@ -12,6 +12,16 @@ export default { }, isSharedLibraryFeatureEnabled () { return this.isSharedLibraryFeatureEnabledForTeam && this.isSharedLibraryFeatureEnabledForPlatform + }, + isBlueprintsFeatureEnabledForTeam () { + const flag = this.team.type.properties.features?.flowBlueprints + return flag === undefined || flag + }, + isBlueprintsFeatureEnabledForPlatform () { + return this.features.flowBlueprints + }, + isBlueprintsFeatureEnabled () { + return this.isBlueprintsFeatureEnabledForTeam && this.isBlueprintsFeatureEnabledForPlatform } } } diff --git a/frontend/src/pages/team/Library/Blueprints.vue b/frontend/src/pages/team/Library/Blueprints.vue index 2a5d3fc183..c905a5a3b7 100644 --- a/frontend/src/pages/team/Library/Blueprints.vue +++ b/frontend/src/pages/team/Library/Blueprints.vue @@ -14,7 +14,7 @@ - + @@ -81,9 +81,11 @@ export default { }, methods: { async loadBlueprints () { - const res = await flowBlueprintsApi.getFlowBlueprintsForTeam(this.team.id) - if (Object.hasOwnProperty.call(res, 'blueprints')) { - this.blueprints = res.blueprints + if (this.isBlueprintsFeatureEnabled && this.isBlueprintsFeatureEnabledForTeam) { + const res = await flowBlueprintsApi.getFlowBlueprintsForTeam(this.team.id) + if (Object.hasOwnProperty.call(res, 'blueprints')) { + this.blueprints = res.blueprints + } } }, onBlueprintSelect (blueprint) { diff --git a/test/e2e/frontend/cypress/tests/team/library.spec.js b/test/e2e/frontend/cypress/tests/team/library.spec.js index 59cd93d704..e945dbf44d 100644 --- a/test/e2e/frontend/cypress/tests/team/library.spec.js +++ b/test/e2e/frontend/cypress/tests/team/library.spec.js @@ -22,31 +22,7 @@ describe('FlowForge - Library', () => { cy.get('[data-el="page-name"]').contains('Library') cy.get('[data-el="ff-tab"]').contains('Blueprints').click() - cy.get('[data-el="category"]') - .contains('Category A') - .parent() - .within(() => { - cy.get('[data-el="tiles-wrapper"]') - .children() - .should('have.length', 1) - - cy.contains('Blueprint 1') - cy.contains('This is a blueprint') - }) - - cy.get('[data-el="category"]') - .contains('Category B') - .parent() - .within(() => { - cy.get('[data-el="tiles-wrapper"]') - .children() - .should('have.length', 2) - - cy.contains('Blueprint 2') - cy.contains('Blueprint 3') - cy.contains('This is another blueprint') - cy.contains('This is yet another blueprint') - }) + cy.contains('This is a FlowFuse Enterprise feature. Please upgrade your instance of FlowFuse in order to use it.') }) }) describe('Team Library', () => {