@finos/legend-application-query 8.1.2 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/application/LegendQuery.d.ts.map +1 -1
- package/lib/application/LegendQuery.js +7 -9
- package/lib/application/LegendQuery.js.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.d.ts +4 -0
- package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.js +4 -0
- package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
- package/lib/components/{QuerySetupStoreProvider.d.ts → CloneQueryServiceSetup.d.ts} +2 -7
- package/lib/components/CloneQueryServiceSetup.d.ts.map +1 -0
- package/lib/components/CloneQueryServiceSetup.js +137 -0
- package/lib/components/CloneQueryServiceSetup.js.map +1 -0
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts +24 -0
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -0
- package/lib/components/Core_LegendQueryApplicationPlugin.js +144 -0
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -0
- package/lib/components/CreateMappingQuerySetup.d.ts +18 -0
- package/lib/components/CreateMappingQuerySetup.d.ts.map +1 -0
- package/lib/components/CreateMappingQuerySetup.js +160 -0
- package/lib/components/CreateMappingQuerySetup.js.map +1 -0
- package/lib/components/EditExistingQuerySetup.d.ts +18 -0
- package/lib/components/EditExistingQuerySetup.d.ts.map +1 -0
- package/lib/components/EditExistingQuerySetup.js +107 -0
- package/lib/components/EditExistingQuerySetup.js.map +1 -0
- package/lib/components/LegendQueryApplication.d.ts.map +1 -1
- package/lib/components/LegendQueryApplication.js +4 -2
- package/lib/components/LegendQueryApplication.js.map +1 -1
- package/lib/components/LoadProjectServiceQuerySetup.d.ts +18 -0
- package/lib/components/LoadProjectServiceQuerySetup.d.ts.map +1 -0
- package/lib/components/LoadProjectServiceQuerySetup.js +63 -0
- package/lib/components/LoadProjectServiceQuerySetup.js.map +1 -0
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +31 -33
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/QueryProductionizerSetup.d.ts +18 -0
- package/lib/components/QueryProductionizerSetup.d.ts.map +1 -0
- package/lib/components/QueryProductionizerSetup.js +85 -0
- package/lib/components/QueryProductionizerSetup.js.map +1 -0
- package/lib/components/QuerySetup.d.ts +20 -5
- package/lib/components/QuerySetup.d.ts.map +1 -1
- package/lib/components/QuerySetup.js +69 -473
- package/lib/components/QuerySetup.js.map +1 -1
- package/lib/components/UpdateExistingServiceQuerySetup.d.ts +18 -0
- package/lib/components/UpdateExistingServiceQuerySetup.d.ts.map +1 -0
- package/lib/components/UpdateExistingServiceQuerySetup.js +69 -0
- package/lib/components/UpdateExistingServiceQuerySetup.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -3
- package/lib/index.js.map +1 -1
- package/lib/package.json +5 -8
- package/lib/stores/CloneServiceQuerySetupStore.d.ts +41 -0
- package/lib/stores/CloneServiceQuerySetupStore.d.ts.map +1 -0
- package/lib/stores/CloneServiceQuerySetupStore.js +98 -0
- package/lib/stores/CloneServiceQuerySetupStore.js.map +1 -0
- package/lib/stores/CreateMappingQuerySetupStore.d.ts +40 -0
- package/lib/stores/CreateMappingQuerySetupStore.d.ts.map +1 -0
- package/lib/stores/CreateMappingQuerySetupStore.js +97 -0
- package/lib/stores/CreateMappingQuerySetupStore.js.map +1 -0
- package/lib/stores/EditExistingQuerySetupStore.d.ts +33 -0
- package/lib/stores/EditExistingQuerySetupStore.d.ts.map +1 -0
- package/lib/stores/EditExistingQuerySetupStore.js +85 -0
- package/lib/stores/EditExistingQuerySetupStore.js.map +1 -0
- package/lib/stores/LegendQueryApplicationPlugin.d.ts +21 -16
- package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.js +4 -0
- package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/stores/LegendQueryRouter.d.ts +28 -1
- package/lib/stores/LegendQueryRouter.d.ts.map +1 -1
- package/lib/stores/LegendQueryRouter.js +33 -3
- package/lib/stores/LegendQueryRouter.js.map +1 -1
- package/lib/stores/LoadProjectServiceQuerySetupStore.d.ts +27 -0
- package/lib/stores/LoadProjectServiceQuerySetupStore.d.ts.map +1 -0
- package/lib/stores/LoadProjectServiceQuerySetupStore.js +61 -0
- package/lib/stores/LoadProjectServiceQuerySetupStore.js.map +1 -0
- package/lib/stores/QueryEditorStore.d.ts +6 -2
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +35 -17
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/QueryEditorStoreTestUtils.d.ts.map +1 -1
- package/lib/stores/QueryEditorStoreTestUtils.js +3 -0
- package/lib/stores/QueryEditorStoreTestUtils.js.map +1 -1
- package/lib/stores/QueryProductionizerSetupStore.d.ts +32 -0
- package/lib/stores/QueryProductionizerSetupStore.d.ts.map +1 -0
- package/lib/stores/QueryProductionizerSetupStore.js +101 -0
- package/lib/stores/QueryProductionizerSetupStore.js.map +1 -0
- package/lib/stores/QuerySetupStore.d.ts +22 -85
- package/lib/stores/QuerySetupStore.d.ts.map +1 -1
- package/lib/stores/QuerySetupStore.js +78 -408
- package/lib/stores/QuerySetupStore.js.map +1 -1
- package/lib/stores/UpdateExistingServiceQuerySetupStore.d.ts +28 -0
- package/lib/stores/UpdateExistingServiceQuerySetupStore.d.ts.map +1 -0
- package/lib/stores/UpdateExistingServiceQuerySetupStore.js +73 -0
- package/lib/stores/UpdateExistingServiceQuerySetupStore.js.map +1 -0
- package/package.json +13 -16
- package/src/application/LegendQuery.tsx +7 -8
- package/src/application/LegendQueryApplicationConfig.ts +14 -0
- package/src/components/CloneQueryServiceSetup.tsx +312 -0
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +184 -0
- package/src/components/CreateMappingQuerySetup.tsx +352 -0
- package/src/components/EditExistingQuerySetup.tsx +280 -0
- package/src/components/LegendQueryApplication.tsx +14 -2
- package/src/components/LoadProjectServiceQuerySetup.tsx +131 -0
- package/src/components/QueryEditor.tsx +127 -81
- package/src/components/QueryProductionizerSetup.tsx +206 -0
- package/src/components/QuerySetup.tsx +285 -1183
- package/src/components/UpdateExistingServiceQuerySetup.tsx +153 -0
- package/src/index.ts +3 -2
- package/src/stores/CloneServiceQuerySetupStore.ts +151 -0
- package/src/stores/CreateMappingQuerySetupStore.ts +155 -0
- package/src/stores/EditExistingQuerySetupStore.ts +111 -0
- package/src/stores/LegendQueryApplicationPlugin.ts +27 -27
- package/src/stores/LegendQueryRouter.ts +95 -12
- package/src/stores/LoadProjectServiceQuerySetupStore.ts +87 -0
- package/src/stores/QueryEditorStore.ts +90 -24
- package/src/stores/QueryEditorStoreTestUtils.ts +3 -0
- package/src/stores/QueryProductionizerSetupStore.ts +143 -0
- package/src/stores/QuerySetupStore.ts +111 -604
- package/src/stores/UpdateExistingServiceQuerySetupStore.ts +118 -0
- package/tsconfig.json +13 -1
- package/lib/components/QuerySetupStoreProvider.d.ts.map +0 -1
- package/lib/components/QuerySetupStoreProvider.js +0 -34
- package/lib/components/QuerySetupStoreProvider.js.map +0 -1
- package/src/components/QuerySetupStoreProvider.tsx +0 -56
@@ -14,617 +14,37 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import {
|
18
|
-
action,
|
19
|
-
computed,
|
20
|
-
flow,
|
21
|
-
flowResult,
|
22
|
-
makeObservable,
|
23
|
-
observable,
|
24
|
-
} from 'mobx';
|
17
|
+
import { action, computed, flow, makeObservable, observable } from 'mobx';
|
25
18
|
import {
|
26
19
|
type GeneratorFn,
|
27
|
-
type PlainObject,
|
28
20
|
ActionState,
|
29
21
|
assertErrorThrown,
|
30
22
|
LogEvent,
|
23
|
+
uniq,
|
24
|
+
isNonNullable,
|
31
25
|
} from '@finos/legend-shared';
|
32
|
-
import {
|
33
|
-
|
34
|
-
type Mapping,
|
35
|
-
type PackageableRuntime,
|
36
|
-
type Service,
|
37
|
-
type QueryInfo,
|
38
|
-
QuerySearchSpecification,
|
39
|
-
BasicGraphManagerState,
|
40
|
-
CORE_PURE_PATH,
|
41
|
-
} from '@finos/legend-graph';
|
42
|
-
import {
|
43
|
-
type DepotServerClient,
|
44
|
-
type StoredEntity,
|
45
|
-
ProjectData,
|
46
|
-
DepotScope,
|
47
|
-
} from '@finos/legend-server-depot';
|
48
|
-
import { type Entity, parseProjectIdentifier } from '@finos/legend-storage';
|
26
|
+
import { BasicGraphManagerState } from '@finos/legend-graph';
|
27
|
+
import type { DepotServerClient } from '@finos/legend-server-depot';
|
49
28
|
import { LEGEND_QUERY_APP_EVENT } from '../LegendQueryAppEvent.js';
|
50
|
-
import {
|
51
|
-
APPLICATION_EVENT,
|
52
|
-
DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
|
53
|
-
DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
|
54
|
-
TAB_SIZE,
|
55
|
-
} from '@finos/legend-application';
|
29
|
+
import { TAB_SIZE } from '@finos/legend-application';
|
56
30
|
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
57
31
|
import type { LegendQueryApplicationStore } from './LegendQueryBaseStore.js';
|
58
|
-
import {
|
59
|
-
|
60
|
-
type ServiceExecutionAnalysisResult,
|
61
|
-
type ServiceInfo,
|
62
|
-
getQueryBuilderGraphManagerExtension,
|
63
|
-
extractServiceInfo,
|
64
|
-
} from '@finos/legend-query-builder';
|
65
|
-
import {
|
66
|
-
EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl,
|
67
|
-
EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateExistingServiceQueryUrl,
|
68
|
-
EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateProjectServiceQueryUrl,
|
69
|
-
} from './LegendQueryRouter.js';
|
70
|
-
|
71
|
-
export abstract class QuerySetupState {
|
72
|
-
setupStore: QuerySetupStore;
|
73
|
-
|
74
|
-
constructor(setupStore: QuerySetupStore) {
|
75
|
-
this.setupStore = setupStore;
|
76
|
-
}
|
77
|
-
}
|
78
|
-
|
79
|
-
export class EditExistingQuerySetupState extends QuerySetupState {
|
80
|
-
queries: LightQuery[] = [];
|
81
|
-
loadQueriesState = ActionState.create();
|
82
|
-
loadQueryState = ActionState.create();
|
83
|
-
currentQuery?: LightQuery | undefined;
|
84
|
-
currentQueryInfo?: QueryInfo | undefined;
|
85
|
-
showCurrentUserQueriesOnly = false;
|
86
|
-
|
87
|
-
constructor(setupStore: QuerySetupStore) {
|
88
|
-
super(setupStore);
|
89
|
-
|
90
|
-
makeObservable(this, {
|
91
|
-
queries: observable,
|
92
|
-
currentQuery: observable,
|
93
|
-
currentQueryInfo: observable,
|
94
|
-
showCurrentUserQueriesOnly: observable,
|
95
|
-
setShowCurrentUserQueriesOnly: action,
|
96
|
-
setCurrentQuery: flow,
|
97
|
-
loadQueries: flow,
|
98
|
-
});
|
99
|
-
}
|
100
|
-
|
101
|
-
setShowCurrentUserQueriesOnly(val: boolean): void {
|
102
|
-
this.showCurrentUserQueriesOnly = val;
|
103
|
-
}
|
104
|
-
|
105
|
-
*setCurrentQuery(queryId: string | undefined): GeneratorFn<void> {
|
106
|
-
if (queryId) {
|
107
|
-
try {
|
108
|
-
this.loadQueryState.inProgress();
|
109
|
-
this.currentQuery =
|
110
|
-
(yield this.setupStore.graphManagerState.graphManager.getLightQuery(
|
111
|
-
queryId,
|
112
|
-
)) as LightQuery;
|
113
|
-
this.currentQueryInfo =
|
114
|
-
(yield this.setupStore.graphManagerState.graphManager.getQueryInfo(
|
115
|
-
queryId,
|
116
|
-
)) as QueryInfo;
|
117
|
-
} catch (error) {
|
118
|
-
assertErrorThrown(error);
|
119
|
-
this.setupStore.applicationStore.notifyError(error);
|
120
|
-
} finally {
|
121
|
-
this.loadQueryState.reset();
|
122
|
-
}
|
123
|
-
} else {
|
124
|
-
this.currentQuery = undefined;
|
125
|
-
}
|
126
|
-
}
|
127
|
-
|
128
|
-
*loadQueries(searchText: string): GeneratorFn<void> {
|
129
|
-
const isValidSearchString =
|
130
|
-
searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
|
131
|
-
this.loadQueriesState.inProgress();
|
132
|
-
try {
|
133
|
-
const searchSpecification = new QuerySearchSpecification();
|
134
|
-
searchSpecification.searchTerm = isValidSearchString
|
135
|
-
? searchText
|
136
|
-
: undefined;
|
137
|
-
searchSpecification.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
|
138
|
-
searchSpecification.showCurrentUserQueriesOnly =
|
139
|
-
this.showCurrentUserQueriesOnly;
|
140
|
-
this.queries =
|
141
|
-
(yield this.setupStore.graphManagerState.graphManager.searchQueries(
|
142
|
-
searchSpecification,
|
143
|
-
)) as LightQuery[];
|
144
|
-
this.loadQueriesState.pass();
|
145
|
-
} catch (error) {
|
146
|
-
assertErrorThrown(error);
|
147
|
-
this.setupStore.applicationStore.notifyError(error);
|
148
|
-
this.loadQueriesState.fail();
|
149
|
-
}
|
150
|
-
}
|
151
|
-
}
|
152
|
-
|
153
|
-
export class QueryProductionizationSetupState extends QuerySetupState {
|
154
|
-
queries: LightQuery[] = [];
|
155
|
-
loadQueriesState = ActionState.create();
|
156
|
-
loadQueryState = ActionState.create();
|
157
|
-
currentQuery?: LightQuery | undefined;
|
158
|
-
currentQueryInfo?: QueryInfo | undefined;
|
159
|
-
|
160
|
-
constructor(setupStore: QuerySetupStore) {
|
161
|
-
super(setupStore);
|
162
|
-
|
163
|
-
makeObservable(this, {
|
164
|
-
queries: observable,
|
165
|
-
currentQuery: observable,
|
166
|
-
currentQueryInfo: observable,
|
167
|
-
setCurrentQuery: flow,
|
168
|
-
loadQueries: flow,
|
169
|
-
});
|
170
|
-
}
|
171
|
-
|
172
|
-
async loadQueryProductionizer(): Promise<void> {
|
173
|
-
if (!this.currentQuery) {
|
174
|
-
return;
|
175
|
-
}
|
176
|
-
|
177
|
-
// fetch project data
|
178
|
-
const project = ProjectData.serialization.fromJson(
|
179
|
-
await this.setupStore.depotServerClient.getProject(
|
180
|
-
this.currentQuery.groupId,
|
181
|
-
this.currentQuery.artifactId,
|
182
|
-
),
|
183
|
-
);
|
184
|
-
|
185
|
-
// find the matching SDLC instance
|
186
|
-
const projectIDPrefix = parseProjectIdentifier(project.projectId).prefix;
|
187
|
-
const matchingSDLCEntry =
|
188
|
-
this.setupStore.applicationStore.config.studioInstances.find(
|
189
|
-
(entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
|
190
|
-
);
|
191
|
-
if (matchingSDLCEntry) {
|
192
|
-
this.setupStore.applicationStore.setBlockingAlert({
|
193
|
-
message: `Loading query...`,
|
194
|
-
prompt: 'Please do not close the application',
|
195
|
-
showLoading: true,
|
196
|
-
});
|
197
|
-
this.setupStore.applicationStore.navigator.visitAddress(
|
198
|
-
EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl(
|
199
|
-
matchingSDLCEntry.url,
|
200
|
-
this.currentQuery.id,
|
201
|
-
),
|
202
|
-
{ useSameWindow: true },
|
203
|
-
);
|
204
|
-
} else {
|
205
|
-
this.setupStore.applicationStore.notifyWarning(
|
206
|
-
`Can't find the corresponding SDLC instance to productionize the query`,
|
207
|
-
);
|
208
|
-
}
|
209
|
-
}
|
210
|
-
|
211
|
-
*setCurrentQuery(queryId: string | undefined): GeneratorFn<void> {
|
212
|
-
if (queryId) {
|
213
|
-
try {
|
214
|
-
this.loadQueryState.inProgress();
|
215
|
-
this.currentQuery =
|
216
|
-
(yield this.setupStore.graphManagerState.graphManager.getLightQuery(
|
217
|
-
queryId,
|
218
|
-
)) as LightQuery;
|
219
|
-
this.currentQueryInfo =
|
220
|
-
(yield this.setupStore.graphManagerState.graphManager.getQueryInfo(
|
221
|
-
queryId,
|
222
|
-
)) as QueryInfo;
|
223
|
-
} catch (error) {
|
224
|
-
assertErrorThrown(error);
|
225
|
-
this.setupStore.applicationStore.notifyError(error);
|
226
|
-
} finally {
|
227
|
-
this.loadQueryState.reset();
|
228
|
-
}
|
229
|
-
} else {
|
230
|
-
this.currentQuery = undefined;
|
231
|
-
}
|
232
|
-
}
|
233
|
-
|
234
|
-
*loadQueries(searchText: string): GeneratorFn<void> {
|
235
|
-
const isValidSearchString =
|
236
|
-
searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
|
237
|
-
this.loadQueriesState.inProgress();
|
238
|
-
try {
|
239
|
-
const searchSpecification = new QuerySearchSpecification();
|
240
|
-
searchSpecification.searchTerm = isValidSearchString
|
241
|
-
? searchText
|
242
|
-
: undefined;
|
243
|
-
searchSpecification.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
|
244
|
-
this.queries =
|
245
|
-
(yield this.setupStore.graphManagerState.graphManager.searchQueries(
|
246
|
-
searchSpecification,
|
247
|
-
)) as LightQuery[];
|
248
|
-
this.loadQueriesState.pass();
|
249
|
-
} catch (error) {
|
250
|
-
assertErrorThrown(error);
|
251
|
-
this.setupStore.applicationStore.notifyError(error);
|
252
|
-
this.loadQueriesState.fail();
|
253
|
-
}
|
254
|
-
}
|
255
|
-
}
|
256
|
-
|
257
|
-
export class UpdateExistingServiceQuerySetupState extends QuerySetupState {
|
258
|
-
services: ServiceInfo[] = [];
|
259
|
-
loadServicesState = ActionState.create();
|
260
|
-
|
261
|
-
constructor(setupStore: QuerySetupStore) {
|
262
|
-
super(setupStore);
|
263
|
-
|
264
|
-
makeObservable(this, {
|
265
|
-
services: observable,
|
266
|
-
loadServices: flow,
|
267
|
-
});
|
268
|
-
}
|
269
|
-
|
270
|
-
async loadServiceUpdater(serviceInfo: ServiceInfo): Promise<void> {
|
271
|
-
// fetch project data
|
272
|
-
const project = ProjectData.serialization.fromJson(
|
273
|
-
await this.setupStore.depotServerClient.getProject(
|
274
|
-
serviceInfo.groupId,
|
275
|
-
serviceInfo.artifactId,
|
276
|
-
),
|
277
|
-
);
|
278
|
-
|
279
|
-
// find the matching SDLC instance
|
280
|
-
const projectIDPrefix = parseProjectIdentifier(project.projectId).prefix;
|
281
|
-
const matchingSDLCEntry =
|
282
|
-
this.setupStore.applicationStore.config.studioInstances.find(
|
283
|
-
(entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
|
284
|
-
);
|
285
|
-
if (matchingSDLCEntry) {
|
286
|
-
this.setupStore.applicationStore.setBlockingAlert({
|
287
|
-
message: `Loading service...`,
|
288
|
-
prompt: 'Please do not close the application',
|
289
|
-
showLoading: true,
|
290
|
-
});
|
291
|
-
this.setupStore.applicationStore.navigator.visitAddress(
|
292
|
-
EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateExistingServiceQueryUrl(
|
293
|
-
matchingSDLCEntry.url,
|
294
|
-
serviceInfo.groupId,
|
295
|
-
serviceInfo.artifactId,
|
296
|
-
serviceInfo.path,
|
297
|
-
),
|
298
|
-
{ useSameWindow: true },
|
299
|
-
);
|
300
|
-
} else {
|
301
|
-
this.setupStore.applicationStore.notifyWarning(
|
302
|
-
`Can't find the corresponding SDLC instance to update the service`,
|
303
|
-
);
|
304
|
-
}
|
305
|
-
}
|
306
|
-
|
307
|
-
*loadServices(searchText: string): GeneratorFn<void> {
|
308
|
-
const isValidSearchString =
|
309
|
-
searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
|
310
|
-
this.loadServicesState.inProgress();
|
311
|
-
try {
|
312
|
-
this.services = (
|
313
|
-
(yield this.setupStore.depotServerClient.getEntitiesByClassifierPath(
|
314
|
-
CORE_PURE_PATH.SERVICE,
|
315
|
-
{
|
316
|
-
search: isValidSearchString ? searchText : undefined,
|
317
|
-
// NOTE: since this mode is meant for contribution, we want to load services
|
318
|
-
// on the snapshot version (i.e. merged to the default branch on the projects)
|
319
|
-
scope: DepotScope.SNAPSHOT,
|
320
|
-
limit: DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
|
321
|
-
},
|
322
|
-
)) as StoredEntity[]
|
323
|
-
).map((storedEntity) => extractServiceInfo(storedEntity));
|
324
|
-
this.loadServicesState.pass();
|
325
|
-
} catch (error) {
|
326
|
-
assertErrorThrown(error);
|
327
|
-
this.setupStore.applicationStore.notifyError(error);
|
328
|
-
this.loadServicesState.fail();
|
329
|
-
}
|
330
|
-
}
|
331
|
-
}
|
332
|
-
|
333
|
-
export class CreateMappingQuerySetupState extends QuerySetupState {
|
334
|
-
projects: ProjectData[] = [];
|
335
|
-
loadProjectsState = ActionState.create();
|
336
|
-
surveyMappingRuntimeCompatibilityState = ActionState.create();
|
337
|
-
currentProject?: ProjectData | undefined;
|
338
|
-
currentVersionId?: string | undefined;
|
339
|
-
currentMapping?: Mapping | undefined;
|
340
|
-
currentRuntime?: PackageableRuntime | undefined;
|
341
|
-
mappingRuntimeCompatibilitySurveyResult: MappingRuntimeCompatibilityAnalysisResult[] =
|
342
|
-
[];
|
343
|
-
|
344
|
-
constructor(setupStore: QuerySetupStore) {
|
345
|
-
super(setupStore);
|
346
|
-
|
347
|
-
makeObservable(this, {
|
348
|
-
projects: observable,
|
349
|
-
currentProject: observable,
|
350
|
-
currentVersionId: observable,
|
351
|
-
currentMapping: observable,
|
352
|
-
currentRuntime: observable,
|
353
|
-
mappingRuntimeCompatibilitySurveyResult: observable,
|
354
|
-
compatibleRuntimes: computed,
|
355
|
-
setCurrentProject: action,
|
356
|
-
setCurrentVersionId: action,
|
357
|
-
setCurrentMapping: action,
|
358
|
-
setCurrentRuntime: action,
|
359
|
-
loadProjects: flow,
|
360
|
-
surveyMappingRuntimeCompatibility: flow,
|
361
|
-
});
|
362
|
-
}
|
363
|
-
|
364
|
-
setCurrentProject(val: ProjectData | undefined): void {
|
365
|
-
this.currentProject = val;
|
366
|
-
}
|
367
|
-
|
368
|
-
setCurrentVersionId(val: string | undefined): void {
|
369
|
-
this.currentVersionId = val;
|
370
|
-
}
|
371
|
-
|
372
|
-
setCurrentMapping(val: Mapping | undefined): void {
|
373
|
-
this.currentMapping = val;
|
374
|
-
}
|
375
|
-
|
376
|
-
setCurrentRuntime(val: PackageableRuntime | undefined): void {
|
377
|
-
this.currentRuntime = val;
|
378
|
-
}
|
379
|
-
|
380
|
-
get compatibleRuntimes(): PackageableRuntime[] {
|
381
|
-
const currentMapping = this.currentMapping;
|
382
|
-
if (!currentMapping) {
|
383
|
-
return [];
|
384
|
-
}
|
385
|
-
return (
|
386
|
-
this.mappingRuntimeCompatibilitySurveyResult.find(
|
387
|
-
(result) => result.mapping === currentMapping,
|
388
|
-
)?.runtimes ?? []
|
389
|
-
);
|
390
|
-
}
|
391
|
-
|
392
|
-
*loadProjects(): GeneratorFn<void> {
|
393
|
-
this.loadProjectsState.inProgress();
|
394
|
-
try {
|
395
|
-
this.projects = (
|
396
|
-
(yield this.setupStore.depotServerClient.getProjects()) as PlainObject<ProjectData>[]
|
397
|
-
).map((v) => ProjectData.serialization.fromJson(v));
|
398
|
-
this.loadProjectsState.pass();
|
399
|
-
} catch (error) {
|
400
|
-
assertErrorThrown(error);
|
401
|
-
this.setupStore.applicationStore.notifyError(error);
|
402
|
-
this.loadProjectsState.fail();
|
403
|
-
}
|
404
|
-
}
|
405
|
-
|
406
|
-
*surveyMappingRuntimeCompatibility(
|
407
|
-
project: ProjectData,
|
408
|
-
versionId: string,
|
409
|
-
): GeneratorFn<void> {
|
410
|
-
this.surveyMappingRuntimeCompatibilityState.inProgress();
|
411
|
-
try {
|
412
|
-
// fetch entities and dependencies
|
413
|
-
const entities = (yield this.setupStore.depotServerClient.getEntities(
|
414
|
-
project,
|
415
|
-
versionId,
|
416
|
-
)) as Entity[];
|
417
|
-
const dependencyEntitiesIndex = (yield flowResult(
|
418
|
-
this.setupStore.depotServerClient.getIndexedDependencyEntities(
|
419
|
-
project,
|
420
|
-
versionId,
|
421
|
-
),
|
422
|
-
)) as Map<string, Entity[]>;
|
423
|
-
|
424
|
-
this.mappingRuntimeCompatibilitySurveyResult = (yield flowResult(
|
425
|
-
getQueryBuilderGraphManagerExtension(
|
426
|
-
this.setupStore.graphManagerState.graphManager,
|
427
|
-
).surveyMappingRuntimeCompatibility(entities, dependencyEntitiesIndex),
|
428
|
-
)) as MappingRuntimeCompatibilityAnalysisResult[];
|
32
|
+
import { generateQuerySetupRoute } from './LegendQueryRouter.js';
|
33
|
+
import type { QuerySetupActionConfiguration } from './LegendQueryApplicationPlugin.js';
|
429
34
|
|
430
|
-
|
431
|
-
} catch (error) {
|
432
|
-
assertErrorThrown(error);
|
433
|
-
this.setupStore.applicationStore.log.error(
|
434
|
-
LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
|
435
|
-
error,
|
436
|
-
);
|
437
|
-
this.setupStore.applicationStore.notifyError(error);
|
438
|
-
this.surveyMappingRuntimeCompatibilityState.fail();
|
439
|
-
}
|
440
|
-
}
|
441
|
-
}
|
442
|
-
|
443
|
-
export class LoadProjectServiceQuerySetupState extends QuerySetupState {
|
444
|
-
projects: ProjectData[] = [];
|
445
|
-
loadProjectsState = ActionState.create();
|
446
|
-
|
447
|
-
constructor(setupStore: QuerySetupStore) {
|
448
|
-
super(setupStore);
|
449
|
-
|
450
|
-
makeObservable(this, {
|
451
|
-
projects: observable,
|
452
|
-
loadProjects: flow,
|
453
|
-
});
|
454
|
-
}
|
455
|
-
|
456
|
-
*loadProjects(): GeneratorFn<void> {
|
457
|
-
this.loadProjectsState.inProgress();
|
458
|
-
try {
|
459
|
-
this.projects = (
|
460
|
-
(yield this.setupStore.depotServerClient.getProjects()) as PlainObject<ProjectData>[]
|
461
|
-
).map((v) => ProjectData.serialization.fromJson(v));
|
462
|
-
this.loadProjectsState.pass();
|
463
|
-
} catch (error) {
|
464
|
-
assertErrorThrown(error);
|
465
|
-
this.setupStore.applicationStore.notifyError(error);
|
466
|
-
this.loadProjectsState.fail();
|
467
|
-
}
|
468
|
-
}
|
469
|
-
|
470
|
-
async loadProjectServiceUpdater(project: ProjectData): Promise<void> {
|
471
|
-
// find the matching SDLC instance
|
472
|
-
const projectIDPrefix = parseProjectIdentifier(project.projectId).prefix;
|
473
|
-
const matchingSDLCEntry =
|
474
|
-
this.setupStore.applicationStore.config.studioInstances.find(
|
475
|
-
(entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
|
476
|
-
);
|
477
|
-
if (matchingSDLCEntry) {
|
478
|
-
this.setupStore.applicationStore.setBlockingAlert({
|
479
|
-
message: `Loading service project...`,
|
480
|
-
prompt: 'Please do not close the application',
|
481
|
-
showLoading: true,
|
482
|
-
});
|
483
|
-
this.setupStore.applicationStore.navigator.visitAddress(
|
484
|
-
EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateProjectServiceQueryUrl(
|
485
|
-
matchingSDLCEntry.url,
|
486
|
-
project.projectId,
|
487
|
-
),
|
488
|
-
{ useSameWindow: true },
|
489
|
-
);
|
490
|
-
} else {
|
491
|
-
this.setupStore.applicationStore.notifyWarning(
|
492
|
-
`Can't find the corresponding SDLC instance to load project '${project.projectId}'`,
|
493
|
-
);
|
494
|
-
}
|
495
|
-
}
|
496
|
-
}
|
497
|
-
|
498
|
-
export interface ServiceExecutionOption {
|
499
|
-
service: Service;
|
500
|
-
key?: string | undefined;
|
501
|
-
}
|
502
|
-
|
503
|
-
export class CloneServiceQuerySetupState extends QuerySetupState {
|
504
|
-
projects: ProjectData[] = [];
|
505
|
-
loadProjectsState = ActionState.create();
|
506
|
-
loadServiceExecutionsState = ActionState.create();
|
507
|
-
currentProject?: ProjectData | undefined;
|
508
|
-
currentVersionId?: string | undefined;
|
509
|
-
currentServiceExecutionOption?: ServiceExecutionOption | undefined;
|
510
|
-
serviceExecutionOptions: ServiceExecutionOption[] = [];
|
511
|
-
|
512
|
-
constructor(setupStore: QuerySetupStore) {
|
513
|
-
super(setupStore);
|
514
|
-
|
515
|
-
makeObservable(this, {
|
516
|
-
serviceExecutionOptions: observable,
|
517
|
-
projects: observable,
|
518
|
-
currentProject: observable,
|
519
|
-
currentVersionId: observable,
|
520
|
-
currentServiceExecutionOption: observable,
|
521
|
-
setCurrentProject: action,
|
522
|
-
setCurrentVersionId: action,
|
523
|
-
setCurrentServiceExecutionOption: action,
|
524
|
-
setServiceExecutionOptions: action,
|
525
|
-
loadProjects: flow,
|
526
|
-
loadServiceExecutionOptions: flow,
|
527
|
-
});
|
528
|
-
}
|
529
|
-
|
530
|
-
setCurrentProject(val: ProjectData | undefined): void {
|
531
|
-
this.currentProject = val;
|
532
|
-
}
|
533
|
-
|
534
|
-
setCurrentVersionId(val: string | undefined): void {
|
535
|
-
this.currentVersionId = val;
|
536
|
-
}
|
537
|
-
|
538
|
-
setCurrentServiceExecutionOption(
|
539
|
-
val: ServiceExecutionOption | undefined,
|
540
|
-
): void {
|
541
|
-
this.currentServiceExecutionOption = val;
|
542
|
-
}
|
543
|
-
|
544
|
-
setServiceExecutionOptions(val: ServiceExecutionOption[]): void {
|
545
|
-
this.serviceExecutionOptions = val;
|
546
|
-
}
|
547
|
-
|
548
|
-
*loadProjects(): GeneratorFn<void> {
|
549
|
-
this.loadProjectsState.inProgress();
|
550
|
-
try {
|
551
|
-
this.projects = (
|
552
|
-
(yield this.setupStore.depotServerClient.getProjects()) as PlainObject<ProjectData>[]
|
553
|
-
).map((v) => ProjectData.serialization.fromJson(v));
|
554
|
-
this.loadProjectsState.pass();
|
555
|
-
} catch (error) {
|
556
|
-
assertErrorThrown(error);
|
557
|
-
this.setupStore.applicationStore.notifyError(error);
|
558
|
-
this.loadProjectsState.fail();
|
559
|
-
}
|
560
|
-
}
|
561
|
-
|
562
|
-
*loadServiceExecutionOptions(
|
563
|
-
project: ProjectData,
|
564
|
-
versionId: string,
|
565
|
-
): GeneratorFn<void> {
|
566
|
-
this.loadServiceExecutionsState.inProgress();
|
567
|
-
try {
|
568
|
-
// fetch entities and dependencies
|
569
|
-
const entities = (yield this.setupStore.depotServerClient.getEntities(
|
570
|
-
project,
|
571
|
-
versionId,
|
572
|
-
)) as Entity[];
|
573
|
-
const dependencyEntitiesIndex = (yield flowResult(
|
574
|
-
this.setupStore.depotServerClient.getIndexedDependencyEntities(
|
575
|
-
project,
|
576
|
-
versionId,
|
577
|
-
),
|
578
|
-
)) as Map<string, Entity[]>;
|
579
|
-
|
580
|
-
const serviceExecutionAnalysisResults = (yield flowResult(
|
581
|
-
getQueryBuilderGraphManagerExtension(
|
582
|
-
this.setupStore.graphManagerState.graphManager,
|
583
|
-
).surveyServiceExecution(entities, dependencyEntitiesIndex),
|
584
|
-
)) as ServiceExecutionAnalysisResult[];
|
585
|
-
|
586
|
-
this.setServiceExecutionOptions(
|
587
|
-
serviceExecutionAnalysisResults.flatMap((result) => {
|
588
|
-
if (result.executionKeys?.length) {
|
589
|
-
return result.executionKeys.map((key) => ({
|
590
|
-
service: result.service,
|
591
|
-
key,
|
592
|
-
}));
|
593
|
-
}
|
594
|
-
return {
|
595
|
-
service: result.service,
|
596
|
-
};
|
597
|
-
}),
|
598
|
-
);
|
599
|
-
this.loadServiceExecutionsState.pass();
|
600
|
-
} catch (error) {
|
601
|
-
assertErrorThrown(error);
|
602
|
-
this.setupStore.applicationStore.log.error(
|
603
|
-
LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
|
604
|
-
error,
|
605
|
-
);
|
606
|
-
this.setupStore.applicationStore.notifyError(error);
|
607
|
-
this.loadServiceExecutionsState.fail();
|
608
|
-
}
|
609
|
-
}
|
610
|
-
}
|
611
|
-
|
612
|
-
export class QuerySetupStore {
|
35
|
+
export abstract class BaseQuerySetupStore {
|
613
36
|
readonly applicationStore: LegendQueryApplicationStore;
|
614
37
|
readonly graphManagerState: BasicGraphManagerState;
|
615
38
|
readonly depotServerClient: DepotServerClient;
|
616
39
|
readonly pluginManager: LegendQueryPluginManager;
|
617
40
|
|
618
41
|
readonly initState = ActionState.create();
|
619
|
-
querySetupState?: QuerySetupState | undefined;
|
620
42
|
|
621
43
|
constructor(
|
622
44
|
applicationStore: LegendQueryApplicationStore,
|
623
45
|
depotServerClient: DepotServerClient,
|
624
46
|
) {
|
625
47
|
makeObservable(this, {
|
626
|
-
querySetupState: observable,
|
627
|
-
setSetupState: action,
|
628
48
|
initialize: flow,
|
629
49
|
});
|
630
50
|
|
@@ -637,23 +57,8 @@ export class QuerySetupStore {
|
|
637
57
|
this.pluginManager = applicationStore.pluginManager;
|
638
58
|
}
|
639
59
|
|
640
|
-
setSetupState(val: QuerySetupState | undefined): void {
|
641
|
-
this.querySetupState = val;
|
642
|
-
}
|
643
|
-
|
644
60
|
*initialize(): GeneratorFn<void> {
|
645
61
|
if (!this.initState.isInInitialState) {
|
646
|
-
// eslint-disable-next-line no-process-env
|
647
|
-
if (process.env.NODE_ENV === 'development') {
|
648
|
-
this.applicationStore.log.info(
|
649
|
-
LogEvent.create(APPLICATION_EVENT.DEVELOPMENT_ISSUE),
|
650
|
-
`Fast-refreshing the app - preventing initialize() recall...`,
|
651
|
-
);
|
652
|
-
return;
|
653
|
-
}
|
654
|
-
this.applicationStore.notifyIllegalState(
|
655
|
-
`Query setup store is already initialized`,
|
656
|
-
);
|
657
62
|
return;
|
658
63
|
}
|
659
64
|
|
@@ -688,3 +93,105 @@ export class QuerySetupStore {
|
|
688
93
|
}
|
689
94
|
}
|
690
95
|
}
|
96
|
+
|
97
|
+
export class QuerySetupLandingPageStore {
|
98
|
+
readonly applicationStore: LegendQueryApplicationStore;
|
99
|
+
readonly pluginManager: LegendQueryPluginManager;
|
100
|
+
|
101
|
+
readonly initState = ActionState.create();
|
102
|
+
|
103
|
+
actions: QuerySetupActionConfiguration[] = [];
|
104
|
+
tags: string[] = [];
|
105
|
+
showAllGroups = false;
|
106
|
+
showAdvancedActions = false;
|
107
|
+
tagToFocus?: string | undefined;
|
108
|
+
|
109
|
+
constructor(applicationStore: LegendQueryApplicationStore) {
|
110
|
+
makeObservable(this, {
|
111
|
+
showAllGroups: observable,
|
112
|
+
showAdvancedActions: observable,
|
113
|
+
tagToFocus: observable,
|
114
|
+
isCustomized: computed,
|
115
|
+
setShowAllGroups: action,
|
116
|
+
setShowAdvancedActions: action,
|
117
|
+
setTagToFocus: action,
|
118
|
+
initialize: action,
|
119
|
+
});
|
120
|
+
|
121
|
+
this.applicationStore = applicationStore;
|
122
|
+
this.pluginManager = applicationStore.pluginManager;
|
123
|
+
this.actions = this.pluginManager
|
124
|
+
.getApplicationPlugins()
|
125
|
+
.flatMap(
|
126
|
+
(plugin) => plugin.getExtraQuerySetupActionConfigurations?.() ?? [],
|
127
|
+
)
|
128
|
+
.sort((a, b) => (a.isAdvanced ? 1 : 0) - (b.isAdvanced ? 1 : 0));
|
129
|
+
this.tags = uniq(
|
130
|
+
this.actions.map((config) => config.tag).filter(isNonNullable),
|
131
|
+
).sort();
|
132
|
+
}
|
133
|
+
|
134
|
+
get isCustomized(): boolean {
|
135
|
+
return (
|
136
|
+
this.showAllGroups || this.showAdvancedActions || Boolean(this.tagToFocus)
|
137
|
+
);
|
138
|
+
}
|
139
|
+
|
140
|
+
setShowAllGroups(val: boolean): void {
|
141
|
+
this.showAllGroups = val;
|
142
|
+
this.updateCurentLocation();
|
143
|
+
}
|
144
|
+
|
145
|
+
setShowAdvancedActions(val: boolean): void {
|
146
|
+
this.showAdvancedActions = val;
|
147
|
+
this.updateCurentLocation();
|
148
|
+
}
|
149
|
+
|
150
|
+
setTagToFocus(val: string | undefined): void {
|
151
|
+
if (val && !this.tags.includes(val)) {
|
152
|
+
return;
|
153
|
+
}
|
154
|
+
this.tagToFocus = val;
|
155
|
+
this.updateCurentLocation();
|
156
|
+
}
|
157
|
+
|
158
|
+
resetConfig(): void {
|
159
|
+
this.setShowAdvancedActions(false);
|
160
|
+
this.setShowAllGroups(false);
|
161
|
+
this.setTagToFocus(undefined);
|
162
|
+
this.updateCurentLocation();
|
163
|
+
}
|
164
|
+
|
165
|
+
private updateCurentLocation(): void {
|
166
|
+
this.applicationStore.navigator.updateCurrentLocation(
|
167
|
+
generateQuerySetupRoute(
|
168
|
+
this.showAllGroups,
|
169
|
+
this.showAdvancedActions,
|
170
|
+
this.tagToFocus,
|
171
|
+
),
|
172
|
+
);
|
173
|
+
}
|
174
|
+
|
175
|
+
initialize(
|
176
|
+
showAdvancedActions: string | undefined,
|
177
|
+
showAllGroups: string | undefined,
|
178
|
+
tagToFocus: string | undefined,
|
179
|
+
): void {
|
180
|
+
if (!this.initState.isInInitialState) {
|
181
|
+
return;
|
182
|
+
}
|
183
|
+
|
184
|
+
if (showAdvancedActions) {
|
185
|
+
this.showAdvancedActions = showAdvancedActions !== 'false';
|
186
|
+
}
|
187
|
+
if (showAllGroups) {
|
188
|
+
this.showAllGroups = showAllGroups !== 'false';
|
189
|
+
}
|
190
|
+
if (tagToFocus) {
|
191
|
+
this.tagToFocus = this.tags.includes(tagToFocus) ? tagToFocus : undefined;
|
192
|
+
}
|
193
|
+
this.updateCurentLocation();
|
194
|
+
|
195
|
+
this.initState.pass();
|
196
|
+
}
|
197
|
+
}
|