open-vault/ui/app/templates/components/secret-delete-menu.hbs
Jordan Reimer 5c2a08de6d
Ember Upgrade to 3.24 (#13443)
* Update browserslist

* Add browserslistrc

* ember-cli-update --to 3.26, fix conflicts

* Run codemodes that start with ember-*

* More codemods - before cp*

* More codemods (curly data-test-*)

* WIP ember-basic-dropdown template errors

* updates ember-basic-dropdown and related deps to fix build issues

* updates basic dropdown instances to new version API

* updates more deps -- ember-template-lint is working again

* runs no-implicit-this codemod

* creates and runs no-quoteless-attributes codemod

* runs angle brackets codemod

* updates lint:hbs globs to only touch hbs files

* removes yield only templates

* creates and runs deprecated args transform

* supresses lint error for invokeAction on LinkTo component

* resolves remaining ambiguous path lint errors

* resolves simple-unless lint errors

* adds warnings for deprecated tagName arg on LinkTo components

* adds warnings for remaining curly component invocation

* updates global template lint rules

* resolves remaining template lint errors

* disables some ember specfic lint rules that target pre octane patterns

* js lint fix run

* resolves remaining js lint errors

* fixes test run

* adds npm-run-all dep

* fixes test attribute issues

* fixes console acceptance tests

* fixes tests

* adds yield only wizard/tutorial-active template

* fixes more tests

* attempts to fix more flaky tests

* removes commented out settled in transit test

* updates deprecations workflow and adds initializer to filter by version

* updates flaky policies acl old test

* updates to flaky transit test

* bumps ember deps down to LTS version

* runs linters after main merge

* fixes client count tests after bad merge conflict fixes

* fixes client count history test

* more updates to lint config

* another round of hbs lint fixes after extending stylistic rule

* updates lint-staged commands

* removes indent eslint rule since it seems to break things

* fixes bad attribute in transform-edit-form template

* test fixes

* fixes enterprise tests

* adds changelog

* removes deprecated ember-concurrency-test-waiters dep and adds @ember/test-waiters

* flaky test fix

Co-authored-by: hashishaw <cshaw@hashicorp.com>
2021-12-16 20:44:29 -07:00

136 lines
5.3 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
@value={{if this.canSoftDeleteSecretData "soft-delete" "delete-latest-version"}}
@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-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-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}}
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}}