UI: Remove upgrade modal (#6871)

* Remove upgrade-link component
* Hide enterprrise links from OSS
* Don't show sidebar if they can't use the options
This commit is contained in:
Joshua Ogle 2019-06-14 15:46:18 -06:00 committed by GitHub
parent 51f3d3137f
commit f58b79db7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 162 additions and 508 deletions

View File

@ -1,18 +0,0 @@
import { computed } from '@ember/object';
import Component from '@ember/component';
export default Component.extend({
tagName: 'span',
classNames: 'tag is-outlined edition-badge',
attributeBindings: ['edition:aria-label'],
icon: computed('edition', function() {
const edition = this.get('edition');
const entEditions = ['Enterprise', 'Premium', 'Pro'];
if (entEditions.includes(edition)) {
return 'edition-enterprise';
} else {
return 'edition-oss';
}
}),
});

View File

@ -2,7 +2,7 @@
align-items: center;
color: $grey;
display: flex;
background: $ui-gray-050;
background: $ui-gray-010;
justify-content: center;
padding: $spacing-xxl $spacing-s;
box-shadow: 0 -2px 0 -1px $ui-gray-300;

View File

@ -1,63 +0,0 @@
.upgrade-overlay {
font-size: 1rem;
opacity: 0;
text-align: left;
transition: opacity $speed-slow;
will-change: opacity;
z-index: 300;
&.is-animated {
opacity: 1;
}
.modal-background {
background-image: url('/ui/vault-hex.svg'), linear-gradient(90deg, #191a1c, #1b212d);
opacity: 0.97;
}
.modal-content {
overflow: auto;
overflow-x: hidden;
transform: translateY(20%) scale(0.9);
transition: transform $speed-slow;
will-change: transform;
}
&.is-animated {
.modal-content {
transform: translateY(0) scale(1);
}
}
.upgrade-overlay-title {
border-bottom: 1px solid $grey;
padding-bottom: $size-10;
.icon {
width: 32px;
#edition-enterprise-hexagon {
fill: $white;
}
}
}
.columns {
margin-bottom: $size-4;
margin-top: $size-4;
}
.column {
display: flex;
.box {
border-radius: $radius;
box-shadow: inset 0 0 0 1px $grey;
width: 100%;
}
}
li {
list-style: inside disc;
}
}

View File

@ -81,7 +81,6 @@
@import './components/toolbar';
@import './components/tool-tip';
@import './components/unseal-warning';
@import './components/upgrade-overlay';
@import './components/ui-wizard';
@import './components/vault-loading';

View File

@ -1,4 +0,0 @@
{{#if icon}}
<Icon @glyph={{icon}} />
{{/if}}
{{edition}}

View File

@ -1,76 +1,67 @@
<div class="popup-menu-content">
<div class="box">
{{#if (and activeCluster.unsealed auth.currentToken)}}
{{#if (has-permission 'status' routeParams='replication')}}
<nav class="menu">
<p class="menu-label">Replication</p>
<ul>
{{#if cluster.anyReplicationEnabled}}
<li>
{{#link-to
"vault.cluster.replication.mode.index"
"dr"
disabled=(not currentToken)
invokeAction=(action onLinkClick)
}}
{{replication-mode-summary
mode="dr"
display='menu'
cluster=cluster
}}
{{/link-to}}
</li>
<li>
{{#if (has-feature "Performance Replication")}}
{{#unless version.isOSS}}
{{#if (and activeCluster.unsealed auth.currentToken)}}
{{#if (has-permission 'status' routeParams='replication')}}
<nav class="menu">
<p class="menu-label">Replication</p>
<ul>
{{#if cluster.anyReplicationEnabled}}
<li>
{{#link-to
"vault.cluster.replication.mode.index"
"performance"
"dr"
disabled=(not currentToken)
invokeAction=(action onLinkClick)
}}
{{replication-mode-summary
mode="dr"
display='menu'
cluster=cluster
}}
{{/link-to}}
</li>
<li>
{{#if (has-feature "Performance Replication")}}
{{#link-to
"vault.cluster.replication.mode.index"
"performance"
disabled=(not currentToken)
invokeAction=(action onLinkClick)
}}
{{replication-mode-summary
mode="performance"
display="menu"
cluster=cluster
tagName="span"
}}
{{/link-to}}
{{else}}
{{replication-mode-summary
mode="performance"
display="menu"
cluster=cluster
tagName="span"
class="menu-item"
}}
{{/link-to}}
{{else}}
{{replication-mode-summary
mode="performance"
display="menu"
cluster=cluster
class="menu-item"
{{/if}}
</li>
{{else}}
<li>
{{#link-to "vault.cluster.replication"
invokeAction=(action onLinkClick)
}}
{{/if}}
</li>
{{else if version.isOSS}}
<li>
{{#link-to "vault.cluster.replication"}}
<div class="level is-mobile">
<span class="level-left">Learn more</span>
<Icon @glyph="edition-enterprise" @class="level-right" />
</div>
{{/link-to}}
</li>
{{else}}
<li>
{{#link-to "vault.cluster.replication"
invokeAction=(action onLinkClick)
}}
<div class="level is-mobile">
<span class="level-left">Enable</span>
<Icon @glyph="minus-circle-outline" @class="has-text-grey-light level-right" />
</div>
{{/link-to}}
</li>
{{/if}}
</ul>
</nav>
<hr/>
<div class="level is-mobile">
<span class="level-left">Enable</span>
<Icon @glyph="plus-circle-outline" @class="has-text-grey-light level-right" />
</div>
{{/link-to}}
</li>
{{/if}}
</ul>
</nav>
<hr/>
{{/if}}
{{/if}}
{{/if}}
{{#unless version.isOSS}}
{{#if (has-permission 'status' routeParams='license')}}
<nav class="menu">
<div class="menu-label">

View File

@ -14,9 +14,12 @@
</span>
{{#if (is-version "OSS")}}
<span>
{{#upgrade-link linkClass="has-text-grey"}}
<a
href="https://hashicorp.com/products/vault/trial?source=vaultui"
class="link has-text-grey"
>
Upgrade to Vault Enterprise
{{/upgrade-link}}
</a>
</span>
{{/if}}
<span>

View File

@ -28,29 +28,17 @@
{{/link-to}}
</li>
{{/if}}
{{#if (has-permission "access" routeParams="namespaces")}}
{{#if (and (has-feature "Namespaces") (has-permission "access" routeParams="namespaces"))}}
<li>
{{#link-to "vault.cluster.access.namespaces" data-test-link=true }}
Namespaces
{{#unless (has-feature "Namespaces")}}
{{#if (is-version "OSS")}}
{{edition-badge edition="Enterprise"}}
{{/if}}
{{/unless}}
{{/link-to}}
</li>
{{/if}}
{{#if (has-permission "access" routeParams="control-groups")}}
{{#if (and (has-feature "Control Groups") (has-permission "access" routeParams="control-groups"))}}
<li>
{{#link-to "vault.cluster.access.control-groups" data-test-link=true current-when="vault.cluster.access.control-groups vault.cluster.access.control-group-accessor vault.cluster.access.control-groups-configure"}}
Control Groups
{{#unless (has-feature "Control Groups")}}
{{#if (is-version "OSS")}}
{{edition-badge edition="Enterprise"}}
{{else}}
{{edition-badge edition="Premium"}}
{{/if}}
{{/unless}}
{{/link-to}}
</li>
{{/if}}

View File

@ -1,44 +1,32 @@
<div class="columns">
{{#menu-sidebar title="Policies" class="is-3" data-test-sidebar=true}}
{{#if (has-permission "policies" routeParams="acl")}}
<li>
{{#link-to "vault.cluster.policies" "acl" data-test-link=true class=(if (is-active-route "vault.cluster.policies" "acl") "is-active")}}
ACL Policies
{{/link-to}}
</li>
{{/if}}
{{#if (has-permission "policies" routeParams="rgp")}}
<li>
{{#link-to "vault.cluster.policies" "rgp" data-test-link=true class=(if (is-active-route "vault.cluster.policies" "rgp") "is-active")}}
Role Governing Policies
{{#unless (has-feature "Sentinel")}}
{{#if (is-version "OSS")}}
{{edition-badge edition="Enterprise"}}
{{else}}
{{edition-badge edition="Premium"}}
{{/if}}
{{/unless}}
{{/link-to}}
</li>
{{/if}}
{{#if (has-permission "policies" routeParams="egp")}}
<li>
{{#link-to "vault.cluster.policies" "egp" data-test-link=true class=(if (is-active-route "vault.cluster.policies" "egp") "is-active")}}
Endpoint Governing Policies
{{#unless (has-feature "Sentinel")}}
{{#if (is-version "OSS")}}
{{edition-badge edition="Enterprise"}}
{{else}}
{{edition-badge edition="Premium"}}
{{/if}}
{{/unless}}
{{/link-to}}
</li>
{{/if}}
{{/menu-sidebar}}
<div class="column is-9">
{{outlet}}
{{#if (and (has-feature "Sentinel") (or (has-permission "policies" routeParams="rgp") (has-permission "policies" routeParams="egp")))}}
<div class="columns">
{{#menu-sidebar title="Policies" class="is-3" data-test-sidebar=true}}
{{#if (has-permission "policies" routeParams="acl")}}
<li>
{{#link-to "vault.cluster.policies" "acl" data-test-link=true class=(if (is-active-route "vault.cluster.policies" "acl") "is-active")}}
ACL Policies
{{/link-to}}
</li>
{{/if}}
{{#if (has-permission "policies" routeParams="rgp")}}
<li>
{{#link-to "vault.cluster.policies" "rgp" data-test-link=true class=(if (is-active-route "vault.cluster.policies" "rgp") "is-active")}}
Role Governing Policies
{{/link-to}}
</li>
{{/if}}
{{#if (has-permission "policies" routeParams="egp")}}
<li>
{{#link-to "vault.cluster.policies" "egp" data-test-link=true class=(if (is-active-route "vault.cluster.policies" "egp") "is-active")}}
Endpoint Governing Policies
{{/link-to}}
</li>
{{/if}}
{{/menu-sidebar}}
<div class="column is-9">
{{outlet}}
</div>
</div>
</div>
{{else}}
{{outlet}}
{{/if}}

View File

@ -156,9 +156,11 @@
>
{{#link-to "vault.cluster.policies.create" class="link"}}
Create {{uppercase policyType}} policy
<Chevron />
{{/link-to}}
<LearnLink @path="/vault/getting-started/policies">
Learn more
<Chevron />
</LearnLink>
</EmptyState>
{{/if}}

View File

@ -7,33 +7,21 @@
{{/link-to}}
</li>
{{/if}}
{{#if (has-permission "policies" routeParams="rgp")}}
<li>
{{#link-to "vault.cluster.policies" "rgp" data-test-link=true class=(if (is-active-route "vault.cluster.policy" "rgp") "is-active")}}
Role Governing Policies
{{#unless (has-feature "Sentinel")}}
{{#if (is-version "OSS")}}
{{edition-badge edition="Enterprise"}}
{{else}}
{{edition-badge edition="Premium"}}
{{/if}}
{{/unless}}
{{/link-to}}
</li>
{{/if}}
{{#if (has-permission "policies" routeParams="egp")}}
<li>
{{#link-to "vault.cluster.policies" "egp" data-test-link=true class=(if (is-active-route "vault.cluster.policy" "egp") "is-active")}}
Endpoint Governing Policies
{{#unless (has-feature "Sentinel")}}
{{#if (is-version "OSS")}}
{{edition-badge edition="Enterprise"}}
{{else}}
{{edition-badge edition="Premium"}}
{{/if}}
{{/unless}}
{{/link-to}}
</li>
{{#if (has-feature "Sentinel")}}
{{#if (has-permission "policies" routeParams="rgp")}}
<li>
{{#link-to "vault.cluster.policies" "rgp" data-test-link=true class=(if (is-active-route "vault.cluster.policy" "rgp") "is-active")}}
Role Governing Policies
{{/link-to}}
</li>
{{/if}}
{{#if (has-permission "policies" routeParams="egp")}}
<li>
{{#link-to "vault.cluster.policies" "egp" data-test-link=true class=(if (is-active-route "vault.cluster.policy" "egp") "is-active")}}
Endpoint Governing Policies
{{/link-to}}
</li>
{{/if}}
{{/if}}
{{/menu-sidebar}}
<div class="column is-9">

View File

@ -1,44 +0,0 @@
import { later } from '@ember/runloop';
import Component from '@ember/component';
import { computed } from '@ember/object';
import layout from '../templates/components/upgrade-link';
export default Component.extend({
layout,
modalContainer: computed('isActive', function() {
return document.getElementById('modal-wormhole');
}),
isAnimated: false,
isActive: false,
tagName: 'span',
trackingSource: computed('pageName', function() {
let trackingSource = 'vaultui';
let pageName = this.get('pageName');
if (pageName) {
trackingSource = trackingSource + '_' + encodeURIComponent(pageName);
}
return trackingSource;
}),
actions: {
openOverlay() {
this.set('isActive', true);
later(
this,
function() {
this.set('isAnimated', true);
},
10
);
},
closeOverlay() {
this.set('isAnimated', false);
later(
this,
function() {
this.set('isActive', false);
},
300
);
},
},
});

View File

@ -7,7 +7,7 @@ export default Component.extend({
title: 'Vault Enterprise',
featureName: computed('title', function() {
let title = this.get('title');
return title === 'Vault Enterprise' ? 'This' : title;
return title === 'Vault Enterprise' ? 'this feature' : title;
}),
minimumEdition: 'Vault Enterprise',
});

View File

@ -1,6 +1,6 @@
<div class="empty-state" ...attributes>
<div class="empty-state-content">
<h3 class="empty-state-title">
<h3 class="empty-state-title" data-test-empty-state-title>
{{title}}
</h3>
{{#if message}}

View File

@ -58,10 +58,14 @@
Performance Replication is a feature of Vault Enterprise Premium.
</p>
<p class="has-text-centered">
{{#upgrade-link linkClass="button is-ghost has-icon-right" pageName="Performance Replication"}}
<a
href="https://hashicorp.com/products/vault/trial?source=vaultui_Performance%20Replication"
class="button is-ghost has-icon-right"
data-test-upgrade-link="true"
>
Learn more
<Icon @glyph="chevron-right" />
{{/upgrade-link}}
<Chevron />
</a>
</p>
{{else if replicationEnabled}}
<h5 class="title is-7 is-uppercase is-marginless">

View File

@ -1,79 +0,0 @@
<button class="link {{linkClass}}" {{action "openOverlay"}}>
{{yield}}
</button>
{{#maybe-in-element modalContainer false}}
<div id="upgrade-modal" class="modal upgrade-overlay has-text-white {{if isActive "is-active"}} {{if isAnimated "is-animated"}}">
<div class="modal-background"></div>
<div class="modal-content">
<h2 class="title upgrade-overlay-title is-2 has-text-white">
<Icon @glyph="edition-enterprise" aria-hidden="true" @size="xl" />
Try Vault Enterprise free for 30 days
</h2>
<h3 class="title is-5 has-text-white">
Collaborate on secrets management and access
</h3>
<p>
Vault Enterprise has features to help unify disparate users and roles,
use collaboration workflows, and disaster recovery for system recovery,
provide governance over secrets management and access with multi-factor
authentication. You'll have access to all the features below.
</p>
<div class="columns">
<div class="column is-flex">
<div class="box has-background-transparent has-text-white ">
<div class="level">
<div class="level-left">
<h3 class="title is-4 has-text-white">
Pro
{{#unless (is-version "OSS")}}
{{#unless version.hasPerfReplication}}
{{edition-badge edition="Current"}}
{{/unless}}
{{/unless}}
</h3>
</div>
</div>
<ul class="upgrade-features-list">
<li>All Open Source features</li>
<li>Disaster Recovery Replication</li>
<li>Cluster management</li>
<li>Init and unseal workflow</li>
<li>GCP Cloud KMS Auto-unseal</li>
<li>Silver support: 9x5 support w/SLA</li>
</ul>
</div>
</div>
<div class="column is-flex">
<div class="box has-background-transparent has-text-white">
<div class="level">
<div class="level-left">
<h3 class="title is-4 has-text-white">
Premium
</h3>
</div>
</div>
<ul class="upgrade-features-list">
<li>All Pro features</li>
<li>Performance Replication</li>
<li>HSM Autounseal</li>
<li>Mount Filters</li>
<li>Multi-Factor Authentication</li>
<li>Sentinel Integration</li>
<li>Control Groups</li>
<li>Seal Wrap / FIPS 140-2 Compliance</li>
<li>Gold support: 24&times;7 support w/SLA</li>
</ul>
</div>
</div>
</div>
<p class="has-text-centered">
<a href="https://hashicorp.com/products/vault/trial?source={{trackingSource}}" class="button is-primary" target="_blank" rel="noreferrer noopener">
Start trial
<Chevron @isButton={{true}} />
</a>
</p>
</div>
<button class="modal-close is-large" aria-label="close" {{action "closeOverlay"}}></button>
</div>
{{/maybe-in-element}}

View File

@ -6,17 +6,18 @@
</p.levelLeft>
</PageHeader>
<div class="box is-sideless is-bottomless has-text-centered has-background-white-bis">
<p class="has-text-grey-dark">
<span data-test-upgrade-feature-description>
{{featureName}} is a {{minimumEdition}} feature.
</span>
You can upgrade to {{minimumEdition}} to unlock additional collaboration and security features
</p>
<p>
{{#upgrade-link linkClass="button is-ghost has-icon-right" data-test-upgrade-link="true" pageName=featureName}}
Vault Enterprise
<Chevron />
{{/upgrade-link}}
</p>
</div>
<EmptyState
@title="Upgrade to use {{featureName}}"
@message="You will need {{minimumEdition}} with {{featureName}} included to use this feature."
>
<a
href="https://www.hashicorp.com/products/vault/enterprise?source=vaultui_{{featureName}}"
class="link has-icon-right"
target="_blank"
rel="noopener"
data-test-upgrade-link="true"
>
Vault Enterprise
<Chevron />
</a>
</EmptyState>

View File

@ -1 +0,0 @@
export { default } from 'core/components/upgrade-link';

View File

@ -58,14 +58,14 @@
Performance Replication
</h3>
{{#if (not (has-feature "Performance Replication"))}}
<p class="help has-text-grey-dark">
Performance Replication is a feature of {{#upgrade-link pageName="Performance Replication"}}Vault Enterprise Premium{{/upgrade-link}}
</p>
{{else}}
<p class="help has-text-grey-dark">
Performance replication scales workloads horizontally across clusters to make requests faster. Local secondaries handle read requests but forward writes to the primary to be handled.
</p>
{{/if}}
<p class="help has-text-grey-dark">
Performance Replication is a feature of Vault Enterprise Premium
</p>
{{else}}
<p class="help has-text-grey-dark">
Performance replication scales workloads horizontally across clusters to make requests faster. Local secondaries handle read requests but forward writes to the primary to be handled.
</p>
{{/if}}
{{/if}}
{{else}}
<p class="has-text-grey-dark box is-shadowless is-fullwidth has-slim-padding">
@ -111,13 +111,10 @@
@glyph="perf-replication"
/>
Performance
{{#if (not (has-feature "Performance Replication"))}}
{{edition-badge edition="Premium"}}
{{/if}}
</h3>
{{#if (not (has-feature "Performance Replication"))}}
<p class="help has-text-grey-dark">
Performance Replication is a feature of {{#upgrade-link pageName="Performance Replication"}}Vault Enterprise Premium{{/upgrade-link}}
Performance Replication is a feature of Vault Enterprise Premium
</p>
{{else}}
<p class="help has-text-grey-dark">

View File

@ -1,17 +0,0 @@
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs>
<linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="c">
<stop stop-color="#FFF" stop-opacity=".25" offset="0%"/>
<stop stop-color="#FFF" stop-opacity=".5" offset="100%"/>
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<mask id="b" fill="#fff">
<path d="M14 9.079V4.625L8 1.25 2 4.625v6.75l6 3.375 6-3.375V9.079zm-.5.264l-1 .529V5.5L8 3 3.5 5.5v4.372l-1-.529V4.875L8.001 1.75 13.5 4.875v4.468zM8.192 12.15l-.191.1L4 10.126v-4.25L8.001 3.75 12 5.875v4.25l-3.808 2.024zM8 0l7 4v8l-7 4-7-4V4l7-4zm0 13l5.5-3.1v1.2L8 14.25 2.5 11.1V9.9L8 13z"/>
</mask>
<g mask="url(#b)">
<path d="M0 0h16v16H0z" id="edition-enterprise-hexagon" fill="#6a7786"/>
</g>
<path fill="url(#c)" opacity=".5" mask="url(#b)" d="M8 0l7 4v8l-7 4z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 895 B

View File

@ -1,17 +0,0 @@
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
<defs>
<path d="M8 0l7 4v8l-7 4-7-4V4l7-4zm0 1.25L2 4.625v6.75l6 3.375 6-3.375v-6.75L8 1.25zm.001.5L13.5 4.875v6.25L8.001 14.25 2.5 11.125v-6.25L8.001 1.75z" id="a"/>
<linearGradient x1="50%" y1="0%" x2="50%" y2="100%" id="c">
<stop stop-color="#FFF" stop-opacity=".25" offset="0%"/>
<stop stop-color="#FFF" stop-opacity=".5" offset="100%"/>
</linearGradient>
</defs>
<g fill="none" fill-rule="evenodd">
<mask id="b" fill="#fff">
<use href="#a"/>
</mask>
<use fill="#fff" href="#a"/>
<g mask="url(#b)" fill="#BAC1CC"><path d="M0 0h16v16H0z"/></g>
<path fill="url(#c)" opacity=".5" mask="url(#b)" d="M8 0l7 4v8l-7 4z"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 769 B

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="74px" height="128px" viewBox="0 0 74 128" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="vault-hex" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" opacity="0.0299999993">
<path d="M36,-1.96752179 L73.7513243,62 L-1.75132433,62 L36,-1.96752179 Z" id="Triangle" stroke="#FFFFFF" stroke-width="2"></path>
<rect id="Rectangle" fill="#FFFFFF" x="0" y="125" width="72" height="2"></rect>
<path d="M36,61.0324782 L73.7513243,125 L-1.75132433,125 L36,61.0324782 Z" id="Triangle" stroke="#FFFFFF" stroke-width="2" transform="translate(36.000000, 93.500000) scale(1, -1) translate(-36.000000, -93.500000) "></path>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 753 B

View File

@ -1,22 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | edition badge', function(hooks) {
setupRenderingTest(hooks);
test('it renders', async function(assert) {
await render(hbs`
{{edition-badge edition="Custom"}}
`);
assert.equal(find('.edition-badge').textContent.trim(), 'Custom', 'contains edition');
await render(hbs`
{{edition-badge edition="Enterprise"}}
`);
assert.equal(find('.edition-badge').textContent.trim(), 'Enterprise', 'renders edition');
});
});

View File

@ -1,48 +0,0 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find, findAll } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
module('Integration | Component | upgrade link', function(hooks) {
setupRenderingTest(hooks);
test('it renders with overlay', async function(assert) {
await render(hbs`
<div id="modal-wormhole"></div>
<div class="upgrade-link-container">
{{#upgrade-link data-test-link}}upgrade{{/upgrade-link}}
</div>
`);
assert.equal(
find('.upgrade-link-container button').textContent.trim(),
'upgrade',
'renders link content'
);
assert.equal(
find('#modal-wormhole .upgrade-overlay-title').textContent.trim(),
'Try Vault Enterprise free for 30 days',
'contains overlay content'
);
assert.equal(
findAll('#modal-wormhole a[href^="https://hashicorp.com/products/vault/trial?source=vaultui"]').length,
1,
'contains info link'
);
});
test('it adds custom classes', async function(assert) {
await render(hbs`
<div id="modal-wormhole"></div>
<div class="upgrade-link-container">
{{#upgrade-link linkClass="button upgrade-button"}}upgrade{{/upgrade-link}}
</div>
`);
assert.equal(
find('.upgrade-link-container button').getAttribute('class'),
'link button upgrade-button',
'adds classes to link'
);
});
});

View File

@ -12,30 +12,44 @@ module('Integration | Component | upgrade page', function(hooks) {
<div id="modal-wormhole"></div>
`);
assert.equal(find('.page-header .title').textContent.trim(), 'Vault Enterprise', 'renders default title');
assert.equal(
find('[data-test-upgrade-feature-description]').textContent.trim(),
'This is a Vault Enterprise feature.',
'renders default description'
find('.page-header .title').textContent.trim(),
'Vault Enterprise',
'renders default page title'
);
assert.equal(
find('[data-test-empty-state-title]').textContent.trim(),
'Upgrade to use this feature',
'renders default title'
);
assert.equal(
find('[data-test-empty-state-message]').textContent.trim(),
'You will need Vault Enterprise with this feature included to use this feature.',
'renders default message'
);
assert.equal(findAll('[data-test-upgrade-link]').length, 1, 'renders upgrade link');
});
test('it renders with custom attributes', async function(assert) {
await render(hbs`
{{upgrade-page title="Test Feature Title" featureName="Specific Feature Name" minimumEdition="Premium"}}
{{upgrade-page title="Test Feature Title" featureName="Specific Feature Name" minimumEdition="Vault Enterprise Premium"}}
<div id="modal-wormhole"></div>
`);
assert.equal(
find('.page-header .title').textContent.trim(),
'Test Feature Title',
'renders default title'
'renders custom page title'
);
assert.equal(
find('[data-test-upgrade-feature-description]').textContent.trim(),
'Specific Feature Name is a Premium feature.',
'renders default description'
find('[data-test-empty-state-title]').textContent.trim(),
'Upgrade to use Specific Feature Name',
'renders custom title'
);
assert.equal(
find('[data-test-empty-state-message]').textContent.trim(),
'You will need Vault Enterprise Premium with Specific Feature Name included to use this feature.',
'renders custom message'
);
});
});