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: add subkey request to kv v2 adapter #27804

Merged
merged 17 commits into from
Jul 29, 2024

Conversation

hellobontempo
Copy link
Contributor

@hellobontempo hellobontempo commented Jul 17, 2024

Description

Adds the subkey component and request to the kv data adapter. There are no user facing changes in this PR.

✅ enterprise tests

JSON off (default) 📸

Screenshot 2024-07-24 at 12 17 34 PM

JSON on 📸

Screenshot 2024-07-29 at 9 31 46 AM

@hellobontempo hellobontempo added this to the 1.18.0-rc milestone Jul 17, 2024
@hellobontempo hellobontempo requested a review from a team as a code owner July 17, 2024 23:09
@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Jul 17, 2024
Copy link

github-actions bot commented Jul 17, 2024

CI Results:
All Go tests succeeded! ✅

Copy link

github-actions bot commented Jul 17, 2024

Build Results:
All builds succeeded! ✅

@@ -10,7 +10,7 @@
data-test-overview-card-container={{@cardTitle}}
...attributes
>
<div class="flex row-wrap space-between has-bottom-margin-m" data-test-overview-card={{@cardTitle}}>
Copy link
Contributor Author

@hellobontempo hellobontempo Jul 23, 2024

Choose a reason for hiding this comment

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

Although this affects overview cards everywhere, it's a very small change and I'd rather the spacing be consistent across the board than have different padding situations.
Screenshot 2024-07-23 at 1 05 16 PM

@@ -10,7 +10,7 @@
data-test-overview-card-container={{@cardTitle}}
...attributes
>
<div class="flex row-wrap space-between has-bottom-margin-m" data-test-overview-card={{@cardTitle}}>
<div class="flex row-wrap space-between has-bottom-margin-s" data-test-overview-card={{@cardTitle}}>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Screenshot 2024-07-23 at 1 05 02 PM

Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
~}}

Copy link
Contributor Author

@hellobontempo hellobontempo Jul 23, 2024

Choose a reason for hiding this comment

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

Screenshot 2024-07-24 at 4 16 58 PM Screenshot 2024-07-24 at 4 17 09 PM

@@ -98,6 +99,10 @@
margin: $spacing-4 0;
}

.has-top-bottom-margin-12 {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

since this is a new class, I opted to use the updated -12 number naming which is a pattern we had discussed moving towards (and away from s, m, l) happy to revert and make this -s if folks prefer

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you just add a comment here to that affect? That this is the pattern we want to move toward, away from s/m/l so that future code-browsers will not be confused by the different types of measurements

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, good idea! Will add

{{/if}}

{{! Use the "subtext" yield for stylized subtext or including elements like doc links. }}
{{#if (has-block "subtext")}}
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 didn't want to update @subText for all OverviewCards, I felt like it made sense to keep both potential use cases. 1) just text subtext and 2) more stylized content, such as inline links

Copy link
Contributor

Choose a reason for hiding this comment

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

Are @subtext and <:subtext> mutually exclusive? Right now passing both with yield both

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 intentionally made them not mutually exclusive as I didn't see a reason for them to be. Someone could add subtext in the default styling and then add a second stylized block. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense to me! I think the most confusing part is that they are named the same thing, so it felt like maybe they should be mutually exclusive. But, naming is hard 🤷

Copy link
Contributor

@Monkeychip Monkeychip left a comment

Choose a reason for hiding this comment

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

looks good. one open question about putting the subkey request in the data adapter, but non-blocking.

Copy link
Contributor

@Monkeychip Monkeychip left a comment

Choose a reason for hiding this comment

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

🚀

Copy link
Contributor

@hashishaw hashishaw left a comment

Choose a reason for hiding this comment

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

Nice work! Just a couple non-blocking comments

// TODO use query-param-string util when https://github.com/hashicorp/vault/pull/27455 is merged
fetchSubkeys(query) {
const { backend, path, version, depth } = query;
const apiPath = buildKvPath(backend, path, 'subkeys'); // encodes mount and secret paths
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason you didn't export a kvSubkeyPath method instead of using the base helper? Then the version and query params logic could be in there as well, and easy to unit test

Copy link
Contributor Author

@hellobontempo hellobontempo Jul 29, 2024

Choose a reason for hiding this comment

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

Since this endpoint isn't implemented yet, it was easier for my brain to fiddle with and update the logic in one place. I can move this into a kvSubkeyPath helper. The adapter unit test felt sufficient for testing, but I can add another test for the util.

Also the default args for this endpoint work a little differently since we always send a depth param but not always a version param, so I can't use the version logic out of the box from buildKvPath

@@ -98,6 +99,10 @@
margin: $spacing-4 0;
}

.has-top-bottom-margin-12 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you just add a comment here to that affect? That this is the pattern we want to move toward, away from s/m/l so that future code-browsers will not be confused by the different types of measurements

{{/if}}

{{! Use the "subtext" yield for stylized subtext or including elements like doc links. }}
{{#if (has-block "subtext")}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Are @subtext and <:subtext> mutually exclusive? Right now passing both with yield both

@hellobontempo hellobontempo merged commit fe18e6c into main Jul 29, 2024
31 checks passed
@hellobontempo hellobontempo deleted the ui/VAULT-28875/add-subkey-request-to-kv-v2 branch July 29, 2024 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed pr/no-changelog ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants