From 6b2b8eecae3515caf0ec9873cd6f32e479ff56ac Mon Sep 17 00:00:00 2001 From: Chris Hines <chris.hines@monash.edu> Date: Thu, 4 Jul 2019 12:43:40 +0800 Subject: [PATCH] fix up the launch dialog so that values are saved correctly --- src/app/launch-dialog/launch-dialog.component.html | 4 ++-- src/app/launch-dialog/launch-dialog.component.ts | 14 ++++++++++++-- src/app/submit-app.service.ts | 1 - 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/app/launch-dialog/launch-dialog.component.html b/src/app/launch-dialog/launch-dialog.component.html index 7d6690a..b881ef7 100644 --- a/src/app/launch-dialog/launch-dialog.component.html +++ b/src/app/launch-dialog/launch-dialog.component.html @@ -20,9 +20,9 @@ <div fxLayout="column" fxLayoutAlign="space-between stretch" style="height: 100%; width: 100%"> <!-- <div fxFlex style="background: blue">app config</div> --> <iframe *ngIf="appconfigurl != null" fxGrow=10 fxFlex [src]="appconfigsafeurl" style="border: none"></iframe> - <iframe *ngIf="appconfigurl != null" [src]="batchcmdsafeurl" style="height: 1px; min-height: 0px; border: none"></iframe> + <iframe *ngIf="appconfigurl != null" [src]="batchcmdsafeurl" style="height: 1px; min-height: 0px; border: none" #batchbuilderiframe></iframe> - <iframe *ngIf="appconfigurl == null" fxFlex [src]="batchcmdsafeurl" fxGrow=1 style="border: none"></iframe> + <iframe *ngIf="appconfigurl == null" fxFlex [src]="batchcmdsafeurl" fxGrow=1 style="border: none" #batchbuilderiframe></iframe> <div fxLayout="row" fxLayoutAlign="space-around"> <button mat-button (click)="cancel()">Cancel</button><button mat-button (click)="launch()" #launchbtn>Launch</button> diff --git a/src/app/launch-dialog/launch-dialog.component.ts b/src/app/launch-dialog/launch-dialog.component.ts index 783c09c..5c87699 100644 --- a/src/app/launch-dialog/launch-dialog.component.ts +++ b/src/app/launch-dialog/launch-dialog.component.ts @@ -18,6 +18,7 @@ export class LaunchDialogComponent implements OnInit { appconfigsafeurl: any; rmListen: any; @ViewChild('launchbtn', { read: ElementRef, static: false }) launchbtn: ElementRef; + @ViewChild('batchbuilderiframe', { read: ElementRef, static: false }) batchbuilderiframe: ElementRef; setFocus: Boolean; sub: Subscription; @@ -56,8 +57,10 @@ export class LaunchDialogComponent implements OnInit { launch() { console.log('cause app submission'); - this.dialogRef.close(); - this.submitAppService.launch(); + console.log(this.batchbuilderiframe); + this.batchbuilderiframe.nativeElement.contentWindow.postMessage('launch selected',"*"); + //this.dialogRef.close(); + //this.submitAppService.launch(); } @@ -91,9 +94,16 @@ export class LaunchDialogComponent implements OnInit { receiveMessage(event) { if (event.data['batchcmd'] !== undefined) { this.submitAppService.submitcmd.next(event.data['batchcmd']); + console.log('recieved a submit cmd'); + console.log('recieveMessage'+this.submitAppService.submitcmd.value); } if (event.data['appData'] !== undefined) { this.submitAppService.appData.next(event.data['appData']); } + if (event.data == "close iframe") { + console.log('recieved close iframe'); + timer(0).subscribe(() => { console.log("timer "+this.submitAppService.submitcmd.value) ; this.dialogRef.close(); this.submitAppService.launch()}); // complete the current event loop, ie receive all messages to get teh correct time before submitting + //this.submitAppService.launch(); + } } } diff --git a/src/app/submit-app.service.ts b/src/app/submit-app.service.ts index a90a8e0..97d34ac 100644 --- a/src/app/submit-app.service.ts +++ b/src/app/submit-app.service.ts @@ -79,7 +79,6 @@ export class SubmitAppService { } canILaunch() { - console.log('in submitAppService, evaluatin can I launch'); if (this.submitcmd.value != null) { if (this.app.value.url == null || this.appData.value != null ) { this.readyToLaunch.next(true); -- GitLab