@finos/legend-query-builder 4.14.72 → 4.14.74
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.js +108 -36
- package/lib/components/explorer/QueryBuilderPropertySearchPanel.js.map +1 -1
- package/lib/components/result/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/result/QueryBuilderResultPanel.js +29 -9
- package/lib/components/result/QueryBuilderResultPanel.js.map +1 -1
- package/lib/index.css +1 -17
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryBuilderConfig.d.ts +2 -1
- package/lib/stores/QueryBuilderConfig.d.ts.map +1 -1
- package/lib/stores/QueryBuilderConfig.js +2 -1
- package/lib/stores/QueryBuilderConfig.js.map +1 -1
- package/lib/stores/QueryBuilderResultState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderResultState.js +4 -1
- package/lib/stores/QueryBuilderResultState.js.map +1 -1
- package/lib/stores/explorer/QueryBuilderExplorerState.d.ts +4 -3
- package/lib/stores/explorer/QueryBuilderExplorerState.d.ts.map +1 -1
- package/lib/stores/explorer/QueryBuilderExplorerState.js +22 -7
- package/lib/stores/explorer/QueryBuilderExplorerState.js.map +1 -1
- package/lib/stores/explorer/QueryBuilderFuzzySearchAdvancedConfigState.d.ts.map +1 -1
- package/lib/stores/explorer/QueryBuilderFuzzySearchAdvancedConfigState.js +1 -1
- package/lib/stores/explorer/QueryBuilderFuzzySearchAdvancedConfigState.js.map +1 -1
- package/lib/stores/explorer/QueryBuilderPropertySearchState.d.ts +7 -1
- package/lib/stores/explorer/QueryBuilderPropertySearchState.d.ts.map +1 -1
- package/lib/stores/explorer/QueryBuilderPropertySearchState.js +160 -74
- package/lib/stores/explorer/QueryBuilderPropertySearchState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.d.ts.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/filter/QueryBuilderFilterState.d.ts +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/package.json +3 -3
- package/src/components/explorer/QueryBuilderPropertySearchPanel.tsx +249 -226
- package/src/components/result/QueryBuilderResultPanel.tsx +75 -16
- package/src/stores/QueryBuilderConfig.ts +2 -1
- package/src/stores/QueryBuilderResultState.ts +4 -0
- package/src/stores/explorer/QueryBuilderExplorerState.ts +58 -5
- package/src/stores/explorer/QueryBuilderFuzzySearchAdvancedConfigState.ts +1 -1
- package/src/stores/explorer/QueryBuilderPropertySearchState.ts +194 -92
- package/src/stores/fetch-structure/tds/post-filter/QueryBuilderPostFilterState.ts +4 -3
- package/src/stores/filter/QueryBuilderFilterState.ts +5 -4
@@ -55,6 +55,7 @@ import {
|
|
55
55
|
extractExecutionResultValues,
|
56
56
|
TDSExecutionResult,
|
57
57
|
RawExecutionResult,
|
58
|
+
ExecutionError,
|
58
59
|
} from '@finos/legend-graph';
|
59
60
|
import {
|
60
61
|
ActionAlertActionType,
|
@@ -80,8 +81,13 @@ import { getExecutedSqlFromExecutionResult } from './tds/QueryBuilderTDSResultSh
|
|
80
81
|
import { QueryBuilderTDSGridResult } from './tds/QueryBuilderTDSGridResult.js';
|
81
82
|
import type { QueryBuilder_LegendApplicationPlugin_Extension } from '../../stores/QueryBuilder_LegendApplicationPlugin_Extension.js';
|
82
83
|
import type { QueryBuilderResultState } from '../../stores/QueryBuilderResultState.js';
|
84
|
+
import { QueryBuilderBaseInfoTooltip } from '../shared/QueryBuilderPropertyInfoTooltip.js';
|
83
85
|
|
84
|
-
const PERMISSION_ERRORS = [
|
86
|
+
const PERMISSION_ERRORS = [
|
87
|
+
'permission denied',
|
88
|
+
'invalid user id or password',
|
89
|
+
'Incorrect username or password',
|
90
|
+
];
|
85
91
|
|
86
92
|
export const QueryBuilderExecutionErrorPanel = observer(
|
87
93
|
(props: {
|
@@ -90,24 +96,38 @@ export const QueryBuilderExecutionErrorPanel = observer(
|
|
90
96
|
}) => {
|
91
97
|
const { resultState, executionError } = props;
|
92
98
|
const queryBuilderState = resultState.queryBuilderState;
|
93
|
-
const errorMessage =
|
94
|
-
?
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
const errorMessage =
|
100
|
+
executionError instanceof Error ? executionError.message : executionError;
|
101
|
+
const errorStackTrace =
|
102
|
+
executionError instanceof ExecutionError ? executionError.stack : '';
|
103
|
+
const isPermissionDeniedError = Boolean(
|
104
|
+
PERMISSION_ERRORS.find((e) =>
|
105
|
+
queryBuilderState.applicationStore.notificationService
|
106
|
+
.getErrorMessage(executionError)
|
107
|
+
?.toLowerCase()
|
108
|
+
.includes(e),
|
109
|
+
),
|
110
|
+
);
|
102
111
|
const openCheckEntitlmentsEditor = (): void => {
|
103
112
|
queryBuilderState.checkEntitlementsState.setShowCheckEntitlementsViewer(
|
104
113
|
true,
|
105
114
|
);
|
106
115
|
};
|
116
|
+
const frequentlyAskedQuestionEntry =
|
117
|
+
queryBuilderState.applicationStore.documentationService.getDocEntry(
|
118
|
+
QUERY_BUILDER_DOCUMENTATION_KEY.FREQUENTLY_ASKED_QUESTIONS,
|
119
|
+
);
|
120
|
+
const openFrequentlyAskedQuestions = (): void => {
|
121
|
+
if (frequentlyAskedQuestionEntry?.url) {
|
122
|
+
queryBuilderState.applicationStore.navigationService.navigator.visitAddress(
|
123
|
+
frequentlyAskedQuestionEntry.url,
|
124
|
+
);
|
125
|
+
}
|
126
|
+
};
|
107
127
|
|
108
128
|
return (
|
109
129
|
<>
|
110
|
-
{isPermissionDeniedError
|
130
|
+
{isPermissionDeniedError && (
|
111
131
|
<div className="query-builder__result__permission-error">
|
112
132
|
<div className="query-builder__result__permission-error__header">
|
113
133
|
Entitlement / Authorization error - Please
|
@@ -128,14 +148,54 @@ export const QueryBuilderExecutionErrorPanel = observer(
|
|
128
148
|
</button>
|
129
149
|
</div>
|
130
150
|
)}
|
131
|
-
<div
|
151
|
+
<div
|
152
|
+
className={clsx('query-builder__result__execution-error', {
|
153
|
+
'query-builder__result__execution-error--max':
|
154
|
+
!isPermissionDeniedError,
|
155
|
+
})}
|
156
|
+
>
|
132
157
|
<div className="query-builder__result__execution-error__header">
|
133
158
|
<span style={{ fontWeight: 'bold' }}>Error Execution Query</span>.
|
134
|
-
Please try again later or review options in application`s
|
135
|
-
<span
|
159
|
+
Please try again later or review options in application`s{' '}
|
160
|
+
<span
|
161
|
+
style={{ fontWeight: 'bold' }}
|
162
|
+
onClick={openFrequentlyAskedQuestions}
|
163
|
+
>
|
164
|
+
Help
|
165
|
+
</span>{' '}
|
166
|
+
menu.
|
136
167
|
</div>
|
137
168
|
<div className="query-builder__result__execution-error__body">
|
138
|
-
|
169
|
+
<div className="query-builder__result__execution-error__body__entry">
|
170
|
+
{errorMessage}
|
171
|
+
</div>
|
172
|
+
{resultState.executionTraceId && queryBuilderState.config && (
|
173
|
+
<div className="query-builder__result__execution-error__body__entry">
|
174
|
+
<span style={{ fontWeight: 'bold' }}> ### trace: </span>
|
175
|
+
{resultState.executionTraceId} |{' '}
|
176
|
+
<button
|
177
|
+
className="query-builder__result__execution-error__body__entry__btn"
|
178
|
+
disabled={!queryBuilderState.config.zipkinTraceBaseURL}
|
179
|
+
onClick={() => {
|
180
|
+
if (queryBuilderState.config?.zipkinTraceBaseURL) {
|
181
|
+
queryBuilderState.applicationStore.navigationService.navigator.visitAddress(
|
182
|
+
queryBuilderState.config.zipkinTraceBaseURL +
|
183
|
+
resultState.executionTraceId,
|
184
|
+
);
|
185
|
+
}
|
186
|
+
}}
|
187
|
+
>
|
188
|
+
{queryBuilderState.config.zipkinTraceBaseURL +
|
189
|
+
resultState.executionTraceId}{' '}
|
190
|
+
</button>
|
191
|
+
</div>
|
192
|
+
)}
|
193
|
+
{errorStackTrace && (
|
194
|
+
<div className="query-builder__result__execution-error__body__entry">
|
195
|
+
<span style={{ fontWeight: 'bold' }}>### stack trace: </span>
|
196
|
+
{errorStackTrace}
|
197
|
+
</div>
|
198
|
+
)}
|
139
199
|
</div>
|
140
200
|
</div>
|
141
201
|
</>
|
@@ -180,7 +240,6 @@ export const QueryBuilderEmptyExecutionResultPanel = observer(
|
|
180
240
|
);
|
181
241
|
},
|
182
242
|
);
|
183
|
-
import { QueryBuilderBaseInfoTooltip } from '../shared/QueryBuilderPropertyInfoTooltip.js';
|
184
243
|
|
185
244
|
export const QueryBuilderResultValues = observer(
|
186
245
|
(props: {
|
@@ -25,12 +25,13 @@ export const DEFAULT_VARIABLE_NAME = 'var';
|
|
25
25
|
export const DEFAULT_CONSTANT_VARIABLE_NAME = 'c_var';
|
26
26
|
export const DEFAULT_POST_FILTER_LAMBDA_VARIABLE_NAME = 'row';
|
27
27
|
|
28
|
-
export const QUERY_BUILDER_PROPERTY_SEARCH_MAX_DEPTH =
|
28
|
+
export const QUERY_BUILDER_PROPERTY_SEARCH_MAX_DEPTH = 10;
|
29
29
|
export const QUERY_BUILDER_PROPERTY_SEARCH_MAX_NODES = 10000;
|
30
30
|
export const QUERY_BUILDER_PROPERTY_SEARCH_RESULTS_LIMIT = 100;
|
31
31
|
|
32
32
|
export enum QUERY_BUILDER_PROPERTY_SEARCH_TYPE {
|
33
33
|
CLASS = 'CLASS',
|
34
|
+
ENUMERATION = 'ENUMERATION',
|
34
35
|
STRING = 'STRING',
|
35
36
|
BOOLEAN = 'BOOLEAN',
|
36
37
|
NUMBER = 'NUMBER',
|
@@ -38,6 +38,7 @@ import {
|
|
38
38
|
reportGraphAnalytics,
|
39
39
|
TDSExecutionResult,
|
40
40
|
V1_ZIPKIN_TRACE_HEADER,
|
41
|
+
ExecutionError,
|
41
42
|
} from '@finos/legend-graph';
|
42
43
|
import { buildLambdaFunction } from './QueryBuilderValueSpecificationBuilder.js';
|
43
44
|
import {
|
@@ -536,6 +537,9 @@ export class QueryBuilderResultState {
|
|
536
537
|
error,
|
537
538
|
);
|
538
539
|
this.setExecutionError(error);
|
540
|
+
if (error instanceof ExecutionError && error.executionTraceId) {
|
541
|
+
this.setExecutionTraceId(error.executionTraceId);
|
542
|
+
}
|
539
543
|
}
|
540
544
|
} finally {
|
541
545
|
this.setIsRunningQuery(false);
|
@@ -31,6 +31,7 @@ import {
|
|
31
31
|
type MappingModelCoverageAnalysisResult,
|
32
32
|
type EnumMappedProperty,
|
33
33
|
type MappedEntity,
|
34
|
+
type ExecutionResultWithMetadata,
|
34
35
|
AbstractPropertyExpression,
|
35
36
|
Class,
|
36
37
|
VariableExpression,
|
@@ -55,7 +56,6 @@ import {
|
|
55
56
|
Association,
|
56
57
|
PRIMITIVE_TYPE,
|
57
58
|
TDSExecutionResult,
|
58
|
-
type ExecutionResult,
|
59
59
|
getAllSubclasses,
|
60
60
|
PropertyExplicitReference,
|
61
61
|
reportGraphAnalytics,
|
@@ -115,6 +115,7 @@ export abstract class QueryBuilderExplorerTreeNodeData implements TreeNodeData {
|
|
115
115
|
isPartOfDerivedPropertyBranch: boolean,
|
116
116
|
type: Type,
|
117
117
|
mappingData: QueryBuilderExplorerTreeNodeMappingData,
|
118
|
+
childrenIds?: string[] | undefined,
|
118
119
|
) {
|
119
120
|
makeObservable(this, {
|
120
121
|
isHighlighting: observable,
|
@@ -131,6 +132,9 @@ export abstract class QueryBuilderExplorerTreeNodeData implements TreeNodeData {
|
|
131
132
|
this.isPartOfDerivedPropertyBranch = isPartOfDerivedPropertyBranch;
|
132
133
|
this.type = type;
|
133
134
|
this.mappingData = mappingData;
|
135
|
+
if (childrenIds) {
|
136
|
+
this.childrenIds = childrenIds;
|
137
|
+
}
|
134
138
|
this.elementRef = createRef();
|
135
139
|
}
|
136
140
|
|
@@ -169,6 +173,7 @@ export class QueryBuilderExplorerTreePropertyNodeData extends QueryBuilderExplor
|
|
169
173
|
isPartOfDerivedPropertyBranch: boolean,
|
170
174
|
mappingData: QueryBuilderExplorerTreeNodeMappingData,
|
171
175
|
type?: Type | undefined,
|
176
|
+
childrenIds?: string[],
|
172
177
|
) {
|
173
178
|
super(
|
174
179
|
id,
|
@@ -177,6 +182,7 @@ export class QueryBuilderExplorerTreePropertyNodeData extends QueryBuilderExplor
|
|
177
182
|
isPartOfDerivedPropertyBranch,
|
178
183
|
type ?? property.genericType.value.rawType,
|
179
184
|
mappingData,
|
185
|
+
childrenIds,
|
180
186
|
);
|
181
187
|
this.property = property;
|
182
188
|
this.parentId = parentId;
|
@@ -197,6 +203,7 @@ export class QueryBuilderExplorerTreeSubTypeNodeData extends QueryBuilderExplore
|
|
197
203
|
isPartOfDerivedPropertyBranch: boolean,
|
198
204
|
mappingData: QueryBuilderExplorerTreeNodeMappingData,
|
199
205
|
multiplicity: Multiplicity,
|
206
|
+
childrenIds?: string[],
|
200
207
|
) {
|
201
208
|
super(
|
202
209
|
id,
|
@@ -205,6 +212,7 @@ export class QueryBuilderExplorerTreeSubTypeNodeData extends QueryBuilderExplore
|
|
205
212
|
isPartOfDerivedPropertyBranch,
|
206
213
|
subclass,
|
207
214
|
mappingData,
|
215
|
+
childrenIds,
|
208
216
|
);
|
209
217
|
this.subclass = subclass;
|
210
218
|
this.parentId = parentId;
|
@@ -652,6 +660,49 @@ const getQueryBuilderTreeData = (
|
|
652
660
|
return { rootIds, nodes };
|
653
661
|
};
|
654
662
|
|
663
|
+
export const cloneQueryBuilderExplorerTreeNodeData = (
|
664
|
+
node: QueryBuilderExplorerTreeNodeData,
|
665
|
+
): QueryBuilderExplorerTreeNodeData => {
|
666
|
+
if (node instanceof QueryBuilderExplorerTreeRootNodeData) {
|
667
|
+
return new QueryBuilderExplorerTreeRootNodeData(
|
668
|
+
node.id,
|
669
|
+
node.label,
|
670
|
+
node.dndText,
|
671
|
+
node.isPartOfDerivedPropertyBranch,
|
672
|
+
node.type,
|
673
|
+
node.mappingData,
|
674
|
+
node.childrenIds,
|
675
|
+
);
|
676
|
+
} else if (node instanceof QueryBuilderExplorerTreePropertyNodeData) {
|
677
|
+
return new QueryBuilderExplorerTreePropertyNodeData(
|
678
|
+
node.id,
|
679
|
+
node.label,
|
680
|
+
node.dndText,
|
681
|
+
node.property,
|
682
|
+
node.parentId,
|
683
|
+
node.isPartOfDerivedPropertyBranch,
|
684
|
+
node.mappingData,
|
685
|
+
node.type,
|
686
|
+
node.childrenIds,
|
687
|
+
);
|
688
|
+
} else if (node instanceof QueryBuilderExplorerTreeSubTypeNodeData) {
|
689
|
+
return new QueryBuilderExplorerTreeSubTypeNodeData(
|
690
|
+
node.id,
|
691
|
+
node.label,
|
692
|
+
node.dndText,
|
693
|
+
node.subclass,
|
694
|
+
node.parentId,
|
695
|
+
node.isPartOfDerivedPropertyBranch,
|
696
|
+
node.mappingData,
|
697
|
+
node.multiplicity,
|
698
|
+
node.childrenIds,
|
699
|
+
);
|
700
|
+
}
|
701
|
+
throw new UnsupportedOperationError(
|
702
|
+
`Unable to clone node of type ${node.constructor.name}`,
|
703
|
+
);
|
704
|
+
};
|
705
|
+
|
655
706
|
export class QueryBuilderExplorerPreviewDataState {
|
656
707
|
isGeneratingPreviewData = false;
|
657
708
|
propertyName = '(unknown)';
|
@@ -957,7 +1008,7 @@ export class QueryBuilderExplorerState {
|
|
957
1008
|
case PRIMITIVE_TYPE.INTEGER:
|
958
1009
|
case PRIMITIVE_TYPE.DECIMAL:
|
959
1010
|
case PRIMITIVE_TYPE.FLOAT: {
|
960
|
-
const previewResult =
|
1011
|
+
const previewResult = (
|
961
1012
|
(yield this.queryBuilderState.graphManagerState.graphManager.runQuery(
|
962
1013
|
buildNumericPreviewDataQuery(
|
963
1014
|
this.queryBuilderState,
|
@@ -970,7 +1021,8 @@ export class QueryBuilderExplorerState {
|
|
970
1021
|
abortController:
|
971
1022
|
this.previewDataState.previewDataAbortController,
|
972
1023
|
},
|
973
|
-
)) as
|
1024
|
+
)) as ExecutionResultWithMetadata
|
1025
|
+
).executionResult;
|
974
1026
|
assertType(
|
975
1027
|
previewResult,
|
976
1028
|
TDSExecutionResult,
|
@@ -998,7 +1050,7 @@ export class QueryBuilderExplorerState {
|
|
998
1050
|
case PRIMITIVE_TYPE.DATE:
|
999
1051
|
case PRIMITIVE_TYPE.STRICTDATE:
|
1000
1052
|
case PRIMITIVE_TYPE.DATETIME: {
|
1001
|
-
const previewResult =
|
1053
|
+
const previewResult = (
|
1002
1054
|
(yield this.queryBuilderState.graphManagerState.graphManager.runQuery(
|
1003
1055
|
buildNonNumericPreviewDataQuery(
|
1004
1056
|
this.queryBuilderState,
|
@@ -1011,7 +1063,8 @@ export class QueryBuilderExplorerState {
|
|
1011
1063
|
abortController:
|
1012
1064
|
this.previewDataState.previewDataAbortController,
|
1013
1065
|
},
|
1014
|
-
)) as
|
1066
|
+
)) as ExecutionResultWithMetadata
|
1067
|
+
).executionResult;
|
1015
1068
|
assertType(
|
1016
1069
|
previewResult,
|
1017
1070
|
TDSExecutionResult,
|
@@ -18,7 +18,7 @@ import { FuzzySearchAdvancedConfigState } from '@finos/legend-shared';
|
|
18
18
|
import { action, makeObservable, observable } from 'mobx';
|
19
19
|
|
20
20
|
export class QueryBuilderFuzzySearchAdvancedConfigState extends FuzzySearchAdvancedConfigState {
|
21
|
-
includeSubTypes =
|
21
|
+
includeSubTypes = true;
|
22
22
|
includeDocumentation = false;
|
23
23
|
|
24
24
|
constructor(
|