Skip to content

Commit 2546922

Browse files
authored
Merge pull request ceph#65576 from rhcs-dashboard/smb-bugfixes
mgr/dashboard: fix smb button and table column
2 parents c907601 + 9ce943e commit 2546922

File tree

5 files changed

+78
-75
lines changed

5 files changed

+78
-75
lines changed

src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-cluster-form/smb-cluster-form.component.html

Lines changed: 66 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474
<!-- Domain Settings -->
7575
<div class="form-item"
76-
*ngIf="this.smbForm.get('auth_mode').value === 'active-directory'">
76+
*ngIf="this.smbForm.get('auth_mode').value === AUTHMODE.ActiveDirectory">
7777
<div cdsCol
7878
[columnNumbers]="{ md: 12 }"
7979
class="d-flex">
@@ -130,7 +130,7 @@
130130
*ngFor="let _ of joinSources.controls; index as i">
131131
<div
132132
cdsRow
133-
*ngIf="this.smbForm.get('auth_mode').value === 'user' && usersGroups$ | async as usersGroups"
133+
*ngIf="this.smbForm.get('auth_mode').value === AUTHMODE.User && usersGroups$ | async as usersGroups"
134134
class="form-item form-item-append"
135135
>
136136
<div
@@ -180,7 +180,7 @@
180180
</ng-container>
181181

182182
<div class="form-item"
183-
*ngIf="this.smbForm.get('auth_mode').value === 'user'">
183+
*ngIf="this.smbForm.get('auth_mode').value === AUTHMODE.User">
184184
<button cdsButton="tertiary"
185185
type="button"
186186
(click)="addUserGroupSetting()"
@@ -212,7 +212,6 @@
212212
<div class="form-item">
213213
<cds-select
214214
label="Placement"
215-
for="placement"
216215
formControlName="placement"
217216
id="placement"
218217
>
@@ -286,62 +285,64 @@
286285
</div>
287286

288287
<!-- Custom DNS -->
289-
<ng-container formArrayName="custom_dns"
290-
*ngFor="let _ of custom_dns.controls; index as i">
291-
<div cdsRow
292-
class="form-item form-item-append">
293-
<div cdsCol
294-
[columnNumbers]="{ lg: 14 }">
295-
<cds-text-label
296-
for="custom_dns"
297-
i18n
298-
>DNS
299-
<input cdsText
300-
[formControlName]="i"
301-
placeholder="192.168.76.204"/>
302-
</cds-text-label>
303-
</div>
304-
<div
305-
cdsCol
306-
[columnNumbers]="{ lg: 1 }"
307-
class="item-action-btn spacing"
308-
>
309-
<cds-icon-button
310-
kind="danger"
311-
size="sm"
312-
(click)="removeCustomDNS(i)"
288+
@if (this.smbForm.get('auth_mode').value === AUTHMODE.ActiveDirectory) {
289+
<ng-container formArrayName="custom_dns"
290+
*ngFor="let _ of custom_dns.controls; index as i">
291+
<div cdsRow
292+
class="form-item form-item-append">
293+
<div cdsCol
294+
[columnNumbers]="{ lg: 14 }">
295+
<cds-text-label
296+
for="custom_dns"
297+
i18n
298+
>DNS
299+
<input cdsText
300+
[formControlName]="i"
301+
placeholder="192.168.76.204"/>
302+
</cds-text-label>
303+
</div>
304+
<div
305+
cdsCol
306+
[columnNumbers]="{ lg: 1 }"
307+
class="item-action-btn spacing"
313308
>
314-
<svg
315-
cdsIcon="trash-can"
316-
size="32"
317-
class="cds--btn__icon"
309+
<cds-icon-button
310+
kind="danger"
311+
size="sm"
312+
(click)="removeCustomDNS(i)"
318313
>
319-
</svg>
320-
</cds-icon-button>
314+
<svg
315+
cdsIcon="trash-can"
316+
size="32"
317+
class="cds--btn__icon"
318+
>
319+
</svg>
320+
</cds-icon-button>
321+
</div>
321322
</div>
322-
</div>
323-
</ng-container>
323+
</ng-container>
324324

325-
<div class="form-item">
326-
<button cdsButton="tertiary"
327-
type="button"
328-
(click)="addCustomDns()"
329-
i18n>
330-
Add custom DNS
331-
<svg
332-
cdsIcon="add"
333-
size="32"
334-
class="cds--btn__icon"
335-
icon></svg>
336-
</button>
337-
<cd-helper i18n>One or more IP Addresses that will be
338-
applied to the Samba containers to override
339-
the default DNS resolver(s). This option is
340-
intended to be used when the host Ceph node
341-
is not configured to resolve DNS entries within
342-
AD domain(s).
343-
</cd-helper>
344-
</div>
325+
<div class="form-item">
326+
<button cdsButton="tertiary"
327+
type="button"
328+
(click)="addCustomDns()"
329+
i18n>
330+
Add custom DNS
331+
<svg
332+
cdsIcon="add"
333+
size="32"
334+
class="cds--btn__icon"
335+
icon></svg>
336+
</button>
337+
<cd-helper i18n>One or more IP Addresses that will be
338+
applied to the Samba containers to override
339+
the default DNS resolver(s). This option is
340+
intended to be used when the host Ceph node
341+
is not configured to resolve DNS entries within
342+
AD domain(s).
343+
</cd-helper>
344+
</div>
345+
}
345346

