-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Render new trace server connection status bar item
Add a contextual (secondary, right-side) VS Code status bar item, that renders the current trace server status. Have the extension context pass this status service to each active web-view provider, for them to update the rendered status upon every related message from the view. Have TraceExplorerOpenedTracesViewProvider pass its status service to the TraceViewerPanel upon using it, in turn. Without this, there are instances where the latest server status isn't shown as expected. Keep this undefined in trace-tree.ts where that is not required. This makes the server status listener-based. Add this connection listener through the TspClientProvider constructor, thus consistently use the latter across. This means also using it in the TraceViewerContainer constructor, instead of TspClient's directly prior. Properly 'stringify' (thus parse) the boolean status value, as passing it straight would break the JSON message otherwise. Explicitly defer showing the item to only once Trace Viewer gets selected for the first time. Like open trace-explorer views which remain shown if unselecting Trace Viewer, keep showing the status item from there on. The VS Code API, anyway, doesn't hold an event that could selectively hide anything upon solely exiting Trace Viewer. Prefer a standard VS Code status bar item to the side widget approach of theia-trace-extension. This should be more standard for such a connection status display, from a VS Code UI (and UX) perspective. This also allows not having to implement a custom widget that differs from the Trace Viewer panels. -The latter being meant to render real views. Base this simple design of the status bar item on [1] below. Now, use the warning background for a found server, for such a positive status to be highlighted, thus noticeable. Use the usual red background for a trace server that is not found, highlighting that as an error. No other color can or should be used anyway for status bar items, per [1]. The latter reference also includes [2]'s, used to come up with this change. [1]https://code.visualstudio.com/api/ux-guidelines/status-bar [2]https://github.com/microsoft/vscode-extension-samples/blob/main/statusbar-sample/src/extension.ts Use a short (thus usable) enough statusBarItem.text, along with a tooltip to complement the trace server status narrative. Overall, with this approach, defer the introduction of the inversify module, used in theia-trace-extension. This would be to inject instances such as objects involved in this change and likely other ones; some being potential singletons. Slightly refactor a few surrounding blank lines while editing some of these files. Fixes #33. Signed-off-by: Marco Miller <marco.miller@ericsson.com>
- Loading branch information
1 parent
e398d33
commit 8a689e4
Showing
11 changed files
with
93 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { StatusBarItem, ThemeColor } from 'vscode'; | ||
|
||
export class TraceServerConnectionStatusService { | ||
|
||
private statusBarItem: StatusBarItem; | ||
|
||
public constructor(statusBarItem: StatusBarItem) { | ||
this.statusBarItem = statusBarItem; | ||
this.statusBarItem.hide(); | ||
} | ||
|
||
public async render(status: boolean): Promise<void> { | ||
if (status) { | ||
this.statusBarItem.backgroundColor = new ThemeColor('statusBarItem.warningBackground'); | ||
this.statusBarItem.text = '$(check) Trace Server'; | ||
this.statusBarItem.tooltip = 'Trace Viewer: server found'; | ||
} else { | ||
this.statusBarItem.backgroundColor = new ThemeColor('statusBarItem.errorBackground'); | ||
this.statusBarItem.text = '$(error) Trace Server'; | ||
this.statusBarItem.tooltip = 'Trace Viewer: server not found'; | ||
} | ||
this.statusBarItem.show(); | ||
} | ||
} |
12 changes: 11 additions & 1 deletion
12
vscode-trace-webviews/src/common/tsp-client-provider-impl.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
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