mgr/dashboard: fix unmanged iscsi service creation

Signed-off-by: Nizamudeen A <nia@redhat.com>
This commit is contained in:
Nizamudeen A 2022-08-24 15:46:10 +05:30
parent ea68560e14
commit 7d157fe48e
2 changed files with 34 additions and 30 deletions

View File

@ -212,35 +212,37 @@
</ng-container>
<!-- iSCSI -->
<ng-container *ngIf="!serviceForm.controls.unmanaged.value && serviceForm.controls.service_type.value === 'iscsi'">
<!-- pool -->
<div class="form-group row">
<label i18n
class="cd-col-form-label required"
for="pool">Pool</label>
<div class="cd-col-form-input">
<select id="pool"
name="pool"
class="form-control"
formControlName="pool">
<option *ngIf="pools === null"
[ngValue]="null"
i18n>Loading...</option>
<option *ngIf="pools && pools.length === 0"
[ngValue]="null"
i18n>-- No pools available --</option>
<option *ngIf="pools && 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 class="invalid-feedback"
*ngIf="serviceForm.showError('pool', frm, 'required')"
i18n>This field is required.</span>
</div>
<!-- pool -->
<div class="form-group row"
*ngIf="serviceForm.controls.service_type.value === 'iscsi'">
<label i18n
class="cd-col-form-label required"
for="pool">Pool</label>
<div class="cd-col-form-input">
<select id="pool"
name="pool"
class="form-control"
formControlName="pool">
<option *ngIf="pools === null"
[ngValue]="null"
i18n>Loading...</option>
<option *ngIf="pools && pools.length === 0"
[ngValue]="null"
i18n>-- No pools available --</option>
<option *ngIf="pools && 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 class="invalid-feedback"
*ngIf="serviceForm.showError('pool', frm, 'required')"
i18n>This field is required.</span>
</div>
</div>
<!-- fields in iSCSI which are hidden when unmanaged is true -->
<ng-container *ngIf="!serviceForm.controls.unmanaged.value && serviceForm.controls.service_type.value === 'iscsi'">
<!-- trusted_ip_list -->
<div class="form-group row">
<label class="cd-col-form-label"

View File

@ -147,8 +147,7 @@ export class ServiceFormComponent extends CdForm implements OnInit {
null,
[
CdValidators.requiredIf({
service_type: 'iscsi',
unmanaged: false
service_type: 'iscsi'
})
]
],
@ -575,6 +574,10 @@ export class ServiceFormComponent extends CdForm implements OnInit {
serviceSpec['monitor_port'] = values['monitor_port'];
}
break;
case 'iscsi':
serviceSpec['pool'] = values['pool'];
break;
}
if (!values['unmanaged']) {
@ -602,7 +605,6 @@ export class ServiceFormComponent extends CdForm implements OnInit {
}
break;
case 'iscsi':
serviceSpec['pool'] = values['pool'];
if (_.isString(values['trusted_ip_list']) && !_.isEmpty(values['trusted_ip_list'])) {
serviceSpec['trusted_ip_list'] = values['trusted_ip_list'].trim();
}