Files
vault/ui/lib/kv/addon/components/page/secret/paths.hbs
claire bontempo 42a337410f UI: add copyable paths for CLI and API commands to kv v2 (#22551)
* add paths route

* WIP copy secret path component

* wip component

* ad v1

* use each-in to iterate over info table row

* update copy

* add commands to kv paths page

* add comments

* WIP tests

* finish tests

* remove version, address comments and use path arg directly remove secret

* update copy

* fix typo for perms

* remove destructuring, that was confusing

* add changelog

* add secure protocal
2023-08-25 09:03:46 -07:00

63 lines
2.3 KiB
Handlebars

<KvPageHeader @breadcrumbs={{@breadcrumbs}} @pageTitle={{@path}}>
<:tabLinks>
<LinkTo @route="secret.details" data-test-secrets-tab="Secret">Secret</LinkTo>
<LinkTo @route="secret.metadata.index" data-test-secrets-tab="Metadata">Metadata</LinkTo>
<LinkTo @route="secret.paths" data-test-secrets-tab="Paths">Paths</LinkTo>
{{#if @canReadMetadata}}
<LinkTo @route="secret.metadata.versions" data-test-secrets-tab="Version History">Version History</LinkTo>
{{/if}}
</:tabLinks>
</KvPageHeader>
<h2 class="title is-5 has-top-margin-xl">
Paths
</h2>
<div class="box is-fullwidth is-sideless is-paddingless is-marginless">
{{#each this.paths as |path|}}
<InfoTableRow @label={{path.label}} @labelWidth="is-one-third" @helperText={{path.text}}>
{{! replace with Hds::Copy::Snippet }}
<CopyButton
class="button is-compact is-transparent level-right"
@clipboardText={{path.snippet}}
@buttonType="button"
@success={{fn (set-flash-message (concat path.label " copied!"))}}
>
<Icon @name="clipboard-copy" aria-label="Copy" />
</CopyButton>
<code class="has-left-margin-s level-left">
{{path.snippet}}
</code>
</InfoTableRow>
{{/each}}
</div>
<h2 class="title is-5 has-top-margin-xl">
Commands
</h2>
<div class="box is-fullwidth is-sideless">
<h3 class="is-label">
CLI
<Hds::Badge @text="kv get" @color="neutral" />
</h3>
<p class="helper-text has-text-grey has-bottom-padding-s">
This command retrieves the value from KV secrets engine at the given key name. For other CLI commands,
<DocLink @path="/vault/docs/commands/kv">
learn more.
</DocLink>
</p>
<CodeSnippet data-test-commands="cli" @codeBlock={{this.commands.cli}} />
<h3 class="has-top-margin-l is-label">
API read secret version
</h3>
<p class="helper-text has-text-grey has-bottom-padding-s">
This command obtains data and metadata for the latest version of this secret. In this example, Vault is located at
https://127.0.0.1:8200. For other API commands,
<DocLink @path="/vault/api-docs/secret/kv/kv-v2">
learn more.
</DocLink>
</p>
<CodeSnippet data-test-commands="api" @clipboardCode={{this.commands.apiCopy}} @codeBlock={{this.commands.apiDisplay}} />
</div>