Skip to content

Commit

Permalink
fix(webapp): add tooltip to menu warning icon when session is closed (#…
Browse files Browse the repository at this point in the history
…852)

Issue: DGW-145
  • Loading branch information
kristahouse authored May 14, 2024
1 parent 199bb89 commit b4ed845
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<ng-container *ngFor="let activeWebSession of activeWebSessions;">
<div class="menu-list-item-container">
<div class="menu-list-item"
[pTooltip]="activeWebSession.name"
[class.selected]="activeWebSessionIndex === activeWebSession.tabIndex"
(click)="onMenuListItemClick($event, activeWebSession)">

<div class="left-content">
<i *ngIf="activeWebSession.icon" class="dvl-icon" [ngClass]="activeWebSession.icon"></i>
<i *ngIf="activeWebSession.icon"
class="dvl-icon"
[pTooltip]="activeWebSession.iconTooltip"
[ngClass]="activeWebSession.icon"></i>
<span class="menu-list-item-label" tooltipEllipsis>{{activeWebSession.name}}</span>
</div>
<p-button (onClick)="onCloseButtonClick($event, activeWebSession)"
[pTooltip]="'Close Session'"
aria-label="Close session"
icon="dvl-icon dvl-icon-close"
iconPos="left"></p-button>
Expand Down
2 changes: 2 additions & 0 deletions webapp/src/client/app/shared/models/web-session.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export class WebSession<WebSessionComponentType, TData> {
public tabIndex?: number;
public data?: TData;
public icon?: string = '';
public iconTooltip?: string = '';
public status: ComponentStatus;
public desktopSize: DesktopSize;

Expand All @@ -42,6 +43,7 @@ export class WebSession<WebSessionComponentType, TData> {
this.component = component;
this.data = data;
this.icon = icon;
this.iconTooltip = name;
this.tabIndex = tabIndex;
this.id = id;
this.sessionId = sessionId;
Expand Down
7 changes: 6 additions & 1 deletion webapp/src/client/app/shared/services/web-session.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,18 @@ export class WebSessionService {
this.setWebSessionCurrentIndex(this.NEW_SESSION_IDX);
}

//For translation ConnectionHasBeenTerminatedEllipsis
async updateWebSessionIcon(updateWebSessionId: string, icon: string): Promise<void> {
const currentSessions = this.webSessionDataSubject.value;
const currentSessions: WebSession<any, any>[] = this.webSessionDataSubject.value;
const index: number = currentSessions.findIndex(session => session.id === updateWebSessionId);
const webSession: WebSession<any, any> = currentSessions[index];

if (index !== -1) {
webSession.icon = icon;
if (icon === WebClientRdpComponent.DVL_WARNING_ICON) {
webSession.iconTooltip = 'Connection has been terminated.';
}

currentSessions[index] = webSession;
this.webSessionDataSubject.next(currentSessions);
} else {
Expand Down

0 comments on commit b4ed845

Please sign in to comment.