Skip to content

UI: Surfacing plugin version for Secret Engines #30712

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

drivera258
Copy link
Contributor

@drivera258 drivera258 commented May 21, 2025

Description

What does this PR do?

  • Update to surface running plugin versions next to each enabled secret engine on list view
  • Add version (if applicable) to engine to icon tooltip
  • Add unsupported message to icon tooltip for secret engines that are not supported
Before After
image image image
image image

TODO only if you're a HashiCorp employee

  • Backport Labels: If this fix needs to be backported, use the appropriate backport/ label that matches the desired release branch. Note that in the CE repo, the latest release branch will look like backport/x.x.x, but older release branches will be backport/ent/x.x.x+ent.
    • LTS: If this fixes a critical security vulnerability or severity 1 bug, it will also need to be backported to the current LTS versions of Vault. To ensure this, use all available enterprise labels.
  • ENT Breakage: If this PR either 1) removes a public function OR 2) changes the signature
    of a public function, even if that change is in a CE file, double check that
    applying the patch for this PR to the ENT repo and running tests doesn't
    break any tests. Sometimes ENT only tests rely on public functions in CE
    files.
  • Jira: If this change has an associated Jira, it's referenced either
    in the PR description, commit message, or branch name.
  • RFC: If this change has an associated RFC, please link it in the description.
  • ENT PR: If this change has an associated ENT PR, please link it in the
    description. Also, make sure the changelog is in this PR, not in your ENT PR.

@drivera258 drivera258 changed the title UI: Surfacing plugin version UI: Surfacing plugin version for Secret Engines May 21, 2025
@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label May 21, 2025
Copy link

github-actions bot commented May 21, 2025

CI Results:
All Go tests succeeded! ✅

@drivera258 drivera258 marked this pull request as ready for review May 23, 2025 16:55
@drivera258 drivera258 requested a review from a team as a code owner May 23, 2025 16:55
Copy link

Build Results:
All builds succeeded! ✅

@drivera258 drivera258 marked this pull request as draft May 27, 2025 22:23
@drivera258 drivera258 added this to the 1.20.0-rc milestone May 28, 2025
@drivera258 drivera258 marked this pull request as ready for review May 28, 2025 19:15
@drivera258 drivera258 requested a review from a team as a code owner May 28, 2025 19:15
@drivera258 drivera258 requested review from robmonte and removed request for robmonte May 28, 2025 19:15
* TODO: maybe add param on object that mentions secret or auth or enterprise
*/

const ALL_ENGINES = [
Copy link
Contributor Author

@drivera258 drivera258 May 28, 2025

Choose a reason for hiding this comment

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

When Angel and I paired on this, we decided on removing the auth-display-names helper (that claire created when doing auth work) in favor of have just one centralized helper for getting display names (ie. this file)

However tests were being wonky with swapping the auth helper with this new one so i undid my changes and kept them separate

Copy link
Contributor

@hellobontempo hellobontempo May 28, 2025

Choose a reason for hiding this comment

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

A helper that returns an array isn't really a good use case for creating a helper. I think it'd make much more sense to make thisconst a util and the helper could be a find function (engine-display-data) that takes a type as an argument. We've historically used helpers for lots of things that should technically be utils.

Copy link
Contributor

Choose a reason for hiding this comment

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

Feel free to update use cases of auth-display-names if you do the above!

Copy link
Contributor

Choose a reason for hiding this comment

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

@Monkeychip - let me know if you disagree! I don't want to give conflicting suggestions 😄

Comment on lines 52 to 59
@text={{if
backend.isSupportedBackend
(concat
(get (find-by "type" backend.type (engines-display-name)) "displayName")
(if (eq backend.version 2) " version 2" (if (eq backend.version 1) " version 1" ""))
)
"This secret engine type is not currently supported by the UI."
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this logic be moved into a template helper in the component file? It might make it a little easier to parse and reduce the chance for regressions if/when updates are made in the future

Copy link
Contributor

Choose a reason for hiding this comment

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

Update per suggestion below - I think it'd make sense to update engine-display-names to be engine-display-data that was a find function which would clean this logic up as well

@@ -36,6 +36,7 @@ export default class SecretsEngineMountConfig extends Component<Args> {
{ label: 'Secret Engine Type', value: model.engineType },
{ label: 'Path', value: model.path },
{ label: 'Accessor', value: model.accessor },
{ label: 'Running Plugin Version', value: model.runningPluginVersion },
Copy link
Contributor

Choose a reason for hiding this comment

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

According to our capitalization policy (confirmed in the Figma file "Capitalization"), we use Title Case for headings and titles, but Sentence case for attributes and labels. I initially used Running Plugin Version to match the existing labels on this form, but technically, it should be sentence-cased. If you feel so inclined, could you update the rest of the Labels on this model to match this pattern? Note: because of openAPI the only time we don't use sentence-case is with Default Lease TTL or Max Lease TTL.

Suggested change
{ label: 'Running Plugin Version', value: model.runningPluginVersion },
{ label: 'Running plugin version', value: model.runningPluginVersion },

.dom('.hds-tooltip-container')
.hasText(
'This secret engine type is not currently supported by the UI.',
'shows tooltip for unsupported engine'
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
'shows tooltip for unsupported engine'
'shows tooltip text for unsupported engine'

await selectChoose(GENERAL.searchSelect.trigger('filter-by-engine-type'), 'kv');

await triggerEvent('.hds-tooltip-button', 'mouseenter');
assert.dom('.hds-tooltip-container').hasText('KV version 2', 'shows tooltip for kv version 2');
Copy link
Contributor

@Monkeychip Monkeychip May 28, 2025

Choose a reason for hiding this comment

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

Could we add another section to this test to cover a non-versioned supported engine—like ssh—that won’t include a version in the text? It’s part of the logic, so I want to make sure that case is explicitly covered.

return ALL_ENGINES.slice();
}

export default buildHelper(methods);
Copy link
Contributor

Choose a reason for hiding this comment

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

Using buildHelper is outdated syntax and no longer necessary, the function can just be exported https://guides.emberjs.com/release/components/helper-functions/#toc_global-helper-functions

{
displayName: 'LDAP',
type: 'ldap',
engineRoute: 'ldap.overview',
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe engineRoute keys should probably deleted as it's unrelated to the function of this const?

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 ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants