Skip to content

Commit bd36d2b

Browse files
authored
Merge #3453 codecatalyst: "Open Dev Environment"
2 parents 695ad0d + 00cdd6b commit bd36d2b

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
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+
}
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 now sorts Dev Environments by most recent usage"
4+
}

src/codecatalyst/wizards/selectResource.ts

Lines changed: 17 additions & 22 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 = () => {
@@ -154,11 +153,7 @@ export function createDevEnvPrompter(
154153
placeholder: 'Search for a Dev Environment',
155154
compare: (a, b) => {
156155
if (isData(a.data) && isData(b.data)) {
157-
if (a.data.status === b.data.status) {
158-
return b.data.lastUpdatedTime.getTime() - a.data.lastUpdatedTime.getTime()
159-
}
160-
161-
return a.data.status === 'RUNNING' ? 1 : b.data.status === 'RUNNING' ? -1 : 0
156+
return b.data.lastUpdatedTime.getTime() - a.data.lastUpdatedTime.getTime()
162157
}
163158

164159
return 0

0 commit comments

Comments
 (0)