From c920df142e9c865e5e121abac1a454909e46a64c Mon Sep 17 00:00:00 2001 From: hashishaw Date: Mon, 17 May 2021 11:53:14 -0500 Subject: [PATCH 1/4] Fix model on identity templates --- .../components/identity/item-details.hbs | 24 +++++++++---------- .../components/identity/item-groups.hbs | 14 ++++++----- .../components/identity/item-members.hbs | 23 +++++++++++------- .../components/identity/item-metadata.hbs | 15 ++++++------ .../identity/item-parent-groups.hbs | 7 +++--- .../components/identity/item-policies.hbs | 7 +++--- 6 files changed, 50 insertions(+), 40 deletions(-) diff --git a/ui/app/templates/components/identity/item-details.hbs b/ui/app/templates/components/identity/item-details.hbs index 03d6c052c15c..5bdceadf2f13 100644 --- a/ui/app/templates/components/identity/item-details.hbs +++ b/ui/app/templates/components/identity/item-details.hbs @@ -1,32 +1,32 @@
- {{#if model.disabled}} + {{#if @model.disabled}} - {{#if model.canEdit}} - {{/if}} {{/if}} - - - - + + + +
- {{#each model.mergedEntityIds as |id|}} + {{#each @model.mergedEntityIds as |id|}}
{{id}}
{{/each}}
- -
- {{#if model.canEdit}} - + {{#if @model.canEdit}} + {{/if}}
{{/linked-block}} {{/each}} - {{#each model.memberEntityIds as |gid|}} + {{#each @model.memberEntityIds as |gid|}} {{#linked-block "vault.cluster.access.identity.show" "groups" @@ -32,14 +32,19 @@ }}
- + {{gid}} + />{{gid}} +
- {{#if model.canEdit}} - + {{#if @model.canEdit}} + {{/if}}
diff --git a/ui/app/templates/components/identity/item-metadata.hbs b/ui/app/templates/components/identity/item-metadata.hbs index 91873d83d9a6..33d730d2e418 100644 --- a/ui/app/templates/components/identity/item-metadata.hbs +++ b/ui/app/templates/components/identity/item-metadata.hbs @@ -1,4 +1,5 @@ -{{#each-in model.metadata as |key value|}} +{{log "model" model this.model @model}} +{{#each-in @model.metadata as |key value|}}
@@ -10,19 +11,19 @@ {{value}}
- {{#if model.canEdit}} - + {{#if @model.canEdit}} + {{/if}}
{{else}} - - Edit {{lowercase (humanize model.identityType)}} + + Edit {{lowercase (humanize @model.identityType)}} Learn more diff --git a/ui/app/templates/components/identity/item-parent-groups.hbs b/ui/app/templates/components/identity/item-parent-groups.hbs index c0031c7c4888..fabc4879e4cb 100644 --- a/ui/app/templates/components/identity/item-parent-groups.hbs +++ b/ui/app/templates/components/identity/item-parent-groups.hbs @@ -1,5 +1,5 @@ -{{#if model.parentGroupIds.length}} - {{#each model.parentGroupIds as |gid|}} +{{#if @model.parentGroupIds.length}} + {{#each @model.parentGroupIds as |gid|}} {{#linked-block "vault.cluster.access.identity.show" "groups" @@ -9,7 +9,8 @@ }}
- + {{gid}} diff --git a/ui/app/templates/components/identity/item-policies.hbs b/ui/app/templates/components/identity/item-policies.hbs index 5d675588ed98..cab6df2a662f 100644 --- a/ui/app/templates/components/identity/item-policies.hbs +++ b/ui/app/templates/components/identity/item-policies.hbs @@ -7,12 +7,13 @@ }}
- {{policyName}} + + {{policyName}}
- {{#if model.canEdit}} - + {{#if @model.canEdit}} + {{/if}}
From 590b37f64dbd99132cc9c533e96024331db9a7d9 Mon Sep 17 00:00:00 2001 From: hashishaw Date: Mon, 17 May 2021 15:49:14 -0500 Subject: [PATCH 2/4] Add tests for identity tabs --- ui/app/models/identity/group.js | 4 ++-- .../vault/cluster/access/identity/show.hbs | 2 +- .../acceptance/access/identity/_shared-tests.js | 16 +++++++++++++--- ui/tests/pages/components/identity/edit-form.js | 2 ++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/ui/app/models/identity/group.js b/ui/app/models/identity/group.js index d51a96ef6af1..31a0b6932928 100644 --- a/ui/app/models/identity/group.js +++ b/ui/app/models/identity/group.js @@ -64,8 +64,8 @@ export default IdentityModel.extend({ 'memberGroupIds.[]', function() { let { memberEntityIds, memberGroupIds } = this; - let numEntities = (memberEntityIds && memberEntityIds.get('length')) || 0; - let numGroups = (memberGroupIds && memberGroupIds.get('length')) || 0; + let numEntities = (memberEntityIds && memberEntityIds.length) || 0; + let numGroups = (memberGroupIds && memberGroupIds.length) || 0; return numEntities + numGroups > 0; } ), diff --git a/ui/app/templates/vault/cluster/access/identity/show.hbs b/ui/app/templates/vault/cluster/access/identity/show.hbs index df09bf4173a2..9aa7a244ab37 100644 --- a/ui/app/templates/vault/cluster/access/identity/show.hbs +++ b/ui/app/templates/vault/cluster/access/identity/show.hbs @@ -21,7 +21,7 @@