-
Notifications
You must be signed in to change notification settings - Fork 488
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
feat(cwl): Add LiveTail StatusBarItems #5894
Conversation
This pull request implements a feature or fix, so it must include a changelog entry. See CONTRIBUTING.md#changelog for instructions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this idea been floated by @jparkhurst3 ? I think we already have 2+ status bar items and this adds 2 more to that
Started thread offline |
} catch (err) { | ||
globals.clock.clearInterval(timer) | ||
throw err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} catch (err) { | |
globals.clock.clearInterval(timer) | |
throw err | |
} finally { | |
globals.clock.clearInterval(timer) |
@@ -162,12 +220,13 @@ function trimOldestLines( | |||
function registerTabChangeCallback( | |||
session: LiveTailSession, | |||
registry: LiveTailSessionRegistry, | |||
document: vscode.TextDocument | |||
document: vscode.TextDocument, | |||
timer: NodeJS.Timer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check if our Timeout
module is useful?
export class Timeout { |
It supports cancellations and other features, so mentioning it in case your needs expand later.
if (editor?.document === document) { | ||
session.showStatusBarItem() | ||
} else { | ||
session.hideStatusBarItem() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could just be a parameter. Separate functions are usually not needed for "toggle".
if (editor?.document === document) { | |
session.showStatusBarItem() | |
} else { | |
session.hideStatusBarItem() | |
session.showStatusBarItem(editor?.document === document) |
let numEvents | ||
if (event.sessionResults === undefined) { | ||
numEvents = 0 | ||
} else { | ||
numEvents = event.sessionResults.length | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a ternary. it's clearer, more readable, and allows const
.
let isSampled: boolean | ||
//sessionMetadata is expected to always be present on a LiveTail stream update | ||
if (event.sessionMetadata === undefined || event.sessionMetadata.sampled === undefined) { | ||
isSampled = false | ||
} else { | ||
isSampled = event.sessionMetadata.sampled | ||
} | ||
session.isSampled = isSampled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could be a ternary.
what was the conclusion? |
Having a LiveTail statusbar item is ok given that its only visible when its respective session is the active editor. UX would prefer a single status bar item that groups the three pieces of information together (eventRate, timer, isSampled), as opposed to the original implementation with three separate items. |
|
Problem
As LiveTail session is running, we want to display to the user metadata about their session.
Solution
While a livetail session is the active editor, in the bottom status bar, we will display the duration the session has been running for, how many events per/s, and if the log data is being sampled or not.
License: I confirm that my contribution is made under the terms of the Apache 2.0 license.