Skip to content

Commit dac01f2

Browse files
author
Newton Der
committed
feat(ai-league): Hide all services except Lambda and S3. Call parent frame after updating Lambda.
1 parent c59b435 commit dac01f2

File tree

6 files changed

+54
-4
lines changed

6 files changed

+54
-4
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"version": "0.0.1",
99
"private": true,
1010
"license": "Apache-2.0",
11+
"enabledApiProposals": [
12+
"embedded"
13+
],
1114
"prettier": {
1215
"printWidth": 120,
1316
"trailingComma": "es5",

packages/core/src/awsexplorer/regionNode.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,43 +52,53 @@ const serviceCandidates: ServiceNode[] = [
5252
{
5353
serviceId: 'apigateway',
5454
createFn: (regionCode: string, partitionId: string) => new ApiGatewayNode(partitionId, regionCode),
55+
when: () => false,
5556
},
5657
{
5758
serviceId: 'apprunner',
5859
createFn: (regionCode: string) => new AppRunnerNode(regionCode, new AppRunnerClient(regionCode)),
60+
when: () => false,
5961
},
6062
{
6163
serviceId: 'cloudformation',
6264
createFn: (regionCode: string) => new CloudFormationNode(regionCode),
65+
when: () => false,
6366
},
6467
{
6568
serviceId: 'docdb',
6669
createFn: (regionCode: string) => new DocumentDBNode(DefaultDocumentDBClient.create(regionCode)),
70+
when: () => false,
6771
},
6872
{
6973
serviceId: 'logs',
7074
createFn: (regionCode: string) => new CloudWatchLogsNode(regionCode),
75+
when: () => false,
7176
},
7277
{
7378
serviceId: 'ec2',
7479
createFn: (regionCode: string, partitionId: string) =>
7580
new Ec2ParentNode(regionCode, partitionId, new Ec2Client(regionCode)),
81+
when: () => false,
7682
},
7783
{
7884
serviceId: 'ecr',
7985
createFn: (regionCode: string) => new EcrNode(new DefaultEcrClient(regionCode)),
86+
when: () => false,
8087
},
8188
{
8289
serviceId: 'redshift',
8390
createFn: (regionCode: string) => new RedshiftNode(new DefaultRedshiftClient(regionCode)),
91+
when: () => false,
8492
},
8593
{
8694
serviceId: 'ecs',
8795
createFn: (regionCode: string) => new TreeShim(getEcsRootNode(regionCode)),
96+
when: () => false,
8897
},
8998
{
9099
serviceId: 'iot',
91100
createFn: (regionCode: string) => new IotNode(new DefaultIotClient(regionCode)),
101+
when: () => false,
92102
},
93103
{
94104
serviceId: 'lambda',
@@ -101,23 +111,28 @@ const serviceCandidates: ServiceNode[] = [
101111
{
102112
serviceId: 'api.sagemaker',
103113
createFn: (regionCode: string) => new SagemakerParentNode(regionCode, new SagemakerClient(regionCode)),
114+
when: () => false,
104115
},
105116
{
106117
serviceId: 'schemas',
107118
createFn: (regionCode: string) => new SchemasNode(new DefaultSchemaClient(regionCode)),
119+
when: () => false,
108120
},
109121
{
110122
serviceId: 'states',
111123
createFn: (regionCode: string) => new StepFunctionsNode(regionCode),
124+
when: () => false,
112125
},
113126
{
114127
serviceId: 'ssm',
115128
createFn: (regionCode: string) => new SsmDocumentNode(regionCode),
129+
when: () => false,
116130
},
117131
{
118132
allRegions: true,
119133
serviceId: 'cloudcontrol',
120134
createFn: (regionCode: string) => new ResourcesNode(regionCode),
135+
when: () => false,
121136
},
122137
]
123138

packages/core/src/lambda/explorer/lambdaNodes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export class LambdaNode extends AWSTreeNodeBase {
3838
super('Lambda', vscode.TreeItemCollapsibleState.Collapsed)
3939
this.functionNodes = new Map<string, LambdaFunctionNode>()
4040
this.contextValue = 'awsLambdaNode'
41+
this.collapsibleState = vscode.TreeItemCollapsibleState.Expanded
4142
}
4243

4344
public override async getChildren(): Promise<AWSTreeNodeBase[]> {

packages/core/src/shared/clients/lambdaClient.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6+
import * as vscode from 'vscode'
67
import { Lambda } from 'aws-sdk'
78
import { _Blob } from 'aws-sdk/clients/lambda'
89
import { ToolkitError } from '../errors'
@@ -157,6 +158,17 @@ export class DefaultLambdaClient {
157158
getLogger().debug('updateFunctionCode returned response: %O', response)
158159
await client.waitFor('functionUpdated', { FunctionName: name }).promise()
159160

161+
vscode.window.sendMessage!({
162+
channel: 'vscode.awstoolkit.lambdaUpdateFunctionCode:request',
163+
type: 'application/x-ai-league-code-editor+json',
164+
value: [
165+
'*',
166+
{
167+
FunctionName: name,
168+
},
169+
],
170+
})
171+
160172
return response
161173
} catch (e) {
162174
getLogger().error('Failed to run updateFunctionCode: %s', e)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*!
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/**
7+
* Custom extensions to vscode extensions API for AWS Console integration. Only
8+
* works with custom fork of VSCode supporting postMessage through VSCode
9+
* Proposed API wrapper.
10+
*/
11+
declare module 'vscode' {
12+
namespace window {
13+
export const receiveMessage: Event<any> | undefined
14+
export const sendMessage: ((message: any) => void) | undefined
15+
}
16+
}

packages/toolkit/package.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@
8080
"generateIcons": "ts-node ../../scripts/generateIcons.ts",
8181
"generateSettings": "ts-node ../../scripts/generateSettings.ts"
8282
},
83+
"enabledApiProposals": [
84+
"embedded"
85+
],
8386
"contributes": {
8487
"configuration": {
8588
"type": "object",
@@ -767,22 +770,22 @@
767770
{
768771
"id": "aws.cdk",
769772
"name": "%AWS.cdk.explorerTitle%",
770-
"when": "!aws.explorer.showAuthView"
773+
"when": "false"
771774
},
772775
{
773776
"id": "aws.appBuilder",
774777
"name": "%AWS.appBuilder.explorerTitle%",
775-
"when": "(isCloud9 || !aws.isWebExtHost) && !aws.explorer.showAuthView"
778+
"when": "false"
776779
},
777780
{
778781
"id": "aws.codecatalyst",
779782
"name": "%AWS.codecatalyst.explorerTitle%",
780-
"when": "(!isCloud9 && !aws.isSageMaker || isCloud9CodeCatalyst) && !aws.explorer.showAuthView"
783+
"when": "false"
781784
},
782785
{
783786
"id": "aws.smus.rootView",
784787
"name": "%AWS.sagemakerunifiedstudio.explorerTitle%",
785-
"when": "!aws.explorer.showAuthView"
788+
"when": "false"
786789
},
787790
{
788791
"type": "webview",

0 commit comments

Comments
 (0)