@@ -12,7 +12,6 @@ import * as vscode from 'vscode'
12
12
import { CloudFormationClient } from '../../shared/clients/cloudFormationClient'
13
13
import { LambdaClient } from '../../shared/clients/lambdaClient'
14
14
import { ext } from '../../shared/extensionGlobals'
15
- import { AWSTreeErrorHandlerNode } from '../../shared/treeview/nodes/awsTreeErrorHandlerNode'
16
15
import { AWSTreeNodeBase } from '../../shared/treeview/nodes/awsTreeNodeBase'
17
16
import { ErrorNode } from '../../shared/treeview/nodes/errorNode'
18
17
import { PlaceholderNode } from '../../shared/treeview/nodes/placeholderNode'
@@ -64,7 +63,7 @@ export class CloudFormationNode extends AWSTreeNodeBase {
64
63
}
65
64
}
66
65
67
- export class CloudFormationStackNode extends AWSTreeErrorHandlerNode {
66
+ export class CloudFormationStackNode extends AWSTreeNodeBase {
68
67
private readonly functionNodes : Map < string , LambdaFunctionNode >
69
68
70
69
public constructor (
@@ -91,26 +90,27 @@ export class CloudFormationStackNode extends AWSTreeErrorHandlerNode {
91
90
return this . stackSummary . StackName
92
91
}
93
92
94
- public async getChildren ( ) : Promise < ( LambdaFunctionNode | PlaceholderNode ) [ ] > {
95
- await this . handleErrorProneOperation (
96
- async ( ) => this . updateChildren ( ) ,
97
- localize ( 'AWS.explorerNode.cloudFormation.error' , 'Error loading CloudFormation resources' )
98
- )
99
-
100
- if ( ! ! this . errorNode ) {
101
- return [ this . errorNode ]
102
- }
103
-
104
- if ( this . functionNodes . size > 0 ) {
105
- return [ ...this . functionNodes . values ( ) ]
106
- }
93
+ public async getChildren ( ) : Promise < AWSTreeNodeBase [ ] > {
94
+ return await makeChildrenNodes ( {
95
+ getChildNodes : async ( ) => {
96
+ await this . updateChildren ( )
107
97
108
- return [
109
- new PlaceholderNode (
110
- this ,
111
- localize ( 'AWS.explorerNode.cloudFormation.noFunctions' , '[no functions in this CloudFormation]' )
112
- )
113
- ]
98
+ return [ ...this . functionNodes . values ( ) ]
99
+ } ,
100
+ getErrorNode : async ( error : Error ) =>
101
+ new ErrorNode (
102
+ this ,
103
+ error ,
104
+ localize ( 'AWS.explorerNode.cloudFormation.error' , 'Error loading CloudFormation resources' )
105
+ ) ,
106
+ getNoChildrenPlaceholderNode : async ( ) =>
107
+ new PlaceholderNode (
108
+ this ,
109
+ localize ( 'AWS.explorerNode.cloudFormation.noFunctions' , '[Stack has no Lambda Functions]' )
110
+ ) ,
111
+ sort : ( nodeA : LambdaFunctionNode , nodeB : LambdaFunctionNode ) =>
112
+ nodeA . functionName . localeCompare ( nodeB . functionName )
113
+ } )
114
114
}
115
115
116
116
public update ( stackSummary : CloudFormation . StackSummary ) : void {
0 commit comments