Commit 3b549cd0 authored by Chris Hines's avatar Chris Hines
Browse files

remove strudelapps.service, use uri encoding to enable more variety in app names

parent 1d0722a1
Pipeline #12379 passed with stages
in 6 minutes and 44 seconds
<mat-list-item style="height: auto; width: auto" class="strudel-job-typography">
<div fxLayout="column" style="width: 100%" class="list-item">
<div style="text-align: left"> {{ jobdata.name }} </div>
<div style="text-align: left"> {{ jobdata.app.name }} </div>
<div *ngIf="jobdata.connectionState == 0 || jobdata.connectionState == null" fxLayout="row" fxLayoutAlign="space-between">
<div fxFlex="10%" style="overflow: auto"> {{ jobdata.state }}</div>
<div fxFlex="10%" style="overflow: auto"> {{ jobdata.jobid }}</div>
......
import { Component, OnInit, Input, OnDestroy } from '@angular/core';
import { Job } from '../job';
import {TesService} from '../tes.service';
import { StrudelappsService } from '../strudelapps.service';
import { timer, Subscription } from 'rxjs';
import { repeat } from 'rxjs/operators';
import { AppAction, Strudelapp} from '../strudelapp';
......@@ -22,7 +21,7 @@ export class JobComponent implements OnInit, OnDestroy {
public mem_resources: string;
public timeremaining: string;
private updatesub: Subscription;
constructor(private tesService: TesService, private strudelAppsService: StrudelappsService, private backendService: BackendSelectionService) {
constructor(private tesService: TesService, private backendService: BackendSelectionService) {
......@@ -103,8 +102,6 @@ export class JobComponent implements OnInit, OnDestroy {
}
onConnect(action: AppAction) {
// Before connecting we must resolve what type of app we are connecting to
// this.jobdata.app = this.strudelAppsService.getApp(this.jobdata.name);
this.jobdata.connectionState = null;
this.tesService.connect(this.jobdata,action);
}
......
......@@ -24,7 +24,7 @@
</mat-list-item>
<mat-divider style="background-color: var(--panel-border-color)"></mat-divider>
<div *ngFor="let job of joblist ; let lastItem = last">
<div *ngIf="app.name == job.appname && job.state != 'Finished'">
<div *ngIf="job.app !== null && app.name == job.app.name && job.state != 'Finished'">
<app-job [jobdata]=job></app-job>
<mat-divider></mat-divider>
</div>
......@@ -55,7 +55,7 @@
</mat-list-item>
<mat-divider style="background-color: var(--panel-border-color)"></mat-divider>
<div *ngFor="let job of joblist ; let lastItem = last">
<div *ngIf="job.app !== null && app.name == job.appname && job.state == 'Finished'">
<div *ngIf="job.app !== null && app.name == job.app.name && job.state == 'Finished'">
<app-job [jobdata]=job></app-job>
<mat-divider></mat-divider>
</div>
......
......@@ -53,6 +53,7 @@ export class JoblistComponent implements OnInit {
{this.sub = timer(5000).pipe(repeat()).subscribe( () => this.getJobs() )});
}*/
updateJoblist(jobquery: Job[], identity: Identity) {
console.log('in updateJoblist')
var joblist: Job[] = []
var qjobids: any[] = [];
var cjobids: any[] = [];
......@@ -91,7 +92,7 @@ export class JoblistComponent implements OnInit {
// any jobs in the joblist that we don't know which application they arem try to figure it out
for (j of joblist) {
if (j.app === undefined || j.app == null) {
j.app = this.getApp(j.appname,identity.site.appCatalog.value);
j.app = Strudelapp.getApp(j.appname,identity.site.appCatalog.value);
}
if (j.identity == undefined) {
j.identity = identity;
......@@ -103,32 +104,6 @@ export class JoblistComponent implements OnInit {
// Sort the joblist so jobs are descending
this.joblist = joblist.sort((a,b) => (a.jobid < b.jobid)? 1:-1);
}
getApp(name: string,applist: any): any {
var idx: number;
var app: any;
var sapp: Strudelapp;
app = applist[0];
for ( let item of applist) {
sapp = <Strudelapp>item;
//let sname = sapp.name.toLowerCase().replace(/\s/g, '');
//let jname = name.toLowerCase().replace(/\s/g, '');
let sname = sapp.name;
let jname = name;
idx = sname.indexOf(jname);
if (idx == 0) {
app = item;
return app;
}
if (sapp.applist != null) {
app = this.getApp(name,sapp.applist);
if (app != null) {
return app;
}
}
}
return null;
}
public ngOnDestroy(): void {
if (this.sub !== undefined) {
......
......@@ -89,7 +89,7 @@ export class LaunchDialogComponent implements OnInit {
theme = 'strudel-light-theme';
}
if (this.identity !== null && this.app !== null) {
this.batchcmdurl = this.identity.site.url+"/"+this.app.name+"?theme="+theme;
this.batchcmdurl = this.identity.site.url+"/"+encodeURIComponent(this.app.name)+"?theme="+theme;
}
this.batchcmdsafeurl = this.domSanitizer.bypassSecurityTrustResourceUrl(this.batchcmdurl);
if (this.app.url !== null) {
......
......@@ -12,7 +12,6 @@ import { repeat, takeUntil, skip, switchMap, take, filter} from 'rxjs/operators'
import { Router, ActivatedRoute, ParamMap } from '@angular/router';
import {Strudelapp} from '../strudelapp';
import { StrudelappsService } from '../strudelapps.service';
import { TesService } from '../tes.service';
import {BackendSelectionService } from '../backend-selection.service';
import { AuthorisationService } from '../authorisation.service';
......@@ -68,7 +67,6 @@ export class LauncherComponent implements OnInit {
public computeSitesService: ComputesitesService,
private router: Router,
private route: ActivatedRoute,
private strudelappsService: StrudelappsService,
public settingsService: SettingsService,
private jobsService: JobsService,
) {
......@@ -249,7 +247,7 @@ export class LauncherComponent implements OnInit {
if (id == 'accountinfo') {
return null;
}
return this.strudelappsService.getApp(v,id.site.appCatalog.value);
return Strudelapp.getApp(v,id.site.appCatalog.value);
}
getId(v: any, appidentities: Identity[]) {
......
......@@ -5,8 +5,6 @@ import { BehaviorSubject } from 'rxjs/BehaviorSubject';
import { Subscription } from 'rxjs';
import { Router, NavigationStart } from '@angular/router';
import {Strudelapp} from '../strudelapp';
import { StrudelappsService } from '../strudelapps.service';
import { TesService } from '../tes.service';
import {BackendSelectionService } from '../backend-selection.service';
import { AuthorisationService } from '../authorisation.service';
......@@ -33,9 +31,6 @@ export class SafeHtmlPipe implements PipeTransform {
styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
public strudelapps: Strudelapp[];
public app: Strudelapp;
public authorised: boolean;
public identity: Identity;
......
<h2>Close {{ data.name }}?</h2>
<h2>Close {{ data.app.name }}?</h2>
It looks like you just closed an application.<br>
You can choose to leave this application running if you will come back to it soon or to terminate it so that someone else may use the computing resources<br>
<div fxLayout="row" fxLayoutAlign="space-between stretch" style="width: 100%">
<button mat-button (click)="close(null)">Leave it running</button><button mat-button (click)="close(data)">Terminate {{ data.name }}</button>
<button mat-button (click)="close(null)">Leave it running</button><button mat-button (click)="close(data)">Terminate {{ data.app.name }}</button>
</div>
......@@ -15,6 +15,8 @@ export class ModaldialogComponent implements OnInit {
}
ngOnInit() {
console.log('created close dialog');
console.log(this.data);
}
close(rv) {
......
import { Component, OnInit } from '@angular/core';
import { Strudelapp } from '../strudelapp';
import { StrudelappsService } from '../strudelapps.service';
import { TesService } from '../tes.service';
import { AuthorisationService } from '../authorisation.service';
import { Computesite } from '../computesite';
......
......@@ -18,6 +18,35 @@ export class Strudelapp {
/// how we create tunnels
applist: Strudelapp[] = null;
desc: string = null;
static getApp(name: string,applist: any): any {
var idx, idxURI: number;
var app: any;
var sapp: Strudelapp;
app = applist[0];
let jname = name;
let uriname = decodeURIComponent(name);
for ( let item of applist) {
sapp = <Strudelapp>item;
//let sname = sapp.name.toLowerCase().replace(/\s/g, '');
//let jname = name.toLowerCase().replace(/\s/g, '');
let sname = sapp.name;
idx = sname.indexOf(jname);
idxURI = sname.indexOf(uriname);
if (idx == 0 || idxURI == 0) {
app = item;
return app;
}
if (sapp.applist != null) {
app = this.getApp(name,sapp.applist);
if (app != null) {
return app;
}
}
}
return null;
}
}
export class StrudelappInstance {
......
import { TestBed, inject } from '@angular/core/testing';
import { StrudelappsService } from './strudelapps.service';
describe('StrudelappsService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [StrudelappsService]
});
});
it('should be created', inject([StrudelappsService], (service: StrudelappsService) => {
expect(service).toBeTruthy();
}));
});
import { Injectable } from '@angular/core';
import { Strudelapp } from './strudelapp';
@Injectable({
providedIn: 'root',
})
export class StrudelappsService {
constructor() { }
getApp(name: string,applist: any): any {
var idx: number;
var app: any;
var sapp: Strudelapp;
app = applist[0];
for ( let item of applist) {
sapp = <Strudelapp>item;
//let sname = sapp.name.toLowerCase().replace(/\s/g, '');
//let jname = name.toLowerCase().replace(/\s/g, '');
let sname = sapp.name;
let jname = name;
idx = sname.indexOf(jname);
if (idx == 0) {
app = item;
return app;
}
if (sapp.applist != null) {
app = this.getApp(name,sapp.applist);
if (app != null) {
return app;
}
}
}
return null;
}
// getApp(name: string,applist: Strudelapp[]): Strudelapp {
/*getApp(name: string,applist: any): any {
var idx: number;
var app: any;
var sapp: Strudelapp;
app = applist[0];
for ( let item of applist) {
sapp = <Strudelapp>item;
let sname = sapp.name.toLowerCase().replace(/\s/g, '');
let jname = name.toLowerCase().replace(/\s/g, '');
idx = sname.indexOf(jname)
if (idx == 0) {
app = item;
return app;
}
if (sapp.applist != null) {
app = this.getApp(name,sapp.applist);
if (app != null) {
return app;
}
}
}
return null;
}*/
}
<div *ngIf="data.name !== undefined && data.name !== null">
<h2>{{ data.name }} Running</h2>
It looks like you already connected to {{ data.name }}<br>
<div *ngIf="data.app !== undefined && data.app !== null">
<h2>{{ data.app.name }} Running</h2>
It looks like you already connected to {{ data.app.name }}<br>
</div>
<div *ngIf="data.name === undefined || data.name === null">
<div *ngIf="data.app === undefined || data.app === null">
<h2>Application Running</h2>
It looks like you already connected to a Strudel2 Application<br>
</div>
......
......@@ -9,6 +9,18 @@
"name": "CVL",
"icon": null,
"scope": "user:email",
"cafingerprint": "ECDSA SHA256:6wVXdokvvlTNcXPMc9KyvIXA8a8XNfLuhBfNOYeeMdg",
"desc": "<div>The Characterisation Virtual Laboratory remote desktop services are available here. The service provides software, data and compute for researchers in the Characterisation research community. For CVL desktop researchers from MASSIVE see <a href=https://www.massive.org.au>https://www.massive.org.au</a> for more information. For CVL desktop users from other infrastructures see <a href=https://www.cvl.org.au>https://www.cvl.org.au</a></div>"
},
{
"authorise": "http://localhost:5000/oauth2/oauth/authorize/choose",
"base": "http://localhost:5000/oauth2/",
"client_id": "Q96kt2Vtw6S78dpORktM81DH",
"sign": "http://localhost:5000/sign/monash_hpcid/api/v1/sign_key",
"logout": "http://localhost:5000/oauth2/logout",
"name": "Localhost",
"icon": null,
"scope": "user:email",
"cafingerprint": "RSA SHA256:cmDxHrZQSPlBMUUcI/BWmruXho1XOzfXPDHSqVTwV2I",
"desc": "<div>The Characterisation Virtual Laboratory remote desktop services are available here. The service provides software, data and compute for researchers in the Characterisation research community. For CVL desktop researchers from MASSIVE see <a href=https://www.massive.org.au>https://www.massive.org.au</a> for more information. For CVL desktop users from other infrastructures see <a href=https://www.cvl.org.au>https://www.cvl.org.au</a></div>"
}
......
......@@ -7,9 +7,9 @@
"cafingerprint": "ECDSA SHA256:6wVXdokvvlTNcXPMc9KyvIXA8a8XNfLuhBfNOYeeMdg",
"appCatalog": [],
"appCatalogCmd": "/usr/local/strudel2_cluster/latest/bin/getapps",
"cancelcmd": "/usr/local/sv2/dev/scripts/bin/s2cancel {jobid}",
"statcmd": "/usr/local/sv2/dev/scripts/bin/s2stat",
"userhealth": "/usr/local/userhealth/0.0.2/bin/uijson",
"cancelcmd": "/usr/local/strudel2_cluster/latest/bin/s2cancel {jobid}",
"statcmd": "/usr/local/strudel2_cluster/latest/bin/s2stat",
"userhealth": "/usr/local/bin/uijson",
"cacheturis": [],
"contact": "<MASSIVE Support> help@massive.org.au"
}
......
......@@ -39,7 +39,7 @@
{
"url": null,
"name": "Jupyter Lab",
"startscript": "#!/bin/bash\nmodule load singularity\nsingularity exec /usr/local/sv2/jupyter.sif /start",
"startscript": "#!/bin/bash\nmodule load singularity\nsingularity exec /usr/local/sv2/juflocu.sif /start",
"instactions": [
{
"name": "Connect",
......
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