diff options
author | 2019-03-31 12:44:35 +0000 | |
---|---|---|
committer | 2019-03-31 12:44:35 +0000 | |
commit | 937b65217fda8763f4770c5bb7f0cfac1ecf8c1a (patch) | |
tree | 188939b628b993ac74fdcbdd27fc2d01be29342f /cds-ui/client/src/app/feature-modules/resource-definition/resource-edit | |
parent | 45df1a8e555afb1e9f287968857437cc91c52618 (diff) | |
parent | 18ae6cc59d9c2be78088903010e22706e3a5e44b (diff) |
Merge "Resources metadata changes"
Diffstat (limited to 'cds-ui/client/src/app/feature-modules/resource-definition/resource-edit')
3 files changed, 33 insertions, 10 deletions
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html index 0bbc0b7c1..3b35a9929 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */--> -<form [formGroup]="ResourceMetadata"> +<form [formGroup]="ResourceMetadata" (ngSubmit)="UploadMetadata()"> <mat-form-field class="form-field"> <input matInput placeholder="Name" formControlName="Resource_Name"> </mat-form-field><mat-form-field class="form-field"> @@ -42,4 +42,8 @@ <mat-form-field class="form-field" > <textarea matInput placeholder="Description" formControlName="_description"></textarea> </mat-form-field> + <br> + <div> + <button mat-button class="matStepNextBtn" type="submit">Save Metadata</button> + </div> </form>
\ No newline at end of file diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.scss b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.scss index d10ad488f..aa8ca61b5 100644 --- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.scss +++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.scss @@ -19,6 +19,13 @@ */
+.matStepNextBtn{
+ color:white;
+ background:#3f51b5;
+ margin-top: 10px;
+ position: absolute;
+ border-radius: 1em;
+}
.meta-form {
width: 100%;
}
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)) { |