-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1978 from DSD-DBS/session-viewer-auto-connect
feat: Handle unready sessions in session viewer
- Loading branch information
Showing
27 changed files
with
586 additions
and
415 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,15 @@ | |
|
||
z-index: 40; | ||
} | ||
|
||
.error { | ||
@apply bg-error; | ||
} | ||
|
||
.warning { | ||
@apply bg-warning; | ||
} | ||
|
||
.primary { | ||
@apply bg-primary; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
frontend/src/app/sessions/session/session-viewer.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!-- | ||
~ SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | ||
~ SPDX-License-Identifier: Apache-2.0 | ||
--> | ||
|
||
@if ((sessionViewerService.sessions$ | async) === undefined) { | ||
<div class="flex h-screen"> | ||
<mat-spinner class="m-auto"></mat-spinner> | ||
</div> | ||
} | ||
|
||
@if (sessionViewerService.sessions$ | async; as viewerSessions) { | ||
@if (viewerSessions.length) { | ||
<div | ||
class="select-none" | ||
[ngClass]="{ | ||
'h-[calc(100vh-2vh-65px-110px)]': | ||
(fullscreenService.isFullscreen$ | async) === false, | ||
'h-screen': fullscreenService.isFullscreen$ | async, | ||
}" | ||
> | ||
@if (this.selectedWindowType === "floating") { | ||
<app-floating-window-manager /> | ||
} @else { | ||
<app-tiling-window-manager /> | ||
} | ||
</div> | ||
} | ||
} | ||
|
||
<div class="fixed bottom-4 right-4 z-50"> | ||
<button | ||
mat-fab | ||
color="primary" | ||
(click)="fullscreenService.toggleFullscreen()" | ||
> | ||
@if (fullscreenService.isFullscreen$ | async) { | ||
<mat-icon>fullscreen_exit</mat-icon> | ||
} @else { | ||
<mat-icon>fullscreen</mat-icon> | ||
} | ||
</button> | ||
</div> |
72 changes: 72 additions & 0 deletions
72
frontend/src/app/sessions/session/session-viewer.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* SPDX-FileCopyrightText: Copyright DB InfraGO AG and contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
import { NgClass, AsyncPipe } from '@angular/common'; | ||
import { Component, OnInit, OnDestroy } from '@angular/core'; | ||
import { FormsModule } from '@angular/forms'; | ||
import { MatButtonModule, MatFabButton } from '@angular/material/button'; | ||
import { MatIconModule } from '@angular/material/icon'; | ||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; | ||
import { ActivatedRoute } from '@angular/router'; | ||
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; | ||
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader'; | ||
import { FullscreenService } from 'src/app/sessions/service/fullscreen.service'; | ||
import { SessionService } from 'src/app/sessions/service/session.service'; | ||
import { UserSessionService } from 'src/app/sessions/service/user-session.service'; | ||
import { FloatingWindowManagerComponent } from './floating-window-manager/floating-window-manager.component'; | ||
import { SessionViewerService } from './session-viewer.service'; | ||
import { TilingWindowManagerComponent } from './tiling-window-manager/tiling-window-manager.component'; | ||
|
||
@Component({ | ||
selector: 'app-session-viewer', | ||
templateUrl: './session-viewer.component.html', | ||
standalone: true, | ||
imports: [ | ||
NgxSkeletonLoaderModule, | ||
FormsModule, | ||
MatButtonModule, | ||
MatIconModule, | ||
NgClass, | ||
FloatingWindowManagerComponent, | ||
TilingWindowManagerComponent, | ||
MatFabButton, | ||
AsyncPipe, | ||
MatProgressSpinnerModule, | ||
], | ||
}) | ||
@UntilDestroy() | ||
export class SessionViewerComponent implements OnInit, OnDestroy { | ||
selectedWindowType?: string = undefined; | ||
|
||
constructor( | ||
public userSessionService: UserSessionService, | ||
public sessionService: SessionService, | ||
public sessionViewerService: SessionViewerService, | ||
public fullscreenService: FullscreenService, | ||
private route: ActivatedRoute, | ||
) { | ||
this.fullscreenService.toggleFullscreen(); | ||
this.fullscreenService.isFullscreen$ | ||
.pipe(untilDestroyed(this)) | ||
.subscribe(() => this.sessionViewerService.resizeSessions()); | ||
} | ||
|
||
ngOnInit(): void { | ||
this.route.queryParams.subscribe((params) => { | ||
this.selectedWindowType = params['window-manager'] || 'tiling'; | ||
const sessionIDs = params['session-id']; | ||
if (typeof sessionIDs === 'string') { | ||
this.sessionViewerService.pushSession(sessionIDs); | ||
} else { | ||
for (const sessionID of sessionIDs) { | ||
this.sessionViewerService.pushSession(sessionID); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
ngOnDestroy(): void { | ||
this.sessionViewerService.clearSessions(); | ||
} | ||
} |
Oops, something went wrong.