-
Notifications
You must be signed in to change notification settings - Fork 734
feat(cwl): Add clear screen and stop session code lens #5958
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4a7a75f
Add clear screen and stop session code lens
1f8d9dd
Remove redundant range variable
104fb2c
Update packages/core/src/awsService/cloudWatchLogs/commands/tailLogGr…
keeganirby 432ecf1
Update packages/core/src/awsService/cloudWatchLogs/commands/tailLogGr…
keeganirby 9b2c3a7
use UriToKey
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
52 changes: 52 additions & 0 deletions
52
packages/core/src/awsService/cloudWatchLogs/document/liveTailCodeLensProvider.ts
This file contains hidden or 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,52 @@ | ||
| /*! | ||
| * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| import * as vscode from 'vscode' | ||
| import { cloudwatchLogsLiveTailScheme } from '../../../shared/constants' | ||
|
|
||
| export class LiveTailCodeLensProvider implements vscode.CodeLensProvider { | ||
| onDidChangeCodeLenses?: vscode.Event<void> | undefined | ||
|
|
||
| provideCodeLenses( | ||
| document: vscode.TextDocument, | ||
| token: vscode.CancellationToken | ||
| ): vscode.ProviderResult<vscode.CodeLens[]> { | ||
| const uri = document.uri | ||
| if (uri.scheme !== cloudwatchLogsLiveTailScheme) { | ||
| return [] | ||
| } | ||
| const codeLenses: vscode.CodeLens[] = [] | ||
| codeLenses.push(this.buildClearDocumentCodeLens(document)) | ||
| codeLenses.push(this.buildStopTailingCodeLens(document)) | ||
| return codeLenses | ||
| } | ||
|
|
||
| private buildClearDocumentCodeLens(document: vscode.TextDocument): vscode.CodeLens { | ||
| const range = this.getBottomOfDocumentRange(document) | ||
| const command: vscode.Command = { | ||
| title: 'Clear document', | ||
| command: 'aws.cwl.clearDocument', | ||
| arguments: [document], | ||
| } | ||
| return new vscode.CodeLens(range, command) | ||
| } | ||
|
|
||
| private buildStopTailingCodeLens(document: vscode.TextDocument): vscode.CodeLens { | ||
| const range = this.getBottomOfDocumentRange(document) | ||
| const command: vscode.Command = { | ||
| title: 'Stop tailing', | ||
| command: 'aws.cwl.stopTailingLogGroup', | ||
| arguments: [document], | ||
| } | ||
| return new vscode.CodeLens(range, command) | ||
| } | ||
|
|
||
| private getBottomOfDocumentRange(document: vscode.TextDocument): vscode.Range { | ||
| return new vscode.Range( | ||
| new vscode.Position(document.lineCount - 1, 0), | ||
| new vscode.Position(document.lineCount - 1, 0) | ||
| ) | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why do we have a different scheme, and a different codelens, for "live tail"? The codelenses for the non-livetail log group search would be useful in live tail. Why are they separate?
Whether a log group is being "tailed" or not is just a flag. It's not an entirely different concept.
Uh oh!
There was an error while loading. Please reload this page.
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.
The CodeLenses in the existing CWL experiences are not very applicable to our LiveTail use case.
"Load newer" & "Load older" don't apply when data is being streamed in constantly. For
View full log stream, customers can apply LogStream filter parameters to their liveTail session already so having this as a codeLens in a Livetail session doesn't seem necessary.On the other hand, a
SearchLogGroupcommand won't need aStop tailingcode lens.These UX are quite separate.
We already separate the CodeLens providers for
logDataandlogStream. Given the UX and functionality of LiveTail is different from our other experiences I think it fits to have a separate CodeLens provider.This is the same reasoning behind having a separate scheme as we discussed here. The way we retrieve/display logs from a LiveTail session stream differs enough from the existing LogDataRegistry that I felt that it was best to separate these logic's, as opposed to finding a way to generalize.
I feel that LiveTail and the existing experiences are separate enough from each other that they should be treated as such.