346347
<!-- Clustering -->
347348
<div class="form-item">
@@ -358,6 +359,11 @@
358359
</cds-select>
359360
</div>
360361

362+
<div
363+
*ngIf="(this.smbForm.get('count').value > 1 && this.smbForm.get('clustering').value.toLowerCase() == CLUSTERING.Default) || this.smbForm.get('clustering').value.toLowerCase() == CLUSTERING.Always"
364+
class="form-item"
365+
>
366+
361367
<!-- Public addrs -->
362368
<ng-container formArrayName="public_addrs"
363369
*ngFor="let _ of public_addrs.controls; index as i">
@@ -368,20 +374,20 @@
368374
<div cdsCol
369375
[columnNumbers]="{ lg: 7 }">
370376
<cds-text-label
371-
for="public_addrs"
377+
for="address"
372378
i18n
373379
helperText="This address will be assigned to one of the host's network devices and managed automatically."
374380
i18n-helperText
375381
cdrequiredField
376-
[invalid]="smbForm?.controls['public_addrs']?.controls[i].controls.address.invalid && smbForm?.controls['public_addrs']?.controls[i].controls.address.dirty"
382+
[invalid]="smbForm?.controls['public_addrs']?.controls[i]?.controls?.address?.invalid && smbForm?.controls['public_addrs']?.controls[i]?.controls?.address?.dirty"
377383
[invalidText]="addressError"
378384
>Address
379385
<input
380386
cdsText
381387
type="text"
382388
formControlName="address"
383389
placeholder="192.168.4.51/24"
384-
[invalid]="smbForm?.controls['public_addrs'].controls[i].controls.address.invalid && smbForm?.controls['public_addrs']?.controls[i].controls.address.dirty"
390+
[invalid]="smbForm?.controls['public_addrs'].controls[i].controls?.address?.invalid && smbForm?.controls['public_addrs']?.controls[i]?.controls?.address?.dirty"
385391
/>
386392
</cds-text-label>
387393
<ng-template #addressError>
@@ -396,7 +402,7 @@
396402
<div cdsCol
397403
[columnNumbers]="{ lg: 7 }">
398404
<cds-text-label
399-
for="public_addrs"
405+
for="destination"
400406
i18n
401407
helperText="Defines where the system will assign the managed IPs. Each string value must be a network address."
402408
i18n-helperText
@@ -426,10 +432,6 @@
426432
</div>
427433
</ng-container>
428434
</ng-container>
429-
<div
430-
*ngIf="(this.smbForm.get('count').value > 1 && this.smbForm.get('clustering').value.toLowerCase() == CLUSTERING.Default) || this.smbForm.get('clustering').value.toLowerCase() == CLUSTERING.Always"
431-
class="form-item"
432-
>
433435
<button cdsButton="tertiary"
434436
type="button"
435437
(click)="addPublicAddrs()"

src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-cluster-form/smb-cluster-form.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe('SmbClusterFormComponent', () => {
8181
});
8282

