Skip to content

Commit f7999b1

Browse files
committed
limit explorer icons and refresh after
1 parent 8062ed6 commit f7999b1

File tree

3 files changed

+26
-5
lines changed

3 files changed

+26
-5
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,12 +1327,12 @@
13271327
{
13281328
"command": "aws.ec2.openTerminal",
13291329
"group": "0@1",
1330-
"when": "viewItem =~ /^(awsEc2(Parent|Running|Stopped|Pending)Node)$/"
1330+
"when": "viewItem =~ /^(awsEc2(Parent|Running)Node)$/"
13311331
},
13321332
{
13331333
"command": "aws.ec2.openTerminal",
13341334
"group": "inline@1",
1335-
"when": "viewItem =~ /^(awsEc2(Parent|Running|Stopped|Pending)Node)$/"
1335+
"when": "viewItem =~ /^(awsEc2(Parent|Running)Node)$/"
13361336
},
13371337
{
13381338
"command": "aws.ec2.startInstance",
@@ -1357,12 +1357,12 @@
13571357
{
13581358
"command": "aws.ec2.rebootInstance",
13591359
"group": "0@1",
1360-
"when": "viewItem =~ /^(awsEc2(Running|Pending)Node)$/"
1360+
"when": "viewItem =~ /^(awsEc2RunningNode)$/"
13611361
},
13621362
{
13631363
"command": "aws.ec2.rebootInstance",
13641364
"group": "inline@1",
1365-
"when": "viewItem =~ /^(awsEc2(Running|Pending)Node)$/"
1365+
"when": "viewItem =~ /^(awsEc2RunningNode)$/"
13661366
},
13671367
{
13681368
"command": "aws.ecr.createRepository",

src/ec2/activation.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ import { ExtContext } from '../shared/extensions'
66
import { Commands } from '../shared/vscode/commands2'
77
import { telemetry } from '../shared/telemetry/telemetry'
88
import { Ec2Node } from './explorer/ec2ParentNode'
9-
import { openRemoteConnection, openTerminal, rebootInstance, startInstance, stopInstance } from './commands'
9+
import {
10+
openRemoteConnection,
11+
openTerminal,
12+
rebootInstance,
13+
refreshExplorer,
14+
startInstance,
15+
stopInstance,
16+
} from './commands'
1017

1118
export async function activate(ctx: ExtContext): Promise<void> {
1219
ctx.extensionContext.subscriptions.push(
@@ -23,14 +30,18 @@ export async function activate(ctx: ExtContext): Promise<void> {
2330

2431
Commands.register('aws.ec2.startInstance', async (node?: Ec2Node) => {
2532
await startInstance(node)
33+
34+
refreshExplorer()
2635
}),
2736

2837
Commands.register('aws.ec2.stopInstance', async (node?: Ec2Node) => {
2938
await stopInstance(node)
39+
refreshExplorer()
3040
}),
3141

3242
Commands.register('aws.ec2.rebootInstance', async (node?: Ec2Node) => {
3343
await rebootInstance(node)
44+
refreshExplorer()
3445
})
3546
)
3647
}

src/ec2/commands.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ import { Ec2ConnectionManager } from './model'
1010
import { Ec2Prompter, instanceFilter } from './prompter'
1111
import { Ec2Selection } from './utils'
1212
import { Ec2Instance } from '../shared/clients/ec2Client'
13+
import { isCloud9 } from '../shared/extensionUtilities'
14+
import { commands } from 'vscode'
15+
16+
export function refreshExplorer(node?: Ec2Node) {
17+
if (isCloud9()) {
18+
commands.executeCommand('aws.refreshAwsExplorer', true)
19+
} else {
20+
commands.executeCommand('aws.refreshAwsExplorerNode', node)
21+
}
22+
}
1323

1424
export async function openTerminal(node?: Ec2Node) {
1525
const selection = await getSelection(node)

0 commit comments

Comments
 (0)