@finos/legend-query-builder 4.14.37 → 4.14.38
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 +10 -9
- package/lib/components/QueryBuilder.js.map +1 -1
- package/lib/components/QueryBuilderSideBar.d.ts.map +1 -1
- package/lib/components/QueryBuilderSideBar.js +3 -3
- package/lib/components/QueryBuilderSideBar.js.map +1 -1
- package/lib/components/QueryBuilderTextEditor.d.ts.map +1 -1
- package/lib/components/QueryBuilderTextEditor.js +17 -3
- package/lib/components/QueryBuilderTextEditor.js.map +1 -1
- package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts +5 -0
- package/lib/components/explorer/QueryBuilderMilestoningEditor.d.ts.map +1 -1
- package/lib/components/explorer/QueryBuilderMilestoningEditor.js +10 -5
- package/lib/components/explorer/QueryBuilderMilestoningEditor.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js +35 -3
- package/lib/components/fetch-structure/QueryBuilderResultModifierPanel.js.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.d.ts.map +1 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js +11 -1
- package/lib/components/fetch-structure/QueryBuilderTDSPanel.js.map +1 -1
- package/lib/components/result/QueryBuilderResultPanel.d.ts.map +1 -1
- package/lib/components/result/QueryBuilderResultPanel.js +6 -5
- package/lib/components/result/QueryBuilderResultPanel.js.map +1 -1
- package/lib/components/workflows/ClassQueryBuilder.d.ts.map +1 -1
- package/lib/components/workflows/ClassQueryBuilder.js +3 -3
- 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 +3 -3
- 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 -3
- package/lib/components/workflows/ServiceQueryBuilder.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryBuilderTextEditorState.d.ts +4 -1
- package/lib/stores/QueryBuilderTextEditorState.d.ts.map +1 -1
- package/lib/stores/QueryBuilderTextEditorState.js +19 -2
- package/lib/stores/QueryBuilderTextEditorState.js.map +1 -1
- package/lib/stores/QueryLoaderState.d.ts +2 -2
- package/lib/stores/QueryLoaderState.d.ts.map +1 -1
- package/lib/stores/QueryLoaderState.js +3 -3
- package/lib/stores/QueryLoaderState.js.map +1 -1
- package/lib/stores/explorer/QueryFunctionsExplorerState.d.ts +1 -1
- package/lib/stores/explorer/QueryFunctionsExplorerState.d.ts.map +1 -1
- package/lib/stores/explorer/QueryFunctionsExplorerState.js +2 -1
- package/lib/stores/explorer/QueryFunctionsExplorerState.js.map +1 -1
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts +1 -0
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.d.ts.map +1 -1
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js +8 -0
- package/lib/stores/fetch-structure/tds/QueryBuilderTDSState.js.map +1 -1
- package/lib/stores/milestoning/QueryBuilderMilestoningState.d.ts.map +1 -1
- package/lib/stores/milestoning/QueryBuilderMilestoningState.js +9 -3
- package/lib/stores/milestoning/QueryBuilderMilestoningState.js.map +1 -1
- package/package.json +5 -5
- package/src/components/QueryBuilder.tsx +16 -15
- package/src/components/QueryBuilderSideBar.tsx +3 -2
- package/src/components/QueryBuilderTextEditor.tsx +46 -11
- package/src/components/explorer/QueryBuilderMilestoningEditor.tsx +60 -46
- package/src/components/fetch-structure/QueryBuilderResultModifierPanel.tsx +53 -3
- package/src/components/fetch-structure/QueryBuilderTDSPanel.tsx +116 -19
- package/src/components/result/QueryBuilderResultPanel.tsx +21 -23
- package/src/components/workflows/ClassQueryBuilder.tsx +3 -2
- package/src/components/workflows/MappingQueryBuilder.tsx +3 -2
- package/src/components/workflows/ServiceQueryBuilder.tsx +7 -3
- package/src/stores/QueryBuilderTextEditorState.ts +20 -2
- package/src/stores/QueryLoaderState.ts +5 -7
- package/src/stores/explorer/QueryFunctionsExplorerState.ts +6 -2
- package/src/stores/fetch-structure/tds/QueryBuilderTDSState.ts +11 -0
- package/src/stores/milestoning/QueryBuilderMilestoningState.ts +11 -7
@@ -1148,27 +1148,118 @@ export const QueryBuilderTDSPanel = observer(
|
|
1148
1148
|
>
|
1149
1149
|
<div className="query-builder__projection__result-modifier-prompt__header">
|
1150
1150
|
<button
|
1151
|
-
className="query-builder__projection__result-modifier-prompt__header__label"
|
1151
|
+
className="query-builder__projection__result-modifier-prompt__header__label editable-value"
|
1152
1152
|
onClick={openResultSetModifierEditor}
|
1153
|
-
title="Configure
|
1153
|
+
title="Configure Query Options..."
|
1154
1154
|
>
|
1155
1155
|
<CogIcon className="query-builder__projection__result-modifier-prompt__header__label__icon" />
|
1156
1156
|
<div className="query-builder__projection__result-modifier-prompt__header__label__title">
|
1157
|
-
|
1157
|
+
{tdsState.isQueryOptionsSet
|
1158
|
+
? 'Query Options'
|
1159
|
+
: 'Set Query Options'}
|
1158
1160
|
</div>
|
1159
1161
|
</button>
|
1162
|
+
<div className="query-builder__projection__result-modifier-prompt__divider">
|
1163
|
+
{tdsState.isQueryOptionsSet && ' - '}
|
1164
|
+
</div>
|
1165
|
+
{tdsState.queryBuilderState.milestoningState.businessDate && (
|
1166
|
+
<div className="query-builder__projection__result-modifier-prompt__group">
|
1167
|
+
<div className="query-builder__projection__result-modifier-prompt__group__label">
|
1168
|
+
Business Date
|
1169
|
+
</div>
|
1170
|
+
<button
|
1171
|
+
className="query-builder__projection__result-modifier-prompt__header__label editable-value"
|
1172
|
+
onClick={openResultSetModifierEditor}
|
1173
|
+
>
|
1174
|
+
<div className="query-builder__projection__result-modifier-prompt__header__label__title">
|
1175
|
+
{getNameOfValueSpecification(
|
1176
|
+
tdsState.queryBuilderState.milestoningState
|
1177
|
+
.businessDate,
|
1178
|
+
tdsState.queryBuilderState,
|
1179
|
+
)}
|
1180
|
+
</div>
|
1181
|
+
</button>
|
1182
|
+
</div>
|
1183
|
+
)}
|
1184
|
+
{tdsState.queryBuilderState.milestoningState.processingDate && (
|
1185
|
+
<div className="query-builder__projection__result-modifier-prompt__group">
|
1186
|
+
<div className="query-builder__projection__result-modifier-prompt__group__label">
|
1187
|
+
Processing Date
|
1188
|
+
</div>
|
1189
|
+
<button
|
1190
|
+
className="query-builder__projection__result-modifier-prompt__header__label editable-value"
|
1191
|
+
onClick={openResultSetModifierEditor}
|
1192
|
+
>
|
1193
|
+
<div className="query-builder__projection__result-modifier-prompt__header__label__title">
|
1194
|
+
{getNameOfValueSpecification(
|
1195
|
+
tdsState.queryBuilderState.milestoningState
|
1196
|
+
.processingDate,
|
1197
|
+
tdsState.queryBuilderState,
|
1198
|
+
)}
|
1199
|
+
</div>
|
1200
|
+
</button>
|
1201
|
+
</div>
|
1202
|
+
)}
|
1203
|
+
{tdsState.queryBuilderState.milestoningState
|
1204
|
+
.isAllVersionsEnabled &&
|
1205
|
+
!tdsState.queryBuilderState.milestoningState
|
1206
|
+
.isAllVersionsInRangeEnabled && (
|
1207
|
+
<div className="query-builder__projection__result-modifier-prompt__group">
|
1208
|
+
<div className="query-builder__projection__result-modifier-prompt__group__label">
|
1209
|
+
All Versions
|
1210
|
+
</div>
|
1211
|
+
<button
|
1212
|
+
className="query-builder__projection__result-modifier-prompt__header__label editable-value"
|
1213
|
+
onClick={openResultSetModifierEditor}
|
1214
|
+
>
|
1215
|
+
<div className="query-builder__projection__result-modifier-prompt__header__label__title">
|
1216
|
+
Yes
|
1217
|
+
</div>
|
1218
|
+
</button>
|
1219
|
+
</div>
|
1220
|
+
)}
|
1221
|
+
{tdsState.queryBuilderState.milestoningState
|
1222
|
+
.isAllVersionsInRangeEnabled &&
|
1223
|
+
tdsState.queryBuilderState.milestoningState.startDate &&
|
1224
|
+
tdsState.queryBuilderState.milestoningState.endDate && (
|
1225
|
+
<div className="query-builder__projection__result-modifier-prompt__group">
|
1226
|
+
<div className="query-builder__projection__result-modifier-prompt__group__label">
|
1227
|
+
All Versions
|
1228
|
+
</div>
|
1229
|
+
<button
|
1230
|
+
className="query-builder__projection__result-modifier-prompt__header__label editable-value"
|
1231
|
+
onClick={openResultSetModifierEditor}
|
1232
|
+
>
|
1233
|
+
<div className="query-builder__projection__result-modifier-prompt__header__label__title">
|
1234
|
+
(
|
1235
|
+
{getNameOfValueSpecification(
|
1236
|
+
tdsState.queryBuilderState.milestoningState.startDate,
|
1237
|
+
tdsState.queryBuilderState,
|
1238
|
+
)}{' '}
|
1239
|
+
-{' '}
|
1240
|
+
{getNameOfValueSpecification(
|
1241
|
+
tdsState.queryBuilderState.milestoningState.endDate,
|
1242
|
+
tdsState.queryBuilderState,
|
1243
|
+
)}
|
1244
|
+
)
|
1245
|
+
</div>
|
1246
|
+
</button>
|
1247
|
+
</div>
|
1248
|
+
)}
|
1160
1249
|
</div>
|
1161
1250
|
{tdsState.resultSetModifierState.limit && (
|
1162
1251
|
<div className="query-builder__projection__result-modifier-prompt__group">
|
1163
1252
|
<div className="query-builder__projection__result-modifier-prompt__group__label">
|
1164
1253
|
Max Rows
|
1165
1254
|
</div>
|
1166
|
-
<
|
1167
|
-
className="query-builder__projection__result-modifier-
|
1255
|
+
<button
|
1256
|
+
className="query-builder__projection__result-modifier-prompt__header__label editable-value"
|
1168
1257
|
onClick={openResultSetModifierEditor}
|
1169
1258
|
>
|
1170
|
-
|
1171
|
-
|
1259
|
+
<div className="query-builder__projection__result-modifier-prompt__header__label__title">
|
1260
|
+
{tdsState.resultSetModifierState.limit}
|
1261
|
+
</div>
|
1262
|
+
</button>
|
1172
1263
|
</div>
|
1173
1264
|
)}
|
1174
1265
|
{tdsState.resultSetModifierState.distinct && (
|
@@ -1176,12 +1267,14 @@ export const QueryBuilderTDSPanel = observer(
|
|
1176
1267
|
<div className="query-builder__projection__result-modifier-prompt__group__label">
|
1177
1268
|
Eliminate Duplicate Rows
|
1178
1269
|
</div>
|
1179
|
-
<
|
1180
|
-
className="query-builder__projection__result-modifier-
|
1270
|
+
<button
|
1271
|
+
className="query-builder__projection__result-modifier-prompt__header__label editable-value"
|
1181
1272
|
onClick={openResultSetModifierEditor}
|
1182
1273
|
>
|
1183
|
-
|
1184
|
-
|
1274
|
+
<div className="query-builder__projection__result-modifier-prompt__header__label__title">
|
1275
|
+
Yes
|
1276
|
+
</div>
|
1277
|
+
</button>
|
1185
1278
|
</div>
|
1186
1279
|
)}
|
1187
1280
|
{tdsState.resultSetModifierState.sortColumns.length > 0 && (
|
@@ -1191,13 +1284,15 @@ export const QueryBuilderTDSPanel = observer(
|
|
1191
1284
|
</div>
|
1192
1285
|
{tdsState.resultSetModifierState.sortColumns.map(
|
1193
1286
|
(columnState) => (
|
1194
|
-
<
|
1195
|
-
className="query-builder__projection__result-modifier-prompt__group__content"
|
1287
|
+
<button
|
1196
1288
|
key={columnState.columnState.uuid}
|
1289
|
+
className="query-builder__projection__result-modifier-prompt__header__label editable-value"
|
1197
1290
|
onClick={openResultSetModifierEditor}
|
1198
1291
|
>
|
1199
|
-
|
1200
|
-
|
1292
|
+
<div className="query-builder__projection__result-modifier-prompt__header__label__title">
|
1293
|
+
{`${columnState.columnState.columnName} ${columnState.sortType}`}
|
1294
|
+
</div>
|
1295
|
+
</button>
|
1201
1296
|
),
|
1202
1297
|
)}
|
1203
1298
|
</div>
|
@@ -1207,12 +1302,14 @@ export const QueryBuilderTDSPanel = observer(
|
|
1207
1302
|
<div className="query-builder__projection__result-modifier-prompt__group__label">
|
1208
1303
|
Slice
|
1209
1304
|
</div>
|
1210
|
-
<
|
1211
|
-
className="query-builder__projection__result-modifier-
|
1305
|
+
<button
|
1306
|
+
className="query-builder__projection__result-modifier-prompt__header__label editable-value"
|
1212
1307
|
onClick={openResultSetModifierEditor}
|
1213
1308
|
>
|
1214
|
-
|
1215
|
-
|
1309
|
+
<div className="query-builder__projection__result-modifier-prompt__header__label__title">
|
1310
|
+
{`${tdsState.resultSetModifierState.slice[0]},${tdsState.resultSetModifierState.slice[1]}`}
|
1311
|
+
</div>
|
1312
|
+
</button>
|
1216
1313
|
</div>
|
1217
1314
|
)}
|
1218
1315
|
{tdsState.queryBuilderState.watermarkState.value && (
|
@@ -16,7 +16,6 @@
|
|
16
16
|
|
17
17
|
import {
|
18
18
|
BlankPanelContent,
|
19
|
-
PanelLoadingIndicator,
|
20
19
|
PlayIcon,
|
21
20
|
DropdownMenu,
|
22
21
|
MenuContent,
|
@@ -43,6 +42,8 @@ import {
|
|
43
42
|
CsvIcon,
|
44
43
|
DebugIcon,
|
45
44
|
ReportIcon,
|
45
|
+
CubesLoadingIndicatorIcon,
|
46
|
+
CubesLoadingIndicator,
|
46
47
|
} from '@finos/legend-art';
|
47
48
|
import { observer } from 'mobx-react-lite';
|
48
49
|
import { flowResult } from 'mobx';
|
@@ -334,6 +335,9 @@ export const QueryBuilderResultPanel = observer(
|
|
334
335
|
</MenuContentItem>
|
335
336
|
));
|
336
337
|
|
338
|
+
const isLoading =
|
339
|
+
resultState.isRunningQuery || resultState.isGeneratingPlan;
|
340
|
+
|
337
341
|
return (
|
338
342
|
<div
|
339
343
|
data-testid={QUERY_BUILDER_TEST_ID.QUERY_BUILDER_RESULT_PANEL}
|
@@ -383,7 +387,7 @@ export const QueryBuilderResultPanel = observer(
|
|
383
387
|
|
384
388
|
<div className="panel__header">
|
385
389
|
<div className="panel__header__title">
|
386
|
-
<div className="panel__header__title__label">
|
390
|
+
<div className="panel__header__title__label">results</div>
|
387
391
|
{executedSql && (
|
388
392
|
<Button
|
389
393
|
onClick={() => setShowSqlModal(true)}
|
@@ -457,7 +461,7 @@ export const QueryBuilderResultPanel = observer(
|
|
457
461
|
{allowSettingPreviewLimit && (
|
458
462
|
<div className="query-builder__result__limit">
|
459
463
|
<div className="query-builder__result__limit__label">
|
460
|
-
preview limit
|
464
|
+
preview row limit
|
461
465
|
</div>
|
462
466
|
<input
|
463
467
|
ref={inputRef}
|
@@ -476,22 +480,20 @@ export const QueryBuilderResultPanel = observer(
|
|
476
480
|
<div className="query-builder__result__execute-btn btn__dropdown-combo btn__dropdown-combo--primary">
|
477
481
|
{resultState.isRunningQuery ? (
|
478
482
|
<button
|
479
|
-
className="btn__dropdown-combo__canceler"
|
483
|
+
className="btn__dropdown-combo__canceler query-builder__result__execute-btn__btn"
|
480
484
|
onClick={cancelQuery}
|
481
485
|
tabIndex={-1}
|
482
486
|
disabled={!isQueryValid}
|
483
487
|
>
|
484
|
-
<div className="btn--dark btn--caution btn__dropdown-combo__canceler__label">
|
485
|
-
<PauseCircleIcon
|
486
|
-
|
487
|
-
Stop
|
488
|
-
</div>
|
488
|
+
<div className="btn--dark btn--caution btn__dropdown-combo__canceler__label query-builder__result__execute-btn__btn">
|
489
|
+
<PauseCircleIcon />
|
490
|
+
Stop
|
489
491
|
</div>
|
490
492
|
</button>
|
491
493
|
) : (
|
492
494
|
<>
|
493
495
|
<button
|
494
|
-
className="btn__dropdown-combo__label"
|
496
|
+
className="btn__dropdown-combo__label query-builder__result__execute-btn__btn query-builder__result__execute-btn__btn--green"
|
495
497
|
onClick={runQuery}
|
496
498
|
tabIndex={-1}
|
497
499
|
title={
|
@@ -503,13 +505,11 @@ export const QueryBuilderResultPanel = observer(
|
|
503
505
|
}
|
504
506
|
disabled={isRunQueryDisabled}
|
505
507
|
>
|
506
|
-
<PlayIcon
|
507
|
-
|
508
|
-
Run Query
|
509
|
-
</div>
|
508
|
+
<PlayIcon />
|
509
|
+
Run Query
|
510
510
|
</button>
|
511
511
|
<DropdownMenu
|
512
|
-
className="btn__dropdown-combo__dropdown-btn"
|
512
|
+
className="btn__dropdown-combo__dropdown-btn query-builder__result__execute-btn__btn query-builder__result__execute-btn__btn--green"
|
513
513
|
disabled={isRunQueryDisabled}
|
514
514
|
content={
|
515
515
|
<MenuContent>
|
@@ -617,18 +617,16 @@ export const QueryBuilderResultPanel = observer(
|
|
617
617
|
))}
|
618
618
|
</div>
|
619
619
|
</div>
|
620
|
-
<PanelContent>
|
621
|
-
<
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
/>
|
626
|
-
{!executionResult && (
|
620
|
+
<PanelContent className="query-builder__result__content">
|
621
|
+
<CubesLoadingIndicator isLoading={isLoading}>
|
622
|
+
<CubesLoadingIndicatorIcon />
|
623
|
+
</CubesLoadingIndicator>
|
624
|
+
{!executionResult && !isLoading && (
|
627
625
|
<BlankPanelContent>
|
628
626
|
Build or load a valid query first
|
629
627
|
</BlankPanelContent>
|
630
628
|
)}
|
631
|
-
{executionResult && (
|
629
|
+
{executionResult && !isLoading && (
|
632
630
|
<div className="query-builder__result__values">
|
633
631
|
<QueryBuilderResultValues
|
634
632
|
executionResult={executionResult}
|
@@ -17,6 +17,7 @@
|
|
17
17
|
import {
|
18
18
|
CustomSelectorInput,
|
19
19
|
PanelHeader,
|
20
|
+
compareLabelFn,
|
20
21
|
createFilter,
|
21
22
|
} from '@finos/legend-art';
|
22
23
|
import { observer } from 'mobx-react-lite';
|
@@ -71,7 +72,7 @@ const ClassQueryBuilderSetupPanelContent = observer(
|
|
71
72
|
: []
|
72
73
|
)
|
73
74
|
.map(buildElementOption)
|
74
|
-
.sort(
|
75
|
+
.sort(compareLabelFn);
|
75
76
|
const selectedMappingOption = queryBuilderState.executionContextState
|
76
77
|
.mapping
|
77
78
|
? buildElementOption(queryBuilderState.executionContextState.mapping)
|
@@ -107,7 +108,7 @@ const ClassQueryBuilderSetupPanelContent = observer(
|
|
107
108
|
new RuntimePointer(PackageableElementExplicitReference.create(rt)),
|
108
109
|
)
|
109
110
|
.map(buildRuntimeValueOption)
|
110
|
-
.sort(
|
111
|
+
.sort(compareLabelFn);
|
111
112
|
const selectedRuntimeOption = queryBuilderState.executionContextState
|
112
113
|
.runtimeValue
|
113
114
|
? buildRuntimeValueOption(
|
@@ -17,6 +17,7 @@
|
|
17
17
|
import {
|
18
18
|
CustomSelectorInput,
|
19
19
|
PanelHeader,
|
20
|
+
compareLabelFn,
|
20
21
|
createFilter,
|
21
22
|
} from '@finos/legend-art';
|
22
23
|
import { observer } from 'mobx-react-lite';
|
@@ -59,7 +60,7 @@ const MappingQueryBuilderSetupPanelContent = observer(
|
|
59
60
|
// mapping
|
60
61
|
const mappingOptions = queryBuilderState.graphManagerState.usableMappings
|
61
62
|
.map(buildElementOption)
|
62
|
-
.sort(
|
63
|
+
.sort(compareLabelFn);
|
63
64
|
const selectedMappingOption = queryBuilderState.executionContextState
|
64
65
|
.mapping
|
65
66
|
? buildElementOption(queryBuilderState.executionContextState.mapping)
|
@@ -93,7 +94,7 @@ const MappingQueryBuilderSetupPanelContent = observer(
|
|
93
94
|
new RuntimePointer(PackageableElementExplicitReference.create(rt)),
|
94
95
|
)
|
95
96
|
.map(buildRuntimeValueOption)
|
96
|
-
.sort(
|
97
|
+
.sort(compareLabelFn);
|
97
98
|
const selectedRuntimeOption = queryBuilderState.executionContextState
|
98
99
|
.runtimeValue
|
99
100
|
? buildRuntimeValueOption(
|
@@ -14,7 +14,11 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import {
|
17
|
+
import {
|
18
|
+
CustomSelectorInput,
|
19
|
+
PanelHeader,
|
20
|
+
compareLabelFn,
|
21
|
+
} from '@finos/legend-art';
|
18
22
|
import { observer } from 'mobx-react-lite';
|
19
23
|
import { getMappingCompatibleClasses, type Service } from '@finos/legend-graph';
|
20
24
|
import { useApplicationStore } from '@finos/legend-application';
|
@@ -57,7 +61,7 @@ const ServiceQueryBuilderSetupPanelContent = observer(
|
|
57
61
|
const serviceOptions =
|
58
62
|
queryBuilderState.usableServices
|
59
63
|
?.map(buildElementOption)
|
60
|
-
.sort(
|
64
|
+
.sort(compareLabelFn) ?? [];
|
61
65
|
const selectedServiceOption = buildElementOption(queryBuilderState.service);
|
62
66
|
const onServiceOptionChange = (
|
63
67
|
option: PackageableElementOption<Service>,
|
@@ -71,7 +75,7 @@ const ServiceQueryBuilderSetupPanelContent = observer(
|
|
71
75
|
// execution context
|
72
76
|
const executionContextOptions = queryBuilderState.executionContexts
|
73
77
|
.map(buildExecutionContextOption)
|
74
|
-
.sort(
|
78
|
+
.sort(compareLabelFn);
|
75
79
|
const selectedExecutionContextOption =
|
76
80
|
queryBuilderState.selectedExecutionContext
|
77
81
|
? buildExecutionContextOption(
|
@@ -67,6 +67,7 @@ export class QueryBuilderTextEditorState extends LambdaEditorState {
|
|
67
67
|
* TODO: consider moving this to another state if we need to simplify the logic of text-mode
|
68
68
|
*/
|
69
69
|
readOnlylambdaJson = '';
|
70
|
+
isReadOnly: boolean | undefined;
|
70
71
|
|
71
72
|
constructor(queryBuilderState: QueryBuilderState) {
|
72
73
|
super('', '');
|
@@ -75,7 +76,9 @@ export class QueryBuilderTextEditorState extends LambdaEditorState {
|
|
75
76
|
rawLambdaState: observable,
|
76
77
|
isConvertingLambdaToString: observable,
|
77
78
|
mode: observable,
|
79
|
+
isReadOnly: observable,
|
78
80
|
setQueryRawLambdaState: action,
|
81
|
+
setIsReadOnly: action,
|
79
82
|
setMode: action,
|
80
83
|
openModal: action,
|
81
84
|
closeModal: flow,
|
@@ -89,10 +92,23 @@ export class QueryBuilderTextEditorState extends LambdaEditorState {
|
|
89
92
|
return buildSourceInformationSourceId(['query-builder']);
|
90
93
|
}
|
91
94
|
|
95
|
+
get text(): string | undefined {
|
96
|
+
if (this.mode === QueryBuilderTextEditorMode.TEXT) {
|
97
|
+
return this.fullLambdaString;
|
98
|
+
} else if (this.mode === QueryBuilderTextEditorMode.JSON) {
|
99
|
+
return this.readOnlylambdaJson;
|
100
|
+
}
|
101
|
+
return undefined;
|
102
|
+
}
|
103
|
+
|
92
104
|
setQueryRawLambdaState(rawLambdaState: QueryBuilderRawLambdaState): void {
|
93
105
|
this.rawLambdaState = rawLambdaState;
|
94
106
|
}
|
95
107
|
|
108
|
+
setIsReadOnly(val: boolean | undefined): void {
|
109
|
+
this.isReadOnly = val;
|
110
|
+
}
|
111
|
+
|
96
112
|
setMode(openModal: QueryBuilderTextEditorMode | undefined): void {
|
97
113
|
this.mode = openModal;
|
98
114
|
}
|
@@ -170,7 +186,7 @@ export class QueryBuilderTextEditorState extends LambdaEditorState {
|
|
170
186
|
}
|
171
187
|
}
|
172
188
|
|
173
|
-
openModal(mode: QueryBuilderTextEditorMode): void {
|
189
|
+
openModal(mode: QueryBuilderTextEditorMode, isReadOnly?: boolean): void {
|
174
190
|
try {
|
175
191
|
const rawLambda = this.queryBuilderState.buildQuery();
|
176
192
|
if (mode === QueryBuilderTextEditorMode.TEXT) {
|
@@ -190,6 +206,7 @@ export class QueryBuilderTextEditorState extends LambdaEditorState {
|
|
190
206
|
);
|
191
207
|
}
|
192
208
|
this.setMode(mode);
|
209
|
+
this.setIsReadOnly(isReadOnly);
|
193
210
|
} catch (error) {
|
194
211
|
assertErrorThrown(error);
|
195
212
|
this.queryBuilderState.applicationStore.notificationService.notifyError(
|
@@ -200,7 +217,7 @@ export class QueryBuilderTextEditorState extends LambdaEditorState {
|
|
200
217
|
|
201
218
|
*closeModal(): GeneratorFn<void> {
|
202
219
|
this.closingQueryState.inProgress();
|
203
|
-
if (this.mode === QueryBuilderTextEditorMode.TEXT) {
|
220
|
+
if (this.mode === QueryBuilderTextEditorMode.TEXT && !this.isReadOnly) {
|
204
221
|
yield flowResult(this.convertLambdaGrammarStringToObject());
|
205
222
|
if (this.parserError) {
|
206
223
|
this.queryBuilderState.applicationStore.notificationService.notifyError(
|
@@ -215,6 +232,7 @@ export class QueryBuilderTextEditorState extends LambdaEditorState {
|
|
215
232
|
}
|
216
233
|
return;
|
217
234
|
}
|
235
|
+
this.setIsReadOnly(undefined);
|
218
236
|
this.closingQueryState.complete();
|
219
237
|
|
220
238
|
this.setMode(undefined);
|
@@ -65,7 +65,7 @@ export class QueryLoaderState {
|
|
65
65
|
|
66
66
|
readonly isReadOnly?: boolean | undefined;
|
67
67
|
readonly onQueryRenamed?: ((query: LightQuery) => void) | undefined;
|
68
|
-
readonly onQueryDeleted?: ((query:
|
68
|
+
readonly onQueryDeleted?: ((query: string) => void) | undefined;
|
69
69
|
readonly handleFetchDefaultQueriesFailure?: (() => void) | undefined;
|
70
70
|
|
71
71
|
queryBuilderState?: QueryBuilderState | undefined;
|
@@ -100,7 +100,7 @@ export class QueryLoaderState {
|
|
100
100
|
|
101
101
|
isReadOnly?: boolean | undefined;
|
102
102
|
onQueryRenamed?: ((query: LightQuery) => void) | undefined;
|
103
|
-
onQueryDeleted?: ((query:
|
103
|
+
onQueryDeleted?: ((query: string) => void) | undefined;
|
104
104
|
handleFetchDefaultQueriesFailure?: (() => void) | undefined;
|
105
105
|
},
|
106
106
|
) {
|
@@ -304,11 +304,9 @@ export class QueryLoaderState {
|
|
304
304
|
*deleteQuery(queryId: string): GeneratorFn<void> {
|
305
305
|
this.deleteQueryState.inProgress();
|
306
306
|
try {
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
this.onQueryDeleted?.(query);
|
311
|
-
this.applicationStore.notificationService.notify(
|
307
|
+
yield this.graphManagerState.graphManager.deleteQuery(queryId);
|
308
|
+
this.onQueryDeleted?.(queryId);
|
309
|
+
this.applicationStore.notificationService.notifySuccess(
|
312
310
|
'Deleted query successfully',
|
313
311
|
);
|
314
312
|
this.deleteQueryState.pass();
|
@@ -30,7 +30,11 @@ import {
|
|
30
30
|
} from '@finos/legend-shared';
|
31
31
|
import { action, makeObservable, observable } from 'mobx';
|
32
32
|
import type { QueryBuilderState } from '../QueryBuilderState.js';
|
33
|
-
import
|
33
|
+
import {
|
34
|
+
type TreeNodeData,
|
35
|
+
type TreeData,
|
36
|
+
compareLabelFn,
|
37
|
+
} from '@finos/legend-art';
|
34
38
|
|
35
39
|
export const QUERY_BUILDER_FUNCTION_DND_TYPE = 'QUERY_BUILDER_FUNCTION';
|
36
40
|
|
@@ -206,7 +210,7 @@ export const getFunctionsExplorerTreeNodeChildren = (
|
|
206
210
|
return node.childrenIds
|
207
211
|
.map((id) => data.nodes.get(id))
|
208
212
|
.filter(isNonNullable)
|
209
|
-
.sort(
|
213
|
+
.sort(compareLabelFn)
|
210
214
|
.sort(
|
211
215
|
(a, b) =>
|
212
216
|
(b.packageableElement instanceof Package ? 1 : 0) -
|
@@ -146,6 +146,7 @@ export class QueryBuilderTDSState
|
|
146
146
|
TEMPORARY__showPostFetchStructurePanel: computed,
|
147
147
|
derivations: computed,
|
148
148
|
hasParserError: computed,
|
149
|
+
isQueryOptionsSet: computed,
|
149
150
|
addColumn: action,
|
150
151
|
moveColumn: action,
|
151
152
|
removeAllColumns: action,
|
@@ -356,6 +357,16 @@ export class QueryBuilderTDSState
|
|
356
357
|
return fetchStructureValidationIssues;
|
357
358
|
}
|
358
359
|
|
360
|
+
get isQueryOptionsSet(): boolean {
|
361
|
+
return (
|
362
|
+
this.resultSetModifierState.limit !== undefined ||
|
363
|
+
this.queryBuilderState.milestoningState.isMilestonedQuery ||
|
364
|
+
this.resultSetModifierState.slice !== undefined ||
|
365
|
+
this.resultSetModifierState.sortColumns.length > 0 ||
|
366
|
+
this.resultSetModifierState.distinct
|
367
|
+
);
|
368
|
+
}
|
369
|
+
|
359
370
|
get tdsColumns(): QueryBuilderTDSColumnState[] {
|
360
371
|
const aggregationStateCols = this.aggregationState.columns.map(
|
361
372
|
(c) => c.projectionColumnState,
|
@@ -75,7 +75,7 @@ export class QueryBuilderMilestoningState implements Hashable {
|
|
75
75
|
startDate: observable,
|
76
76
|
endDate: observable,
|
77
77
|
showMilestoningEditor: observable,
|
78
|
-
|
78
|
+
|
79
79
|
setProcessingDate: action,
|
80
80
|
setBusinessDate: action,
|
81
81
|
setStartDate: action,
|
@@ -87,6 +87,10 @@ export class QueryBuilderMilestoningState implements Hashable {
|
|
87
87
|
initializeAllVersionsInRangeParameters: action,
|
88
88
|
clearAllVersionsInRangeParameters: action,
|
89
89
|
clearGetAllParameters: action,
|
90
|
+
|
91
|
+
isAllVersionsEnabled: computed,
|
92
|
+
isAllVersionsInRangeEnabled: computed,
|
93
|
+
isMilestonedQuery: computed,
|
90
94
|
hashCode: computed,
|
91
95
|
});
|
92
96
|
|
@@ -380,9 +384,9 @@ export class QueryBuilderMilestoningState implements Hashable {
|
|
380
384
|
this.queryBuilderState.parametersState.parameterStates.find(
|
381
385
|
(p) => p.parameter === this.startDate,
|
382
386
|
);
|
383
|
-
|
384
|
-
|
385
|
-
|
387
|
+
if (paramState) {
|
388
|
+
this.queryBuilderState.parametersState.removeParameter(paramState);
|
389
|
+
}
|
386
390
|
}
|
387
391
|
if (
|
388
392
|
this.endDate instanceof VariableExpression &&
|
@@ -394,9 +398,9 @@ export class QueryBuilderMilestoningState implements Hashable {
|
|
394
398
|
this.queryBuilderState.parametersState.parameterStates.find(
|
395
399
|
(p) => p.parameter === this.endDate,
|
396
400
|
);
|
397
|
-
|
398
|
-
|
399
|
-
|
401
|
+
if (paramState) {
|
402
|
+
this.queryBuilderState.parametersState.removeParameter(paramState);
|
403
|
+
}
|
400
404
|
}
|
401
405
|
this.setStartDate(undefined);
|
402
406
|
this.setEndDate(undefined);
|