Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enterprise version detection fix #4547

Merged
merged 5 commits into from
May 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ui/app/routes/vault/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const POLL_INTERVAL_MS = 10000;
const { inject } = Ember;

export default Ember.Route.extend(ModelBoundaryRoute, ClusterRoute, {
version: inject.service(),
store: inject.service(),
auth: inject.service(),
currentCluster: Ember.inject.service(),
Expand All @@ -21,15 +22,17 @@ export default Ember.Route.extend(ModelBoundaryRoute, ClusterRoute, {
const params = this.paramsFor(this.routeName);
const id = this.getClusterId(params);
if (id) {
return this.get('auth').setCluster(id);
this.get('auth').setCluster(id);
return this.get('version').fetchFeatures();
} else {
return Ember.RSVP.reject({ httpStatus: 404, message: 'not found', path: params.cluster_name });
}
},

model(params) {
const id = this.getClusterId(params);
return this.get('store').findRecord('cluster', id);

return this.get('store').findRecord('cluster', id);
},

stopPoll: Ember.on('deactivate', function() {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/services/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default Service.extend({

hasSentinel: hasFeature('Sentinel'),

isEnterprise: computed.match('version', /\+\w+$/),
isEnterprise: computed.match('version', /\+.+$/),

isOSS: computed.not('isEnterprise'),

Expand Down
7 changes: 7 additions & 0 deletions ui/app/styles/components/status-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,16 @@
width: 100%;
text-align: left;

.icon {
color: $menu-item-hover-background-color;
}
&:hover {
background-color: $menu-item-hover-background-color;
color: $menu-item-hover-color;
.icon {
color: $menu-item-hover-color;
}

}

&.is-active {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
<div class="level-left is-flex-1">
<div>
{{#if (or replicationUnsupported (and (eq mode 'performance') (not version.hasPerfReplication)))}}
<p>
Upgrade to Vault Enterprise Premium to use Performance Replication.
</p>
{{else if replicationEnabled}}
<span>
{{capitalize modeForUrl}}
</span>
{{#if secondaryId}}
<div class="level is-mobile">
<div class="level-left is-flex-1">
<div>
{{#if (or replicationUnsupported (and (eq mode 'performance') (not version.hasPerfReplication)))}}
<p>
Upgrade to Vault Enterprise Premium to use Performance Replication.
</p>
{{else if replicationEnabled}}
<span>
{{capitalize modeForUrl}}
</span>
{{#if secondaryId}}
<span class="tag is-light">
<code>
{{secondaryId}}
</code>
</span>
{{/if}}
<span class="tag is-light">
<code>
{{secondaryId}}
{{clusterIdDisplay}}
</code>
</span>
{{else}}
Enable
{{/if}}
<span class="tag is-light">
<code>
{{clusterIdDisplay}}
</code>
</span>
{{else}}
Enable
{{/if}}
</div>
</div>
</div>
<div class="level-right">
{{#if replicationEnabled}}
{{#if (get cluster (concat mode 'StateGlyph'))}}
{{i-con size=14 glyph=(get cluster (concat mode 'StateGlyph')) class="has-text-info" aria-label=(concat mode 'StateDisplay')}}
{{else if syncProgress}}
<progress value="{{syncProgressPercent}}" max="100" class="progress is-small is-narrow is-info">
{{syncProgress.progress}} of {{syncProgress.total}} keys
</progress>
<div class="level-right">
{{#if replicationEnabled}}
{{#if (get cluster (concat mode 'StateGlyph'))}}
{{i-con size=14 glyph=(get cluster (concat mode 'StateGlyph'))}}
{{else if syncProgress}}
<progress value="{{syncProgressPercent}}" max="100" class="progress is-small is-narrow is-info">
{{syncProgress.progress}} of {{syncProgress.total}} keys
</progress>
{{/if}}
{{/if}}
{{/if}}
</div>
</div>
7 changes: 7 additions & 0 deletions ui/tests/unit/services/version-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ test('setting version computes isEnterprise properly', function(assert) {
assert.equal(service.get('isEnterprise'), true);
});

test('setting version with hsm ending computes isEnterprise properly', function(assert) {
let service = this.subject();
service.set('version', '0.9.5+prem.hsm');
assert.equal(service.get('isOSS'), false);
assert.equal(service.get('isEnterprise'), true);
});

test('hasPerfReplication', function(assert) {
let service = this.subject();
assert.equal(service.get('hasPerfReplication'), false);
Expand Down