Skip to content

Commit ac2b8da

Browse files
committed
merge in new icons
2 parents 421227a + 9730ba6 commit ac2b8da

File tree

7 files changed

+27
-25
lines changed

7 files changed

+27
-25
lines changed

package.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,10 +1120,6 @@
11201120
"command": "aws.ec2.openTerminal",
11211121
"when": "aws.isDevMode"
11221122
},
1123-
{
1124-
"command": "aws.ec2.openTerminal",
1125-
"when": "aws.isDevMode"
1126-
},
11271123
{
11281124
"command": "aws.ec2.startInstance",
11291125
"when": "false"
@@ -1385,11 +1381,6 @@
13851381
"group": "0@1",
13861382
"when": "viewItem =~ /^(awsEc2RunningNode)$/"
13871383
},
1388-
{
1389-
"command": "aws.ec2.rebootInstance",
1390-
"group": "inline@1",
1391-
"when": "viewItem =~ /^(awsEc2RunningNode)$/"
1392-
},
13931384
{
13941385
"command": "aws.ecr.createRepository",
13951386
"when": "view == aws.explorer && viewItem == awsEcrNode",

src/ec2/explorer/ec2InstanceNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export class Ec2InstanceNode extends AWSTreeNodeBase implements AWSResourceNode
3434

3535
public updateInstance(newInstance: Ec2Instance) {
3636
this.setInstance(newInstance)
37-
this.label = `${this.name} (${this.InstanceId})`
37+
this.label = `${this.name} (${this.InstanceId}) ${this.instance.status!.toUpperCase()}`
3838
this.contextValue = this.getContext()
3939
this.iconPath = new vscode.ThemeIcon(getIconCode(this.instance))
4040
this.tooltip = `${this.name}\n${this.InstanceId}\n${this.instance.status}\n${this.arn}`
@@ -45,7 +45,7 @@ export class Ec2InstanceNode extends AWSTreeNodeBase implements AWSResourceNode
4545
}
4646

4747
public isPending(): boolean {
48-
return this.getStatus() != 'running' && this.getStatus() != 'stopped'
48+
return this.getStatus() == 'pending'
4949
}
5050

5151
public async updateStatus() {

src/ec2/prompter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class Ec2Prompter {
2323
protected static asQuickPickItem(instance: Ec2Instance): DataQuickPickItem<string> {
2424
const icon = `$(${getIconCode(instance)})`
2525
return {
26-
label: `${icon} \t ${instance.name ?? '(no name)'}`,
26+
label: `${instance.name ?? '(no name)'} \t ${icon} ${instance.status!.toUpperCase()}`,
2727
detail: instance.InstanceId,
2828
data: instance.InstanceId,
2929
}

src/ec2/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import { Ec2Instance } from '../shared/clients/ec2Client'
77

88
export function getIconCode(instance: Ec2Instance) {
99
if (instance.status === 'running') {
10-
return 'check'
10+
return 'pass'
1111
}
1212

1313
if (instance.status === 'stopped') {
14-
return 'stop'
14+
return 'circle-slash'
1515
}
1616

1717
return 'loading~spin'

src/test/ec2/explorer/ec2InstanceNode.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ describe('ec2InstanceNode', function () {
4848
})
4949

5050
it('initializes the label', async function () {
51-
assert.strictEqual(testNode.label, `${getNameOfInstance(testInstance)} (${testInstance.InstanceId})`)
51+
assert.strictEqual(
52+
testNode.label,
53+
`${getNameOfInstance(testInstance)} (${testInstance.InstanceId}) ${testInstance.status!.toUpperCase()}`
54+
)
5255
})
5356

5457
it('initializes the functionName', async function () {
@@ -86,6 +89,9 @@ describe('ec2InstanceNode', function () {
8689
it('updates label with new instance', async function () {
8790
const newIdInstance = { ...testInstance, InstanceId: 'testId2' }
8891
testNode.updateInstance(newIdInstance)
89-
assert.strictEqual(testNode.label, `${getNameOfInstance(newIdInstance)} (${newIdInstance.InstanceId})`)
92+
assert.strictEqual(
93+
testNode.label,
94+
`${getNameOfInstance(newIdInstance)} (${newIdInstance.InstanceId}) ${newIdInstance.status!.toUpperCase()}`
95+
)
9096
})
9197
})

src/test/ec2/explorer/ec2ParentNode.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ describe('ec2ParentNode', function () {
9898
it('sorts child nodes', async function () {
9999
const sortedText = ['aa', 'ab', 'bb', 'bc', 'cc', 'cd']
100100
const instances = [
101-
{ name: 'ab', InstanceId: '0' },
102-
{ name: 'bb', InstanceId: '1' },
103-
{ name: 'bc', InstanceId: '2' },
104-
{ name: 'aa', InstanceId: '3' },
105-
{ name: 'cc', InstanceId: '4' },
106-
{ name: 'cd', InstanceId: '5' },
101+
{ name: 'ab', InstanceId: '0', status: 'running' },
102+
{ name: 'bb', InstanceId: '1', status: 'running' },
103+
{ name: 'bc', InstanceId: '2', status: 'running' },
104+
{ name: 'aa', InstanceId: '3', status: 'running' },
105+
{ name: 'cc', InstanceId: '4', status: 'running' },
106+
{ name: 'cd', InstanceId: '5', status: 'running' },
107107
]
108108

109109
getInstanceStub.resolves(mapToInstanceCollection(instances))
@@ -124,9 +124,9 @@ describe('ec2ParentNode', function () {
124124

125125
it('is able to handle children with duplicate names', async function () {
126126
const instances = [
127-
{ name: 'firstOne', InstanceId: '0' },
128-
{ name: 'secondOne', InstanceId: '1' },
129-
{ name: 'firstOne', InstanceId: '2' },
127+
{ name: 'firstOne', InstanceId: '0', status: 'running' },
128+
{ name: 'secondOne', InstanceId: '1', status: 'running' },
129+
{ name: 'firstOne', InstanceId: '2', status: 'running' },
130130
]
131131

132132
getInstanceStub.resolves(mapToInstanceCollection(instances))

src/test/ec2/prompter.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ describe('Ec2Prompter', async function () {
5555
const testInstance = {
5656
name: 'testName',
5757
InstanceId: 'testInstanceId',
58+
status: 'running',
5859
}
5960

6061
const result = prompter.testAsQuickPickItem(testInstance)
@@ -69,6 +70,7 @@ describe('Ec2Prompter', async function () {
6970
it('returns QuickPickItem for non-named instances', function () {
7071
const testInstance = {
7172
InstanceId: 'testInstanceId',
73+
status: 'running',
7274
}
7375

7476
const result = prompter.testAsQuickPickItem(testInstance)
@@ -117,14 +119,17 @@ describe('Ec2Prompter', async function () {
117119
{
118120
InstanceId: '1',
119121
name: 'first',
122+
status: 'running',
120123
},
121124
{
122125
InstanceId: '2',
123126
name: 'second',
127+
status: 'running',
124128
},
125129
{
126130
InstanceId: '3',
127131
name: 'third',
132+
status: 'running',
128133
},
129134
]
130135
prompter.unsetFilter()

0 commit comments

Comments
 (0)