Skip to content

Commit 8b5b1ad

Browse files
authored
Merge pull request ceph#59332 from afreen23/nvmeof-group-mtls
mgr/dashboard: Add group field in nvmeof service form Reviewed-by: Afreen Misbah <[email protected]>
2 parents 59891f0 + c90cf84 commit 8b5b1ad

File tree

4 files changed

+42
-2
lines changed

4 files changed

+42
-2
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,30 @@
105105
</div>
106106
</div>
107107

108+
<!-- Group Name -->
109+
<div class="form-group row"
110+
*ngIf="serviceForm.controls.service_type.value === 'nvmeof'">
111+
<label class="cd-col-form-label required"
112+
for="group">
113+
<span i18n>Group Name</span>
114+
</label>
115+
<div class="cd-col-form-input">
116+
<div class="input-group">
117+
<input id="group"
118+
class="form-control"
119+
type="text"
120+
formControlName="group"
121+
(change)="onNvmeofGroupChange($event.target.value)">
122+
</div>
123+
<cd-help-text i18n>
124+
The name of the gateway group.
125+
</cd-help-text>
126+
<span class="invalid-feedback"
127+
*ngIf="serviceForm.showError('service_id', frm, 'required')"
128+
i18n>This field is required.</span>
129+
</div>
130+
</div>
131+
108132
<!-- Service id -->
109133
<div class="form-group row"
110134
*ngIf="serviceForm.controls.service_type.value !== 'snmp-gateway'">

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ x4Ea7kGVgx9kWh5XjWz9wjZvY49UKIT5ppIAWPMbLl3UpfckiuNhTA==
392392
formHelper.setValue('service_type', 'nvmeof');
393393
formHelper.setValue('service_id', 'svc');
394394
formHelper.setValue('pool', 'xyz');
395+
formHelper.setValue('group', 'abc');
395396
});
396397

397398
it('should submit nvmeof', () => {
@@ -401,7 +402,8 @@ x4Ea7kGVgx9kWh5XjWz9wjZvY49UKIT5ppIAWPMbLl3UpfckiuNhTA==
401402
service_id: 'svc',
402403
placement: {},
403404
unmanaged: false,
404-
pool: 'xyz'
405+
pool: 'xyz',
406+
group: 'abc'
405407
});
406408
});
407409

@@ -412,6 +414,10 @@ x4Ea7kGVgx9kWh5XjWz9wjZvY49UKIT5ppIAWPMbLl3UpfckiuNhTA==
412414
it('should throw error when there is no pool', () => {
413415
formHelper.expectErrorChange('pool', '', 'required');
414416
});
417+
418+
it('should throw error when there is no group', () => {
419+
formHelper.expectErrorChange('group', '', 'required');
420+
});
415421
});
416422

417423
describe('should test service smb', () => {

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ export class ServiceFormComponent extends CdForm implements OnInit {
195195
})
196196
]
197197
],
198+
group: [null, Validators.required],
198199
// RGW
199200
rgw_frontend_port: [null, [CdValidators.number(false)]],
200201
realm_name: [null],
@@ -522,6 +523,7 @@ export class ServiceFormComponent extends CdForm implements OnInit {
522523
break;
523524
case 'nvmeof':
524525
this.serviceForm.get('pool').setValue(response[0].spec.pool);
526+
this.serviceForm.get('group').setValue(response[0].spec.group);
525527
break;
526528
case 'rgw':
527529
this.serviceForm
@@ -778,10 +780,13 @@ export class ServiceFormComponent extends CdForm implements OnInit {
778780
?.pool_name;
779781
if (defaultRbdPool) {
780782
this.serviceForm.get('pool').setValue(defaultRbdPool);
781-
this.serviceForm.get('service_id').setValue(defaultRbdPool);
782783
}
783784
}
784785

786+
onNvmeofGroupChange(groupName: string) {
787+
this.serviceForm.get('service_id').setValue(groupName);
788+
}
789+
785790
requiresServiceId(serviceType: string) {
786791
return ['mds', 'rgw', 'nfs', 'iscsi', 'nvmeof', 'smb', 'ingress'].includes(serviceType);
787792
}
@@ -837,6 +842,7 @@ export class ServiceFormComponent extends CdForm implements OnInit {
837842
break;
838843
case 'nvmeof':
839844
this.serviceForm.get('pool').disable();
845+
this.serviceForm.get('group').disable();
840846
break;
841847
}
842848
}
@@ -920,6 +926,9 @@ export class ServiceFormComponent extends CdForm implements OnInit {
920926
break;
921927

922928
case 'nvmeof':
929+
serviceSpec['pool'] = values['pool'];
930+
serviceSpec['group'] = values['group'];
931+
break;
923932
case 'iscsi':
924933
serviceSpec['pool'] = values['pool'];
925934
break;

src/pybind/mgr/dashboard/frontend/src/app/shared/models/service.interface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface CephServiceAdditionalSpec {
3131
monitor_port: number;
3232
virtual_interface_networks: string[];
3333
pool: string;
34+
group: string;
3435
rgw_frontend_ssl_certificate: string;
3536
ssl: boolean;
3637
ssl_cert: string;

0 commit comments

Comments
 (0)