aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSwapnali Shadanan Pode <sp00501638@techmahindra.com>2019-03-29 16:01:02 +0530
committerSwapnali Pode <sp00501638@techmahindra.com>2019-03-29 18:56:21 +0000
commit18ae6cc59d9c2be78088903010e22706e3a5e44b (patch)
tree1a23c11a82ee3c2eee4e81c514d196cb7a420287
parent33406683825449874c490349778f27206c51dbca (diff)
Resources metadata changes
Change-Id: Ifddeb90d0e28ccc6023b5f7efe8568b41db08f84 Issue-ID: CCSDK-804 Signed-off-by: sp00501638 <sp00501638@techmahindra.com>
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.html6
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.scss7
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-metadata/resource-metadata.component.ts30
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)) {