UI - first RC feedback (#4278)

* add hasSentinel to the version service
* use hasSentinel instead of features directly
* type='button' strikes again
* pass url param in tab links to ensure hrefs are updated
* 404 when the item_type is invalid for the identity route
This commit is contained in:
Matthew Irish 2018-04-05 16:08:18 -05:00 committed by GitHub
parent 3dd3247006
commit 3a734d7cb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 19 additions and 8 deletions

View File

@ -0,0 +1,5 @@
import Trigger from 'ember-basic-dropdown/components/basic-dropdown/trigger';
export default Trigger.extend({
attributeBindings: ['type'],
});

View File

@ -1,4 +1,5 @@
import Ember from 'ember'; import Ember from 'ember';
import DS from 'ember-data';
const MODEL_FROM_PARAM = { const MODEL_FROM_PARAM = {
entities: 'entity', entities: 'entity',
@ -8,8 +9,11 @@ const MODEL_FROM_PARAM = {
export default Ember.Route.extend({ export default Ember.Route.extend({
model(params) { model(params) {
let model = MODEL_FROM_PARAM[params.item_type]; let model = MODEL_FROM_PARAM[params.item_type];
if (!model) {
//TODO 404 behavior; const error = new DS.AdapterError();
Ember.set(error, 'httpStatus', 404);
throw error;
}
return model; return model;
}, },
}); });

View File

@ -8,7 +8,7 @@ export default Ember.Route.extend(UnloadModelRoute, UnsavedModelRoute, {
model() { model() {
let policyType = this.policyType(); let policyType = this.policyType();
if (!this.get('version.features').includes('Sentinel') && policyType !== 'acl') { if (!this.get('version.hasSentinel') && policyType !== 'acl') {
return this.transitionTo('vault.cluster.policies', policyType); return this.transitionTo('vault.cluster.policies', policyType);
} }
return this.store.createRecord(`policy/${policyType}`, {}); return this.store.createRecord(`policy/${policyType}`, {});

View File

@ -15,7 +15,7 @@ export default Ember.Route.extend(ClusterRoute, {
}, },
shouldReturnEmptyModel(policyType, version) { shouldReturnEmptyModel(policyType, version) {
return policyType !== 'acl' && (version.get('isOSS') || !version.get('features').includes('Sentinel')); return policyType !== 'acl' && (version.get('isOSS') || !version.get('hasSentinel'));
}, },
model(params) { model(params) {

View File

@ -16,7 +16,7 @@ export default Ember.Route.extend(ClusterRoute, {
if (!ALLOWED_TYPES.includes(policyType)) { if (!ALLOWED_TYPES.includes(policyType)) {
return this.transitionTo('vault.cluster.policies', ALLOWED_TYPES[0]); return this.transitionTo('vault.cluster.policies', ALLOWED_TYPES[0]);
} }
if (!this.get('version.features').includes('Sentinel') && policyType !== 'acl') { if (!this.get('version.hasSentinel') && policyType !== 'acl') {
return this.transitionTo('vault.cluster.policies', policyType); return this.transitionTo('vault.cluster.policies', policyType);
} }
return {}; return {};

View File

@ -22,6 +22,8 @@ export default Service.extend({
hasDRReplication: hasFeature('DR Replication'), hasDRReplication: hasFeature('DR Replication'),
hasSentinel: hasFeature('Sentinel'),
isEnterprise: computed.match('version', /\+\w+$/), isEnterprise: computed.match('version', /\+\w+$/),
isOSS: computed.not('isEnterprise'), isOSS: computed.not('isEnterprise'),

View File

@ -23,12 +23,12 @@
<nav class="tabs sub-nav"> <nav class="tabs sub-nav">
<ul> <ul>
{{#link-to "vault.cluster.access.identity.index" tagName="li"}} {{#link-to "vault.cluster.access.identity.index" tagName="li"}}
<a href={{href-to "vault.cluster.access.identity.index"}}> <a href={{href-to "vault.cluster.access.identity.index" (pluralize identityType)}}>
{{capitalize (pluralize identityType)}} {{capitalize (pluralize identityType)}}
</a> </a>
{{/link-to}} {{/link-to}}
{{#link-to "vault.cluster.access.identity.aliases.index" tagName="li"}} {{#link-to "vault.cluster.access.identity.aliases.index" tagName="li"}}
<a href={{href-to "vault.cluster.access.identity.aliases.index"}}> <a href={{href-to "vault.cluster.access.identity.aliases.index" (pluralize identityType)}}>
Aliases Aliases
</a> </a>
{{/link-to}} {{/link-to}}

View File

@ -1,5 +1,5 @@
{{#tool-tip renderInPlace=true as |d|}} {{#tool-tip renderInPlace=true as |d|}}
{{#d.trigger tagName="button" class=(concat "tool-tip-trigger button") data-test-tool-tip-trigger=true}} {{#d.trigger tagName="button" type="button" class=(concat "tool-tip-trigger button") data-test-tool-tip-trigger=true}}
{{i-con {{i-con
glyph="information-reversed" glyph="information-reversed"
class="auto-width" class="auto-width"