From b336ddd7554e54dc038894cde0fb3ddee7302096 Mon Sep 17 00:00:00 2001 From: Logan Terry Date: Wed, 8 Sep 2021 20:09:55 -0600 Subject: [PATCH 1/2] Fix ownership not propagating to module views. --- SBOLCanvasFrontend/src/app/graph-helpers.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SBOLCanvasFrontend/src/app/graph-helpers.ts b/SBOLCanvasFrontend/src/app/graph-helpers.ts index 9fcfa5ed..af9ca3b7 100644 --- a/SBOLCanvasFrontend/src/app/graph-helpers.ts +++ b/SBOLCanvasFrontend/src/app/graph-helpers.ts @@ -1631,6 +1631,11 @@ export class GraphHelpers extends GraphBase { // edge case, module view, need to check parent circuit container toCheck.add(cell.getParent().getValue()); } + } else if(cell.isCircuitContainer() && cell.getParent().isModuleView()){ + // transition state to module views + toCheck.add(cell.getParent().getId()); + } else if(cell.isModule()){ + toCheck.add(cell.getParent().getId()); } } } From c2f45ed16973164c5419791c66c0827d216fbf7c Mon Sep 17 00:00:00 2001 From: Logan Terry Date: Wed, 8 Sep 2021 21:12:01 -0600 Subject: [PATCH 2/2] Add logout functionality --- SBOLCanvasBackend/src/servlets/SynBioHub.java | 17 +++++++++++++++-- .../download-graph.component.html | 3 ++- .../download-graph/download-graph.component.ts | 7 +++++++ SBOLCanvasFrontend/src/app/login.service.ts | 11 +++++++++++ 4 files changed, 35 insertions(+), 3 deletions(-) diff --git a/SBOLCanvasBackend/src/servlets/SynBioHub.java b/SBOLCanvasBackend/src/servlets/SynBioHub.java index 3423888b..9a08ad1f 100644 --- a/SBOLCanvasBackend/src/servlets/SynBioHub.java +++ b/SBOLCanvasBackend/src/servlets/SynBioHub.java @@ -94,8 +94,21 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t user = sbhf.getUser(); body = user; - } else if (request.getPathInfo().equals("/listMyCollections")) { - + } else if (request.getPathInfo().equals("/logout")) { + + if(server == null || user == null) { + response.setStatus(HttpStatus.SC_BAD_REQUEST); + return; + } + + SynBioHubFrontend sbhf = new SynBioHubFrontend(server); + sbhf.setUser(user); + sbhf.logout(); + response.setStatus(HttpStatus.SC_OK); + return; + + }else if (request.getPathInfo().equals("/listMyCollections")) { + if (server == null || user == null) { response.setStatus(HttpStatus.SC_BAD_REQUEST); return; diff --git a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html index 0a1a467d..6cf5fb1a 100644 --- a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html +++ b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.html @@ -100,7 +100,8 @@

Download

- + + diff --git a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts index fb57ba93..244233b4 100644 --- a/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts +++ b/SBOLCanvasFrontend/src/app/download-graph/download-graph.component.ts @@ -157,6 +157,13 @@ export class DownloadGraphComponent implements OnInit { }); } + async onLogoutClick() { + this.working = true; + await this.loginService.logout(this.registry); + this.working = false; + this.updateParts(); + } + onCancelClick() { this.dialogRef.close(); } diff --git a/SBOLCanvasFrontend/src/app/login.service.ts b/SBOLCanvasFrontend/src/app/login.service.ts index 90290d37..e871de3e 100644 --- a/SBOLCanvasFrontend/src/app/login.service.ts +++ b/SBOLCanvasFrontend/src/app/login.service.ts @@ -15,6 +15,7 @@ export interface LoginDialogData { export class LoginService { private loginURL = environment.backendURL + '/SynBioHub/login'; + private logoutURL = environment.backendURL + '/SynBioHub/logout'; public users: {} = {}; @@ -39,4 +40,14 @@ export class LoginService { return this.http.get(this.loginURL, { responseType: 'text', headers: headers, params: params }); } + async logout(server: string) { + let headers = new HttpHeaders(); + headers = headers.set("Authorization", this.users[server]); + let params = new HttpParams(); + params = params.append("server", server); + await this.http.get(this.logoutURL, { headers: headers, params: params }).toPromise(); + + delete this.users[server]; + } + }