@finos/legend-application-query 7.0.0 → 8.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 +1 -1
- package/lib/application/LegendQuery.js.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.d.ts +6 -7
- package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.js +9 -4
- package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
- package/lib/components/LegendQueryApplication.d.ts +0 -2
- package/lib/components/LegendQueryApplication.d.ts.map +1 -1
- package/lib/components/LegendQueryApplication.js +2 -3
- package/lib/components/LegendQueryApplication.js.map +1 -1
- package/lib/components/LegendQueryBaseStoreProvider.d.ts +1 -3
- package/lib/components/LegendQueryBaseStoreProvider.d.ts.map +1 -1
- package/lib/components/LegendQueryBaseStoreProvider.js +2 -2
- package/lib/components/LegendQueryBaseStoreProvider.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +29 -25
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/QueryEditorComponentTestUtils.d.ts.map +1 -1
- package/lib/components/QueryEditorComponentTestUtils.js +2 -2
- package/lib/components/QueryEditorComponentTestUtils.js.map +1 -1
- package/lib/components/QueryEditorStoreProvider.d.ts.map +1 -1
- package/lib/components/QueryEditorStoreProvider.js +6 -8
- package/lib/components/QueryEditorStoreProvider.js.map +1 -1
- package/lib/components/QuerySetup.d.ts +6 -0
- package/lib/components/QuerySetup.d.ts.map +1 -1
- package/lib/components/QuerySetup.js +99 -23
- package/lib/components/QuerySetup.js.map +1 -1
- package/lib/components/QuerySetupStoreProvider.d.ts.map +1 -1
- package/lib/components/QuerySetupStoreProvider.js +2 -3
- package/lib/components/QuerySetupStoreProvider.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +4 -4
- package/lib/stores/LegendQueryBaseStore.d.ts +2 -3
- package/lib/stores/LegendQueryBaseStore.d.ts.map +1 -1
- package/lib/stores/LegendQueryBaseStore.js +2 -2
- package/lib/stores/LegendQueryBaseStore.js.map +1 -1
- package/lib/stores/LegendQueryRouter.d.ts +12 -1
- package/lib/stores/LegendQueryRouter.d.ts.map +1 -1
- package/lib/stores/LegendQueryRouter.js +13 -2
- package/lib/stores/LegendQueryRouter.js.map +1 -1
- package/lib/stores/QueryEditorStore.d.ts +10 -7
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +18 -11
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/QueryEditorStoreTestUtils.d.ts.map +1 -1
- package/lib/stores/QueryEditorStoreTestUtils.js +1 -0
- package/lib/stores/QueryEditorStoreTestUtils.js.map +1 -1
- package/lib/stores/QuerySetupStore.d.ts +17 -3
- package/lib/stores/QuerySetupStore.d.ts.map +1 -1
- package/lib/stores/QuerySetupStore.js +102 -11
- package/lib/stores/QuerySetupStore.js.map +1 -1
- package/package.json +12 -12
- package/src/application/LegendQuery.tsx +1 -4
- package/src/application/LegendQueryApplicationConfig.ts +30 -10
- package/src/components/LegendQueryApplication.tsx +3 -9
- package/src/components/LegendQueryBaseStoreProvider.tsx +4 -14
- package/src/components/QueryEditor.tsx +57 -51
- package/src/components/QueryEditorComponentTestUtils.tsx +1 -6
- package/src/components/QueryEditorStoreProvider.tsx +3 -14
- package/src/components/QuerySetup.tsx +232 -35
- package/src/components/QuerySetupStoreProvider.tsx +2 -11
- package/src/stores/LegendQueryBaseStore.ts +2 -4
- package/src/stores/LegendQueryRouter.ts +28 -2
- package/src/stores/QueryEditorStore.ts +18 -16
- package/src/stores/QueryEditorStoreTestUtils.ts +1 -0
- package/src/stores/QuerySetupStore.ts +149 -9
@@ -36,12 +36,15 @@ import {
|
|
36
36
|
type Service,
|
37
37
|
QuerySearchSpecification,
|
38
38
|
BasicGraphManagerState,
|
39
|
+
CORE_PURE_PATH,
|
39
40
|
} from '@finos/legend-graph';
|
40
41
|
import {
|
41
42
|
type DepotServerClient,
|
43
|
+
type StoredEntity,
|
42
44
|
ProjectData,
|
45
|
+
DepotScope,
|
43
46
|
} from '@finos/legend-server-depot';
|
44
|
-
import type
|
47
|
+
import { type Entity, parseProjectIdentifier } from '@finos/legend-storage';
|
45
48
|
import { LEGEND_QUERY_APP_EVENT } from '../LegendQueryAppEvent.js';
|
46
49
|
import { APPLICATION_EVENT, TAB_SIZE } from '@finos/legend-application';
|
47
50
|
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
@@ -49,8 +52,14 @@ import type { LegendQueryApplicationStore } from './LegendQueryBaseStore.js';
|
|
49
52
|
import {
|
50
53
|
type MappingRuntimeCompatibilityAnalysisResult,
|
51
54
|
type ServiceExecutionAnalysisResult,
|
55
|
+
type ServiceInfo,
|
52
56
|
getQueryBuilderGraphManagerExtension,
|
57
|
+
extractServiceInfo,
|
53
58
|
} from '@finos/legend-query-builder';
|
59
|
+
import {
|
60
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateExistingServiceQueryUrl,
|
61
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateProjectServiceQueryUrl,
|
62
|
+
} from './LegendQueryRouter.js';
|
54
63
|
|
55
64
|
export abstract class QuerySetupState {
|
56
65
|
setupStore: QuerySetupStore;
|
@@ -121,8 +130,86 @@ export class EditExistingQuerySetupState extends QuerySetupState {
|
|
121
130
|
this.loadQueriesState.pass();
|
122
131
|
} catch (error) {
|
123
132
|
assertErrorThrown(error);
|
133
|
+
this.setupStore.applicationStore.notifyError(error);
|
124
134
|
this.loadQueriesState.fail();
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
|
139
|
+
const MINIMUM_SERVICE_LOADER_SEARCH_LENGTH = 3;
|
140
|
+
const DEFAULT_SERVICE_LOADER_LIMIT = 10;
|
141
|
+
|
142
|
+
export class UpdateExistingServiceQuerySetupState extends QuerySetupState {
|
143
|
+
services: ServiceInfo[] = [];
|
144
|
+
loadServicesState = ActionState.create();
|
145
|
+
|
146
|
+
constructor(setupStore: QuerySetupStore) {
|
147
|
+
super(setupStore);
|
148
|
+
|
149
|
+
makeObservable(this, {
|
150
|
+
services: observable,
|
151
|
+
loadServices: flow,
|
152
|
+
});
|
153
|
+
}
|
154
|
+
|
155
|
+
async loadServiceUpdater(serviceInfo: ServiceInfo): Promise<void> {
|
156
|
+
// fetch project data
|
157
|
+
const project = ProjectData.serialization.fromJson(
|
158
|
+
await this.setupStore.depotServerClient.getProject(
|
159
|
+
serviceInfo.groupId,
|
160
|
+
serviceInfo.artifactId,
|
161
|
+
),
|
162
|
+
);
|
163
|
+
|
164
|
+
// find the matching SDLC instance
|
165
|
+
const projectIDPrefix = parseProjectIdentifier(project.projectId).prefix;
|
166
|
+
const matchingSDLCEntry =
|
167
|
+
this.setupStore.applicationStore.config.studioInstances.find(
|
168
|
+
(entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
|
169
|
+
);
|
170
|
+
if (matchingSDLCEntry) {
|
171
|
+
this.setupStore.applicationStore.setBlockingAlert({
|
172
|
+
message: `Loading service...`,
|
173
|
+
prompt: 'Please do not close the application',
|
174
|
+
showLoading: true,
|
175
|
+
});
|
176
|
+
this.setupStore.applicationStore.navigator.jumpTo(
|
177
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateExistingServiceQueryUrl(
|
178
|
+
matchingSDLCEntry.url,
|
179
|
+
serviceInfo.groupId,
|
180
|
+
serviceInfo.artifactId,
|
181
|
+
serviceInfo.path,
|
182
|
+
),
|
183
|
+
);
|
184
|
+
} else {
|
185
|
+
this.setupStore.applicationStore.notifyWarning(
|
186
|
+
`Can't find the corresponding SDLC instance to update the service`,
|
187
|
+
);
|
188
|
+
}
|
189
|
+
}
|
190
|
+
|
191
|
+
*loadServices(searchText: string): GeneratorFn<void> {
|
192
|
+
const isValidSearchString =
|
193
|
+
searchText.length >= MINIMUM_SERVICE_LOADER_SEARCH_LENGTH;
|
194
|
+
this.loadServicesState.inProgress();
|
195
|
+
try {
|
196
|
+
this.services = (
|
197
|
+
(yield this.setupStore.depotServerClient.getEntitiesByClassifierPath(
|
198
|
+
CORE_PURE_PATH.SERVICE,
|
199
|
+
{
|
200
|
+
search: isValidSearchString ? searchText : undefined,
|
201
|
+
// NOTE: since this mode is meant for contribution, we want to load services
|
202
|
+
// on the snapshot version (i.e. merged to the default branch on the projects)
|
203
|
+
scope: DepotScope.SNAPSHOT,
|
204
|
+
limit: DEFAULT_SERVICE_LOADER_LIMIT,
|
205
|
+
},
|
206
|
+
)) as StoredEntity[]
|
207
|
+
).map((storedEntity) => extractServiceInfo(storedEntity));
|
208
|
+
this.loadServicesState.pass();
|
209
|
+
} catch (error) {
|
210
|
+
assertErrorThrown(error);
|
125
211
|
this.setupStore.applicationStore.notifyError(error);
|
212
|
+
this.loadServicesState.fail();
|
126
213
|
}
|
127
214
|
}
|
128
215
|
}
|
@@ -195,8 +282,8 @@ export class CreateMappingQuerySetupState extends QuerySetupState {
|
|
195
282
|
this.loadProjectsState.pass();
|
196
283
|
} catch (error) {
|
197
284
|
assertErrorThrown(error);
|
198
|
-
this.loadProjectsState.fail();
|
199
285
|
this.setupStore.applicationStore.notifyError(error);
|
286
|
+
this.loadProjectsState.fail();
|
200
287
|
}
|
201
288
|
}
|
202
289
|
|
@@ -226,13 +313,67 @@ export class CreateMappingQuerySetupState extends QuerySetupState {
|
|
226
313
|
|
227
314
|
this.surveyMappingRuntimeCompatibilityState.pass();
|
228
315
|
} catch (error) {
|
229
|
-
this.surveyMappingRuntimeCompatibilityState.fail();
|
230
316
|
assertErrorThrown(error);
|
231
317
|
this.setupStore.applicationStore.log.error(
|
232
318
|
LogEvent.create(LEGEND_QUERY_APP_EVENT.QUERY_PROBLEM),
|
233
319
|
error,
|
234
320
|
);
|
235
321
|
this.setupStore.applicationStore.notifyError(error);
|
322
|
+
this.surveyMappingRuntimeCompatibilityState.fail();
|
323
|
+
}
|
324
|
+
}
|
325
|
+
}
|
326
|
+
|
327
|
+
export class LoadProjectServiceQuerySetupState extends QuerySetupState {
|
328
|
+
projects: ProjectData[] = [];
|
329
|
+
loadProjectsState = ActionState.create();
|
330
|
+
|
331
|
+
constructor(setupStore: QuerySetupStore) {
|
332
|
+
super(setupStore);
|
333
|
+
|
334
|
+
makeObservable(this, {
|
335
|
+
projects: observable,
|
336
|
+
loadProjects: flow,
|
337
|
+
});
|
338
|
+
}
|
339
|
+
|
340
|
+
*loadProjects(): GeneratorFn<void> {
|
341
|
+
this.loadProjectsState.inProgress();
|
342
|
+
try {
|
343
|
+
this.projects = (
|
344
|
+
(yield this.setupStore.depotServerClient.getProjects()) as PlainObject<ProjectData>[]
|
345
|
+
).map((v) => ProjectData.serialization.fromJson(v));
|
346
|
+
this.loadProjectsState.pass();
|
347
|
+
} catch (error) {
|
348
|
+
assertErrorThrown(error);
|
349
|
+
this.setupStore.applicationStore.notifyError(error);
|
350
|
+
this.loadProjectsState.fail();
|
351
|
+
}
|
352
|
+
}
|
353
|
+
|
354
|
+
async loadProjectServiceUpdater(project: ProjectData): Promise<void> {
|
355
|
+
// find the matching SDLC instance
|
356
|
+
const projectIDPrefix = parseProjectIdentifier(project.projectId).prefix;
|
357
|
+
const matchingSDLCEntry =
|
358
|
+
this.setupStore.applicationStore.config.studioInstances.find(
|
359
|
+
(entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
|
360
|
+
);
|
361
|
+
if (matchingSDLCEntry) {
|
362
|
+
this.setupStore.applicationStore.setBlockingAlert({
|
363
|
+
message: `Loading service project...`,
|
364
|
+
prompt: 'Please do not close the application',
|
365
|
+
showLoading: true,
|
366
|
+
});
|
367
|
+
this.setupStore.applicationStore.navigator.jumpTo(
|
368
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateProjectServiceQueryUrl(
|
369
|
+
matchingSDLCEntry.url,
|
370
|
+
project.projectId,
|
371
|
+
),
|
372
|
+
);
|
373
|
+
} else {
|
374
|
+
this.setupStore.applicationStore.notifyWarning(
|
375
|
+
`Can't find the corresponding SDLC instance to load project '${project.projectId}'`,
|
376
|
+
);
|
236
377
|
}
|
237
378
|
}
|
238
379
|
}
|
@@ -242,7 +383,7 @@ export interface ServiceExecutionOption {
|
|
242
383
|
key?: string | undefined;
|
243
384
|
}
|
244
385
|
|
245
|
-
export class
|
386
|
+
export class CloneServiceQuerySetupState extends QuerySetupState {
|
246
387
|
projects: ProjectData[] = [];
|
247
388
|
loadProjectsState = ActionState.create();
|
248
389
|
loadServiceExecutionsState = ActionState.create();
|
@@ -296,8 +437,8 @@ export class LoadServiceQuerySetupState extends QuerySetupState {
|
|
296
437
|
this.loadProjectsState.pass();
|
297
438
|
} catch (error) {
|
298
439
|
assertErrorThrown(error);
|
299
|
-
this.loadProjectsState.fail();
|
300
440
|
this.setupStore.applicationStore.notifyError(error);
|
441
|
+
this.loadProjectsState.fail();
|
301
442
|
}
|
302
443
|
}
|
303
444
|
|
@@ -340,13 +481,13 @@ export class LoadServiceQuerySetupState extends QuerySetupState {
|
|
340
481
|
);
|
341
482
|
this.loadServiceExecutionsState.pass();
|
342
483
|
} catch (error) {
|
343
|
-
this.loadServiceExecutionsState.fail();
|
344
484
|
assertErrorThrown(error);
|
345
485
|
this.setupStore.applicationStore.log.error(
|
346
486
|
LogEvent.create(LEGEND_QUERY_APP_EVENT.QUERY_PROBLEM),
|
347
487
|
error,
|
348
488
|
);
|
349
489
|
this.setupStore.applicationStore.notifyError(error);
|
490
|
+
this.loadServiceExecutionsState.fail();
|
350
491
|
}
|
351
492
|
}
|
352
493
|
}
|
@@ -362,7 +503,6 @@ export class QuerySetupStore {
|
|
362
503
|
constructor(
|
363
504
|
applicationStore: LegendQueryApplicationStore,
|
364
505
|
depotServerClient: DepotServerClient,
|
365
|
-
pluginManager: LegendQueryPluginManager,
|
366
506
|
) {
|
367
507
|
makeObservable(this, {
|
368
508
|
querySetupState: observable,
|
@@ -372,11 +512,11 @@ export class QuerySetupStore {
|
|
372
512
|
|
373
513
|
this.applicationStore = applicationStore;
|
374
514
|
this.graphManagerState = new BasicGraphManagerState(
|
375
|
-
pluginManager,
|
515
|
+
applicationStore.pluginManager,
|
376
516
|
applicationStore.log,
|
377
517
|
);
|
378
518
|
this.depotServerClient = depotServerClient;
|
379
|
-
this.pluginManager = pluginManager;
|
519
|
+
this.pluginManager = applicationStore.pluginManager;
|
380
520
|
}
|
381
521
|
|
382
522
|
setSetupState(val: QuerySetupState | undefined): void {
|