-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clarify when the Trace Server is Offline
Make use of a status LED placed next to the Trace Viewer label to indicate server status. Red and Green States indicate when the server is up/down. LED has a tooltip to show more details when hovered Signed-off-by: hriday-panchasara <hriday.panchasara@ericsson.com>
- Loading branch information
1 parent
8da7a8b
commit 4163ae9
Showing
6 changed files
with
85 additions
and
0 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
43 changes: 43 additions & 0 deletions
43
theia-extensions/viewer-prototype/src/browser/trace-server-status.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,43 @@ | ||
/* eslint-disable @typescript-eslint/no-non-null-assertion */ | ||
import { injectable } from 'inversify'; | ||
import { RestClient, ConnectionStatusListener } from 'tsp-typescript-client/lib/protocol/rest-client'; | ||
|
||
@injectable() | ||
export class TraceServerConnectionStatusService { | ||
|
||
private connectionStatusListener: ConnectionStatusListener; | ||
|
||
private constructor() { | ||
this.connectionStatusListener = ((status: boolean) => { | ||
if (status) { | ||
this.renderSuccess(); | ||
} else { | ||
this.renderFailure(); | ||
} | ||
}); | ||
} | ||
|
||
public addConnectionStatusListener(): void { | ||
RestClient.addConnectionStatusListener(this.connectionStatusListener); | ||
} | ||
|
||
public removeConnectionStatusListener(): void { | ||
RestClient.removeConnectionStatusListener(this.connectionStatusListener); | ||
} | ||
|
||
private renderSuccess(): void { | ||
if (document.getElementById('trace.viewer.serverCheck')) { | ||
document.getElementById('trace.viewer.serverCheck')!.className = 'fa fa-check-circle-o fa-lg'; | ||
document.getElementById('trace.viewer.serverCheck')!.title = 'Server health and latency are good. No known issues'; | ||
document.getElementById('trace.viewer.serverCheck')!.style.color = 'green'; | ||
} | ||
} | ||
|
||
private renderFailure(): void { | ||
if (document.getElementById('trace.viewer.serverCheck')) { | ||
document.getElementById('trace.viewer.serverCheck')!.className = 'fa fa-times-circle-o fa-lg'; | ||
document.getElementById('trace.viewer.serverCheck')!.title = 'Trace Viewer Critical Error: Trace Server Offline'; | ||
document.getElementById('trace.viewer.serverCheck')!.style.color = 'red'; | ||
} | ||
} | ||
} |
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