aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzhilarasi <ezhrajam@in.ibm.com>2019-02-20 19:24:40 +0530
committerEzhilarasi <ezhrajam@in.ibm.com>2019-02-20 19:27:32 +0530
commitcb0e4c08f41f74e97ee68d85fd49aa47a4471f5a (patch)
tree644d21d3c7a4ab44bc16dbf4b8cf0d0f3f500863
parentfa9bfa9fdc7e2a1afe09d6bca9106ec9651fb38e (diff)
Update Blueprintstate after Search
Change-Id: Ic56cbbff004045bf928a25ad540eac8413399eb0 Issue-ID: CCSDK-762 Signed-off-by: Ezhilarasi <ezhrajam@in.ibm.com>
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html2
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts29
2 files changed, 19 insertions, 12 deletions
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html
index f97ea0ee7..b6cd90286 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html
@@ -22,5 +22,5 @@ limitations under the License.
<input type="file" accept=".json" (change)="fileChanged($event)">
</div>
<div>
- <button mat-button matStepperNext class="matStepNextBtn" (click)="extractBlueprint()">Upload</button>
+ <button mat-button matStepperNext class="matStepNextBtn" (click)="updateBlueprintState()">Upload</button>
</div> \ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
index 3a344c9fc..5fe28e7f9 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
@@ -21,7 +21,11 @@ limitations under the License.
import { Component, OnInit, EventEmitter, Output } from '@angular/core';
import { Store } from '@ngrx/store';
-import { IBlueprint} from '../../../../common/core/store/models/blueprint.model';
+import { IBlueprint } from '../../../../common/core/store/models/blueprint.model';
+import { IBlueprintState } from '../../../../common/core/store/models/blueprintState.model';
+import { IAppState } from '../../../../common/core/store/state/app.state';
+import { LoadBlueprintSuccess } from '../../../../common/core/store/actions/blueprint.action';
+import { Observable } from 'rxjs';
@Component({
selector: 'app-search-template',
@@ -29,25 +33,28 @@ import { IBlueprint} from '../../../../common/core/store/models/blueprint.model'
styleUrls: ['./search-template.component.scss']
})
export class SearchTemplateComponent implements OnInit {
- file: any;
+ file: File;
localBluePrintData: IBlueprint;
fileText: object[];
-
- constructor() { }
+ blueprintState: IBlueprintState;
+ bpState: Observable<IBlueprintState>;
+
+ constructor(private store: Store<IAppState>) { }
- ngOnInit() { }
+ ngOnInit() {
+ }
fileChanged(e: any) {
this.file = e.target.files[0];
+ }
+
+ updateBlueprintState() {
let fileReader = new FileReader();
- fileReader.readAsText(e.srcElement.files[0]);
+ fileReader.readAsText(this.file);
var me = this;
fileReader.onload = function () {
- let fileData = JSON.stringify(fileReader.result);
- me.localBluePrintData = JSON.parse(fileData);
- console.log(me.localBluePrintData);
+ var data: IBlueprint = JSON.parse(fileReader.result.toString());
+ me.store.dispatch(new LoadBlueprintSuccess(data));
}
}
- extractBlueprint(){
- }
}