From 3a734d7cb43d9627e17f76a59a29585d68de8725 Mon Sep 17 00:00:00 2001 From: Matthew Irish Date: Thu, 5 Apr 2018 16:08:18 -0500 Subject: [PATCH] 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 --- ui/app/components/basic-dropdown/trigger.js | 5 +++++ ui/app/routes/vault/cluster/access/identity.js | 8 ++++++-- ui/app/routes/vault/cluster/policies/create.js | 2 +- ui/app/routes/vault/cluster/policies/index.js | 2 +- ui/app/routes/vault/cluster/policy.js | 2 +- ui/app/services/version.js | 2 ++ ui/app/templates/components/identity/entity-nav.hbs | 4 ++-- ui/app/templates/components/info-tooltip.hbs | 2 +- 8 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 ui/app/components/basic-dropdown/trigger.js diff --git a/ui/app/components/basic-dropdown/trigger.js b/ui/app/components/basic-dropdown/trigger.js new file mode 100644 index 000000000..2d3272397 --- /dev/null +++ b/ui/app/components/basic-dropdown/trigger.js @@ -0,0 +1,5 @@ +import Trigger from 'ember-basic-dropdown/components/basic-dropdown/trigger'; + +export default Trigger.extend({ + attributeBindings: ['type'], +}); diff --git a/ui/app/routes/vault/cluster/access/identity.js b/ui/app/routes/vault/cluster/access/identity.js index ad1545d19..88254bc17 100644 --- a/ui/app/routes/vault/cluster/access/identity.js +++ b/ui/app/routes/vault/cluster/access/identity.js @@ -1,4 +1,5 @@ import Ember from 'ember'; +import DS from 'ember-data'; const MODEL_FROM_PARAM = { entities: 'entity', @@ -8,8 +9,11 @@ const MODEL_FROM_PARAM = { export default Ember.Route.extend({ model(params) { let model = MODEL_FROM_PARAM[params.item_type]; - - //TODO 404 behavior; + if (!model) { + const error = new DS.AdapterError(); + Ember.set(error, 'httpStatus', 404); + throw error; + } return model; }, }); diff --git a/ui/app/routes/vault/cluster/policies/create.js b/ui/app/routes/vault/cluster/policies/create.js index 92c438f37..8604648e1 100644 --- a/ui/app/routes/vault/cluster/policies/create.js +++ b/ui/app/routes/vault/cluster/policies/create.js @@ -8,7 +8,7 @@ export default Ember.Route.extend(UnloadModelRoute, UnsavedModelRoute, { model() { 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.store.createRecord(`policy/${policyType}`, {}); diff --git a/ui/app/routes/vault/cluster/policies/index.js b/ui/app/routes/vault/cluster/policies/index.js index 50ff37289..4b310d506 100644 --- a/ui/app/routes/vault/cluster/policies/index.js +++ b/ui/app/routes/vault/cluster/policies/index.js @@ -15,7 +15,7 @@ export default Ember.Route.extend(ClusterRoute, { }, 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) { diff --git a/ui/app/routes/vault/cluster/policy.js b/ui/app/routes/vault/cluster/policy.js index 168b05e7d..9e2996fc6 100644 --- a/ui/app/routes/vault/cluster/policy.js +++ b/ui/app/routes/vault/cluster/policy.js @@ -16,7 +16,7 @@ export default Ember.Route.extend(ClusterRoute, { if (!ALLOWED_TYPES.includes(policyType)) { 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 {}; diff --git a/ui/app/services/version.js b/ui/app/services/version.js index 8236d82e3..4284c44fd 100644 --- a/ui/app/services/version.js +++ b/ui/app/services/version.js @@ -22,6 +22,8 @@ export default Service.extend({ hasDRReplication: hasFeature('DR Replication'), + hasSentinel: hasFeature('Sentinel'), + isEnterprise: computed.match('version', /\+\w+$/), isOSS: computed.not('isEnterprise'), diff --git a/ui/app/templates/components/identity/entity-nav.hbs b/ui/app/templates/components/identity/entity-nav.hbs index 9d81b9d33..a7e34fa12 100644 --- a/ui/app/templates/components/identity/entity-nav.hbs +++ b/ui/app/templates/components/identity/entity-nav.hbs @@ -23,12 +23,12 @@