145 lines
5.8 KiB
Handlebars
145 lines
5.8 KiB
Handlebars
{{#if @isV2}}
|
|
{{#if (and this.canUndeleteVersion @modelForData.deleted)}}
|
|
<button type="button" class="toolbar-link" onclick={{action this.handleDelete "undelete"}} data-test-secret-undelete>
|
|
Undelete
|
|
</button>
|
|
{{/if}}
|
|
{{#if (and (not @modelForData.deleted) (not @modelForData.destroyed))}}
|
|
{{#if (or this.canDestroyVersion this.canDestroyAllVersions)}}
|
|
<button
|
|
type="button"
|
|
class="toolbar-link"
|
|
{{on "click" (fn (mut this.showDeleteModal) true)}}
|
|
data-test-delete-open-modal
|
|
>
|
|
{{if (and (not @modelForData.deleted) (not @modelForData.destroyed)) "Delete" "Destroy"}}
|
|
</button>
|
|
<div class="toolbar-separator"></div>
|
|
{{else}}
|
|
{{#if (or (and this.isLatestVersion this.canDeleteSecretData) this.canSoftDeleteSecretData)}}
|
|
<ConfirmAction
|
|
@buttonClasses="toolbar-link"
|
|
@confirmTitle="Delete"
|
|
@confirmMessage="Deleting this secret removes read access, but the underlying data will not be removed and can be undeleted later."
|
|
@onConfirmAction={{action "handleDelete" (if this.canSoftDeleteSecretData "soft-delete" "delete-latest-version")}}
|
|
data-test-secret-v2-delete="true"
|
|
>
|
|
Delete
|
|
</ConfirmAction>
|
|
{{/if}}
|
|
{{/if}}
|
|
{{/if}}
|
|
|
|
<Modal
|
|
@title="Delete Secret?"
|
|
@onClose={{action (mut this.showDeleteModal) false}}
|
|
@isActive={{this.showDeleteModal}}
|
|
@type="warning"
|
|
@showCloseButton={{true}}
|
|
>
|
|
<section class="modal-card-body">
|
|
<p class="has-bottom-margin-s">
|
|
There are three ways to delete or destroy the
|
|
<strong>{{@model.id}}</strong>
|
|
secret. Each is different, so be sure to read the below carefully.
|
|
</p>
|
|
<p class="has-bottom-margin-s"><strong>How would you like to proceed?</strong></p>
|
|
{{#unless @modelForData.destroyed}}
|
|
{{#unless @modelForData.deleted}}
|
|
{{#if (or this.canSoftDeleteSecretData this.canDeleteSecretData)}}
|
|
<div class="modal-radio-button" data-test-delete-modal="delete-version">
|
|
<RadioButton
|
|
id="delete-version"
|
|
name="setup-deleteType"
|
|
class="radio"
|
|
@value={{if this.canSoftDeleteSecretData "soft-delete" "delete-latest-version"}}
|
|
@groupValue={{this.deleteType}}
|
|
@onChange={{fn (mut this.deleteType)}}
|
|
/>
|
|
<div class="helper-text">
|
|
{{#if this.canSoftDeleteSecretData}}
|
|
<label for="delete-version" data-test-type-select="delete-version"><strong>Delete this version</strong></label>
|
|
<p>
|
|
This deletes Version
|
|
{{@modelForData.version}}
|
|
of the secret. It can be un-deleted later.
|
|
</p>
|
|
{{else}}
|
|
<label for="delete-version" data-test-type-select="delete-version"><strong>Delete latest version</strong></label>
|
|
<p>
|
|
Your policy does not allow deleting a specific version of this secret. This will delete the
|
|
<strong>latest version</strong>
|
|
of this secret. It can be un-deleted later.
|
|
</p>
|
|
{{/if}}
|
|
</div>
|
|
</div>
|
|
{{/if}}
|
|
{{/unless}}
|
|
{{#if this.canDestroyVersion}}
|
|
<div class="modal-radio-button" data-test-delete-modal="destroy-version">
|
|
<RadioButton
|
|
id="destroy-version"
|
|
name="setup-deleteType"
|
|
class="radio"
|
|
@value="destroy"
|
|
@groupValue={{this.deleteType}}
|
|
@onChange={{fn (mut this.deleteType)}}
|
|
/>
|
|
<div class="helper-text">
|
|
<label for="destroy-version" data-test-type-select="destroy-version"><strong>Destroy this version</strong></label>
|
|
<p>
|
|
Version
|
|
{{@modelForData.version}}
|
|
is permanently destroyed and cannot be read or recovered later.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
{{/if}}
|
|
{{/unless}}
|
|
{{#if this.canDestroyAllVersions}}
|
|
<div class="modal-radio-button" data-test-delete-modal="destroy-all-versions">
|
|
<RadioButton
|
|
id="destroy-all-versions"
|
|
name="setup-deleteType"
|
|
class="radio"
|
|
@value="destroy-all-versions"
|
|
@groupValue={{this.deleteType}}
|
|
@onChange={{fn (mut this.deleteType)}}
|
|
/>
|
|
<div class="helper-text">
|
|
<label for="destroy-all-versions" data-test-replication-type-select="destroy-all-versions">
|
|
<strong>Destroy all versions</strong>
|
|
</label>
|
|
<p>All secret versions and metadata are permanently destroyed and cannot be read or recovered later.</p>
|
|
</div>
|
|
</div>
|
|
{{/if}}
|
|
</section>
|
|
<footer class="modal-card-foot modal-card-foot-outlined">
|
|
<button
|
|
type="button"
|
|
class="button is-danger-outlined"
|
|
{{on "click" (fn this.handleDelete this.deleteType (action (mut this.showDeleteModal) false))}}
|
|
disabled={{if this.deleteType false true}}
|
|
data-test-modal-delete
|
|
>
|
|
Delete
|
|
</button>
|
|
<button type="button" class="button is-secondary" {{on "click" (action (mut this.showDeleteModal) false)}}>
|
|
Cancel
|
|
</button>
|
|
</footer>
|
|
</Modal>
|
|
{{else if this.canDeleteSecretData}}
|
|
<ConfirmAction
|
|
@buttonClasses="toolbar-link"
|
|
@confirmTitle="Delete secret?"
|
|
@confirmMessage="You will not be able to recover this secret data later."
|
|
@onConfirmAction={{action "handleDelete" "v1"}}
|
|
data-test-secret-v1-delete="true"
|
|
>
|
|
Delete
|
|
</ConfirmAction>
|
|
<div class="toolbar-separator"></div>
|
|
{{/if}} |