diff options
author | Ezhilarasi <ezhrajam@in.ibm.com> | 2019-08-28 19:47:07 +0530 |
---|---|---|
committer | Ezhilarasi <ezhrajam@in.ibm.com> | 2019-08-28 19:47:18 +0530 |
commit | d191268ce2a6cf15bd27b11a845f31e70f22b0a8 (patch) | |
tree | ef4c7a3f29db4e5ae513d6a466c8b0f9c61b4221 /cds-ui/client/src/app/feature-modules/blueprint | |
parent | 2e8016248a0ea29e8e4918d32bd263473520eaa3 (diff) |
Metadata form edit changes
Changes to make Metadata form edit option from search from database
Change-Id: I5602fd2609b43d8702736b039b0ab0c0105e1e1f
Issue-ID: CCSDK-1275
Signed-off-by: Ezhilarasi <ezhrajam@in.ibm.com>
Diffstat (limited to 'cds-ui/client/src/app/feature-modules/blueprint')
-rw-r--r-- | cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts index f49517017..5a0b96c14 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts @@ -48,7 +48,8 @@ export class MetadataComponent implements OnInit { blueprintName: string; uploadedFileName: string; entryDefinition: string; - + viewOnly: boolean = true; + options: string; constructor(private formBuilder: FormBuilder, private store: Store<IAppState>, private loader: LoaderService, private dataService: SelectTemplateService) { this.bpState = this.store.select('blueprint'); @@ -66,11 +67,10 @@ export class MetadataComponent implements OnInit { ngOnInit() { this.dataService.currentMessage.subscribe( res => { - let options = res; - console.log(options + " data from service ngoninit" + res); + this.options = res; + // this.metdataFormfields(res); } ); - this.bpState.subscribe( blueprintdata => { var blueprintState: IBlueprintState = { blueprint: blueprintdata.blueprint, isLoadSuccess: blueprintdata.isLoadSuccess, isSaveSuccess: blueprintdata.isSaveSuccess, isUpdateSuccess: blueprintdata.isUpdateSuccess }; @@ -92,6 +92,28 @@ export class MetadataComponent implements OnInit { } let temp_author = metadatavalues[0]; console.log(temp_author); + if(this.options=='2'){ + this.CBAMetadataForm = this.formBuilder.group({ + template_author: ['', Validators.required], + author_email: ['', Validators.required], + user_groups: [metadatavalues[2], Validators.required], + template_name: ['', Validators.required], + template_version: ['', Validators.required], + template_tags: [metadatavalues[5], Validators.required] + }); + } + else if(this.options=='3'){ + this.CBAMetadataForm = this.formBuilder.group({ + template_author: [metadatavalues[0]], + author_email: [metadatavalues[1]], + user_groups: [metadatavalues[2]], + template_name: [metadatavalues[3]], + template_version: [metadatavalues[4]], + template_tags: [metadatavalues[5]] + }); + this.CBAMetadataForm.disable(); + } + else{ this.CBAMetadataForm = this.formBuilder.group({ template_author: [metadatavalues[0], Validators.required], author_email: [metadatavalues[1], Validators.required], @@ -100,9 +122,28 @@ export class MetadataComponent implements OnInit { template_version: [metadatavalues[4], Validators.required], template_tags: [metadatavalues[5], Validators.required] }); + } + }) + + } - + + metdataFormfields(options: string) { + if (options == '2') { + this.CBAMetadataForm.setValue({ + template_author: ["", Validators.required], + author_email: ["", Validators.required], + template_name: ["", Validators.required], + template_version: ["1.0.0", Validators.required] + + }) + } + if (options == '3') { + this.CBAMetadataForm.disable(); + } + } + UploadMetadata() { this.loader.showLoader(); this.metadata = Object.assign({}, this.CBAMetadataForm.value); |