Skip to content

Commit e7e789b

Browse files
keeganirbykaranA-aws
authored andcommitted
fix(cwl): Change wording in menus, add info message when opening running session (aws#6073)
## Problem Addresses feedback after working with Toolkit UXD. There are inconsistencies with formatting/capitalization of certain nouns in the LiveTail menu. Some of the verbiage is unclear/too lengthy. In the case there is an already running session and the user tries to start a new session with the same parameters, it is unclear that we are opening an already existing session and not starting a new one. ## Solution * Consistent spacing and capitalization of "Log Group" and "Log Stream" * Introduce new Info window when opening and existing session stream * Re-words LogStream filter type sub menu.
1 parent e1e38a5 commit e7e789b

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

packages/core/src/awsService/cloudWatchLogs/commands/tailLogGroup.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ export async function tailLogGroup(
4343
}
4444
const session = new LiveTailSession(liveTailSessionConfig)
4545
if (registry.has(uriToKey(session.uri))) {
46-
await prepareDocument(session)
46+
await vscode.window.showTextDocument(session.uri, { preview: false })
47+
void vscode.window.showInformationMessage(`Switching editor to an existing session that matches request.`)
4748
span.record({
4849
result: 'Succeeded',
4950
sessionAlreadyStarted: true,

packages/core/src/awsService/cloudWatchLogs/wizard/liveTailLogStreamSubmenu.ts

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class LogStreamFilterSubmenu extends Prompter<LogStreamFilterResponse> {
4141
public createMenuPrompter() {
4242
const helpUri = startLiveTailHelpUrl
4343
const prompter = createQuickPick(this.menuOptions, {
44-
title: 'Select LogStream filter type',
44+
title: 'Include log events from...',
4545
buttons: createCommonButtons(helpUri),
4646
})
4747
return prompter
@@ -50,18 +50,15 @@ export class LogStreamFilterSubmenu extends Prompter<LogStreamFilterResponse> {
5050
private get menuOptions(): DataQuickPickItem<LogStreamFilterType>[] {
5151
const options: DataQuickPickItem<LogStreamFilterType>[] = []
5252
options.push({
53-
label: 'All',
54-
detail: 'Include log events from all LogStreams in the selected LogGroup',
53+
label: 'All Log Streams',
5554
data: 'all',
5655
})
5756
options.push({
58-
label: 'Specific',
59-
detail: 'Include log events from only a specific LogStream',
57+
label: 'Specific Log Stream',
6058
data: 'specific',
6159
})
6260
options.push({
63-
label: 'Prefix',
64-
detail: 'Include log events from LogStreams that begin with a provided prefix',
61+
label: 'Log Streams matching prefix',
6562
data: 'prefix',
6663
})
6764
return options
@@ -70,21 +67,21 @@ export class LogStreamFilterSubmenu extends Prompter<LogStreamFilterResponse> {
7067
public createLogStreamPrefixBox(): InputBoxPrompter {
7168
const helpUri = startLiveTailLogStreamPrefixHelpUrl
7269
return createInputBox({
73-
title: 'Enter LogStream prefix',
74-
placeholder: 'logStream prefix (case sensitive; empty matches all)',
75-
prompt: 'Only log events in the LogStreams that have names that start with the prefix that you specify here are included in the Live Tail session',
70+
title: 'Enter Log Stream prefix',
71+
placeholder: 'log stream prefix (case sensitive; empty matches all)',
72+
prompt: 'Only log events in Log Streams whose name starts with the supplied prefix will be included.',
7673
validateInput: (input) => this.validateLogStreamPrefix(input),
7774
buttons: createCommonButtons(helpUri),
7875
})
7976
}
8077

8178
public validateLogStreamPrefix(prefix: string) {
8279
if (prefix.length > 512) {
83-
return 'LogStream prefix cannot be longer than 512 characters'
80+
return 'Log Stream prefix cannot be longer than 512 characters'
8481
}
8582

8683
if (!this.logStreamPrefixRegEx.test(prefix)) {
87-
return 'LogStream prefix must match pattern: [^:*]*'
84+
return 'Log Stream prefix must match pattern: [^:*]*'
8885
}
8986
}
9087

@@ -104,7 +101,7 @@ export class LogStreamFilterSubmenu extends Prompter<LogStreamFilterResponse> {
104101
.map((streams) => streams!.map((stream) => ({ data: stream.logStreamName!, label: stream.logStreamName! })))
105102

106103
return createQuickPick(items, {
107-
title: 'Select LogStream',
104+
title: 'Select Log Stream',
108105
buttons: createCommonButtons(helpUri),
109106
})
110107
}

packages/core/src/awsService/cloudWatchLogs/wizard/tailLogGroupWizard.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export class TailLogGroupWizard extends Wizard<TailLogGroupWizardResponse> {
3838
this.form.regionLogGroupSubmenuResponse.bindPrompter(createRegionLogGroupSubmenu)
3939
this.form.logStreamFilter.bindPrompter((state) => {
4040
if (!state.regionLogGroupSubmenuResponse?.data) {
41-
throw new ToolkitError('LogGroupName is null')
41+
throw new ToolkitError('Log Group name is null')
4242
}
4343
return new LogStreamFilterSubmenu(
4444
state.regionLogGroupSubmenuResponse.data,
@@ -57,7 +57,7 @@ export function createRegionLogGroupSubmenu(): RegionSubmenu<string> {
5757
buttons: [createExitButton()],
5858
},
5959
{ title: localize('AWS.cwl.tailLogGroup.regionPromptTitle', 'Select Region for Log Group') },
60-
'LogGroups'
60+
'Log Groups'
6161
)
6262
}
6363

@@ -69,7 +69,7 @@ async function getLogGroupQuickPickOptions(regionCode: string): Promise<DataQuic
6969

7070
for await (const logGroupObject of logGroups) {
7171
if (!logGroupObject.arn || !logGroupObject.logGroupName) {
72-
throw new ToolkitError('LogGroupObject name or arn undefined')
72+
throw new ToolkitError('Log Group name or arn is undefined')
7373
}
7474

7575
logGroupsOptions.push({
@@ -88,7 +88,7 @@ export function buildLogGroupArn(logGroupName: string, region: string): string {
8888
const awsAccountId = globals.awsContext.getCredentialAccountId()
8989
if (awsAccountId === undefined) {
9090
throw new ToolkitError(
91-
`Failed to construct Arn for LogGroup because awsAccountId is undefined. LogGroup: ${logGroupName}`
91+
`Failed to construct Arn for Log Group because awsAccountId is undefined. Log Group: ${logGroupName}`
9292
)
9393
}
9494
return `arn:aws:logs:${region}:${awsAccountId}:log-group:${logGroupName}`
@@ -103,7 +103,7 @@ export function createFilterPatternPrompter() {
103103
return createInputBox({
104104
title: 'Provide log event filter pattern',
105105
placeholder: 'filter pattern (case sensitive; empty matches all)',
106-
prompt: 'Optional pattern to use to filter the results to include only log events that match the pattern.',
106+
prompt: 'Optional filter to include only log events that match the supplied pattern.',
107107
buttons: [createHelpButton(helpUri), createBackButton(), createExitButton()],
108108
})
109109
}

packages/core/src/test/awsService/cloudWatchLogs/wizard/liveTailLogStreamSubmenu.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@ describe('liveTailLogStreamSubmenu', async function () {
2121

2222
describe('Menu prompter', async function () {
2323
it('gives option for each filter type', async function () {
24-
logStreamMenuPrompter.assertContainsItems('All', 'Specific', 'Prefix')
25-
logStreamMenuPrompter.acceptItem('All')
24+
logStreamMenuPrompter.assertContainsItems(
25+
'All Log Streams',
26+
'Specific Log Stream',
27+
'Log Streams matching prefix'
28+
)
29+
logStreamMenuPrompter.acceptItem('All Log Streams')
2630
await logStreamMenuPrompter.result()
2731
})
2832
})
@@ -42,7 +46,7 @@ describe('liveTailLogStreamSubmenu', async function () {
4246
const invalidInput = 'my-log-stream:'
4347
getTestWindow().onDidShowInputBox((input) => {
4448
input.acceptValue(invalidInput)
45-
assert.deepEqual(input.validationMessage, 'LogStream prefix must match pattern: [^:*]*')
49+
assert.deepEqual(input.validationMessage, 'Log Stream prefix must match pattern: [^:*]*')
4650
input.hide()
4751
})
4852
const inputBox = logStreamFilterSubmenu.createLogStreamPrefixBox()
@@ -53,7 +57,7 @@ describe('liveTailLogStreamSubmenu', async function () {
5357
const invalidInput = 'my-log-stream*'
5458
getTestWindow().onDidShowInputBox((input) => {
5559
input.acceptValue(invalidInput)
56-
assert.deepEqual(input.validationMessage, 'LogStream prefix must match pattern: [^:*]*')
60+
assert.deepEqual(input.validationMessage, 'Log Stream prefix must match pattern: [^:*]*')
5761
input.hide()
5862
})
5963
const inputBox = logStreamFilterSubmenu.createLogStreamPrefixBox()
@@ -64,7 +68,7 @@ describe('liveTailLogStreamSubmenu', async function () {
6468
const invalidInput = 'a'.repeat(520)
6569
getTestWindow().onDidShowInputBox((input) => {
6670
input.acceptValue(invalidInput)
67-
assert.deepEqual(input.validationMessage, 'LogStream prefix cannot be longer than 512 characters')
71+
assert.deepEqual(input.validationMessage, 'Log Stream prefix cannot be longer than 512 characters')
6872
input.hide()
6973
})
7074
const inputBox = logStreamFilterSubmenu.createLogStreamPrefixBox()

0 commit comments

Comments
 (0)