forked from hashicorp/vault
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI: VAULT-8429 Update query and serializer so that it includes parsed…
…Certificate (hashicorp#20246) Co-authored-by: Kianna Quach <kianna.quach@hashicorp.com> Co-authored-by: claire bontempo <68122737+hellobontempo@users.noreply.github.com>
- Loading branch information
1 parent
9ae8f48
commit 6ac4849
Showing
8 changed files
with
226 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{{#each @issuers as |pkiIssuer idx|}} | ||
<LinkedBlock class="list-item-row" @params={{array "issuers.issuer.details" pkiIssuer.id}} @linkPrefix={{@mountPoint}}> | ||
<div class="level is-mobile"> | ||
<div class="level-left"> | ||
<div> | ||
<Icon @name="certificate" class="has-text-grey-light" /> | ||
<span class="has-text-weight-semibold is-underline"> | ||
{{pkiIssuer.issuerRef}} | ||
{{#if pkiIssuer.issuerName}} | ||
<span class="tag has-text-grey-dark">{{pkiIssuer.id}}</span> | ||
{{/if}} | ||
</span> | ||
<div class="is-flex-row has-left-margin-l has-top-margin-xs"> | ||
{{#if pkiIssuer.isDefault}} | ||
<span class="tag has-text-grey-dark" data-test-is-default={{idx}}>default issuer</span> | ||
{{/if}} | ||
{{#if (not (eq pkiIssuer.isRoot undefined))}} | ||
<span class="tag has-text-grey-dark" data-test-is-root-tag={{idx}}>{{if | ||
pkiIssuer.isRoot | ||
"root" | ||
"intermediate" | ||
}}</span> | ||
{{/if}} | ||
{{#if pkiIssuer.serialNumber}} | ||
<InfoTooltip> | ||
Serial number | ||
</InfoTooltip> | ||
<span class="tag has-background-transparent" data-test-serial-number={{idx}}>{{pkiIssuer.serialNumber}}</span> | ||
{{/if}} | ||
{{#if pkiIssuer.keyId}} | ||
<InfoTooltip> | ||
Key ID | ||
</InfoTooltip> | ||
<span class="tag has-background-transparent" data-test-key-id={{idx}}>{{pkiIssuer.keyId}}</span> | ||
{{/if}} | ||
</div> | ||
</div> | ||
</div> | ||
<div class="level-right is-flex is-paddingless is-marginless"> | ||
<div class="level-item"> | ||
<PopupMenu> | ||
<nav class="menu" aria-label="issuer config options"> | ||
<ul class="menu-list"> | ||
<li data-test-popup-menu-details> | ||
<LinkTo @route="issuers.issuer.details" @model={{pkiIssuer.id}}> | ||
Details | ||
</LinkTo> | ||
</li> | ||
<li> | ||
<LinkTo @route="issuers.issuer.edit" @model={{pkiIssuer.id}}> | ||
Edit | ||
</LinkTo> | ||
</li> | ||
</ul> | ||
</nav> | ||
</PopupMenu> | ||
</div> | ||
</div> | ||
</div> | ||
</LinkedBlock> | ||
{{/each}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
ui/tests/integration/components/pki/page/pki-issuer-list-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { module, test } from 'qunit'; | ||
import { render } from '@ember/test-helpers'; | ||
import { setupMirage } from 'ember-cli-mirage/test-support'; | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
import { setupEngine } from 'ember-engines/test-support'; | ||
import { setupRenderingTest } from 'vault/tests/helpers'; | ||
|
||
/** | ||
* this test is for the page component only. A separate test is written for the form rendered | ||
*/ | ||
module('Integration | Component | page/pki-issuer-list', function (hooks) { | ||
setupRenderingTest(hooks); | ||
setupEngine(hooks, 'pki'); | ||
setupMirage(hooks); | ||
|
||
hooks.beforeEach(function () { | ||
this.store = this.owner.lookup('service:store'); | ||
this.secretMountPath = this.owner.lookup('service:secret-mount-path'); | ||
this.secretMountPath.currentPath = 'pki-test'; | ||
this.engineId = 'pki'; | ||
}); | ||
|
||
test('it renders when issuer metadata tags when info is provided', async function (assert) { | ||
this.store.createRecord('pki/issuer', { | ||
issuerId: 'abcd-efgh', | ||
issuerName: 'issuer-0', | ||
common_name: 'common-name-issuer-0', | ||
isRoot: true, | ||
serialNumber: '74:2d:ed:f2:c4:3b:76:5e:6e:0d:f1:6a:c0:8b:6f:e3:3c:62:f9:03', | ||
}); | ||
this.store.createRecord('pki/issuer', { | ||
issuerId: 'ijkl-mnop', | ||
issuerName: 'issuer-1', | ||
isRoot: false, | ||
parsedCertificate: { | ||
common_name: 'common-name-issuer-1', | ||
}, | ||
serialNumber: '74:2d:ed:f2:c4:3b:76:5e:6e:0d:f1:6a:c0:8b:6f:e3:3c:62:f9:03', | ||
}); | ||
this.issuers = this.store.peekAll('pki/issuer'); | ||
|
||
await render(hbs`<Page::PkiIssuerList @issuers={{this.issuers}} @mountPoint={{this.engineId}} />`, { | ||
owner: this.engine, | ||
}); | ||
|
||
this.issuers.forEach(async (issuer, idx) => { | ||
assert | ||
.dom(`[data-test-serial-number="${idx}"]`) | ||
.hasText('74:2d:ed:f2:c4:3b:76:5e:6e:0d:f1:6a:c0:8b:6f:e3:3c:62:f9:03'); | ||
if (idx === 1) { | ||
assert.dom(`[data-test-is-root-tag="${idx}"]`).hasText('intermediate'); | ||
} else { | ||
assert.dom(`[data-test-is-root-tag="${idx}"]`).hasText('root'); | ||
} | ||
}); | ||
}); | ||
test('it renders when issuer data even though issuer metadata isnt provided', async function (assert) { | ||
this.store.createRecord('pki/issuer', { | ||
issuerId: 'abcd-efgh', | ||
issuerName: 'issuer-0', | ||
isDefault: false, | ||
}); | ||
this.store.createRecord('pki/issuer', { | ||
issuerId: 'ijkl-mnop', | ||
issuerName: 'issuer-1', | ||
isDefault: true, | ||
}); | ||
this.issuers = this.store.peekAll('pki/issuer'); | ||
|
||
await render(hbs`<Page::PkiIssuerList @issuers={{this.issuers}} @mountPoint={{this.engineId}} />`, { | ||
owner: this.engine, | ||
}); | ||
assert.dom(`[data-test-is-default="1"]`).hasText('default issuer'); | ||
}); | ||
}); |