open-vault/ui/app/templates/components/transform-list-item.hbs
2020-11-04 13:27:21 -06:00

83 lines
2.5 KiB
Handlebars

{{#if (and item.updatePath.canRead (not isBuiltin))}}
{{#linked-block
"vault.cluster.secrets.backend.show"
itemPath
class="list-item-row"
data-test-secret-link=itemPath
encode=true
queryParams=(secret-query-params backendType)
}}
<div class="columns is-mobile">
<div class="column is-10">
<SecretLink
@mode="show"
@secret={{itemPath}}
@queryParams={{query-params type=modelType}}
@class="has-text-black has-text-weight-semibold">
<Icon
@glyph='file-outline'
@class="has-text-grey-light"/>
{{if (eq item.id ' ') '(self)' (or item.keyWithoutParent item.id)}}
</SecretLink>
</div>
<div class="column has-text-right">
{{#if (or item.updatePath.canRead item.updatePath.canUpdate)}}
<PopupMenu name="secret-menu">
<nav class="menu">
<ul class="menu-list">
{{#if item.updatePath.canRead}}
<li class="action">
<SecretLink
@mode="show"
@secret={{itemPath}}
@class="has-text-black has-text-weight-semibold">
Details
</SecretLink>
</li>
{{/if}}
{{#if item.updatePath.canUpdate}}
<li class="action">
<SecretLink
@mode="edit"
@secret={{itemPath}}
@class="has-text-black has-text-weight-semibold">
Edit
</SecretLink>
</li>
{{/if}}
</ul>
</nav>
</PopupMenu>
{{/if}}
</div>
</div>
{{/linked-block}}
{{else}}
<div class="list-item-row" data-test-view-only-list-item>
<div class="columns is-mobile">
<div class="column is-12 has-text-grey has-text-weight-semibold">
<Icon
@glyph='file-outline'
@class="has-text-grey-light"/>
{{#if isBuiltin}}
<ToolTip
@verticalPosition="above"
@horizontalPosition="left"
as |T|>
<T.trigger @tabindex=false>
{{item.id}}
</T.trigger>
<T.content @class="tool-tip">
<div class="box">
This is a built-in HashiCorp {{itemType}}. It can't be viewed or edited.
</div>
</T.content>
</ToolTip>
{{else}}
{{item.id}}
{{/if}}
</div>
</div>
</div>
{{/if}}