Skip to content

Commit ae3851c

Browse files
committed
merge in master
2 parents 40abd17 + 82a2368 commit ae3851c

File tree

8 files changed

+33
-26
lines changed

8 files changed

+33
-26
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "misleading error when downloading a Lambda to a workspace without a folder"
4+
}

package.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,10 @@
11201120
"command": "aws.ec2.openTerminal",
11211121
"when": "aws.isDevMode"
11221122
},
1123+
{
1124+
"command": "aws.ec2.openTerminal",
1125+
"when": "aws.isDevMode"
1126+
},
11231127
{
11241128
"command": "aws.ec2.startInstance",
11251129
"when": "false"
@@ -1359,22 +1363,22 @@
13591363
{
13601364
"command": "aws.ec2.startInstance",
13611365
"group": "0@1",
1362-
"when": "viewItem =~ /^(awsEc2StoppedNode)$/"
1366+
"when": "viewItem =~ /^(awsEc2(Stopped|Pending)Node)$/"
13631367
},
13641368
{
13651369
"command": "aws.ec2.startInstance",
13661370
"group": "inline@1",
1367-
"when": "viewItem =~ /^(awsEc2StoppedNode)$/"
1371+
"when": "viewItem =~ /^(awsEc2(Stopped|Pending)Node)$/"
13681372
},
13691373
{
13701374
"command": "aws.ec2.stopInstance",
13711375
"group": "0@1",
1372-
"when": "viewItem =~ /^(awsEc2RunningNode)$/"
1376+
"when": "viewItem =~ /^(awsEc2(Running|Pending)Node)$/"
13731377
},
13741378
{
13751379
"command": "aws.ec2.stopInstance",
13761380
"group": "inline@1",
1377-
"when": "viewItem =~ /^(awsEc2RunningNode)$/"
1381+
"when": "viewItem =~ /^(awsEc2(Running|Pending)Node)$/"
13781382
},
13791383
{
13801384
"command": "aws.ec2.rebootInstance",

src/ec2/activation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ export async function activate(ctx: ExtContext): Promise<void> {
3535

3636
Commands.register('aws.ec2.startInstance', async (node?: Ec2Node) => {
3737
await startInstance(node)
38-
await refreshExplorer(node)
38+
refreshExplorer(node)
3939
}),
4040

4141
Commands.register('aws.ec2.stopInstance', async (node?: Ec2Node) => {
4242
await stopInstance(node)
43-
await refreshExplorer(node)
43+
refreshExplorer(node)
4444
}),
4545

4646
Commands.register('aws.ec2.rebootInstance', async (node?: Ec2Node) => {
4747
await rebootInstance(node)
48-
await refreshExplorer(node)
48+
refreshExplorer(node)
4949
})
5050
)
5151
}

src/ec2/explorer/ec2InstanceNode.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import { AWSResourceNode } from '../../shared/treeview/nodes/awsResourceNode'
88
import { AWSTreeNodeBase } from '../../shared/treeview/nodes/awsTreeNodeBase'
99
import { Ec2Instance } from '../../shared/clients/ec2Client'
1010
import globals from '../../shared/extensionGlobals'
11-
import { getIconCodeForInstanceStatus } from '../utils'
11+
import { Commands } from '../../shared/vscode/commands'
12+
import { getIconCode } from '../utils'
1213
import { Ec2Selection } from '../prompter'
1314
import { Ec2ParentNode } from './ec2ParentNode'
14-
import { Commands } from '../../shared/vscode/commands'
1515

1616
export const Ec2InstanceRunningContext = 'awsEc2RunningNode'
1717
export const Ec2InstanceStoppedContext = 'awsEc2StoppedNode'
@@ -36,7 +36,7 @@ export class Ec2InstanceNode extends AWSTreeNodeBase implements AWSResourceNode
3636
this.setInstance(newInstance)
3737
this.label = `${this.name} (${this.InstanceId})`
3838
this.contextValue = this.getContext()
39-
this.iconPath = new vscode.ThemeIcon(getIconCodeForInstanceStatus(this.instance))
39+
this.iconPath = new vscode.ThemeIcon(getIconCode(this.instance))
4040
this.tooltip = `${this.name}\n${this.InstanceId}\n${this.instance.status}\n${this.arn}`
4141

4242
if (this.isPending()) {

src/ec2/prompter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Ec2Client, Ec2Instance } from '../shared/clients/ec2Client'
99
import { isValidResponse } from '../shared/wizards/wizard'
1010
import { CancellationError } from '../shared/utilities/timeoutUtils'
1111
import { AsyncCollection } from '../shared/utilities/asyncCollection'
12-
import { getIconForInstanceStatus } from './utils'
12+
import { getIconCode } from './utils'
1313

1414
export type instanceFilter = (instance: Ec2Instance) => boolean
1515
export interface Ec2Selection {
@@ -21,7 +21,7 @@ export class Ec2Prompter {
2121
public constructor(protected filter?: instanceFilter) {}
2222

2323
protected static asQuickPickItem(instance: Ec2Instance): DataQuickPickItem<string> {
24-
const icon = getIconForInstanceStatus(instance)
24+
const icon = `$(${getIconCode(instance)})`
2525
return {
2626
label: `${icon} \t ${instance.name ?? '(no name)'}`,
2727
detail: instance.InstanceId,

src/ec2/utils.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55

66
import { Ec2Instance } from '../shared/clients/ec2Client'
77

8-
export function getIconForInstanceStatus(instance: Ec2Instance) {
9-
return `$(${getIconCodeForInstanceStatus(instance)})`
10-
}
11-
12-
export function getIconCodeForInstanceStatus(instance: Ec2Instance) {
8+
export function getIconCode(instance: Ec2Instance) {
139
if (instance.status === 'running') {
1410
return 'check'
1511
}

src/lambda/commands/downloadLambda.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ async function runDownloadLambda(functionNode: LambdaFunctionNode): Promise<Resu
4242

4343
if (workspaceFolders.length === 0) {
4444
vscode.window.showErrorMessage(
45-
localize('AWS.lambda.download.noWorkspaceFolders', 'Open a workspace before downloading a Lambda function.')
45+
localize(
46+
'AWS.lambda.download.noWorkspaceFolders',
47+
'Open a workspace and add a folder to it before downloading a Lambda function.'
48+
)
4649
)
4750
return 'Cancelled'
4851
}

src/test/ec2/prompter.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as assert from 'assert'
66
import { Ec2Prompter, instanceFilter } from '../../ec2/prompter'
77
import { Ec2Instance } from '../../shared/clients/ec2Client'
88
import { RegionSubmenuResponse } from '../../shared/ui/common/regionSubmenu'
9-
import { getIconForInstanceStatus } from '../../ec2/utils'
9+
import { getIconCode } from '../../ec2/utils'
1010
import { Ec2Selection } from '../../ec2/prompter'
1111
import { AsyncCollection } from '../../shared/utilities/asyncCollection'
1212
import { intoCollection } from '../../shared/utilities/collectionUtils'
@@ -59,7 +59,7 @@ describe('Ec2Prompter', async function () {
5959

6060
const result = prompter.testAsQuickPickItem(testInstance)
6161
const expected = {
62-
label: `${getIconForInstanceStatus(testInstance)} \t ${testInstance.name}`,
62+
label: `$(${getIconCode(testInstance)}) \t ${testInstance.name}`,
6363
detail: testInstance.InstanceId,
6464
data: testInstance.InstanceId,
6565
}
@@ -73,7 +73,7 @@ describe('Ec2Prompter', async function () {
7373

7474
const result = prompter.testAsQuickPickItem(testInstance)
7575
const expected = {
76-
label: `${getIconForInstanceStatus(testInstance)} \t (no name)`,
76+
label: `$(${getIconCode(testInstance)}) \t (no name)`,
7777
detail: testInstance.InstanceId,
7878
data: testInstance.InstanceId,
7979
}
@@ -139,17 +139,17 @@ describe('Ec2Prompter', async function () {
139139
it('returns items mapped to QuickPick items without filter', async function () {
140140
const expected = [
141141
{
142-
label: `${getIconForInstanceStatus(prompter.instances[0])} \t ${prompter.instances[0].name!}`,
142+
label: `$(${getIconCode(prompter.instances[0])}) \t ${prompter.instances[0].name!}`,
143143
detail: prompter.instances[0].InstanceId!,
144144
data: prompter.instances[0].InstanceId!,
145145
},
146146
{
147-
label: `${getIconForInstanceStatus(prompter.instances[1])} \t ${prompter.instances[1].name!}`,
147+
label: `$(${getIconCode(prompter.instances[1])}) \t ${prompter.instances[1].name!}`,
148148
detail: prompter.instances[1].InstanceId!,
149149
data: prompter.instances[1].InstanceId!,
150150
},
151151
{
152-
label: `${getIconForInstanceStatus(prompter.instances[2])} \t ${prompter.instances[2].name!}`,
152+
label: `$(${getIconCode(prompter.instances[2])}) \t ${prompter.instances[2].name!}`,
153153
detail: prompter.instances[2].InstanceId!,
154154
data: prompter.instances[2].InstanceId!,
155155
},
@@ -164,12 +164,12 @@ describe('Ec2Prompter', async function () {
164164

165165
const expected = [
166166
{
167-
label: `${getIconForInstanceStatus(prompter.instances[0])} \t ${prompter.instances[0].name!}`,
167+
label: `$(${getIconCode(prompter.instances[0])}) \t ${prompter.instances[0].name!}`,
168168
detail: prompter.instances[0].InstanceId!,
169169
data: prompter.instances[0].InstanceId!,
170170
},
171171
{
172-
label: `${getIconForInstanceStatus(prompter.instances[2])} \t ${prompter.instances[2].name!}`,
172+
label: `$(${getIconCode(prompter.instances[2])}) \t ${prompter.instances[2].name!}`,
173173
detail: prompter.instances[2].InstanceId!,
174174
data: prompter.instances[2].InstanceId!,
175175
},

0 commit comments

Comments
 (0)