@@ -13,18 +13,14 @@ import { CloudFormationClient } from '../../shared/clients/cloudFormationClient'
13
13
import { LambdaClient } from '../../shared/clients/lambdaClient'
14
14
import { ext } from '../../shared/extensionGlobals'
15
15
import { AWSTreeErrorHandlerNode } from '../../shared/treeview/nodes/awsTreeErrorHandlerNode'
16
+ import { AWSTreeNodeBase } from '../../shared/treeview/nodes/awsTreeNodeBase'
16
17
import { ErrorNode } from '../../shared/treeview/nodes/errorNode'
17
18
import { PlaceholderNode } from '../../shared/treeview/nodes/placeholderNode'
18
- import { RegionNode } from '../../shared/treeview/nodes/regionNode'
19
19
import { intersection , toArrayAsync , toMap , toMapAsync , updateInPlace } from '../../shared/utilities/collectionUtils'
20
20
import { listCloudFormationStacks , listLambdaFunctions } from '../utils'
21
21
import { FunctionNodeBase } from './functionNode'
22
22
23
23
export interface CloudFormationNode extends AWSTreeErrorHandlerNode {
24
- readonly regionCode : string
25
-
26
- readonly parent : RegionNode
27
-
28
24
getChildren ( ) : Thenable < ( CloudFormationStackNode | ErrorNode ) [ ] >
29
25
30
26
updateChildren ( ) : Thenable < void >
@@ -33,11 +29,7 @@ export interface CloudFormationNode extends AWSTreeErrorHandlerNode {
33
29
export class DefaultCloudFormationNode extends AWSTreeErrorHandlerNode implements CloudFormationNode {
34
30
private readonly stackNodes : Map < string , CloudFormationStackNode >
35
31
36
- public get regionCode ( ) : string {
37
- return this . parent . regionCode
38
- }
39
-
40
- public constructor ( public readonly parent : RegionNode ) {
32
+ public constructor ( private readonly regionCode : string ) {
41
33
super ( 'CloudFormation' , vscode . TreeItemCollapsibleState . Collapsed )
42
34
this . stackNodes = new Map < string , CloudFormationStackNode > ( )
43
35
}
@@ -61,7 +53,7 @@ export class DefaultCloudFormationNode extends AWSTreeErrorHandlerNode implement
61
53
this . stackNodes ,
62
54
stacks . keys ( ) ,
63
55
key => this . stackNodes . get ( key ) ! . update ( stacks . get ( key ) ! ) ,
64
- key => new DefaultCloudFormationStackNode ( this , stacks . get ( key ) ! )
56
+ key => new DefaultCloudFormationStackNode ( this , this . regionCode , stacks . get ( key ) ! )
65
57
)
66
58
}
67
59
}
@@ -71,7 +63,7 @@ export interface CloudFormationStackNode extends AWSTreeErrorHandlerNode {
71
63
readonly stackId ?: CloudFormation . StackId
72
64
readonly stackName : CloudFormation . StackName
73
65
74
- readonly parent : CloudFormationNode
66
+ readonly parent : AWSTreeNodeBase
75
67
76
68
getChildren ( ) : Thenable < ( CloudFormationFunctionNode | PlaceholderNode ) [ ] >
77
69
@@ -81,11 +73,11 @@ export interface CloudFormationStackNode extends AWSTreeErrorHandlerNode {
81
73
export class DefaultCloudFormationStackNode extends AWSTreeErrorHandlerNode implements CloudFormationStackNode {
82
74
private readonly functionNodes : Map < string , CloudFormationFunctionNode >
83
75
84
- public get regionCode ( ) : string {
85
- return this . parent . regionCode
86
- }
87
-
88
- public constructor ( public readonly parent : CloudFormationNode , private stackSummary : CloudFormation . StackSummary ) {
76
+ public constructor (
77
+ public readonly parent : AWSTreeNodeBase ,
78
+ public readonly regionCode : string ,
79
+ private stackSummary : CloudFormation . StackSummary
80
+ ) {
89
81
super ( '' , vscode . TreeItemCollapsibleState . Collapsed )
90
82
91
83
this . update ( stackSummary )
@@ -145,7 +137,7 @@ export class DefaultCloudFormationStackNode extends AWSTreeErrorHandlerNode impl
145
137
this . functionNodes ,
146
138
intersection ( resources , functions . keys ( ) ) ,
147
139
key => this . functionNodes . get ( key ) ! . update ( functions . get ( key ) ! ) ,
148
- key => new DefaultCloudFormationFunctionNode ( this , functions . get ( key ) ! )
140
+ key => new DefaultCloudFormationFunctionNode ( this , this . regionCode , functions . get ( key ) ! )
149
141
)
150
142
}
151
143
@@ -168,12 +160,12 @@ export interface CloudFormationFunctionNode extends FunctionNodeBase {
168
160
}
169
161
170
162
export class DefaultCloudFormationFunctionNode extends FunctionNodeBase {
171
- public get regionCode ( ) : string {
172
- return this . parent . regionCode
173
- }
174
-
175
- public constructor ( public readonly parent : CloudFormationStackNode , configuration : Lambda . FunctionConfiguration ) {
176
- super ( configuration )
163
+ public constructor (
164
+ public readonly parent : AWSTreeNodeBase ,
165
+ public readonly regionCode : string ,
166
+ configuration : Lambda . FunctionConfiguration
167
+ ) {
168
+ super ( parent , configuration )
177
169
this . contextValue = 'awsCloudFormationFunctionNode'
178
170
}
179
171
}
0 commit comments