-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
transformation-edit.hbs
127 lines (123 loc) · 3.73 KB
/
transformation-edit.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
<PageHeader as |p|>
<p.top>
<KeyValueHeader @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 capabilities.canDelete}}
{{#if (gt model.allowed_roles.length 0)}}
<ToolTip
@verticalPosition="above"
@horizontalPosition="center"
as |T|>
<T.trigger @tabindex="-1">
<button
class="toolbar-link"
aria-disabled="true"
type="button"
disabled
>
Delete transformation
</button>
</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}}
<button
class="toolbar-link"
onclick={{action (mut isDeleteModalActive) true}}
type="button"
>
Delete transformation
</button>
{{/if}}
<div class="toolbar-separator" />
{{/if}}
{{#if capabilities.canUpdate }}
{{#if (gt model.allowed_roles.length 0)}}
<button
class="toolbar-link"
onclick={{action (mut isEditModalActive) true}}
type="button"
data-test-edit-link
>
Edit transformation
</button>
{{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="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">
<LinkTo @route="vault.cluster.secrets.backend.edit" @model={{model.id}} @tagName="button" class="button is-primary" data-test-edit-confirm-button={{true}}>
Confirm
</LinkTo>
<button
type="button"
class="button is-secondary"
onclick={{action (mut isEditModalActive) false}}
>
Cancel
</button>
</footer>
</Modal>