import { ServiceFormComponent } from './service-form.component';
import { PoolService } from '~/app/shared/api/pool.service';
import { USER } from '~/app/shared/constants/app.constants';
+import { SelectModule } from 'carbon-components-angular';
// for 'nvmeof' service
const mockPools = [
ReactiveFormsModule,
RouterTestingModule,
SharedModule,
+ SelectModule,
ToastrModule.forRoot()
]
});
expect(ssl_key).toBeNull();
});
+ it('should submit rgw with QAT Compression (None)', () => {
+ formHelper.setValue('service_type', 'rgw');
+ formHelper.setValue(component.serviceForm.get('qat').get('compression'), 'none');
+ });
+
+ it('should submit rgw with QAT Compression (Hardware)', () => {
+ formHelper.setValue('service_type', 'rgw');
+ formHelper.setValue(component.serviceForm.get('qat')?.get('compression'), 'hw');
+ });
+
+ it('should submit rgw with QAT Compression (Software)', () => {
+ formHelper.setValue('service_type', 'rgw');
+ formHelper.setValue(component.serviceForm.get('qat')?.get('compression'), 'sw');
+ });
+
it('should test .pem file', () => {
const pemCert = `
-----BEGIN CERTIFICATE-----
import { CdValidators } from '~/app/shared/forms/cd-validators';
import { FinishedTask } from '~/app/shared/models/finished-task';
import { Host } from '~/app/shared/models/host.interface';
-import { CephServiceSpec } from '~/app/shared/models/service.interface';
+import { CephServiceSpec, QatOptions, QatSepcs } from '~/app/shared/models/service.interface';
import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
import { TaskWrapperService } from '~/app/shared/services/task-wrapper.service';
import { TimerService } from '~/app/shared/services/timer.service';
selected: false
}));
showMgmtGatewayMessage: boolean = false;
+ qatCompressionOptions = [
+ { value: QatOptions.hw, label: 'Hardware' },
+ { value: QatOptions.sw, label: 'Software' },
+ { value: QatOptions.none, label: 'None' }
+ ];
constructor(
public actionLabels: ActionLabelsI18n,
realm_name: [null],
zonegroup_name: [null],
zone_name: [null],
+ qat: new CdFormGroup({
+ compression: new UntypedFormControl(QatOptions.none)
+ }),
// iSCSI
trusted_ip_list: [null],
api_port: [null, [CdValidators.number(false)]],
this.setRgwFields(
response[0].spec?.rgw_realm,
response[0].spec?.rgw_zonegroup,
- response[0].spec?.rgw_zone
+ response[0].spec?.rgw_zone,
+ response[0].spec?.qat
);
this.serviceForm.get('ssl').setValue(response[0].spec?.ssl);
if (response[0].spec?.ssl) {
}
}
- setRgwFields(realm_name?: string, zonegroup_name?: string, zone_name?: string) {
+ setRgwFields(realm_name?: string, zonegroup_name?: string, zone_name?: string, qat?: QatSepcs) {
const observables = [
this.rgwRealmService.getAllRealmsInfo(),
this.rgwZonegroupService.getAllZonegroupsInfo(),
this.serviceForm.get('zonegroup_name').setValue(zonegroup_name);
this.serviceForm.get('zone_name').setValue(zone_name);
}
+ if (qat) {
+ this.serviceForm.get(`qat.compression`)?.setValue(qat['compression']);
+ }
if (this.realmList.length === 0) {
this.showRealmCreationForm = true;
} else {
serviceSpec['rgw_zonegroup'] =
values['zonegroup_name'] !== 'default' ? values['zonegroup_name'] : null;
serviceSpec['rgw_zone'] = values['zone_name'] !== 'default' ? values['zone_name'] : null;
+ if (values['qat']['compression'] && values['qat']['compression'] != QatOptions.none) {
+ serviceSpec['qat'] = values['qat'];
+ } else if (values['qat']['compression'] == QatOptions.none) {
+ delete serviceSpec['qat'];
+ }
}
const serviceId: string = values['service_id'];