Skip to content

Commit

Permalink
Merge pull request #1996 from DSD-DBS/session-focus
Browse files Browse the repository at this point in the history
feat: Auto-focus first session in the session viewer
  • Loading branch information
MoritzWeber0 authored Nov 14, 2024
2 parents d06c824 + 75f5a7f commit ed2237d
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions frontend/src/app/sessions/session/session-viewer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,18 @@ export class SessionViewerService {
),
)
.subscribe((session) => {
this.sessionsService
.getSessionConnectionInformation(session.id)
.subscribe((connectionInfo) => {
this._connectToSession(session, connectionInfo.payload);
});
if (
this.sessionService.beautifyState(
session.preparation_state,
session.state,
).success
) {
this.sessionsService
.getSessionConnectionInformation(session.id)
.subscribe((connectionInfo) => {
this._connectToSession(session, connectionInfo.payload);
});
}
}),
);
}
Expand All @@ -85,7 +92,11 @@ export class SessionViewerService {
}

this.sessionService.setConnectionInformation(connectionInfo);
viewerSession.focused = false;
if (!this._sessions.value?.length) {
viewerSession.focused = true;
} else {
viewerSession.focused = false;
}
viewerSession.safeResourceURL =
this.domSanitizer.bypassSecurityTrustResourceUrl(
connectionInfo.redirect_url,
Expand Down

0 comments on commit ed2237d

Please sign in to comment.