Commit 63de0fdd authored by Chris Hines's avatar Chris Hines
Browse files

warn the user of what happens if you open Jupyter Lab first

parent eb65011a
Pipeline #11587 failed with stages
in 2 minutes and 40 seconds
......@@ -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]
......
......@@ -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;
......
......@@ -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));
}
......
<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>
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();
});
});
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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment