Fixed defect CCSDK-1339 12/88712/1
authorArundathi Patil <arundpil@in.ibm.com>
Tue, 21 May 2019 14:42:12 +0000 (20:12 +0530)
committerNirvan Ramjuttun <nirvan.ramjuttun@amdocs.com>
Tue, 28 May 2019 18:57:11 +0000 (14:57 -0400)
Fixed defect ccsdk-1339

Issue-ID: CCSDK-1339
Change-Id: Iabf12c0c7430cda9a259d1917f344d58c432bd05
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
cds-ui/client/src/app/common/core/store/models/blueprintState.model.ts
cds-ui/client/src/app/common/core/store/reducers/blueprint.reducer.ts
cds-ui/client/src/app/feature-modules/blueprint/select-template/metadata/metadata.component.ts
cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts

index 6d26592..6d3aa8c 100644 (file)
@@ -28,6 +28,8 @@ export interface IBlueprintState {
     name?: string;
     files?: any;
     filesData?: any;
+    uploadedFileName?: string;
+    entryDefinition?: string;
     isLoadSuccess?: boolean;
     isUpdateSuccess?: boolean;
     isSaveSuccess?: boolean;
index 37a659d..da933ab 100644 (file)
@@ -55,7 +55,9 @@ export function blueprintReducer(state: IBlueprintState = initialBlueprintState,
                     blueprint: action.payload.blueprint,
                     name: action.payload.name,
                     files: action.payload.files,
-                    filesData: action.payload.filesData
+                    filesData: action.payload.filesData,
+                    uploadedFileName: action.payload.uploadedFileName,
+                    entryDefinition: action.payload.entryDefinition
                     }
         default:
             return state;
index 2327a58..609aaca 100644 (file)
@@ -23,13 +23,12 @@ import { Component, OnInit } from '@angular/core';
 import { FormBuilder, FormGroup, Validators } from '@angular/forms';
 import { Observable } from 'rxjs';
 import { Store } from '@ngrx/store';
-import { A11yModule } from '@angular/cdk/a11y';
 
 import { IAppState } from '../../../../common/core/store/state/app.state';
 import { IBlueprintState } from 'src/app/common/core/store/models/blueprintState.model';
 import { IBlueprint } from 'src/app/common/core/store/models/blueprint.model';
 import { IMetaData } from '../../../../common/core/store/models/metadata.model';
-import { LoadBlueprintSuccess } from 'src/app/common/core/store/actions/blueprint.action';
+import { SetBlueprintState } from 'src/app/common/core/store/actions/blueprint.action';
 
 @Component({
   selector: 'app-metadata',
@@ -41,6 +40,13 @@ export class MetadataComponent implements OnInit {
   metadata: IMetaData;
   bpState: Observable<IBlueprintState>;
   blueprint: IBlueprint;
+  filesTree: any = [];
+  filesData: any = [];
+  selectedFile: string;
+  zipFolder: any;
+  blueprintName: string;
+  uploadedFileName: string;
+  entryDefinition: string;
   
   constructor(private formBuilder: FormBuilder, private store: Store<IAppState>) {
     this.bpState = this.store.select('blueprint');
@@ -57,6 +63,16 @@ export class MetadataComponent implements OnInit {
   ngOnInit() {
     this.bpState.subscribe(
       blueprintdata => {
+        var blueprintState: IBlueprintState = { blueprint: blueprintdata.blueprint, isLoadSuccess: blueprintdata.isLoadSuccess, isSaveSuccess: blueprintdata.isSaveSuccess, isUpdateSuccess: blueprintdata.isUpdateSuccess };
+        this.blueprint = blueprintState.blueprint;
+        this.filesTree = blueprintdata.files;
+        this.filesData = blueprintdata.filesData;
+        this.blueprintName = blueprintdata.name;
+        this.uploadedFileName = blueprintdata.uploadedFileName;
+        this.entryDefinition = blueprintdata.entryDefinition;
+
+
+
         var blueprintState: IBlueprintState = { blueprint: blueprintdata.blueprint, isLoadSuccess: blueprintdata.isLoadSuccess, isSaveSuccess: blueprintdata.isSaveSuccess, isUpdateSuccess: blueprintdata.isUpdateSuccess };
         this.metadata = blueprintState.blueprint.metadata;
         this.blueprint = blueprintState.blueprint;
@@ -82,7 +98,21 @@ export class MetadataComponent implements OnInit {
   UploadMetadata() {
     this.metadata = Object.assign({}, this.CBAMetadataForm.value);
     this.blueprint.metadata = this.metadata;
-    this.store.dispatch(new LoadBlueprintSuccess(this.blueprint));
+
+    this.filesData.forEach((fileNode) => {
+      if (fileNode.name.includes(this.blueprintName) && fileNode.name == this.entryDefinition) {
+        fileNode.data = JSON.stringify(this.blueprint, null, "\t");
+      }
+    });
+    let blueprintState = {
+      blueprint: this.blueprint,
+      name: this.blueprintName,
+      files: this.filesTree,
+      filesData: this.filesData,
+      uploadedFileName: this.uploadedFileName,
+      entryDefinition: this.entryDefinition
+    }
+    this.store.dispatch(new SetBlueprintState(blueprintState));
   }
 
 }
\ No newline at end of file
index 9c11f76..25f85de 100644 (file)
@@ -53,6 +53,7 @@ export class SearchTemplateComponent implements OnInit {
   private activationBlueprint: any;
   private tocsaMetadaData: any;
   private blueprintName: string;
+  private entryDefinition: string;
 
   constructor(private store: Store<IAppState>) { }
 
@@ -78,7 +79,9 @@ export class SearchTemplateComponent implements OnInit {
       blueprint: data,
       name: this.blueprintName,
       files: this.tree,
-      filesData: this.paths
+      filesData: this.paths,
+      uploadedFileName: this.uploadedFileName,
+      entryDefinition: this.entryDefinition
     }
     this.store.dispatch(new SetBlueprintState(blueprintState))
     // this.store.dispatch(new LoadBlueprintSuccess(data));
@@ -142,6 +145,7 @@ export class SearchTemplateComponent implements OnInit {
             this.activationBlueprint = path.data; 
             newPart.data = JSON.parse(this.activationBlueprint.toString());            
             console.log('newpart', newPart);
+            this.entryDefinition = path.name.trim();
           }
           if(newPart.name !== '') {            
               currentLevel.push(newPart);