@finos/legend-query-builder 0.6.30 → 0.6.32
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/QueryBuilder.d.ts.map +1 -1
- package/lib/components/QueryBuilder.js +1 -1
- package/lib/components/QueryBuilder.js.map +1 -1
- package/lib/components/QueryBuilderComponentTestUtils.d.ts.map +1 -1
- package/lib/components/QueryBuilderComponentTestUtils.js +2 -2
- package/lib/components/QueryBuilderComponentTestUtils.js.map +1 -1
- package/lib/components/QueryBuilderConstantExpressionPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderConstantExpressionPanel.js +3 -2
- package/lib/components/QueryBuilderConstantExpressionPanel.js.map +1 -1
- package/lib/components/QueryBuilderDiffPanel.js +1 -1
- package/lib/components/QueryBuilderDiffPanel.js.map +1 -1
- package/lib/components/QueryBuilderNavigationBlocker.js +4 -4
- package/lib/components/QueryBuilderNavigationBlocker.js.map +1 -1
- package/lib/components/QueryBuilderParametersPanel.d.ts.map +1 -1
- package/lib/components/QueryBuilderParametersPanel.js +4 -3
- package/lib/components/QueryBuilderParametersPanel.js.map +1 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.js +1 -1
- package/lib/components/QueryBuilderPropertyExpressionEditor.js.map +1 -1
- package/lib/components/QueryBuilderResultPanel.js +4 -4
- package/lib/components/QueryBuilderResultPanel.js.map +1 -1
- package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
- package/lib/components/QueryBuilderSideBar.js +9 -6
- package/lib/components/QueryBuilderSideBar.js.map +1 -1
- package/lib/components/QueryBuilderTextEditor.js +1 -1
- package/lib/components/QueryBuilderTextEditor.js.map +1 -1
- package/lib/components/explorer/QueryBuilderExplorerPanel.js +2 -2
- package/lib/components/explorer/QueryBuilderExplorerPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js +3 -3
- package/lib/components/fetch-structure/QueryBuilderPostFilterPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +1 -1
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js +9 -6
- package/lib/components/fetch-structure/QueryBuilderTDSWindowPanel.js.map +1 -1
- package/lib/components/filter/QueryBuilderFilterPanel.js +3 -3
- package/lib/components/filter/QueryBuilderFilterPanel.js.map +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.d.ts.map +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.js +1 -1
- package/lib/components/shared/BasicValueSpecificationEditor.js.map +1 -1
- package/lib/components/shared/CustomDatePicker.d.ts.map +1 -1
- package/lib/components/shared/CustomDatePicker.js +3 -7
- package/lib/components/shared/CustomDatePicker.js.map +1 -1
- package/lib/components/shared/LambdaEditor.js +3 -3
- package/lib/components/shared/LambdaEditor.js.map +1 -1
- package/lib/components/workflows/ClassQueryBuilder.d.ts.map +1 -1
- package/lib/components/workflows/ClassQueryBuilder.js +6 -4
- package/lib/components/workflows/ClassQueryBuilder.js.map +1 -1
- package/lib/components/workflows/MappingQueryBuilder.d.ts.map +1 -1
- package/lib/components/workflows/MappingQueryBuilder.js +6 -4
- package/lib/components/workflows/MappingQueryBuilder.js.map +1 -1
- package/lib/components/workflows/ServiceQueryBuilder.d.ts.map +1 -1
- package/lib/components/workflows/ServiceQueryBuilder.js +3 -2
- package/lib/components/workflows/ServiceQueryBuilder.js.map +1 -1
- package/lib/graphManager/protocol/pure/v1/V1_QueryBuilder_PureGraphManagerExtension.js +2 -2
- package/lib/graphManager/protocol/pure/v1/V1_QueryBuilder_PureGraphManagerExtension.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +7 -7
- package/lib/stores/QueryBuilderChangeDetectionState.js +1 -1
- package/lib/stores/QueryBuilderChangeDetectionState.js.map +1 -1
- package/lib/stores/QueryBuilderConstantsState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderConstantsState.js +1 -1
- package/lib/stores/QueryBuilderConstantsState.js.map +1 -1
- package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderResultState.js +11 -16
- package/lib/stores/QueryBuilderResultState.js.map +1 -1
- package/lib/stores/QueryBuilderState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderState.js +10 -10
- package/lib/stores/QueryBuilderState.js.map +1 -1
- package/lib/stores/QueryBuilderTelemetry.d.ts +1 -1
- package/lib/stores/QueryBuilderTelemetry.d.ts.map +1 -1
- package/lib/stores/QueryBuilderTextEditorState.js +3 -3
- package/lib/stores/QueryBuilderTextEditorState.js.map +1 -1
- package/lib/stores/explorer/QueryBuilderExplorerState.d.ts.map +1 -1
- package/lib/stores/explorer/QueryBuilderExplorerState.js +4 -4
- package/lib/stores/explorer/QueryBuilderExplorerState.js.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js +3 -3
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.js.map +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js +1 -1
- package/lib/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.js.map +1 -1
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +3 -3
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js +2 -2
- package/lib/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.js.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterState.d.ts.map +1 -1
- package/lib/stores/filter/QueryBuilderFilterState.js +1 -1
- package/lib/stores/filter/QueryBuilderFilterState.js.map +1 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts +3 -2
- package/lib/stores/shared/ValueSpecificationEditorHelper.d.ts.map +1 -1
- package/lib/stores/shared/ValueSpecificationEditorHelper.js +32 -22
- package/lib/stores/shared/ValueSpecificationEditorHelper.js.map +1 -1
- package/package.json +14 -14
- package/src/components/QueryBuilder.tsx +3 -1
- package/src/components/QueryBuilderComponentTestUtils.tsx +5 -2
- package/src/components/QueryBuilderConstantExpressionPanel.tsx +6 -2
- package/src/components/QueryBuilderDiffPanel.tsx +1 -1
- package/src/components/QueryBuilderNavigationBlocker.tsx +4 -4
- package/src/components/QueryBuilderParametersPanel.tsx +9 -3
- package/src/components/QueryBuilderPropertyExpressionEditor.tsx +1 -1
- package/src/components/QueryBuilderResultPanel.tsx +4 -4
- package/src/components/QueryBuilderSideBar.tsx +18 -6
- package/src/components/QueryBuilderTextEditor.tsx +1 -1
- package/src/components/explorer/QueryBuilderExplorerPanel.tsx +2 -2
- package/src/components/fetch-structure/QueryBuilderPostFilterPanel.tsx +3 -3
- package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +3 -1
- package/src/components/fetch-structure/QueryBuilderTDSWindowPanel.tsx +13 -6
- package/src/components/filter/QueryBuilderFilterPanel.tsx +3 -3
- package/src/components/shared/BasicValueSpecificationEditor.tsx +3 -1
- package/src/components/shared/CustomDatePicker.tsx +9 -16
- package/src/components/shared/LambdaEditor.tsx +3 -3
- package/src/components/workflows/ClassQueryBuilder.tsx +12 -4
- package/src/components/workflows/MappingQueryBuilder.tsx +12 -4
- package/src/components/workflows/ServiceQueryBuilder.tsx +7 -2
- package/src/graphManager/protocol/pure/v1/V1_QueryBuilder_PureGraphManagerExtension.ts +2 -2
- package/src/stores/QueryBuilderChangeDetectionState.ts +1 -1
- package/src/stores/QueryBuilderConstantsState.ts +3 -1
- package/src/stores/QueryBuilderResultState.ts +23 -16
- package/src/stores/QueryBuilderState.ts +16 -10
- package/src/stores/QueryBuilderTelemetry.ts +1 -1
- package/src/stores/QueryBuilderTextEditorState.ts +3 -3
- package/src/stores/explorer/QueryBuilderExplorerState.ts +6 -4
- package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeState.ts +3 -3
- package/src/stores/fetch-structure/graph-fetch/QueryBuilderGraphFetchTreeUtil.ts +1 -1
- package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +3 -3
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +1 -1
- package/src/stores/fetch-structure/tds/projection/QueryBuilderProjectionColumnState.ts +2 -2
- package/src/stores/filter/QueryBuilderFilterState.ts +3 -1
- package/src/stores/shared/ValueSpecificationEditorHelper.ts +54 -50
@@ -197,11 +197,13 @@ export class QueryBuilderResultState {
|
|
197
197
|
this.exportDataState.pass();
|
198
198
|
} catch (error) {
|
199
199
|
assertErrorThrown(error);
|
200
|
-
this.queryBuilderState.applicationStore.
|
200
|
+
this.queryBuilderState.applicationStore.logService.error(
|
201
201
|
LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
|
202
202
|
error,
|
203
203
|
);
|
204
|
-
this.queryBuilderState.applicationStore.notifyError(
|
204
|
+
this.queryBuilderState.applicationStore.notificationService.notifyError(
|
205
|
+
error,
|
206
|
+
);
|
205
207
|
this.exportDataState.fail();
|
206
208
|
}
|
207
209
|
}
|
@@ -254,13 +256,13 @@ export class QueryBuilderResultState {
|
|
254
256
|
if (this.queryRunPromise === promise) {
|
255
257
|
this.setExecutionResult(result);
|
256
258
|
this.latestRunHashCode = currentHashCode;
|
257
|
-
stopWatch.record();
|
258
259
|
this.setExecutionDuration(stopWatch.elapsed);
|
259
260
|
|
260
|
-
report.timings =
|
261
|
-
|
262
|
-
|
263
|
-
|
261
|
+
report.timings =
|
262
|
+
this.queryBuilderState.applicationStore.timeService.finalizeTimingsRecord(
|
263
|
+
stopWatch,
|
264
|
+
report.timings,
|
265
|
+
);
|
264
266
|
QueryBuilderTelemetry.logEvent_QueryRunSucceeded(
|
265
267
|
this.queryBuilderState.applicationStore.telemetryService,
|
266
268
|
report,
|
@@ -268,11 +270,13 @@ export class QueryBuilderResultState {
|
|
268
270
|
}
|
269
271
|
} catch (error) {
|
270
272
|
assertErrorThrown(error);
|
271
|
-
this.queryBuilderState.applicationStore.
|
273
|
+
this.queryBuilderState.applicationStore.logService.error(
|
272
274
|
LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
|
273
275
|
error,
|
274
276
|
);
|
275
|
-
this.queryBuilderState.applicationStore.notifyError(
|
277
|
+
this.queryBuilderState.applicationStore.notificationService.notifyError(
|
278
|
+
error,
|
279
|
+
);
|
276
280
|
} finally {
|
277
281
|
this.setIsRunningQuery(false);
|
278
282
|
this.pressedRunQuery.complete();
|
@@ -350,11 +354,12 @@ export class QueryBuilderResultState {
|
|
350
354
|
}
|
351
355
|
stopWatch.record(QUERY_BUILDER_EVENT.BUILD_EXECUTION_PLAN__SUCCESS);
|
352
356
|
|
353
|
-
report
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
357
|
+
// report
|
358
|
+
report.timings =
|
359
|
+
this.queryBuilderState.applicationStore.timeService.finalizeTimingsRecord(
|
360
|
+
stopWatch,
|
361
|
+
report.timings,
|
362
|
+
);
|
358
363
|
if (debug) {
|
359
364
|
QueryBuilderTelemetry.logEvent_ExecutionPlanDebugSucceeded(
|
360
365
|
this.queryBuilderState.applicationStore.telemetryService,
|
@@ -368,11 +373,13 @@ export class QueryBuilderResultState {
|
|
368
373
|
}
|
369
374
|
} catch (error) {
|
370
375
|
assertErrorThrown(error);
|
371
|
-
this.queryBuilderState.applicationStore.
|
376
|
+
this.queryBuilderState.applicationStore.logService.error(
|
372
377
|
LogEvent.create(GRAPH_MANAGER_EVENT.EXECUTION_FAILURE),
|
373
378
|
error,
|
374
379
|
);
|
375
|
-
this.queryBuilderState.applicationStore.notifyError(
|
380
|
+
this.queryBuilderState.applicationStore.notificationService.notifyError(
|
381
|
+
error,
|
382
|
+
);
|
376
383
|
} finally {
|
377
384
|
this.isGeneratingPlan = false;
|
378
385
|
}
|
@@ -268,7 +268,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
268
268
|
}
|
269
269
|
|
270
270
|
registerCommands(): void {
|
271
|
-
this.applicationStore.
|
271
|
+
this.applicationStore.commandService.registerCommand({
|
272
272
|
key: QUERY_BUILDER_COMMAND_KEY.COMPILE,
|
273
273
|
action: () => {
|
274
274
|
flowResult(this.compileQuery()).catch(
|
@@ -291,7 +291,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
291
291
|
|
292
292
|
deregisterCommands(): void {
|
293
293
|
[QUERY_BUILDER_COMMAND_KEY.COMPILE].forEach((key) =>
|
294
|
-
this.applicationStore.
|
294
|
+
this.applicationStore.commandService.deregisterCommand(key),
|
295
295
|
);
|
296
296
|
}
|
297
297
|
|
@@ -439,7 +439,9 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
439
439
|
await onSaveQuery(query);
|
440
440
|
} catch (error) {
|
441
441
|
assertErrorThrown(error);
|
442
|
-
this.applicationStore.notifyError(
|
442
|
+
this.applicationStore.notificationService.notifyError(
|
443
|
+
`Can't save query: ${error.message}`,
|
444
|
+
);
|
443
445
|
}
|
444
446
|
}
|
445
447
|
|
@@ -457,10 +459,12 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
457
459
|
this.graphManagerState.graph,
|
458
460
|
{ keepSourceInformation: true },
|
459
461
|
)) as string;
|
460
|
-
this.applicationStore.notifySuccess(
|
462
|
+
this.applicationStore.notificationService.notifySuccess(
|
463
|
+
'Compiled successfully',
|
464
|
+
);
|
461
465
|
} catch (error) {
|
462
466
|
assertErrorThrown(error);
|
463
|
-
this.applicationStore.
|
467
|
+
this.applicationStore.logService.error(
|
464
468
|
LogEvent.create(GRAPH_MANAGER_EVENT.COMPILATION_FAILURE),
|
465
469
|
error,
|
466
470
|
);
|
@@ -476,7 +480,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
476
480
|
|
477
481
|
// decide if we need to fall back to text mode for debugging
|
478
482
|
if (fallbackToTextModeForDebugging) {
|
479
|
-
this.applicationStore.notifyWarning(
|
483
|
+
this.applicationStore.notificationService.notifyWarning(
|
480
484
|
'Compilation failed and error cannot be located in form mode. Redirected to text mode for debugging.',
|
481
485
|
);
|
482
486
|
this.textEditorState.openModal(QueryBuilderTextEditorMode.TEXT);
|
@@ -487,7 +491,7 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
487
491
|
// of query builder text-mode
|
488
492
|
// See https://github.com/finos/legend-studio/issues/319
|
489
493
|
} else {
|
490
|
-
this.applicationStore.notifyWarning(
|
494
|
+
this.applicationStore.notificationService.notifyWarning(
|
491
495
|
`Compilation failed: ${error.message}`,
|
492
496
|
);
|
493
497
|
}
|
@@ -503,15 +507,17 @@ export abstract class QueryBuilderState implements CommandRegistrar {
|
|
503
507
|
this.graphManagerState.graph,
|
504
508
|
{ keepSourceInformation: true },
|
505
509
|
)) as string;
|
506
|
-
this.applicationStore.notifySuccess(
|
510
|
+
this.applicationStore.notificationService.notifySuccess(
|
511
|
+
'Compiled successfully',
|
512
|
+
);
|
507
513
|
} catch (error) {
|
508
514
|
assertErrorThrown(error);
|
509
515
|
if (error instanceof CompilationError) {
|
510
|
-
this.applicationStore.
|
516
|
+
this.applicationStore.logService.error(
|
511
517
|
LogEvent.create(GRAPH_MANAGER_EVENT.COMPILATION_FAILURE),
|
512
518
|
error,
|
513
519
|
);
|
514
|
-
this.applicationStore.notifyWarning(
|
520
|
+
this.applicationStore.notificationService.notifyWarning(
|
515
521
|
`Compilation failed: ${error.message}`,
|
516
522
|
);
|
517
523
|
const errorElementCoordinates = extractSourceInformationCoordinates(
|
@@ -15,7 +15,7 @@
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
import type { GraphManagerOperationReport } from '@finos/legend-graph';
|
18
|
-
import type { TelemetryService } from '@finos/legend-
|
18
|
+
import type { TelemetryService } from '@finos/legend-application';
|
19
19
|
import { QUERY_BUILDER_EVENT } from './QueryBuilderEvent.js';
|
20
20
|
|
21
21
|
type LaunchQueryExecution_TelemteryData = {
|
@@ -118,7 +118,7 @@ export class QueryBuilderTextEditorState extends LambdaEditorState {
|
|
118
118
|
if (error instanceof ParserError) {
|
119
119
|
this.setParserError(error);
|
120
120
|
}
|
121
|
-
this.queryBuilderState.applicationStore.
|
121
|
+
this.queryBuilderState.applicationStore.logService.error(
|
122
122
|
LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
|
123
123
|
error,
|
124
124
|
);
|
@@ -156,7 +156,7 @@ export class QueryBuilderTextEditorState extends LambdaEditorState {
|
|
156
156
|
this.isConvertingLambdaToString = false;
|
157
157
|
} catch (error) {
|
158
158
|
assertErrorThrown(error);
|
159
|
-
this.queryBuilderState.applicationStore.
|
159
|
+
this.queryBuilderState.applicationStore.logService.error(
|
160
160
|
LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
|
161
161
|
error,
|
162
162
|
);
|
@@ -194,7 +194,7 @@ export class QueryBuilderTextEditorState extends LambdaEditorState {
|
|
194
194
|
if (this.mode === QueryBuilderTextEditorMode.TEXT) {
|
195
195
|
yield flowResult(this.convertLambdaGrammarStringToObject());
|
196
196
|
if (this.parserError) {
|
197
|
-
this.queryBuilderState.applicationStore.notifyError(
|
197
|
+
this.queryBuilderState.applicationStore.notificationService.notifyError(
|
198
198
|
`Can't parse query. Please fix error before closing: ${this.parserError.message}`,
|
199
199
|
);
|
200
200
|
} else {
|
@@ -679,7 +679,9 @@ export class QueryBuilderExplorerState {
|
|
679
679
|
this.refreshTreeData();
|
680
680
|
} catch (error) {
|
681
681
|
assertErrorThrown(error);
|
682
|
-
this.queryBuilderState.applicationStore.notifyError(
|
682
|
+
this.queryBuilderState.applicationStore.notificationService.notifyError(
|
683
|
+
error.message,
|
684
|
+
);
|
683
685
|
} finally {
|
684
686
|
this.mappingModelCoverageAnalysisState.complete();
|
685
687
|
}
|
@@ -691,7 +693,7 @@ export class QueryBuilderExplorerState {
|
|
691
693
|
): GeneratorFn<void> {
|
692
694
|
const runtime = this.queryBuilderState.runtimeValue;
|
693
695
|
if (!runtime) {
|
694
|
-
this.queryBuilderState.applicationStore.notifyWarning(
|
696
|
+
this.queryBuilderState.applicationStore.notificationService.notifyWarning(
|
695
697
|
`Can't preview data for property '${node.property.name}': runtime is not specified`,
|
696
698
|
);
|
697
699
|
return;
|
@@ -704,7 +706,7 @@ export class QueryBuilderExplorerState {
|
|
704
706
|
return;
|
705
707
|
}
|
706
708
|
if (this.previewDataState.isGeneratingPreviewData) {
|
707
|
-
this.queryBuilderState.applicationStore.notifyWarning(
|
709
|
+
this.queryBuilderState.applicationStore.notificationService.notifyWarning(
|
708
710
|
`Can't preview data for property '${node.property.name}': another preview request is being executed`,
|
709
711
|
);
|
710
712
|
return;
|
@@ -786,7 +788,7 @@ export class QueryBuilderExplorerState {
|
|
786
788
|
}
|
787
789
|
} catch (error) {
|
788
790
|
assertErrorThrown(error);
|
789
|
-
this.queryBuilderState.applicationStore.notifyWarning(
|
791
|
+
this.queryBuilderState.applicationStore.notificationService.notifyWarning(
|
790
792
|
`Can't preview data for property '${node.property.name}'. Error: ${error.message}`,
|
791
793
|
);
|
792
794
|
this.previewDataState.setPreviewData(undefined);
|
@@ -181,7 +181,7 @@ export class QueryBuilderGraphFetchTreeState
|
|
181
181
|
},
|
182
182
|
): void {
|
183
183
|
if (!this.treeData) {
|
184
|
-
this.queryBuilderState.applicationStore.notifyWarning(
|
184
|
+
this.queryBuilderState.applicationStore.notificationService.notifyWarning(
|
185
185
|
`Can't add property: graph-fetch tree has not been properly initialized`,
|
186
186
|
);
|
187
187
|
return;
|
@@ -211,7 +211,7 @@ export class QueryBuilderGraphFetchTreeState
|
|
211
211
|
|
212
212
|
fetchProperties(nodes: QueryBuilderExplorerTreePropertyNodeData[]): void {
|
213
213
|
if (!this.treeData) {
|
214
|
-
this.queryBuilderState.applicationStore.notifyWarning(
|
214
|
+
this.queryBuilderState.applicationStore.notificationService.notifyWarning(
|
215
215
|
`Can't add property: graph-fetch tree has not been properly initialized`,
|
216
216
|
);
|
217
217
|
return;
|
@@ -224,7 +224,7 @@ export class QueryBuilderGraphFetchTreeState
|
|
224
224
|
|
225
225
|
checkBeforeChangingImplementation(onChange: () => void): void {
|
226
226
|
if (this.treeData?.rootIds.length) {
|
227
|
-
this.queryBuilderState.applicationStore.setActionAlertInfo({
|
227
|
+
this.queryBuilderState.applicationStore.alertService.setActionAlertInfo({
|
228
228
|
message:
|
229
229
|
'Current graph-fetch will be lost when switching to projection mode. Do you still want to proceed?',
|
230
230
|
type: ActionAlertType.CAUTION,
|
@@ -253,7 +253,7 @@ export const addQueryBuilderPropertyNode = (
|
|
253
253
|
parentExplorerTreeNode.parentId,
|
254
254
|
);
|
255
255
|
} else {
|
256
|
-
queryBuilderState.applicationStore.notifyError(
|
256
|
+
queryBuilderState.applicationStore.notificationService.notifyError(
|
257
257
|
`Can't cast the root class of graph fetch structure to its subtype`,
|
258
258
|
);
|
259
259
|
return;
|
@@ -360,7 +360,7 @@ export class QueryBuilderTDSState
|
|
360
360
|
});
|
361
361
|
} catch (error) {
|
362
362
|
assertErrorThrown(error);
|
363
|
-
this.queryBuilderState.applicationStore.
|
363
|
+
this.queryBuilderState.applicationStore.logService.error(
|
364
364
|
LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
|
365
365
|
error,
|
366
366
|
);
|
@@ -609,7 +609,7 @@ export class QueryBuilderTDSState
|
|
609
609
|
}
|
610
610
|
|
611
611
|
checkBeforeClearingColumns(onChange: () => void): void {
|
612
|
-
this.queryBuilderState.applicationStore.setActionAlertInfo({
|
612
|
+
this.queryBuilderState.applicationStore.alertService.setActionAlertInfo({
|
613
613
|
message:
|
614
614
|
'You will be clearing all projection columns. Do you still want to proceed?',
|
615
615
|
type: ActionAlertType.CAUTION,
|
@@ -637,7 +637,7 @@ export class QueryBuilderTDSState
|
|
637
637
|
// but we make the assumption that if there is no projection column, there should
|
638
638
|
// not be any post-filter at all
|
639
639
|
) {
|
640
|
-
this.queryBuilderState.applicationStore.setActionAlertInfo({
|
640
|
+
this.queryBuilderState.applicationStore.alertService.setActionAlertInfo({
|
641
641
|
message:
|
642
642
|
this.showPostFilterPanel && this.postFilterState.nodes.size > 0
|
643
643
|
? 'With graph-fetch mode, post filter is not supported. Current projection columns and post filters will be lost when switching to the graph-fetch mode. Do you still want to proceed?'
|
@@ -452,7 +452,7 @@ export class PostFilterConditionState implements Hashable {
|
|
452
452
|
}
|
453
453
|
} catch (error) {
|
454
454
|
assertErrorThrown(error);
|
455
|
-
this.postFilterState.tdsState.queryBuilderState.applicationStore.notifyError(
|
455
|
+
this.postFilterState.tdsState.queryBuilderState.applicationStore.notificationService.notifyError(
|
456
456
|
`Can't drag column '${columnState.columnName}' due to: ${error.message}`,
|
457
457
|
);
|
458
458
|
}
|
@@ -215,7 +215,7 @@ class QueryBuilderDerivationProjectionLambdaState extends LambdaEditorState {
|
|
215
215
|
if (error instanceof ParserError) {
|
216
216
|
this.setParserError(error);
|
217
217
|
}
|
218
|
-
this.queryBuilderState.applicationStore.
|
218
|
+
this.queryBuilderState.applicationStore.logService.error(
|
219
219
|
LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
|
220
220
|
error,
|
221
221
|
);
|
@@ -251,7 +251,7 @@ class QueryBuilderDerivationProjectionLambdaState extends LambdaEditorState {
|
|
251
251
|
this.clearErrors();
|
252
252
|
} catch (error) {
|
253
253
|
assertErrorThrown(error);
|
254
|
-
this.queryBuilderState.applicationStore.
|
254
|
+
this.queryBuilderState.applicationStore.logService.error(
|
255
255
|
LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
|
256
256
|
error,
|
257
257
|
);
|
@@ -158,7 +158,9 @@ export class FilterConditionState implements Hashable {
|
|
158
158
|
new FilterConditionState(this.filterState, propertyExpression);
|
159
159
|
} catch (error) {
|
160
160
|
assertErrorThrown(error);
|
161
|
-
this.filterState.queryBuilderState.applicationStore.notifyError(
|
161
|
+
this.filterState.queryBuilderState.applicationStore.notificationService.notifyError(
|
162
|
+
error,
|
163
|
+
);
|
162
164
|
return;
|
163
165
|
}
|
164
166
|
|
@@ -16,14 +16,11 @@
|
|
16
16
|
|
17
17
|
import {
|
18
18
|
type PureModel,
|
19
|
-
type InstanceValue,
|
20
19
|
VariableExpression,
|
21
20
|
type ValueSpecification,
|
22
21
|
type Type,
|
23
22
|
type Enum,
|
24
23
|
CollectionInstanceValue,
|
25
|
-
DATE_FORMAT,
|
26
|
-
DATE_TIME_FORMAT,
|
27
24
|
Enumeration,
|
28
25
|
EnumValueExplicitReference,
|
29
26
|
EnumValueInstanceValue,
|
@@ -35,53 +32,73 @@ import {
|
|
35
32
|
PRIMITIVE_TYPE,
|
36
33
|
INTERNAL__PropagatedValue,
|
37
34
|
SimpleFunctionExpression,
|
35
|
+
SUPPORTED_FUNCTIONS,
|
38
36
|
} from '@finos/legend-graph';
|
39
|
-
import {
|
40
|
-
addDays,
|
41
|
-
formatDate,
|
42
|
-
Randomizer,
|
43
|
-
UnsupportedOperationError,
|
44
|
-
} from '@finos/legend-shared';
|
37
|
+
import { Randomizer, UnsupportedOperationError } from '@finos/legend-shared';
|
45
38
|
import { generateDefaultValueForPrimitiveType } from '../QueryBuilderValueSpecificationHelper.js';
|
46
|
-
import {
|
39
|
+
import {
|
40
|
+
instanceValue_setValues,
|
41
|
+
valueSpecification_setGenericType,
|
42
|
+
} from './ValueSpecificationModifierHelper.js';
|
43
|
+
|
44
|
+
const VAR_DEFAULT_NAME = 'var';
|
45
|
+
|
46
|
+
export const createSupportedFunctionExpression = (
|
47
|
+
supportedFuncName: SUPPORTED_FUNCTIONS,
|
48
|
+
expectedReturnType: Type,
|
49
|
+
): SimpleFunctionExpression => {
|
50
|
+
const funcExpression = new SimpleFunctionExpression(supportedFuncName);
|
51
|
+
valueSpecification_setGenericType(
|
52
|
+
funcExpression,
|
53
|
+
GenericTypeExplicitReference.create(new GenericType(expectedReturnType)),
|
54
|
+
);
|
55
|
+
return funcExpression;
|
56
|
+
};
|
47
57
|
|
48
|
-
const
|
58
|
+
const createMockPrimitiveValueSpecification = (
|
49
59
|
primitiveType: PrimitiveType,
|
50
60
|
propertyName: string,
|
51
|
-
):
|
61
|
+
): ValueSpecification => {
|
62
|
+
const primitiveTypeName = primitiveType.name;
|
63
|
+
if (
|
64
|
+
primitiveTypeName === PRIMITIVE_TYPE.DATE ||
|
65
|
+
primitiveTypeName === PRIMITIVE_TYPE.DATETIME
|
66
|
+
) {
|
67
|
+
return createSupportedFunctionExpression(
|
68
|
+
SUPPORTED_FUNCTIONS.NOW,
|
69
|
+
PrimitiveType.DATETIME,
|
70
|
+
);
|
71
|
+
} else if (primitiveTypeName === PRIMITIVE_TYPE.STRICTDATE) {
|
72
|
+
return createSupportedFunctionExpression(
|
73
|
+
SUPPORTED_FUNCTIONS.TODAY,
|
74
|
+
PrimitiveType.STRICTDATE,
|
75
|
+
);
|
76
|
+
}
|
77
|
+
const primitiveInstanceValue = new PrimitiveInstanceValue(
|
78
|
+
GenericTypeExplicitReference.create(new GenericType(primitiveType)),
|
79
|
+
);
|
52
80
|
const randomizer = new Randomizer();
|
81
|
+
let value: string | boolean | number;
|
53
82
|
switch (primitiveType.name) {
|
54
83
|
case PRIMITIVE_TYPE.BOOLEAN:
|
55
|
-
|
84
|
+
value = randomizer.getRandomItemInCollection([true, false]) ?? true;
|
85
|
+
break;
|
56
86
|
case PRIMITIVE_TYPE.FLOAT:
|
57
|
-
|
87
|
+
value = randomizer.getRandomFloat();
|
88
|
+
break;
|
58
89
|
case PRIMITIVE_TYPE.DECIMAL:
|
59
|
-
|
90
|
+
value = randomizer.getRandomDouble();
|
91
|
+
break;
|
60
92
|
case PRIMITIVE_TYPE.NUMBER:
|
61
93
|
case PRIMITIVE_TYPE.INTEGER:
|
62
|
-
|
63
|
-
|
64
|
-
case PRIMITIVE_TYPE.DATE:
|
65
|
-
case PRIMITIVE_TYPE.STRICTDATE:
|
66
|
-
return formatDate(
|
67
|
-
randomizer.getRandomDate(
|
68
|
-
new Date(Date.now()),
|
69
|
-
addDays(Date.now(), 100),
|
70
|
-
),
|
71
|
-
DATE_FORMAT,
|
72
|
-
);
|
73
|
-
case PRIMITIVE_TYPE.DATETIME:
|
74
|
-
return formatDate(
|
75
|
-
randomizer.getRandomDate(
|
76
|
-
new Date(Date.now()),
|
77
|
-
addDays(Date.now(), 100),
|
78
|
-
),
|
79
|
-
DATE_TIME_FORMAT,
|
80
|
-
);
|
94
|
+
value = randomizer.getRandomWholeNumber(100);
|
95
|
+
break;
|
81
96
|
case PRIMITIVE_TYPE.STRING:
|
82
97
|
default:
|
83
|
-
|
98
|
+
value = `${propertyName} ${randomizer.getRandomWholeNumber(100)}`;
|
84
99
|
}
|
100
|
+
instanceValue_setValues(primitiveInstanceValue, [value]);
|
101
|
+
return primitiveInstanceValue;
|
85
102
|
};
|
86
103
|
|
87
104
|
export const createMockEnumerationProperty = (
|
@@ -155,7 +172,7 @@ export const buildDefaultInstanceValue = (
|
|
155
172
|
export const generateVariableExpressionMockValue = (
|
156
173
|
parameter: VariableExpression,
|
157
174
|
graph: PureModel,
|
158
|
-
):
|
175
|
+
): ValueSpecification | undefined => {
|
159
176
|
const varType = parameter.genericType?.value.rawType;
|
160
177
|
const multiplicity = parameter.multiplicity;
|
161
178
|
if ((!multiplicity.upperBound || multiplicity.upperBound > 1) && varType) {
|
@@ -165,20 +182,7 @@ export const generateVariableExpressionMockValue = (
|
|
165
182
|
);
|
166
183
|
}
|
167
184
|
if (varType instanceof PrimitiveType) {
|
168
|
-
|
169
|
-
GenericTypeExplicitReference.create(
|
170
|
-
varType === PrimitiveType.DATE
|
171
|
-
? new GenericType(PrimitiveType.STRICTDATE)
|
172
|
-
: new GenericType(varType),
|
173
|
-
),
|
174
|
-
);
|
175
|
-
instanceValue_setValues(primitiveInstanceValue, [
|
176
|
-
createMockPrimitiveProperty(
|
177
|
-
varType,
|
178
|
-
parameter.name === '' ? 'myVar' : parameter.name,
|
179
|
-
),
|
180
|
-
]);
|
181
|
-
return primitiveInstanceValue;
|
185
|
+
return createMockPrimitiveValueSpecification(varType, VAR_DEFAULT_NAME);
|
182
186
|
} else if (varType instanceof Enumeration) {
|
183
187
|
const enumValueInstance = new EnumValueInstanceValue(
|
184
188
|
GenericTypeExplicitReference.create(new GenericType(varType)),
|