Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hide usernames button to dashboard for privacy on screensharings #216

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@
>Whether finished sessions should be included.
</clr-control-helper>
</clr-toggle-container>
<clr-toggle-container id="hideUsernamesToggle">
<clr-toggle-wrapper>
<input
type="checkbox"
clrToggle
name="hideUsernames"
[(ngModel)]="hideUsernames"
/>
<label>Hide Usernames</label>
</clr-toggle-wrapper>
<clr-control-helper
>Keep names hidden in screensharings
</clr-control-helper>
</clr-toggle-container>
</div>
<div class="clr-col">
<input
Expand Down Expand Up @@ -104,6 +118,7 @@
<progress-card
[progress]="p"
[pause]="pause"
[hideUsername]="hideUsernames"
(nameClickedEvent)="filterName($event)"
></progress-card>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export class ProgressDashboardComponent implements OnInit {
public callInterval: any;
public circleVisible: boolean = true;
public users: User[];
public hideUsernames: boolean = false;

public pauseCall: boolean = false; // Stop refreshing if we are looking at a progress
public pause = (pause: boolean) => {
Expand Down
115 changes: 80 additions & 35 deletions src/app/progress/progress.component.html
Original file line number Diff line number Diff line change
@@ -1,40 +1,85 @@
<div class="card">
<div class="progress">
<progress class="{{getProgressColorClass()}}" [value]="getProgress() || 0" max="100"></progress>
</div>

<div class="card-header" (click)="progressFilterName()">
{{ progress.username }}
</div>
<div class="card-block">
<div class="card-text">
<div><cds-icon shape="play" solid></cds-icon> {{progress.scenario_name}}</div>
<div *ngIf="progress.course"><cds-icon shape="layers" solid></cds-icon> {{progress.course_name}}</div>
<div *ngIf="progress.current_step > 0"><cds-icon shape="number-list"></cds-icon> {{ progress.current_step }} / {{ progress.total_step }}</div>
<div *ngIf="progress.current_step == 0"><cds-icon shape="number-list"></cds-icon> Not started yet</div>
<div *ngIf="!progress.finished" title="Since {{progress.started}}"><cds-icon shape="clock"></cds-icon> {{ timeSince(progress.started) }}</div>
<div *ngIf="progress.finished" title="{{progress.started}}-{{progress.last_update}}"><cds-icon shape="clock"></cds-icon> {{ timeSince(progress.started, progress.last_update) }}</div>
</div>
</div>



<div class="progress">
<progress
class="{{ getProgressColorClass() }}"
[value]="getProgress() || 0"
max="100"
></progress>
</div>

<div class="card-footer">

<clr-dropdown>
<button class="dropdown-toggle btn btn-primary" clrDropdownTrigger>
Actions
<cds-icon shape="angle" direction="down"></cds-icon>
</button>
<clr-dropdown-menu clrPosition="top-left" *clrIfOpen>
<div class="dropdown-item " (click)="openInfo()" clrDropdownItem>Info</div>
<div class="dropdown-item" (click)="openTerminalWindow()" [clrDisabled]="progress.finished" clrDropdownItem *rbac="['sessions.get', 'courses.get','progresses.list', 'scenarios.get', 'virtualmachineclaims.get']">Join Session</div>
<div class="dropdown-divider" role="separator" aria-hidden="true"></div>
<div class="dropdown-item " (click)="terminateSession()" [clrDisabled]="progress.finished" clrDropdownItem *rbac="['sessions.update']">Terminate Session</div>
</clr-dropdown-menu>
</clr-dropdown>
<div class="card-header" (click)="progressFilterName()">
{{ getUsername() }}
</div>
<div class="card-block">
<div class="card-text">
<div>
<cds-icon shape="play" solid></cds-icon> {{ progress.scenario_name }}
</div>
<div *ngIf="progress.course">
<cds-icon shape="layers" solid></cds-icon> {{ progress.course_name }}
</div>
<div *ngIf="progress.current_step > 0">
<cds-icon shape="number-list"></cds-icon> {{ progress.current_step }} /
{{ progress.total_step }}
</div>
<div *ngIf="progress.current_step == 0">
<cds-icon shape="number-list"></cds-icon> Not started yet
</div>
<div *ngIf="!progress.finished" title="Since {{ progress.started }}">
<cds-icon shape="clock"></cds-icon> {{ timeSince(progress.started) }}
</div>
<div
*ngIf="progress.finished"
title="{{ progress.started }}-{{ progress.last_update }}"
>
<cds-icon shape="clock"></cds-icon>
{{ timeSince(progress.started, progress.last_update) }}
</div>
</div>
</div>

<div class="card-footer">
<clr-dropdown>
<button class="dropdown-toggle btn btn-primary" clrDropdownTrigger>
Actions
<cds-icon shape="angle" direction="down"></cds-icon>
</button>
<clr-dropdown-menu clrPosition="top-left" *clrIfOpen>
<div class="dropdown-item" (click)="openInfo()" clrDropdownItem>
Info
</div>
<div
class="dropdown-item"
(click)="openTerminalWindow()"
[clrDisabled]="progress.finished"
clrDropdownItem
*rbac="[
'sessions.get',
'courses.get',
'progresses.list',
'scenarios.get',
'virtualmachineclaims.get'
]"
>
Join Session
</div>
<div class="dropdown-divider" role="separator" aria-hidden="true"></div>
<div
class="dropdown-item"
(click)="terminateSession()"
[clrDisabled]="progress.finished"
clrDropdownItem
*rbac="['sessions.update']"
>
Terminate Session
</div>
</clr-dropdown-menu>
</clr-dropdown>
</div>
</div>

<progress-info #progressInfo [progress]="progress" [pause]="pause"></progress-info>
<progress-info
#progressInfo
[progress]="progress"
[pause]="pause"
></progress-info>
7 changes: 7 additions & 0 deletions src/app/progress/progress.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ export class ProgressComponent {
@Input()
public progress: Progress;

@Input()
public hideUsername: boolean;

@Input()
public pause: Function;

Expand Down Expand Up @@ -94,4 +97,8 @@ export class ProgressComponent {
}
return 'status-running';
}

public getUsername() {
return this.hideUsername ? this.progress.user : this.progress.username;
}
}
Loading