8383
it('should check submit request', () => {
84-
component.smbForm.get('auth_mode').setValue(AUTHMODE.activeDirectory);
84+
component.smbForm.get('auth_mode').setValue(AUTHMODE.ActiveDirectory);
8585
component.smbForm.get('domain_settings').setValue('test-realm');
8686
component.smbForm.get('cluster_id').setValue('cluster-id');
8787
component.submitAction();

src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-cluster-form/smb-cluster-form.component.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export class SmbClusterFormComponent extends CdForm implements OnInit {
5151
orchStatus$: Observable<any>;
5252
allClustering: string[] = [];
5353
CLUSTERING = CLUSTERING;
54+
AUTHMODE = AUTHMODE;
5455
selectedLabels: string[] = [];
5556
selectedHosts: string[] = [];
5657
action: string;
@@ -130,7 +131,7 @@ export class SmbClusterFormComponent extends CdForm implements OnInit {
130131
customDnsFormArray.push(new FormControl(dns));
131132
});
132133
}
133-
if (this.clusterResponse.auth_mode == AUTHMODE.activeDirectory) {
134+
if (this.clusterResponse.auth_mode == AUTHMODE.ActiveDirectory) {
134135
this.domainSettingsObject = this.clusterResponse?.domain_settings;
135136
this.smbForm.get('domain_settings').setValue(this.domainSettingsObject.realm);
136137
} else {
@@ -187,13 +188,13 @@ export class SmbClusterFormComponent extends CdForm implements OnInit {
187188
validators: [Validators.required]
188189
}),
189190
auth_mode: [
190-
AUTHMODE.activeDirectory,
191+
AUTHMODE.ActiveDirectory,
191192
{
192193
validators: [Validators.required]
193194
}
194195
],
195196
domain_settings: [null],
196-
placement: [{}],
197+
placement: [],
197198
hosts: [[]],
198199
label: [
199200
null,
@@ -229,7 +230,7 @@ export class SmbClusterFormComponent extends CdForm implements OnInit {
229230
const userGroupSettingsControl = this.smbForm.get('joinSources') as FormArray;
230231

231232
// User Group Setting should be optional if authMode is "Active Directory"
232-
if (authMode === AUTHMODE.activeDirectory) {
233+
if (authMode === AUTHMODE.ActiveDirectory) {
233234
if (userGroupSettingsControl) {
234235
userGroupSettingsControl.clear();
235236
}
@@ -285,7 +286,7 @@ export class SmbClusterFormComponent extends CdForm implements OnInit {
285286
}
286287

287288
// Domain Setting should be mandatory if authMode is "Active Directory"
288-
if (authMode === AUTHMODE.activeDirectory && !domainSettingsControl.value) {
289+
if (authMode === AUTHMODE.ActiveDirectory && !domainSettingsControl.value) {
289290
domainSettingsControl.setErrors({ required: true });
290291
this.smbForm.markAllAsTouched();
291292
return;
@@ -381,7 +382,7 @@ export class SmbClusterFormComponent extends CdForm implements OnInit {
381382
requestModel.cluster_resource.clustering = rawFormValue.clustering.toLowerCase();
382383
}
383384

384-
if (rawFormValue.placement.count) {
385+
if (rawFormValue.placement?.count) {
385386
requestModel.cluster_resource.count = rawFormValue.placement.count;
386387
}
387388

@@ -450,8 +451,8 @@ export class SmbClusterFormComponent extends CdForm implements OnInit {
450451

451452
addPublicAddrs() {
452453
const control = this.formBuilder.group({
453-
address: ['', Validators.required],
454-
destination: ['']
454+
address: new FormControl('', { validators: [Validators.required] }),
455+
destination: new FormControl('')
455456
});
456457
this.public_addrs.push(control);
457458
}

src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb-usersgroups-list/smb-usersgroups-list.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export class SmbUsersgroupsListComponent extends ListWithDetails implements OnIn
7676
},
7777
{
7878
name: $localize`Linked to cluster`,
79-
prop: 'values.linked_to_cluster',
79+
prop: 'linked_to_cluster',
8080
flexGrow: 2
8181
}
8282
];

src/pybind/mgr/dashboard/frontend/src/app/ceph/smb/smb.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export const RESOURCE = {
6868

6969
export const AUTHMODE = {
7070
User: 'user',
71-
activeDirectory: 'active-directory'
71+
ActiveDirectory: 'active-directory'
7272
};
7373

7474
export const PLACEMENT = {

0 commit comments

Comments
 (0)