summaryrefslogtreecommitdiffstats
path: root/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.html
blob: bad80a7f358874f69357e14812bb03b29c78bd85 (plain)
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
<div class="cd-col-form"
     *cdFormLoading="loading">
  <form name="bucketForm"
        #frm="ngForm"
        [formGroup]="bucketForm"
        novalidate>
    <div class="card">
      <div i18n="form title"
           class="card-header">{{ action | titlecase }} {{ resource | upperFirst }}</div>

      <div class="card-body">
        <!-- Id -->
        <div class="form-group row"
             *ngIf="editing">
          <label i18n
                 class="cd-col-form-label"
                 for="id">Id</label>
          <div class="cd-col-form-input">
            <input id="id"
                   name="id"
                   class="form-control"
                   type="text"
                   formControlName="id"
                   readonly>
          </div>
        </div>

        <!-- Name -->
        <div class="form-group row">
          <label class="cd-col-form-label"
                 [ngClass]="{required: !editing}"
                 for="bid"
                 i18n>Name</label>
          <div class="cd-col-form-input">
            <input id="bid"
                   name="bid"
                   class="form-control"
                   type="text"
                   i18n-placeholder
                   placeholder="Name..."
                   formControlName="bid"
                   [readonly]="editing"
                   [autofocus]="!editing">
            <span class="invalid-feedback"
                  *ngIf="bucketForm.showError('bid', frm, 'required')"
                  i18n>This field is required.</span>
            <span class="invalid-feedback"
                  *ngIf="bucketForm.showError('bid', frm, 'bucketNameInvalid')"
                  i18n>Bucket names can only contain lowercase letters, numbers, periods and hyphens.</span>
            <span class="invalid-feedback"
                  *ngIf="bucketForm.showError('bid', frm, 'bucketNameNotAllowed')"
                  i18n>The chosen name is already in use.</span>
            <span class="invalid-feedback"
                  *ngIf="bucketForm.showError('bid', frm, 'containsUpperCase')"
                  i18n>Bucket names must not contain uppercase characters or underscores.</span>
            <span class="invalid-feedback"
                  *ngIf="bucketForm.showError('bid', frm, 'lowerCaseOrNumber')"
                  i18n>Each label must start and end with a lowercase letter or a number.</span>
            <span class="invalid-feedback"
                  *ngIf="bucketForm.showError('bid', frm, 'ipAddress')"
                  i18n>Bucket names cannot be formatted as IP address.</span>
            <span class="invalid-feedback"
                  *ngIf="bucketForm.showError('bid', frm, 'onlyLowerCaseAndNumbers')"
                  i18n>Bucket labels cannot be empty and can only contain lowercase letters, numbers and hyphens.</span>
            <span class="invalid-feedback"
                  *ngIf="bucketForm.showError('bid', frm, 'shouldBeInRange')"
                  i18n>Bucket names must be 3 to 63 characters long.</span>
          </div>
        </div>

        <!-- Owner -->
        <div class="form-group row">
          <label class="cd-col-form-label required"
                 for="owner"
                 i18n>Owner</label>
          <div class="cd-col-form-input">
            <select id="owner"
                    name="owner"
                    class="form-control"
                    formControlName="owner"
                    [autofocus]="editing">
              <option i18n
                      *ngIf="owners === null"
                      [ngValue]="null">Loading...</option>
              <option i18n
                      *ngIf="owners !== null"
                      [ngValue]="null">-- Select a user --</option>
              <option *ngFor="let owner of owners"
                      [value]="owner">{{ owner }}</option>
            </select>
            <span class="invalid-feedback"
                  *ngIf="bucketForm.showError('owner', frm, 'required')"
                  i18n>This field is required.</span>
          </div>
        </div>

        <!-- Placement target -->
        <div class="form-group row">
          <label class="cd-col-form-label"
                 [ngClass]="{required: !editing}"
                 for="placement-target"
                 i18n>Placement target</label>
          <div class="cd-col-form-input">
            <ng-template #placementTargetSelect>
              <select id="placement-target"
                      name="placement-target"
                      formControlName="placement-target"
                      class="form-control">
                <option i18n
                        *ngIf="placementTargets === null"
                        [ngValue]="null">Loading...</option>
                <option i18n
                        *ngIf="placementTargets !== null"
                        [ngValue]="null">-- Select a placement target --</option>
                <option *ngFor="let placementTarget of placementTargets"
                        [value]="placementTarget.name">{{ placementTarget.description }}</option>
              </select>
              <span class="invalid-feedback"
                    *ngIf="bucketForm.showError('placement-target', frm, 'required')"
                    i18n>This field is required.</span>
            </ng-template>
            <ng-container *ngIf="editing; else placementTargetSelect">
              <input id="placement-target"
                     name="placement-target"
                     formControlName="placement-target"
                     class="form-control"
                     type="text"
                     readonly>
            </ng-container>
          </div>
        </div>

        <!-- Versioning -->
        <fieldset *ngIf="editing">
          <legend class="cd-header"
                  i18n>Versioning</legend>

          <div class="form-group row">
            <div class="cd-col-form-offset">
              <div class="custom-control custom-checkbox">
                <input type="checkbox"
                       class="custom-control-input"
                       id="versioning"
                       name="versioning"
                       formControlName="versioning"
                       (change)="setMfaDeleteValidators()">
                <label class="custom-control-label"
                       for="versioning"
                       i18n>Enabled</label>
                <cd-helper>
                  <span i18n>Enables versioning for the objects in the bucket.</span>
                </cd-helper>
              </div>
            </div>
          </div>
        </fieldset>

        <!-- Multi-Factor Authentication -->
        <fieldset *ngIf="editing">
          <!-- MFA Delete -->
          <legend class="cd-header"
                  i18n>Multi-Factor Authentication</legend>

          <div class="form-group row">
            <div class="cd-col-form-offset">
              <div class="custom-control custom-checkbox">
                <input type="checkbox"
                       class="custom-control-input"
                       id="mfa-delete"
                       name="mfa-delete"
                       formControlName="mfa-delete"
                       (change)="setMfaDeleteValidators()">
                <label class="custom-control-label"
                       for="mfa-delete"
                       i18n>Delete enabled</label>
                <cd-helper>
                  <span i18n>Enables MFA (multi-factor authentication) Delete, which requires additional authentication for changing the bucket versioning state.</span>
                </cd-helper>
              </div>
            </div>
          </div>
          <div *ngIf="areMfaCredentialsRequired()"
               class="form-group row">
            <label i18n
                   class="cd-col-form-label"
                   for="mfa-token-serial">Token Serial Number</label>
            <div class="cd-col-form-input">
              <input type="text"
                     id="mfa-token-serial"
                     name="mfa-token-serial"
                     formControlName="mfa-token-serial"
                     class="form-control">
              <span class="invalid-feedback"
                    *ngIf="bucketForm.showError('mfa-token-serial', frm, 'required')"
                    i18n>This field is required.</span>
            </div>
          </div>
          <div *ngIf="areMfaCredentialsRequired()"
               class="form-group row">
            <label i18n
                   class="cd-col-form-label"
                   for="mfa-token-pin">Token PIN</label>
            <div class="cd-col-form-input">
              <input type="text"
                     id="mfa-token-pin"
                     name="mfa-token-pin"
                     formControlName="mfa-token-pin"
                     class="form-control">
              <span class="invalid-feedback"
                    *ngIf="bucketForm.showError('mfa-token-pin', frm, 'required')"
                    i18n>This field is required.</span>
            </div>
          </div>
        </fieldset>

        <!-- Locking -->
        <fieldset>
          <legend class="cd-header"
                  i18n>Locking</legend>

          <!-- Locking enabled -->
          <div class="form-group row">
            <div class="cd-col-form-offset">
              <div class="custom-control custom-checkbox">
                <input class="custom-control-input"
                       id="lock_enabled"
                       formControlName="lock_enabled"
                       type="checkbox">
                <label class="custom-control-label"
                       for="lock_enabled"
                       i18n>Enabled</label>
                <cd-helper>
                  <span i18n>Enables locking for the objects in the bucket. Locking can only be enabled while creating a bucket.</span>
                </cd-helper>
              </div>
            </div>
          </div>

          <!-- Locking mode -->
          <div *ngIf="bucketForm.getValue('lock_enabled')"
               class="form-group row">
            <label class="cd-col-form-label"
                   for="lock_mode"
                   i18n>Mode</label>
            <div class="cd-col-form-input">
              <select class="form-control"
                      formControlName="lock_mode"
                      name="lock_mode"
                      id="lock_mode">
                <option i18n
                        value="COMPLIANCE">Compliance</option>
                <option i18n
                        value="GOVERNANCE">Governance</option>
              </select>
            </div>
          </div>

          <!-- Retention period (days) -->
          <div *ngIf="bucketForm.getValue('lock_enabled')"
               class="form-group row">
            <label class="cd-col-form-label"
                   for="lock_retention_period_days">
              <ng-container i18n>Days</ng-container>
              <cd-helper i18n>The number of days that you want to specify for the default retention period that will be applied to new objects placed in this bucket.</cd-helper>
            </label>
            <div class="cd-col-form-input">
              <input class="form-control"
                     type="number"
                     id="lock_retention_period_days"
                     formControlName="lock_retention_period_days"
                     min="0">
              <span class="invalid-feedback"
                    *ngIf="bucketForm.showError('lock_retention_period_days', frm, 'pattern')"
                    i18n>The entered value must be a positive integer.</span>
              <span class="invalid-feedback"
                    *ngIf="bucketForm.showError('lock_retention_period_days', frm, 'lockDays')"
                    i18n>Retention Days must be a positive integer.</span>
            </div>
          </div>
        </fieldset>

      </div>
      <div class="card-footer">
        <cd-form-button-panel (submitActionEvent)="submit()"
                              [form]="bucketForm"
                              [submitText]="(action | titlecase) + ' ' + (resource | upperFirst)"
                              wrappingClass="text-right"></cd-form-button-panel>
      </div>
    </div>
  </form>
</div>