8f5d62139c
* initial setup, modify toolbar header * footer buttons setup * setup first delete version delete method * clean up * handle destory all versions * handle undelete * conditional for modal and undelete * remove delete from version area * modelForData in permissions * setup for soft delete and modify adpater to allow DELETE in additon to POST * dropdown for soft delete * stuck * handle all soft deletes * conditional for destroy all versions * remove old functionality from secret-version-menu * glimmerize secret-version-menu * Updated secret version menu and version history * Updated icons and columns in version history * create new component * clean up * glimmerize secret delete menu * fix undelete * Fixed radio labels in version delete menu * handle v1 delete * refining * handle errors with flash messages * add changelog * fix test * add to test * amend test * address PR comments * whoopies * add urlEncoding Co-authored-by: Arnav Palnitkar <arnav@hashicorp.com>
132 lines
5 KiB
Handlebars
132 lines
5 KiB
Handlebars
{{#unless @isV2}}
|
|
{{#if this.canDelete}}
|
|
<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>
|
|
{{/if}}
|
|
{{else}}
|
|
{{#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 false))}}
|
|
data-test-delete-open-modal
|
|
>
|
|
{{if (and (not @modelForData.deleted) (not @modelForData.destroyed)) "Delete" "Destroy"}}
|
|
</button>
|
|
<div class="toolbar-separator"/>
|
|
{{else}}
|
|
{{#if (or this.canDeleteAnyVersion (and this.isLatestVersion this.canDelete))}}
|
|
<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 canDeleteAnyVersion "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 this.canDelete}}
|
|
<div class="modal-radio-button" data-test-delete-modal="delete-version">
|
|
<RadioButton
|
|
@value="delete"
|
|
@radioClass="radio"
|
|
@groupValue={{this.deleteType}}
|
|
@changed={{action (mut this.deleteType)}}
|
|
@name="setup-deleteType"
|
|
@radioId="delete-version"
|
|
/>
|
|
<div class="helper-text">
|
|
<label for="delete-version" data-test-replication-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>
|
|
</div>
|
|
</div>
|
|
{{/if}}
|
|
{{/unless}}
|
|
{{#if this.canDestroyVersion}}
|
|
<div class="modal-radio-button" data-test-delete-modal="destroy-version">
|
|
<RadioButton
|
|
@value="destroy"
|
|
@radioClass="radio"
|
|
@groupValue={{this.deleteType}}
|
|
@changed={{action (mut this.deleteType)}}
|
|
@name="setup-deleteType"
|
|
@radioId="destroy-version"
|
|
/>
|
|
<div class="helper-text">
|
|
<label for="destroy-version" data-test-replication-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
|
|
@value="destroy-all-versions"
|
|
@radioClass="radio"
|
|
@groupValue={{this.deleteType}}
|
|
@changed={{action (mut this.deleteType)}}
|
|
@name="setup-deleteType"
|
|
@radioId="destroy-all-versions"
|
|
/>
|
|
<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 has-text-danger"
|
|
{{on "click" (fn this.handleDelete this.deleteType (action (mut this.showDeleteModal) false))}}
|
|
disabled={{if this.deleteType false true}}
|
|
>
|
|
Delete
|
|
</button>
|
|
<button
|
|
type="button"
|
|
class="button is-secondary"
|
|
{{on "click" (action (mut this.showDeleteModal) false)}}
|
|
>
|
|
Cancel
|
|
</button>
|
|
</footer>
|
|
</Modal>
|
|
{{/unless}}
|