diff --git a/ui/app/components/license-info.js b/ui/app/components/license-info.js index c131a631d204..b48d1b7876e2 100644 --- a/ui/app/components/license-info.js +++ b/ui/app/components/license-info.js @@ -7,18 +7,25 @@ export default Component.extend({ startTime: '', licenseId: '', features: null, + model: null, text: '', showForm: false, isTemporary: computed('licenseId', function() { return this.licenseId === 'temporary'; }), - featuresInfo: computed('features', function() { - let info = []; - allFeatures().forEach(feature => { - let active = this.features.includes(feature) ? true : false; - info.push({ name: feature, active: active }); + featuresInfo: computed('model', 'features', function() { + return allFeatures().map(feature => { + let active = this.features.includes(feature); + if (active && feature === 'Performance Standby') { + let count = this.model.performanceStandbyCount; + return { + name: feature, + active: count ? active : false, + count, + }; + } + return { name: feature, active }; }); - return info; }), saveModel() {}, actions: { diff --git a/ui/app/models/license.js b/ui/app/models/license.js index 4026b1e00963..369678ab0677 100644 --- a/ui/app/models/license.js +++ b/ui/app/models/license.js @@ -26,4 +26,5 @@ export default DS.Model.extend({ licenseId: attr('string'), startTime: attr('string'), text: attr('string'), + performanceStandbyCount: attr('number'), }); diff --git a/ui/app/templates/components/license-info.hbs b/ui/app/templates/components/license-info.hbs index 6c9350ee95e0..b8177199d16f 100644 --- a/ui/app/templates/components/license-info.hbs +++ b/ui/app/templates/components/license-info.hbs @@ -71,7 +71,8 @@ {{#each featuresInfo as |info|}} {{#info-table-row label=info.name value=(if info.active "Active" "Not Active") data-test-feature-row="data-test-feature-row"}} {{#if info.active}} - Active + Active {{#if info.count}}— + {{info.count}} standby nodes allotted{{/if}} {{else}} Not Active {{/if}} diff --git a/ui/tests/integration/components/license-test.js b/ui/tests/integration/components/license-info-test.js similarity index 78% rename from ui/tests/integration/components/license-test.js rename to ui/tests/integration/components/license-info-test.js index 2cac4ac9dab3..f7a934dfbe52 100644 --- a/ui/tests/integration/components/license-test.js +++ b/ui/tests/integration/components/license-info-test.js @@ -15,14 +15,6 @@ const component = create(license); module('Integration | Component | license info', function(hooks) { setupRenderingTest(hooks); - hooks.beforeEach(function() { - component.setContext(this); - }); - - hooks.afterEach(function() { - component.removeContext(); - }); - const LICENSE_WARNING_TEXT = `Warning Your temporary license expires in 30 minutes and your vault will seal. Please enter a valid license below.`; test('it renders properly for temporary license', async function(assert) { @@ -114,4 +106,36 @@ module('Integration | Component | license info', function(hooks) { await component.saveButton(); assert.ok(this.get('saveModel').calledOnce); }); + + test('it renders Performance Standby as inactive if count is 0', async function(assert) { + const now = Date.now(); + this.set('licenseId', 'temporary'); + this.set('expirationTime', addMinutes(now, 30)); + this.set('startTime', now); + this.set('model', { performanceStandbyCount: 0 }); + this.set('features', ['Performance Standby', 'Namespaces']); + + await render( + hbs`` + ); + + let row = component.featureRows.filterBy('featureName', 'Performance Standby')[0]; + assert.equal(row.featureStatus, 'Not Active', 'renders feature as inactive because when count is 0'); + }); + + test('it renders Performance Standby as active and shows count', async function(assert) { + const now = Date.now(); + this.set('licenseId', 'temporary'); + this.set('expirationTime', addMinutes(now, 30)); + this.set('startTime', now); + this.set('model', { performanceStandbyCount: 4 }); + this.set('features', ['Performance Standby', 'Namespaces']); + + await render( + hbs`` + ); + + let row = component.featureRows.filterBy('featureName', 'Performance Standby')[0]; + assert.equal(row.featureStatus, 'Active — 4 standby nodes allotted', 'renders active and displays count'); + }); });