forked from hashicorp/vault
-
Notifications
You must be signed in to change notification settings - Fork 0
/
secret-delete-menu.hbs
133 lines (132 loc) · 5.22 KB
/
secret-delete-menu.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
{{#unless @isV2}}
{{#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" />
{{/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 (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>
{{/unless}}