summaryrefslogtreecommitdiffstats
path: root/cds-ui/client/src/app/feature-modules/blueprint
diff options
context:
space:
mode:
authorEzhilarasi <ezhrajam@in.ibm.com>2019-02-20 19:30:16 +0530
committerEzhilarasi <ezhrajam@in.ibm.com>2019-02-20 19:30:26 +0530
commit7a2c8aaff83f0fad4885f6731ea16da9dc0068c2 (patch)
treed45c171bae15f66e0f26cacc14b3f929e8a6a0fc /cds-ui/client/src/app/feature-modules/blueprint
parentfa9bfa9fdc7e2a1afe09d6bca9106ec9651fb38e (diff)
Fetch metadata from stores
Change-Id: Ie63a455e92e717e07a6e3ad20f9f46dd6e271904 Issue-ID: CCSDK-762 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.ts38
1 files changed, 33 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 176cc55a7..cfcb6471a 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
@@ -19,10 +19,14 @@ limitations under the License.
============LICENSE_END============================================
*/
-import { Component, OnInit, EventEmitter, Output } from '@angular/core';
+import { Component, OnInit, EventEmitter, Output, AfterViewInit, AfterContentInit, OnChanges, DoCheck, AfterViewChecked } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { IMetaData } from '../../../../common/core/store/models/metadata.model';
import { A11yModule } from '@angular/cdk/a11y';
+import { IAppState } from '../../../../common/core/store/state/app.state';
+import { Store } from '@ngrx/store';
+import { Observable } from 'rxjs';
+import { IBlueprintState } from 'src/app/common/core/store/models/blueprintState.model';
@Component({
selector: 'app-metadata',
@@ -32,11 +36,11 @@ import { A11yModule } from '@angular/cdk/a11y';
export class MetadataComponent implements OnInit {
CBAMetadataForm: FormGroup;
metadata: IMetaData;
+ bpState: Observable<IBlueprintState>;
@Output() metadataform = new EventEmitter<IMetaData>();
- constructor(private formBuilder: FormBuilder) { }
-
- ngOnInit() {
+ constructor(private formBuilder: FormBuilder, private store: Store<IAppState>) {
+ this.bpState = this.store.select('blueprint');
this.CBAMetadataForm = this.formBuilder.group({
template_author: ['', Validators.required],
author_email: ['', Validators.required],
@@ -46,9 +50,33 @@ export class MetadataComponent implements OnInit {
template_tags: ['', Validators.required]
});
}
+
+ ngOnInit() {
+ this.bpState.subscribe(
+ blueprintdata => {
+ var blueprintState: IBlueprintState = { blueprint: blueprintdata.blueprint, isLoadSuccess: blueprintdata.isLoadSuccess, isSaveSuccess: blueprintdata.isSaveSuccess, isUpdateSuccess: blueprintdata.isUpdateSuccess };
+ this.metadata = blueprintState.blueprint.metadata;
+ let metadatavalues = [];
+ for (let key in this.metadata) {
+ if (this.metadata.hasOwnProperty(key)) {
+ metadatavalues.push(this.metadata[key]);
+ }
+ }
+ let temp_author = metadatavalues[0];
+ console.log(temp_author);
+ this.CBAMetadataForm = this.formBuilder.group({
+ template_author: [metadatavalues[0], Validators.required],
+ author_email: [metadatavalues[1], Validators.required],
+ user_groups: [metadatavalues[2], Validators.required],
+ template_name: [metadatavalues[3], Validators.required],
+ template_version: [metadatavalues[4], Validators.required],
+ template_tags: [metadatavalues[5], Validators.required]
+ });
+ })
+ }
+
UploadMetadata() {
this.metadata = Object.assign({}, this.CBAMetadataForm.value);
- console.log(this.metadata.template_author);
this.metadataform.emit(this.metadata);
}