Skip to content

Commit 6031055

Browse files
committed
feat(codecatalyst): filter "Open Dev Environment" by space, project
Problem: "Open Dev Environment" menu: - shows env id prominently which is not human-friendly - user cannot filter by space or project name - "Last used" string takes unnecessary space Solution: - Set `matchOnDetail=true` so the list can be filtered by the detail description, not just the label. - Drop "Last used" label; the timestamp is clear enough on its own.
1 parent 89b98f6 commit 6031055

File tree

2 files changed

+20
-17
lines changed

2 files changed

+20
-17
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Feature",
3+
"description": "CodeCatalyst: `AWS: Open CodeCatalyst Dev Environment` command allows filtering by Space and Project name"
4+
}

src/codecatalyst/wizards/selectResource.ts

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -53,30 +53,28 @@ function fromDevEnv(env: codecatalyst.DevEnvironment): Omit<DataQuickPickItem<un
5353
const labelParts = [] as string[]
5454

5555
if (env.status === 'RUNNING') {
56-
labelParts.push('$(pass) ')
56+
labelParts.push('$(pass)')
5757
} else {
58-
labelParts.push('$(circle-slash) ') // TODO(sijaden): get actual 'stopped' icon
58+
labelParts.push('$(circle-slash)') // TODO(sijaden): get actual 'stopped' icon
5959
}
6060

61-
const repo = env.repositories[0]
62-
63-
if (repo) {
64-
const branchName = repo.branchName?.replace('refs/heads/', '')
65-
labelParts.push(branchName ? `${repo.repositoryName}/${branchName}` : repo.repositoryName)
66-
} else {
67-
labelParts.push(`${env.id} (no repository)`)
68-
}
61+
labelParts.push(env.alias ? env.alias : env.id)
6962

70-
if (env.alias) {
71-
labelParts.push(` ${env.alias}`)
72-
}
63+
const repo = env.repositories[0]
64+
const branchName = repo?.branchName?.replace('refs/heads/', '')
65+
const repoLabel = repo
66+
? branchName
67+
? `${repo.repositoryName}/${branchName}`
68+
: repo.repositoryName
69+
: '(no repository)'
7370

74-
const lastUsed = `Last used: ${getRelativeDate(env.lastUpdatedTime)}`
71+
const statusLabel = env.status === 'RUNNING' ? 'RUNNING - IN USE' : env.status
72+
const desc = `${statusLabel} ${getRelativeDate(env.lastUpdatedTime)}`
7573

7674
return {
77-
label: labelParts.join(''),
78-
description: env.status === 'RUNNING' ? 'RUNNING - IN USE' : env.status,
79-
detail: `${env.org.name}/${env.project.name}, ${lastUsed}`,
75+
label: labelParts.join(' '),
76+
description: desc,
77+
detail: `${env.org.name}/${env.project.name}/${repoLabel}`,
8078
}
8179
}
8280

@@ -90,6 +88,7 @@ function createResourcePrompter<T extends codecatalyst.CodeCatalystResource>(
9088
const prompter = createQuickPick(items, {
9189
buttons: [refresh, ...createCommonButtons(helpUri)],
9290
...presentation,
91+
matchOnDetail: true,
9392
})
9493

9594
refresh.onClick = () => {

0 commit comments

Comments
 (0)