-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Create sections for Secrets sync destination fields for create/edit view #27538
Conversation
CI Results: |
Build Results: |
ui/lib/sync/addon/components/secrets/page/destinations/create-and-edit.hbs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of questions! Could you include a screenshot of the edit view as well?
Connection credentials are sensitive information | ||
{{#if @destination.isNew}} used to authenticate with the destination. {{else}} | ||
and the value cannot be read. Enable the input to update. | ||
{{/if}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lot more logic now that relies on whether a model isNew
or not. Could we add test coverage for this logic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done and dusted. Note the maskedInput vs wrapped maskedInputs
by the enableInput
component on create
vs edit
are covered in the create-and-edit
test. They're a little hard to see. I added one for create in this PR. And the edit masked check is done by calling enableInput on the test here. If those values were not wrapped by the correct component, you couldn't find this value.
ui/lib/sync/addon/components/secrets/page/destinations/create-and-edit.hbs
Outdated
Show resolved
Hide resolved
ui/lib/sync/addon/components/secrets/page/destinations/create-and-edit.hbs
Outdated
Show resolved
Hide resolved
this.model = this.generateModel(); | ||
|
||
await this.renderFormComponent(); | ||
assert.dom(PAGE.breadcrumbs).hasText('Secrets Sync Destinations Destination Edit Destination'); | ||
assert.dom('h2').hasText('Credentials', 'renders credentials section on edit'); | ||
assert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved this into a subtext specific test
class="has-bottom-margin-m" | ||
data-test-destination-subText={{group}} | ||
> | ||
{{(this.groupSubtext group @destination.isNew)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{{(this.groupSubtext group @destination.isNew)}} | |
{{this.groupSubtext group @destination.isNew}} |
class="has-bottom-margin-m" | ||
data-test-destination-subText={{group}} | ||
> | ||
{{(this.groupSubtext group @destination.isNew)}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of passing in isNew
here can we just access this.args.destination.isNew
in the component helper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that and then realized I was hitting issues because this is within an each iteration, so it's easier to access the destination by passing it in like this.
groupSubtext(group: string, isNew: boolean) { | ||
const dynamicText = isNew | ||
? 'used to authenticate with the destination' | ||
: 'and the value cannot be read. Enable the input to update'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
groupSubtext(group: string, isNew: boolean) { | |
const dynamicText = isNew | |
? 'used to authenticate with the destination' | |
: 'and the value cannot be read. Enable the input to update'; | |
groupSubtext(group: string) { | |
const dynamicText = this.args.destination.isNew | |
? 'used to authenticate with the destination' | |
: 'and the value cannot be read. Enable the input to update'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strange! it must be how the template helper functions compile 🤔
ui/tests/integration/components/sync/secrets/page/destinations/create-and-edit-test.js
Outdated
Show resolved
Hide resolved
const { type } = SYNC_DESTINATIONS[0]; | ||
this.model = this.store.createRecord(`sync/destinations/${type}`, { type }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the test above, this needs to be updated to the following to accurately render the edit view
const { type } = SYNC_DESTINATIONS[0]; | |
this.model = this.store.createRecord(`sync/destinations/${type}`, { type }); | |
const { type } = SYNC_DESTINATIONS[0]; | |
this.model = this.generateModel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also since these are "it renders" related tests, the assertions below could also just move into the test above. I don't think separate subtext tests are needed since the existing "edit: it renders" and "create: it renders" are so small already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch re: 1st comment.
Re 2nd comment: I broke these up because I wanted to isolate the isNew functionality from the transition and breadcrumbs. However, let me clear up the tests a bit to make that more evident.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one assertion update then this is good to go!
@@ -56,13 +56,18 @@ module('Integration | Component | sync | Secrets::Page::Destinations::CreateAndE | |||
assert.true(transition, 'transitions to vault.cluster.sync.secrets.destinations.create on cancel'); | |||
}); | |||
|
|||
test('create: it renders fieldGroups subtext', async function (assert) { | |||
assert.expect(2); | |||
test('create: it renders headers and fieldGroups subtext', async function (assert) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing that final cleanup! Looks great! 🚀
Description
Creates a separate section for updating sensitive creds on Secrets sync create/edit form.
Designs:
Implementation create:
Implementation edit: