From e1c08524fbed7c508c12050307e183224d7581d0 Mon Sep 17 00:00:00 2001 From: "Anvith K.S" Date: Mon, 19 Oct 2020 21:13:05 +0530 Subject: [PATCH 1/4] Fixed issues with Huawei FS create form. --- .../cloud-file-share-create.component.html | 2 +- .../cloud-file-share-create.component.ts | 60 +++++++++++++++---- 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.html b/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.html index 851acc86..d4e20ac9 100644 --- a/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.html +++ b/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.html @@ -57,7 +57,7 @@

{{i18n.keyID['sds_creatFileShare']}}

- + diff --git a/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.ts b/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.ts index 0916876d..f7cca87d 100644 --- a/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.ts +++ b/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.ts @@ -36,6 +36,8 @@ export class CloudFileShareCreateComponent implements OnInit{ isVisible: boolean = false; showField: boolean = true; sfsType: string = "SFS"; + protocolTypeOptions: any; + selectedProtocol; errorMessage = { "name": { required: "Name is required", @@ -99,6 +101,13 @@ export class CloudFileShareCreateComponent implements OnInit{ 'description': new FormControl('', {validators:[Validators.maxLength(250),Validators.pattern(this.validRule.description)]}), 'type' : new FormControl('cloudFS') }); + + this.protocolTypeOptions = [ + { + label: 'NFS', + value: 'NFS' + } + ]; this.getTypes(); this.getBackends(); } @@ -156,6 +165,9 @@ export class CloudFileShareCreateComponent implements OnInit{ if(this.cloudFileShareCreateForm.controls['sfsType']){ this.cloudFileShareCreateForm.removeControl('sfsType'); } + if(this.cloudFileShareCreateForm.controls['size']){ + this.cloudFileShareCreateForm.removeControl('size'); + } this.cloudFileShareCreateForm.addControl('size', this.fb.control('')); this.cloudFileShareCreateForm.removeControl('availabilityZone'); if(this.cloudFileShareCreateForm.get('metadata')){ @@ -178,6 +190,9 @@ export class CloudFileShareCreateComponent implements OnInit{ this.cloudFileShareCreateForm.controls['name'].setValidators([Validators.required, Validators.minLength(2), Validators.maxLength(16), Validators.pattern(this.validRule.name),Utils.isExisted(this.allNamesForCheck)]); this.errorMessage.name.maxlength = "The file share name should have maximum 16 characters." this.cloudFileShareCreateForm.controls['name'].updateValueAndValidity(); + if(this.cloudFileShareCreateForm.controls['size']){ + this.cloudFileShareCreateForm.removeControl('size'); + } this.cloudFileShareCreateForm.addControl('size', this.fb.control('1024', [Validators.required])); this.cloudFileShareCreateForm.addControl('availabilityZone', this.fb.control('')); this.cloudFileShareCreateForm.removeControl('encrypted'); @@ -206,9 +221,19 @@ export class CloudFileShareCreateComponent implements OnInit{ this.cloudFileShareCreateForm.removeControl('size'); } this.cloudFileShareCreateForm.removeControl('availabilityZone'); + this.cloudFileShareCreateForm.removeControl('encrypted'); + this.cloudFileShareCreateForm.removeControl('encryptionSettings'); this.cloudFileShareCreateForm.addControl('encrypted', this.fb.control(false, [Validators.required])); - if(this.cloudFileShareCreateForm.controls['encrypted']){ - this.cloudFileShareCreateForm.addControl('encryptionSettings', this.fb.array([this.createEncryptionSettings('KmsKeyId', '')])); + if(!this.cloudFileShareCreateForm.controls['encryptionSettings']){ + if(this.cloudFileShareCreateForm.controls['encrypted']){ + this.cloudFileShareCreateForm.get("encrypted").valueChanges.subscribe( + (value:string)=>{ + if(value){ + this.cloudFileShareCreateForm.addControl('encryptionSettings', this.fb.array([this.createEncryptionSettings('KmsKeyId', '')])); + } + } + ); + } } this.cloudFileShareCreateForm.removeControl('tags'); this.cloudFileShareCreateForm.addControl('tags', this.fb.array([this.createTags('Name','')])); @@ -231,11 +256,24 @@ export class CloudFileShareCreateComponent implements OnInit{ this.cloudFileShareCreateForm.addControl('size', this.fb.control('1', [Validators.required])); this.cloudFileShareCreateForm.addControl('availabilityZone', this.fb.control('')); this.cloudFileShareCreateForm.addControl('encrypted', this.fb.control(false, [Validators.required])); - this.cloudFileShareCreateForm.addControl('protocols', this.fb.control('NFS')); - if(this.cloudFileShareCreateForm.controls['encrypted']){ - this.cloudFileShareCreateForm.addControl('encryptionSettings', this.fb.array([this.createEncryptionSettings('KmsKeyId', '')])); - this.addNextEncryptionSettings('KmsKeyName', 'sfs/default'); - this.addNextEncryptionSettings('DomainId', ''); + this.cloudFileShareCreateForm.addControl('protocols', this.fb.control('')); + this.cloudFileShareCreateForm.removeControl('encrypted'); + this.cloudFileShareCreateForm.removeControl('encryptionSettings'); + this.cloudFileShareCreateForm.addControl('encrypted', this.fb.control(false, [Validators.required])); + if(!this.cloudFileShareCreateForm.controls['encryptionSettings']){ + if(this.cloudFileShareCreateForm.controls['encrypted']){ + this.cloudFileShareCreateForm.get("encrypted").valueChanges.subscribe( + (value:string)=>{ + if(value){ + this.cloudFileShareCreateForm.addControl('encryptionSettings', this.fb.array([this.createEncryptionSettings('KmsKeyId', '')])); + this.addNextEncryptionSettings('KmsKeyName', 'sfs/default'); + this.addNextEncryptionSettings('DomainId', ''); + } else{ + this.cloudFileShareCreateForm.removeControl('encryptionSettings'); + } + } + ); + } } this.cloudFileShareCreateForm.removeControl('tags'); this.cloudFileShareCreateForm.addControl('tags', this.fb.array([this.createTags('Name','')])); @@ -376,11 +414,11 @@ export class CloudFileShareCreateComponent implements OnInit{ dataArr['tags'] = value['tags']; } if(value['protocols']){ - var protoArr:string[]; - protoArr = [value['protocols']] - dataArr['protocols'] = protoArr; + dataArr['protocols'] = []; + value['protocols'].forEach(protoElement => { + dataArr['protocols'].push(protoElement); + }); } - return dataArr; } onSubmit(value){ From 451c896ef74a830e6b844ec5db4e47f319f875d4 Mon Sep 17 00:00:00 2001 From: "Anvith K.S" Date: Mon, 19 Oct 2020 21:20:49 +0530 Subject: [PATCH 2/4] Fixed size not updated when changed from GCP to Huawei --- .../create/cloud-file-share-create.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.ts b/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.ts index f7cca87d..db69f0f9 100644 --- a/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.ts +++ b/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.ts @@ -252,7 +252,9 @@ export class CloudFileShareCreateComponent implements OnInit{ } ); } - + if(this.cloudFileShareCreateForm.controls['size']){ + this.cloudFileShareCreateForm.removeControl('size'); + } this.cloudFileShareCreateForm.addControl('size', this.fb.control('1', [Validators.required])); this.cloudFileShareCreateForm.addControl('availabilityZone', this.fb.control('')); this.cloudFileShareCreateForm.addControl('encrypted', this.fb.control(false, [Validators.required])); From 34b1433bc3276863a91f9249f9182e2e87bc5aaf Mon Sep 17 00:00:00 2001 From: "Anvith K.S" Date: Mon, 19 Oct 2020 21:28:33 +0530 Subject: [PATCH 3/4] Fixed CI error. Added missing multiselect module --- .../cloud-file-share/create/cloud-file-share-create.module.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/business/block/cloud-file-share/create/cloud-file-share-create.module.ts b/src/app/business/block/cloud-file-share/create/cloud-file-share-create.module.ts index d1b3b0c3..76399c29 100644 --- a/src/app/business/block/cloud-file-share/create/cloud-file-share-create.module.ts +++ b/src/app/business/block/cloud-file-share/create/cloud-file-share-create.module.ts @@ -7,7 +7,7 @@ import { CloudFileShareCreateComponent } from './cloud-file-share-create.compone import { RouterModule } from '@angular/router'; import { DataTableModule, DropMenuModule, DialogModule, FormModule, InputTextModule, InputTextareaModule, - DropdownModule, ConfirmationService, ConfirmDialogModule, CalendarModule, CheckboxModule, InputSwitchModule, + DropdownModule, MultiSelectModule, ConfirmationService, ConfirmDialogModule, CalendarModule, CheckboxModule, InputSwitchModule, TableModule, TabViewModule, ButtonModule, SpinnerModule, GrowlModule, RadioButtonModule } from '../../../../components/common/api'; import { HttpService } from '../../../../shared/service/Http.service'; @@ -37,6 +37,7 @@ let routers = [{ InputTextareaModule, DataTableModule, DropdownModule, + MultiSelectModule, DropMenuModule, DialogModule, FormModule, From 0191965a0bef4853121fc9d040aecde5e1213c97 Mon Sep 17 00:00:00 2001 From: "Anvith K.S" Date: Mon, 19 Oct 2020 22:03:53 +0530 Subject: [PATCH 4/4] Added CIFS to protocol options --- .../create/cloud-file-share-create.component.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.ts b/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.ts index db69f0f9..cf44a030 100644 --- a/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.ts +++ b/src/app/business/block/cloud-file-share/create/cloud-file-share-create.component.ts @@ -106,6 +106,10 @@ export class CloudFileShareCreateComponent implements OnInit{ { label: 'NFS', value: 'NFS' + }, + { + label: 'CIFS', + value: 'CIFS' } ]; this.getTypes();