open-vault/ui/app/templates/components/secret-list/item.hbs
Angel Garbarino c013e4a741
UI add custom metadata to KV2 (#12169)
* initial setup

* form field editType kv is very helpful

* setting up things

* setup two routes for metadata

* routing

* clean up routing

* meh router changes not my favorite but its working

* show metadata

* add controller for backendCrumb mixin

* setting up edit metadata and trimming SecretEditMetadata component

* add edit metadata save functionality

* create new version work

* setup model and formfieldgroups for added config data.

* add config network request to secret-engine

* fix validations on config

* add config rows

* breaking up secret edit

* add validation for metadata on create

* stuff, but broken now on metadata tab

* fix metadata route error

* permissions

* saving small text changes

* permissions

* cleanup

* some test fixes and convert secret create or update to glimmer

* all these changes fix secret create kv test

* remove alert banners per design request

* fix error for array instead of object in jsonEditor

* add changelog

* styling

* turn into glimmer component

* cleanup

* test failure fix

* add delete or

* clean up

* remove all hardcoded for api integration

* add helper and fix create mode on create new version

* address chelseas pr comments

* add jsdocs to helper

* fix test
2021-08-31 09:41:41 -06:00

99 lines
3.8 KiB
Handlebars

{{#linked-block
(concat
"vault.cluster.secrets.backend."
(if @item.isFolder "list" "show")
(unless @item.id "-root")
)
@item.id
class="list-item-row"
data-test-secret-link=@item.id
encode=true
queryParams=(secret-query-params @backendModel.type)
}}
<div class="columns is-mobile">
<div class="column is-10">
<SecretLink
@mode={{if @item.isFolder "list" "show" }}
@secret={{@item.id}}
@queryParams={{if (eq @backendModel.type "transit") (query-params tab="actions") ""}}
@class="has-text-black has-text-weight-semibold">
{{#if (eq @backendModel.type "transit")}}
<Icon @glyph="key" @class="has-text-grey-light"/>
{{else}}
<Icon @glyph={{if @item.isFolder 'folder-outline' 'file-outline' }} @class="has-text-grey-light"/>
{{/if}}
{{if (eq @item.id ' ') '(self)' (or @item.keyWithoutParent @item.id)}}
</SecretLink>
</div>
<div class="column has-text-right">
<PopupMenu name="secret-menu">
<Confirm as |c|>
<nav class="menu">
<ul class="menu-list">
{{#if @item.isFolder}}
<SecretLink
@mode="list"
@secret={{@item.id}}
@class="has-text-black has-text-weight-semibold">
Contents
</SecretLink>
{{else}}
{{#if (or @item.versionPath.isLoading @item.secretPath.isLoading)}}
<li class="action">
<button disabled type="button" class="link button is-loading is-transparent">
loading
</button>
</li>
{{else}}
{{#if (or @item.canReadSecretData @item.canRead)}}
<li class="action">
<SecretLink
@mode="show"
@secret={{@item.id}}
@class="has-text-black has-text-weight-semibold">
Details
</SecretLink>
</li>
{{#if @backendModel.isV2KV}}
<li class="action">
<SecretLink
@mode="versions"
@secret={{@item.id}}
@class="has-text-black has-text-weight-semibold">
View version history
</SecretLink>
</li>
{{/if}}
{{/if}}
{{#if (or @item.canEditSecretData @item.canEdit)}}
<li class="action">
<SecretLink
@mode="edit"
@secret={{@item.id}}
@class="has-text-black has-text-weight-semibold">
{{if @backendModel.isV2KV
"Create new version"
"Edit"
}}
</SecretLink>
</li>
{{/if}}
{{#if (or @item.canDeleteSecretData @item.canDelete)}}
<li class="action">
<c.Message
@id={{@item.id}}
@triggerText={{if @backendModel.isV2KV "Permanently delete" "Delete"}}
@message="This will permanently delete this secret and all its versions."
@onConfirm={{@delete}}/>
</li>
{{/if}}
{{/if}}
{{/if}}
</ul>
</nav>
</Confirm>
</PopupMenu>
</div>
</div>
{{/linked-block}}