Skip to content

Commit

Permalink
Merge pull request #4341 from FlowFuse/blueprint-ce
Browse files Browse the repository at this point in the history
Show feature not available on CE Blueprint page
  • Loading branch information
cstns authored Aug 7, 2024
2 parents cce4376 + 165939d commit ef94197
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 29 deletions.
10 changes: 10 additions & 0 deletions frontend/src/mixins/Features.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
10 changes: 6 additions & 4 deletions frontend/src/pages/team/Library/Blueprints.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</div>
</li>
</ul>
<EmptyState v-else>
<EmptyState v-else :featureUnavailable="!isBlueprintsFeatureEnabled" :featureUnavailableToTeam="!isBlueprintsFeatureEnabledForTeam">
<template #img>
<img src="../../../images/empty-states/team-library.png" alt="team-logo">
</template>
Expand Down Expand Up @@ -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) {
Expand Down
26 changes: 1 addition & 25 deletions test/e2e/frontend/cypress/tests/team/library.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit ef94197

Please sign in to comment.