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

UI: Move OIDC key header out of form component #27848

Merged
merged 6 commits into from
Jul 23, 2024
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
19 changes: 0 additions & 19 deletions ui/app/templates/components/oidc/key-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,6 @@
SPDX-License-Identifier: BUSL-1.1
~}}

<PageHeader as |p|>
<p.top>
<Hds::Breadcrumb>
{{#if @model.isNew}}
<Hds::Breadcrumb::Item @text="Keys" @route="vault.cluster.access.oidc.keys" />
{{else}}
<Hds::Breadcrumb::Item @text="Details" @route="vault.cluster.access.oidc.keys.key.details" @model={{@model.name}} />
{{/if}}
<Hds::Breadcrumb::Item @text="{{if @model.isNew 'Create' 'Edit'}} Key" @current={{true}} />
</Hds::Breadcrumb>
</p.top>
<p.levelLeft>
<h1 class="title is-3" data-test-oidc-key-title>
{{if @model.isNew "Create" "Edit"}}
Key
</h1>
</p.levelLeft>
</PageHeader>

<form {{on "submit" (perform this.save)}}>
<div class="box is-sideless is-fullwidth is-bottomless">
<MessageError @errorMessage={{this.errorBanner}} />
Expand Down
14 changes: 14 additions & 0 deletions ui/app/templates/vault/cluster/access/oidc/keys/create.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
SPDX-License-Identifier: BUSL-1.1
~}}

<PageHeader as |p|>
<p.top>
<Hds::Breadcrumb>
<Hds::Breadcrumb::Item @text="Keys" @route="vault.cluster.access.oidc.keys" />
<Hds::Breadcrumb::Item @text="Create Key" @current={{true}} />
</Hds::Breadcrumb>
</p.top>
<p.levelLeft>
<h1 class="title is-3">
Create Key
</h1>
</p.levelLeft>
</PageHeader>

<Oidc::KeyForm
@model={{this.model}}
@onCancel={{transition-to "vault.cluster.access.oidc.keys"}}
Expand Down
19 changes: 19 additions & 0 deletions ui/app/templates/vault/cluster/access/oidc/keys/key/edit.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@
SPDX-License-Identifier: BUSL-1.1
~}}

<PageHeader as |p|>
<p.top>
<Hds::Breadcrumb>
<Hds::Breadcrumb::Item @text="Keys" @route="vault.cluster.access.oidc.keys" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this

<Hds::Breadcrumb::Item
@text="Details"
@route="vault.cluster.access.oidc.keys.key.details"
@model={{this.model.name}}
/>
<Hds::Breadcrumb::Item @text="Edit Key" @current={{true}} />
</Hds::Breadcrumb>
</p.top>
<p.levelLeft>
<h1 class="title is-3">
Edit Key
</h1>
</p.levelLeft>
</PageHeader>

<Oidc::KeyForm
@model={{this.model}}
@onCancel={{transition-to "vault.cluster.access.oidc.keys.key.details" this.model.name}}
Expand Down
6 changes: 2 additions & 4 deletions ui/tests/integration/components/oidc/key-form-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module('Integration | Component | oidc/key-form', function (hooks) {
});

test('it should save new key', async function (assert) {
assert.expect(9);
assert.expect(8);
this.server.post('/identity/oidc/key/test-key', (schema, req) => {
assert.ok(true, 'Request made to save key');
return JSON.parse(req.requestBody);
Expand All @@ -49,7 +49,6 @@ module('Integration | Component | oidc/key-form', function (hooks) {
/>
`);

assert.dom('[data-test-oidc-key-title]').hasText('Create Key', 'Form title renders correct text');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted these assertions instead of move them because they no longer rely on @model.isNew logic and are hardcoded

assert.dom(SELECTORS.keySaveButton).hasText('Create', 'Save button has correct text');
assert.dom('[data-test-input="algorithm"]').hasValue('RS256', 'default algorithm is correct');
assert.strictEqual(findAll('[data-test-field]').length, 4, 'renders all input fields');
Expand All @@ -70,7 +69,7 @@ module('Integration | Component | oidc/key-form', function (hooks) {
});

test('it should update key and limit access to selected applications', async function (assert) {
assert.expect(12);
assert.expect(11);

this.server.post('/identity/oidc/key/test-key', (schema, req) => {
assert.ok(true, 'Request made to update key');
Expand All @@ -94,7 +93,6 @@ module('Integration | Component | oidc/key-form', function (hooks) {
/>
`);

assert.dom('[data-test-oidc-key-title]').hasText('Edit Key', 'Title renders correct text');
assert.dom(SELECTORS.keySaveButton).hasText('Update', 'Save button has correct text');
assert.dom('[data-test-input="name"]').isDisabled('Name input is disabled when editing');
assert.dom('[data-test-input="name"]').hasValue('test-key', 'Name input is populated with model value');
Expand Down
Loading