8e62cf66bc
* Update or create new role after allowed_roles on transformation updated * Update tests to include transformation create/edit and role create scenarios
137 lines
3.7 KiB
Handlebars
137 lines
3.7 KiB
Handlebars
<PageHeader as |p|>
|
||
<p.top>
|
||
{{key-value-header
|
||
baseKey=model
|
||
path="vault.cluster.secrets.backend.list"
|
||
mode=mode
|
||
root=root
|
||
showCurrent=true
|
||
}}
|
||
</p.top>
|
||
<p.levelLeft>
|
||
<h1 class="title is-3" data-test-secret-header="true">
|
||
{{#if (eq mode "create") }}
|
||
Create transformation
|
||
{{else if (eq mode 'edit')}}
|
||
Edit transformation
|
||
{{else}}
|
||
Transformation <code>{{model.id}}</code>
|
||
{{/if}}
|
||
</h1>
|
||
</p.levelLeft>
|
||
</PageHeader>
|
||
|
||
{{#if (eq mode "show")}}
|
||
<Toolbar>
|
||
<ToolbarActions>
|
||
{{#if (or capabilities.canUpdate capabilities.canDelete)}}
|
||
<div class="toolbar-separator" />
|
||
{{/if}}
|
||
{{#if capabilities.canDelete}}
|
||
{{#if (gt model.allowed_roles.length 0)}}
|
||
<ToolTip
|
||
@verticalPosition="above"
|
||
@horizontalPosition="center"
|
||
as |T|>
|
||
<T.trigger @tabindex=false>
|
||
<a
|
||
class="toolbar-link"
|
||
aria-disabled="true"
|
||
disabled
|
||
>
|
||
Delete transformation
|
||
</a>
|
||
</T.trigger>
|
||
<T.content @class="tool-tip">
|
||
<div class="box">
|
||
This transformation is in use by a role and can’t be deleted.
|
||
</div>
|
||
</T.content>
|
||
</ToolTip>
|
||
{{else}}
|
||
<a
|
||
class="toolbar-link"
|
||
onclick={{action (mut isDeleteModalActive) true}}
|
||
>
|
||
Delete transformation
|
||
</a>
|
||
{{/if}}
|
||
{{/if}}
|
||
{{#if capabilities.canUpdate }}
|
||
{{#if (gt model.allowed_roles.length 0)}}
|
||
<a
|
||
class="toolbar-link"
|
||
onclick={{action (mut isEditModalActive) true}}
|
||
data-test-edit-link
|
||
>
|
||
Edit transformation
|
||
</a>
|
||
{{else}}
|
||
<ToolbarSecretLink
|
||
@secret={{model.id}}
|
||
@mode="edit"
|
||
@data-test-edit-link=true
|
||
@replace=true
|
||
>
|
||
Edit transformation
|
||
</ToolbarSecretLink>
|
||
{{/if}}
|
||
{{/if}}
|
||
</ToolbarActions>
|
||
</Toolbar>
|
||
{{/if}}
|
||
|
||
{{#if (eq mode 'edit')}}
|
||
<TransformEditForm @mode={{mode}} @model={{model}} />
|
||
{{else if (eq mode 'create')}}
|
||
<TransformCreateForm @mode={{mode}} @model={{model}} />
|
||
{{else}}
|
||
<TransformShowTransformation
|
||
@model={{model}}
|
||
/>
|
||
{{/if}}
|
||
|
||
<ConfirmationModal
|
||
@title="Delete transformation"
|
||
@onClose={{action (mut isDeleteModalActive) false}}
|
||
@isActive={{isDeleteModalActive}}
|
||
@confirmText={{model.name}}
|
||
@toConfirmMsg="Type {{model.name}} to confirm deleting the transformation."
|
||
@onConfirm={{action "delete"}}
|
||
>
|
||
<p class="has-bottom-margin-m">
|
||
Deleting the <strong>{{model.name}}</strong> transformation means that the underlying keys are lost and the data encoded by the transformation are unrecoverable and cannot be decoded.
|
||
</p>
|
||
<MessageError @model={{model}} @errorMessage={{error}} />
|
||
</ConfirmationModal>
|
||
|
||
<Modal
|
||
@title="Edit transformation"
|
||
@onClose={{action (mut isEditModalActive) false}}
|
||
@isActive={{isEditModalActive}}
|
||
@type="warning"
|
||
@showCloseButton={{true}}
|
||
>
|
||
<section class="modal-card-body">
|
||
<p>
|
||
You’re editing a transformation that is in use by at least one role. Editing it may mean that encode and decode operations stop working. Are you sure?
|
||
</p>
|
||
</section>
|
||
<footer class="modal-card-foot modal-card-foot-outlined">
|
||
{{#link-to
|
||
"vault.cluster.secrets.backend.edit" model.id
|
||
tagName="button"
|
||
class="button is-primary"
|
||
data-test-edit-confirm-button=true
|
||
}}
|
||
Confirm
|
||
{{/link-to}}
|
||
<button
|
||
class="button is-secondary"
|
||
onclick={{action (mut isEditModalActive) false}}
|
||
>
|
||
Cancel
|
||
</button>
|
||
</footer>
|
||
</Modal>
|