/
rbd-form.component.html
338 lines (321 loc) · 14.6 KB
/
rbd-form.component.html
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
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<div class="cd-col-form"
*cdFormLoading="loading">
<form name="rbdForm"
#formDir="ngForm"
[formGroup]="rbdForm"
novalidate>
<div class="card">
<div i18n="form title"
class="card-header">{{ action | titlecase }} {{ resource | upperFirst }}</div>
<div class="card-body">
<!-- Parent -->
<div class="form-group row"
*ngIf="rbdForm.getValue('parent')">
<label i18n
class="cd-col-form-label"
for="name">{{ action | titlecase }} from</label>
<div class="cd-col-form-input">
<input class="form-control"
type="text"
id="parent"
name="parent"
formControlName="parent">
<hr>
</div>
</div>
<!-- Name -->
<div class="form-group row">
<label class="cd-col-form-label required"
for="name"
i18n>Name</label>
<div class="cd-col-form-input">
<input class="form-control"
type="text"
placeholder="Name..."
id="name"
name="name"
formControlName="name"
autofocus>
<span class="invalid-feedback"
*ngIf="rbdForm.showError('name', formDir, 'required')">
<ng-container i18n>This field is required.</ng-container>
</span>
<span class="invalid-feedback"
*ngIf="rbdForm.showError('name', formDir, 'pattern')">
<ng-container i18n>'/' and '@' are not allowed.</ng-container>
</span>
</div>
</div>
<!-- Pool -->
<div class="form-group row"
(change)="onPoolChange($event.target.value)">
<label class="cd-col-form-label"
[ngClass]="{'required': mode !== 'editing'}"
for="pool"
i18n>Pool</label>
<div class="cd-col-form-input">
<input class="form-control"
type="text"
placeholder="Pool name..."
id="pool"
name="pool"
formControlName="pool"
*ngIf="mode === 'editing' || !poolPermission.read">
<select id="pool"
name="pool"
class="form-control custom-select"
formControlName="pool"
*ngIf="mode !== 'editing' && poolPermission.read">
<option *ngIf="pools === null"
[ngValue]="null"
i18n>Loading...</option>
<option *ngIf="pools !== null && pools.length === 0"
[ngValue]="null"
i18n>-- No rbd pools available --</option>
<option *ngIf="pools !== null && pools.length > 0"
[ngValue]="null"
i18n>-- Select a pool --</option>
<option *ngFor="let pool of pools"
[value]="pool.pool_name">{{ pool.pool_name }}</option>
</select>
<span *ngIf="rbdForm.showError('pool', formDir, 'required')"
class="invalid-feedback"
i18n>This field is required.</span>
</div>
</div>
<!-- Namespace -->
<div class="form-group row"
*ngIf="mode !== 'editing' && rbdForm.getValue('pool') && namespaces === null">
<div class="cd-col-form-offset">
<i [ngClass]="[icons.spinner, icons.spin]"></i>
</div>
</div>
<div class="form-group row"
*ngIf="(mode === 'editing' && rbdForm.getValue('namespace')) || mode !== 'editing' && (namespaces && namespaces.length > 0 || !poolPermission.read)">
<label class="cd-col-form-label"
for="pool">
Namespace
</label>
<div class="cd-col-form-input">
<input class="form-control"
type="text"
placeholder="Namespace..."
id="namespace"
name="namespace"
formControlName="namespace"
*ngIf="mode === 'editing' || !poolPermission.read">
<select id="namespace"
name="namespace"
class="form-control custom-select"
formControlName="namespace"
*ngIf="mode !== 'editing' && poolPermission.read">
<option *ngIf="pools === null"
[ngValue]="null"
i18n>Loading...</option>
<option *ngIf="pools !== null && pools.length === 0"
[ngValue]="null"
i18n>-- No namespaces available --</option>
<option *ngIf="pools !== null && pools.length > 0"
[ngValue]="null"
i18n>-- Select a namespace --</option>
<option *ngFor="let namespace of namespaces"
[value]="namespace">{{ namespace }}</option>
</select>
</div>
</div>
<!-- Use a dedicated pool -->
<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="useDataPool"
name="useDataPool"
formControlName="useDataPool"
(change)="onUseDataPoolChange()">
<label class="custom-control-label"
for="useDataPool"
i18n>Use a dedicated data pool</label>
<cd-helper *ngIf="allDataPools.length <= 1">
<span i18n>You need more than one pool with the rbd application label use to use a dedicated data pool.</span>
</cd-helper>
</div>
</div>
</div>
<!-- Data Pool -->
<div class="form-group row"
*ngIf="rbdForm.getValue('useDataPool')">
<label class="cd-col-form-label"
for="dataPool">
<span [ngClass]="{'required': mode !== 'editing'}"
i18n>Data pool</span>
<cd-helper i18n-html
html="Dedicated pool that stores the object-data of the RBD.">
</cd-helper>
</label>
<div class="cd-col-form-input">
<input class="form-control"
type="text"
placeholder="Data pool name..."
id="dataPool"
name="dataPool"
formControlName="dataPool"
*ngIf="mode === 'editing' || !poolPermission.read">
<select id="dataPool"
name="dataPool"
class="form-control custom-select"
formControlName="dataPool"
(change)="onDataPoolChange($event.target.value)"
*ngIf="mode !== 'editing' && poolPermission.read">
<option *ngIf="dataPools === null"
[ngValue]="null"
i18n>Loading...</option>
<option *ngIf="dataPools !== null && dataPools.length === 0"
[ngValue]="null"
i18n>-- No data pools available --</option>
<option *ngIf="dataPools !== null && dataPools.length > 0"
[ngValue]="null">-- Select a data pool --
</option>
<option *ngFor="let dataPool of dataPools"
[value]="dataPool.pool_name">{{ dataPool.pool_name }}</option>
</select>
<span class="invalid-feedback"
*ngIf="rbdForm.showError('dataPool', formDir, 'required')"
i18n>This field is required.</span>
</div>
</div>
<!-- Size -->
<div class="form-group row">
<label class="cd-col-form-label required"
for="size"
i18n>Size</label>
<div class="cd-col-form-input">
<input id="size"
name="size"
class="form-control"
type="text"
formControlName="size"
i18n-placeholder
placeholder="e.g., 10GiB"
defaultUnit="GiB"
cdDimlessBinary>
<span class="invalid-feedback"
*ngIf="rbdForm.showError('size', formDir, 'required')"
i18n>This field is required.</span>
<span class="invalid-feedback"
*ngIf="rbdForm.showError('size', formDir, 'invalidSizeObject')"
i18n>You have to increase the size.</span>
</div>
</div>
<!-- Features -->
<div class="form-group row"
formGroupName="features">
<label i18n
class="cd-col-form-label"
for="features">Features</label>
<div class="cd-col-form-input">
<div class="custom-control custom-checkbox"
*ngFor="let feature of featuresList">
<input type="checkbox"
class="custom-control-input"
id="{{ feature.key }}"
name="{{ feature.key }}"
formControlName="{{ feature.key }}">
<label class="custom-control-label"
for="{{ feature.key }}">{{ feature.desc }}</label>
<cd-helper *ngIf="feature.helperHtml"
html="{{ feature.helperHtml }}">
</cd-helper>
</div>
</div>
</div>
<!-- Advanced -->
<div class="row">
<div class="col-sm-12">
<a class="float-right margin-right-md"
(click)="advancedEnabled = true; false"
*ngIf="!advancedEnabled"
href=""
i18n>Advanced...</a>
</div>
</div>
<div [hidden]="!advancedEnabled">
<legend class="cd-header"
i18n>Advanced</legend>
<div class="col-md-12">
<h4 class="cd-header"
i18n>Striping</h4>
<!-- Object Size -->
<div class="form-group row">
<label i18n
class="cd-col-form-label"
for="size">Object size<cd-helper>Object Size: Objects in the Ceph Storage Cluster have a maximum configurable size (e.g., 2MB, 4MB, etc.). The object size should be large enough to accommodate many stripe units, and should be a multiple of the stripe unit.</cd-helper></label>
<div class="cd-col-form-input">
<select id="obj_size"
name="obj_size"
class="form-control custom-select"
formControlName="obj_size">
<option *ngFor="let objectSize of objectSizes"
[value]="objectSize">{{ objectSize }}</option>
</select>
</div>
</div>
<!-- stripingUnit -->
<div class="form-group row">
<label class="cd-col-form-label"
[ngClass]="{'required': rbdForm.getValue('stripingCount')}"
for="stripingUnit"
i18n>Stripe unit<cd-helper>Stripe Width: Stripes have a configurable unit size (e.g., 64kb). The Ceph Client divides the data it will write to objects into equally sized stripe units, except for the last stripe unit. A stripe width, should be a fraction of the Object Size so that an object may contain many stripe units.</cd-helper></label>
<div class="cd-col-form-input">
<select id="stripingUnit"
name="stripingUnit"
class="form-control custom-select"
formControlName="stripingUnit">
<option i18n
[ngValue]="null">-- Select stripe unit --</option>
<option *ngFor="let objectSize of objectSizes"
[value]="objectSize">{{ objectSize }}</option>
</select>
<span class="invalid-feedback"
*ngIf="rbdForm.showError('stripingUnit', formDir, 'required')"
i18n>This field is required because stripe count is defined!</span>
<span class="invalid-feedback"
*ngIf="rbdForm.showError('stripingUnit', formDir, 'invalidStripingUnit')"
i18n>Stripe unit is greater than object size.</span>
</div>
</div>
<!-- Stripe Count -->
<div class="form-group row">
<label class="cd-col-form-label"
[ngClass]="{'required': rbdForm.getValue('stripingUnit')}"
for="stripingCount"
i18n>Stripe count<cd-helper>Stripe Count: The Ceph Client writes a sequence of stripe units over a series of objects determined by the stripe count. The series of objects is called an object set. After the Ceph Client writes to the last object in the object set, it returns to the first object in the object set.</cd-helper></label>
<div class="cd-col-form-input">
<input id="stripingCount"
name="stripingCount"
formControlName="stripingCount"
class="form-control"
type="number">
<span class="invalid-feedback"
*ngIf="rbdForm.showError('stripingCount', formDir, 'required')"
i18n>This field is required because stripe unit is defined!</span>
<span class="invalid-feedback"
*ngIf="rbdForm.showError('stripingCount', formDir, 'min')"
i18n>Stripe count must be greater than 0.</span>
</div>
</div>
</div>
<cd-rbd-configuration-form [form]="rbdForm"
[initializeData]="initializeConfigData"
(changes)="getDirtyConfigurationValues = $event"></cd-rbd-configuration-form>
</div>
</div>
<div class="card-footer">
<cd-form-button-panel (submitActionEvent)="submit()"
[form]="formDir"
[submitText]="(action | titlecase) + ' ' + (resource | upperFirst)"
wrappingClass="text-right"></cd-form-button-panel>
</div>
</div>
</form>
</div>