diff options
author | 2019-03-29 16:01:02 +0530 | |
---|---|---|
committer | 2019-03-29 18:56:21 +0000 | |
commit | 18ae6cc59d9c2be78088903010e22706e3a5e44b (patch) | |
tree | 1a23c11a82ee3c2eee4e81c514d196cb7a420287 /cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts | |
parent | 33406683825449874c490349778f27206c51dbca (diff) |
Resources metadata changes
Change-Id: Ifddeb90d0e28ccc6023b5f7efe8568b41db08f84
Issue-ID: CCSDK-804
Signed-off-by: sp00501638 <sp00501638@techmahindra.com>
Diffstat (limited to 'cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts')
-rw-r--r-- | cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts index 536be26cd..29244f0fb 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, EventEmitter, Output } from '@angular/core'; import {FormBuilder, FormGroup, Validators} from '@angular/forms'; import { IResources } from 'src/app/common/core/store/models/resources.model'; import { IResourcesState } from 'src/app/common/core/store/models/resourcesState.model'; @@ -45,7 +45,8 @@ export class ResourceMetadataComponent implements OnInit { resources: IResources; propertyValues = []; property = []; - + @Output() resourcesData = new EventEmitter(); + constructor(private formBuilder: FormBuilder, private store: Store<IAppState>) { this.rdState = this.store.select('resources'); this.ResourceMetadata = this.formBuilder.group({ @@ -68,16 +69,27 @@ export class ResourceMetadataComponent implements OnInit { this.properties= resourcesState.resources.property; this.propertyValues= this.checkNested(this.properties); this.ResourceMetadata = this.formBuilder.group({ - Resource_Name: [this.resource_name, Validators.required], - _tags: [this.tags, Validators.required], - _description : [ this.propertyValues[0], Validators.required], - _type: [ this.propertyValues[1], Validators.required], - required: [ this.propertyValues[2], Validators.required], - entry_schema: [this.propertyValues[3]] + Resource_Name: [this.resource_name, Validators.required], + _tags: [this.tags, Validators.required], + _description : [ this.propertyValues[0], Validators.required], + _type: [ this.propertyValues[1], Validators.required], + required: [ JSON.stringify(this.propertyValues[2]), Validators.required], + entry_schema: [this.propertyValues[3]] }); }) } - + + UploadMetadata() { + + this.resources.name = this.ResourceMetadata.value.Resource_Name; + this.resources.tags = this.ResourceMetadata.value._tags; + this.resources.property.description = this.ResourceMetadata.value._description; + this.resources.property.type = this.ResourceMetadata.value._type; + this.resources.property.required = this.ResourceMetadata.value.required; + this.resources.property.entry_schema = this.ResourceMetadata.value.entry_schema; + this.resourcesData.emit(this.resources); + } + checkNested(obj) { for (let key in obj) { if (obj.hasOwnProperty(key)) { |