diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 25237dd83e3fd420215864348e3adc887224186b..386730c657402a61ab74d0b4173ef93825ae1d02 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -66,6 +66,7 @@ import { AboutUsComponent } from './aboutus/aboutus.component'; import { OurServicesComponent } from './ourservices/ourservices.component'; import { ContactUsComponent } from './contactus/contactus.component'; import { NoaccountComponent } from './noaccount/noaccount.component'; +import { WarndialogComponent } from './warndialog/warndialog.component'; // import { FileExplorerModule } from './file-explorer/file-explorer.module'; @@ -98,6 +99,7 @@ import { NoaccountComponent } from './noaccount/noaccount.component'; OurServicesComponent, ContactUsComponent, NoaccountComponent, + WarndialogComponent, ], imports: [ BrowserModule, @@ -136,7 +138,7 @@ import { NoaccountComponent } from './noaccount/noaccount.component'; ], - entryComponents: [ LogoutdialogComponent, ModaldialogComponent], + entryComponents: [ LogoutdialogComponent, ModaldialogComponent, WarndialogComponent], //providers: [ StrudelappsService, ComputesitesService, TesService, SubmitAppService, MatDialog, AuthorisationService,BackendSelectionService,SettingsService], providers: [NotificationsService, ComputesitesService, TesService, BrowserWindowService, SubmitAppService, MatDialog, AuthorisationService,BackendSelectionService,SettingsService, JobsService], bootstrap: [AppComponent] diff --git a/src/app/browser-window.service.ts b/src/app/browser-window.service.ts index 8670905aecf1d53241276a58b4ddefd3514ea276..efe537d51c38cbe92b583a09f253d523eca14c80 100644 --- a/src/app/browser-window.service.ts +++ b/src/app/browser-window.service.ts @@ -13,6 +13,7 @@ import {BackendSelectionService} from './backend-selection.service'; import {repeat, take, takeUntil, filter, catchError, map, tap} from 'rxjs/operators'; import {timer, interval, Subject, BehaviorSubject, of} from 'rxjs'; import { ModaldialogComponent } from './modaldialog/modaldialog.component'; +import { WarndialogComponent } from './warndialog/warndialog.component'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material'; import {NotificationsService } from './notifications.service'; import { HttpClientModule, HttpClient, HttpHeaders, HttpErrorResponse } from '@angular/common/http'; @@ -29,6 +30,7 @@ export class BrowserWindowService { private authdone$: Subject<boolean>; private openapps: any[]; public cancelJob$: Subject<Job>; + private warnref: MatDialogRef<WarndialogComponent>; constructor(private backendSelectionService: BackendSelectionService, public dialog: MatDialog, @@ -131,6 +133,10 @@ export class BrowserWindowService { var app: any; this.openapps.forEach( (app,index) => { if (app.window.closed) { + if (this.warnref !== undefined && this.warnref !== null) { + console.log('warnref',this.warnref,this.warnref.getState()); + this.warnref.close(); + } if (app.job.state == 'RUNNING') { let dialogRef = this.dialog.open(ModaldialogComponent, { width: '600px', @@ -147,6 +153,7 @@ export class BrowserWindowService { public finishAppWindow(windowloc: any, job:Job, action: AppAction) { let appwindow = window.open(windowloc); + this.warnref = this.dialog.open(WarndialogComponent, {width: '600px', data: job}) if (appwindow == null) { this.notifications.notify('It looks like a window failed to open. Please check your popup blocker settings (Strudel 2 needs to be able to open a window to your application'); return; diff --git a/src/app/tes.service.ts b/src/app/tes.service.ts index 0445842d45b4fbfa976cf7630127adc9681a725c..972e4e88df3453e8f86a48c7244dbf5545749733 100644 --- a/src/app/tes.service.ts +++ b/src/app/tes.service.ts @@ -71,6 +71,7 @@ public openWindow$: Subject<any>; private getUserHealthError(error: any, identity: Identity) { identity.accountalerts.next([]); + console.error(error) this.notifications.notify("There was an error checking your user account"); } @@ -91,7 +92,7 @@ getUserHealth(identity: Identity) { params.set('username',JSON.stringify(identity.username)); this.updateUserHealthSub = this.runCommand(identity,identity.site.userhealth) - .pipe(takeUntil(this.cancelRequests$)) + .pipe(takeUntil(this.cancelRequests$),tap((v) => console.log(v))) .subscribe(resp => this.addUserHealth(identity,resp), error => this.getUserHealthError(error,identity)); } diff --git a/src/app/warndialog/warndialog.component.css b/src/app/warndialog/warndialog.component.css new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/app/warndialog/warndialog.component.html b/src/app/warndialog/warndialog.component.html new file mode 100644 index 0000000000000000000000000000000000000000..c4e20fc1916f38d7e0ec9fd43bff9e489bed524c --- /dev/null +++ b/src/app/warndialog/warndialog.component.html @@ -0,0 +1,13 @@ + <div *ngIf="data.name !== undefined && data.name !== null"> + <h2>{{ data.name }} Running</h2> + It looks like you already connected to {{ data.name }}<br> + </div> + <div *ngIf="data.name === undefined || data.name === null"> + <h2>Application Running</h2> + It looks like you already connected to a Strudel2 Application<br> + </div> + Depending on which applications you are connecting to and which order you open the windows in, you may experience bugs<br> + For example if you open Jupyter Lab then a terminal Jupyter Lab will misbehave. If you open terminal the Jupyter Lab this will be OK. + <div fxLayout="row" fxLayoutAlign="space-between stretch" style="width: 100%"> + <button mat-button (click)="close(null)">OK, Got it!</button> + </div> diff --git a/src/app/warndialog/warndialog.component.spec.ts b/src/app/warndialog/warndialog.component.spec.ts new file mode 100644 index 0000000000000000000000000000000000000000..d3dfec3bb522b9adae3328620a32df0be1086b37 --- /dev/null +++ b/src/app/warndialog/warndialog.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { WarndialogComponent } from './warndialog.component'; + +describe('WarndialogComponent', () => { + let component: WarndialogComponent; + let fixture: ComponentFixture<WarndialogComponent>; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ WarndialogComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(WarndialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/warndialog/warndialog.component.ts b/src/app/warndialog/warndialog.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..a4c01c9ce87d7c5d79ff55bf3b6b47635bd6aaa9 --- /dev/null +++ b/src/app/warndialog/warndialog.component.ts @@ -0,0 +1,25 @@ + +import { Component, OnInit, Inject } from '@angular/core'; +import { MatDialog, MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/material'; + +@Component({ + selector: 'app-warndialog', + templateUrl: './warndialog.component.html', + styleUrls: ['./warndialog.component.css'] +}) +export class WarndialogComponent implements OnInit { + + constructor( + public dialogRef: MatDialogRef<WarndialogComponent>, + @Inject(MAT_DIALOG_DATA) public data: any, +) { + } + + ngOnInit() { + } + + close(rv) { + this.dialogRef.close(rv); + } + +}