@@ -6,6 +6,7 @@ import { RoutineNode } from "./routineNode";
6
6
import { AtelierAPI } from "../../api" ;
7
7
import { ClassNode } from "./classNode" ;
8
8
import { CSPFileNode } from "./cspFileNode" ;
9
+ import { cspApps } from "../../extension" ;
9
10
10
11
type IconPath =
11
12
| string
@@ -57,7 +58,7 @@ export class RootNode extends NodeBase {
57
58
return this . getItems ( path , this . _category ) ;
58
59
}
59
60
60
- public getList (
61
+ public async getList (
61
62
path : string ,
62
63
category : string ,
63
64
flat : boolean
@@ -81,7 +82,7 @@ export class RootNode extends NodeBase {
81
82
spec = "*" ;
82
83
break ;
83
84
case "OTH" :
84
- spec = "*" ;
85
+ spec = "*.other " ;
85
86
break ;
86
87
default :
87
88
return ;
@@ -97,27 +98,45 @@ export class RootNode extends NodeBase {
97
98
98
99
const api = new AtelierAPI ( this . workspaceFolder ) ;
99
100
api . setNamespace ( this . namespace ) ;
100
- return api
101
- . actionQuery ( sql , [ spec , direction , orderBy , systemFiles , flat ? "1" : "0" , notStudio , generated ] )
102
- . then ( ( data ) => {
103
- const content = data . result . content ;
104
- return content ;
105
- } )
106
- . then ( ( data ) =>
107
- data . map ( ( el : { Name : string ; Type : number } ) => {
108
- let fullName = el . Name ;
109
- if ( this instanceof PackageNode ) {
110
- fullName = this . fullName + "." + el . Name ;
111
- } else if ( this . isCsp ) {
112
- fullName = this . fullName + "/" + el . Name ;
113
- }
114
- return {
115
- Name : el . Name ,
116
- Type : String ( el . Type ) ,
117
- fullName,
118
- } ;
101
+ if ( category == "CSP" && path == "" ) {
102
+ // Use the results from the getCSPApps() API
103
+ const cspAppsKey = (
104
+ api . config . serverName && api . config . serverName != ""
105
+ ? `${ api . config . serverName } :${ api . config . ns } `
106
+ : `${ api . config . host } :${ api . config . port } ${ api . config . pathPrefix } :${ api . config . ns } `
107
+ ) . toLowerCase ( ) ;
108
+ let nsCspApps : string [ ] | undefined = cspApps . get ( cspAppsKey ) ;
109
+ if ( nsCspApps == undefined ) {
110
+ nsCspApps = await api . getCSPApps ( ) . then ( ( data ) => data . result . content || [ ] ) ;
111
+ cspApps . set ( cspAppsKey , nsCspApps ) ;
112
+ }
113
+ return nsCspApps . map ( ( cspApp ) => {
114
+ return { Name : cspApp . slice ( 1 ) , fullName : cspApp . slice ( 1 ) , Type : "10" } ;
115
+ } ) ;
116
+ } else {
117
+ // Use StudioOpenDialog
118
+ return api
119
+ . actionQuery ( sql , [ spec , direction , orderBy , systemFiles , flat ? "1" : "0" , notStudio , generated ] )
120
+ . then ( ( data ) => {
121
+ const content = data . result . content ;
122
+ return content ;
119
123
} )
120
- ) ;
124
+ . then ( ( data ) =>
125
+ data . map ( ( el : { Name : string ; Type : number } ) => {
126
+ let fullName = el . Name ;
127
+ if ( this instanceof PackageNode ) {
128
+ fullName = this . fullName + "." + el . Name ;
129
+ } else if ( this . isCsp ) {
130
+ fullName = this . fullName + "/" + el . Name ;
131
+ }
132
+ return {
133
+ Name : el . Name ,
134
+ Type : String ( el . Type ) ,
135
+ fullName,
136
+ } ;
137
+ } )
138
+ ) ;
139
+ }
121
140
}
122
141
123
142
public getItems ( path : string , category : string ) : Promise < NodeBase [ ] > {
0 commit comments