@finos/legend-application-query 13.7.193 → 13.7.196
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/__lib__/LegendQueryNavigation.d.ts +18 -0
- package/lib/__lib__/LegendQueryNavigation.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryNavigation.js +21 -0
- package/lib/__lib__/LegendQueryNavigation.js.map +1 -1
- package/lib/__lib__/LegendQueryUserDataHelper.d.ts +9 -9
- package/lib/__lib__/LegendQueryUserDataHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryUserDataHelper.js.map +1 -1
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.d.ts +7 -7
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.js +5 -5
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.js.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.js +7 -7
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +46 -50
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/data-space/DataSpaceQueryCreator.d.ts.map +1 -1
- package/lib/components/data-space/DataSpaceQueryCreator.js +2 -0
- package/lib/components/data-space/DataSpaceQueryCreator.js.map +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.d.ts +2 -2
- package/lib/components/data-space/DataSpaceQuerySetup.d.ts.map +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.js +32 -15
- package/lib/components/data-space/DataSpaceQuerySetup.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/light-mode.css +2 -2
- package/lib/light-mode.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/QueryEditorStore.d.ts +3 -3
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +20 -12
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.d.ts +30 -0
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.d.ts.map +1 -0
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.js +41 -0
- package/lib/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.js.map +1 -0
- package/lib/stores/data-space/DataSpaceQueryBuilderHelper.d.ts +0 -3
- package/lib/stores/data-space/DataSpaceQueryBuilderHelper.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryBuilderHelper.js +0 -6
- package/lib/stores/data-space/DataSpaceQueryBuilderHelper.js.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts +45 -17
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js +195 -67
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +7 -3
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.d.ts +46 -0
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.d.ts.map +1 -0
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.js +63 -0
- package/lib/stores/data-space/LegendQueryBareQueryBuilderState.js.map +1 -0
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.d.ts +47 -0
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.d.ts.map +1 -0
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.js +145 -0
- package/lib/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.js.map +1 -0
- package/package.json +11 -11
- package/src/__lib__/LegendQueryNavigation.ts +43 -0
- package/src/__lib__/LegendQueryUserDataHelper.ts +14 -12
- package/src/__lib__/LegendQueryUserDataSpaceHelper.ts +14 -14
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +5 -13
- package/src/components/QueryEditor.tsx +145 -103
- package/src/components/data-space/DataSpaceQueryCreator.tsx +4 -2
- package/src/components/data-space/DataSpaceQuerySetup.tsx +63 -20
- package/src/index.ts +1 -1
- package/src/stores/QueryEditorStore.ts +100 -91
- package/src/stores/data-product/query-builder/LegendQueryDataProductQueryBuilderState.ts +129 -0
- package/src/stores/data-space/DataSpaceQueryBuilderHelper.ts +0 -29
- package/src/stores/data-space/DataSpaceQueryCreatorStore.ts +293 -101
- package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +11 -12
- package/src/stores/data-space/LegendQueryBareQueryBuilderState.ts +117 -0
- package/src/stores/data-space/query-builder/LegendQueryDataSpaceQueryBuilderState.ts +340 -0
- package/tsconfig.json +3 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts +0 -44
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts.map +0 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.js +0 -89
- package/lib/stores/data-space/DataSpaceQuerySetupState.js.map +0 -1
- package/src/stores/data-space/DataSpaceQuerySetupState.ts +0 -171
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
ModalTitle,
|
|
34
34
|
ModalFooterButton,
|
|
35
35
|
ExclamationTriangleIcon,
|
|
36
|
-
PanelListItem,
|
|
37
36
|
clsx,
|
|
38
37
|
ModalHeaderActions,
|
|
39
38
|
TimesIcon,
|
|
@@ -57,7 +56,6 @@ import {
|
|
|
57
56
|
} from '../__lib__/LegendQueryNavigation.js';
|
|
58
57
|
import { ExistingQueryEditorStore } from '../stores/QueryEditorStore.js';
|
|
59
58
|
import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
|
|
60
|
-
import { DataSpaceQuerySetupState } from './../stores/data-space/DataSpaceQuerySetupState.js';
|
|
61
59
|
import {
|
|
62
60
|
LEGEND_APPLICATION_COLOR_THEME,
|
|
63
61
|
ReleaseLogManager,
|
|
@@ -97,6 +95,7 @@ import {
|
|
|
97
95
|
import { LegendQueryInfo } from './LegendQueryAppInfo.js';
|
|
98
96
|
import { QueryEditorDataspaceInfoModal } from './data-space/DataSpaceInfo.js';
|
|
99
97
|
import { DataSpaceQueryBuilderState } from '@finos/legend-extension-dsl-data-space/application';
|
|
98
|
+
import { LegendQueryBareQueryBuilderState } from '../stores/data-space/LegendQueryBareQueryBuilderState.js';
|
|
100
99
|
|
|
101
100
|
const CreateQueryDialog = observer(() => {
|
|
102
101
|
const editorStore = useQueryEditorStore();
|
|
@@ -297,35 +296,27 @@ const SaveQueryDialog = observer(
|
|
|
297
296
|
},
|
|
298
297
|
);
|
|
299
298
|
|
|
300
|
-
|
|
301
|
-
(props: {
|
|
302
|
-
queryBuilderState: QueryBuilderState;
|
|
303
|
-
existingEditorStore: ExistingQueryEditorStore;
|
|
304
|
-
}) => {
|
|
299
|
+
const RenameQueryDialog = observer(
|
|
300
|
+
(props: { existingEditorStore: ExistingQueryEditorStore }) => {
|
|
305
301
|
const { existingEditorStore } = props;
|
|
306
302
|
const updateState = existingEditorStore.updateState;
|
|
307
|
-
const isRenaming = updateState.queryRenamer;
|
|
308
303
|
const applicationStore = existingEditorStore.applicationStore;
|
|
309
|
-
const
|
|
304
|
+
const handleClose = (): void =>
|
|
305
|
+
updateState.setIsQueryRenameDialogOpen(false);
|
|
306
|
+
|
|
310
307
|
const [queryRenameName, setQueryRenameName] = useState<string>(
|
|
311
308
|
existingEditorStore.lightQuery.name,
|
|
312
309
|
);
|
|
310
|
+
const [queryDescription, setQueryDescription] = useState<string>(
|
|
311
|
+
existingEditorStore.lightQuery.description ?? '',
|
|
312
|
+
);
|
|
313
313
|
|
|
314
|
-
const
|
|
315
|
-
setQueryRenameName(existingEditorStore.lightQuery.name);
|
|
316
|
-
existingEditorStore.updateState.setQueryRenamer(true);
|
|
317
|
-
};
|
|
318
|
-
const renameQuery = (val: string): void => {
|
|
319
|
-
if (queryRenameName !== existingEditorStore.lightQuery.name) {
|
|
320
|
-
flowResult(updateState.updateQuery(val, undefined)).catch(
|
|
321
|
-
applicationStore.alertUnhandledError,
|
|
322
|
-
);
|
|
323
|
-
}
|
|
324
|
-
};
|
|
314
|
+
const nameInputRef = useRef<HTMLInputElement>(null);
|
|
325
315
|
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
|
|
316
|
+
const isEmptyName = !queryRenameName;
|
|
317
|
+
const isExistingQueryName =
|
|
318
|
+
existingEditorStore.existingQueryName &&
|
|
319
|
+
queryRenameName !== existingEditorStore.lightQuery.name;
|
|
329
320
|
|
|
330
321
|
const debouncedLoadQueries = useMemo(
|
|
331
322
|
() =>
|
|
@@ -337,106 +328,157 @@ export const QueryEditorExistingQueryHeader = observer(
|
|
|
337
328
|
[applicationStore.alertUnhandledError, existingEditorStore],
|
|
338
329
|
);
|
|
339
330
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
331
|
+
const changeName: React.ChangeEventHandler<HTMLInputElement> = (event) => {
|
|
332
|
+
setQueryRenameName(event.target.value);
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const changeDescription: React.ChangeEventHandler<HTMLInputElement> = (
|
|
336
|
+
event,
|
|
337
|
+
) => {
|
|
338
|
+
setQueryDescription(event.target.value);
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
const renameQuery = (): void => {
|
|
342
|
+
const nameChanged =
|
|
343
|
+
queryRenameName !== existingEditorStore.lightQuery.name;
|
|
344
|
+
const descriptionChanged =
|
|
345
|
+
queryDescription !== (existingEditorStore.lightQuery.description ?? '');
|
|
346
|
+
if (nameChanged || descriptionChanged) {
|
|
347
|
+
flowResult(
|
|
348
|
+
updateState.updateQuery(
|
|
349
|
+
nameChanged ? queryRenameName : undefined,
|
|
350
|
+
undefined,
|
|
351
|
+
descriptionChanged ? queryDescription : undefined,
|
|
352
|
+
),
|
|
353
|
+
).catch(applicationStore.alertUnhandledError);
|
|
343
354
|
}
|
|
355
|
+
handleClose();
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
useEffect(() => {
|
|
359
|
+
nameInputRef.current?.focus();
|
|
360
|
+
}, []);
|
|
361
|
+
|
|
362
|
+
useEffect(() => {
|
|
363
|
+
existingEditorStore.setExistingQueryName(undefined);
|
|
344
364
|
const searchText = queryRenameName;
|
|
345
365
|
debouncedLoadQueries.cancel();
|
|
346
366
|
debouncedLoadQueries(searchText);
|
|
347
|
-
}, [
|
|
348
|
-
queryRenameName,
|
|
349
|
-
debouncedLoadQueries,
|
|
350
|
-
isRenaming,
|
|
351
|
-
existingEditorStore,
|
|
352
|
-
]);
|
|
353
|
-
|
|
354
|
-
const isExistingQueryName =
|
|
355
|
-
existingEditorStore.existingQueryName &&
|
|
356
|
-
queryRenameName !== existingEditorStore.lightQuery.name;
|
|
367
|
+
}, [queryRenameName, debouncedLoadQueries, existingEditorStore]);
|
|
357
368
|
|
|
358
369
|
return (
|
|
359
|
-
|
|
360
|
-
{
|
|
361
|
-
|
|
362
|
-
|
|
370
|
+
<Dialog
|
|
371
|
+
open={updateState.isQueryRenameDialogOpen}
|
|
372
|
+
onClose={handleClose}
|
|
373
|
+
classes={{
|
|
374
|
+
root: 'editor-modal__root-container',
|
|
375
|
+
container: 'editor-modal__container',
|
|
376
|
+
paper: 'editor-modal__content',
|
|
377
|
+
}}
|
|
378
|
+
>
|
|
379
|
+
<Modal
|
|
380
|
+
darkMode={
|
|
381
|
+
!applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
|
|
382
|
+
}
|
|
383
|
+
className="query-export"
|
|
384
|
+
>
|
|
385
|
+
<ModalHeader title="Rename Query" />
|
|
386
|
+
<ModalBody>
|
|
387
|
+
<PanelLoadingIndicator
|
|
388
|
+
isLoading={updateState.updateQueryState.isInProgress}
|
|
389
|
+
/>
|
|
390
|
+
<div className="input-section">
|
|
391
|
+
<div className="input-label">Update Query Name</div>
|
|
363
392
|
<div className="input--with-validation">
|
|
364
393
|
<input
|
|
365
|
-
ref={
|
|
366
|
-
className={clsx(
|
|
367
|
-
'input
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
},
|
|
371
|
-
)}
|
|
372
|
-
onChange={changeQueryName}
|
|
373
|
-
onKeyDown={(event) => {
|
|
374
|
-
if (
|
|
375
|
-
event.code === 'Enter' ||
|
|
376
|
-
event.code === 'NumpadEnter'
|
|
377
|
-
) {
|
|
378
|
-
event.stopPropagation();
|
|
379
|
-
updateState.setQueryRenamer(false);
|
|
380
|
-
existingEditorStore.setExistingQueryName(undefined);
|
|
381
|
-
renameQuery(queryRenameName);
|
|
382
|
-
} else if (event.code === 'Escape') {
|
|
383
|
-
event.stopPropagation();
|
|
384
|
-
updateState.setQueryRenamer(false);
|
|
385
|
-
existingEditorStore.setExistingQueryName(undefined);
|
|
386
|
-
}
|
|
387
|
-
}}
|
|
394
|
+
ref={nameInputRef}
|
|
395
|
+
className={clsx('input input--dark', {
|
|
396
|
+
'input--caution': isExistingQueryName,
|
|
397
|
+
})}
|
|
398
|
+
spellCheck={false}
|
|
388
399
|
value={queryRenameName}
|
|
400
|
+
onChange={changeName}
|
|
401
|
+
title="Query Name"
|
|
402
|
+
placeholder='(e.g. "MyQuery")'
|
|
389
403
|
/>
|
|
390
404
|
{isExistingQueryName && (
|
|
391
405
|
<div
|
|
392
406
|
className="input--with-validation__caution"
|
|
393
|
-
title={`Query
|
|
407
|
+
title={`Query named '${queryRenameName}' already exists`}
|
|
394
408
|
>
|
|
395
409
|
<ExclamationTriangleIcon className="input--with-validation__caution__indicator" />
|
|
396
410
|
</div>
|
|
397
411
|
)}
|
|
398
412
|
</div>
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
<button
|
|
412
|
-
className="query-editor__header__content__title__actions__action"
|
|
413
|
-
tabIndex={-1}
|
|
414
|
-
onClick={() => {
|
|
415
|
-
updateState.setQueryRenamer(false);
|
|
416
|
-
existingEditorStore.setExistingQueryName(undefined);
|
|
417
|
-
}}
|
|
418
|
-
>
|
|
419
|
-
<TimesIcon />
|
|
420
|
-
</button>
|
|
413
|
+
</div>
|
|
414
|
+
<div className="input-section" style={{ marginTop: '1rem' }}>
|
|
415
|
+
<div className="input-label">Update Query Description</div>
|
|
416
|
+
<div className="input--with-validation">
|
|
417
|
+
<input
|
|
418
|
+
className="input input--dark"
|
|
419
|
+
spellCheck={true}
|
|
420
|
+
value={queryDescription}
|
|
421
|
+
onChange={changeDescription}
|
|
422
|
+
title="Query Description"
|
|
423
|
+
placeholder="Add details about what this query retrieves"
|
|
424
|
+
/>
|
|
421
425
|
</div>
|
|
422
|
-
</PanelListItem>
|
|
423
|
-
</div>
|
|
424
|
-
) : (
|
|
425
|
-
<div
|
|
426
|
-
onDoubleClick={enableRename}
|
|
427
|
-
className="query-editor__header__content__main query-editor__header__content__title"
|
|
428
|
-
title="Double-click to rename query"
|
|
429
|
-
>
|
|
430
|
-
<div className="query-editor__header__content__title__text">
|
|
431
|
-
{existingEditorStore.lightQuery.name}
|
|
432
426
|
</div>
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
427
|
+
</ModalBody>
|
|
428
|
+
<ModalFooter>
|
|
429
|
+
<ModalFooterButton
|
|
430
|
+
text="Update Query"
|
|
431
|
+
title="Update query name and description"
|
|
432
|
+
disabled={
|
|
433
|
+
existingEditorStore.isPerformingBlockingAction ||
|
|
434
|
+
Boolean(isExistingQueryName) ||
|
|
435
|
+
isEmptyName
|
|
436
|
+
}
|
|
437
|
+
onClick={renameQuery}
|
|
438
|
+
/>
|
|
439
|
+
<ModalFooterButton
|
|
440
|
+
text="Cancel"
|
|
441
|
+
onClick={handleClose}
|
|
442
|
+
type="secondary"
|
|
443
|
+
/>
|
|
444
|
+
</ModalFooter>
|
|
445
|
+
</Modal>
|
|
446
|
+
</Dialog>
|
|
447
|
+
);
|
|
448
|
+
},
|
|
449
|
+
);
|
|
450
|
+
|
|
451
|
+
export const QueryEditorExistingQueryHeader = observer(
|
|
452
|
+
(props: {
|
|
453
|
+
queryBuilderState: QueryBuilderState;
|
|
454
|
+
existingEditorStore: ExistingQueryEditorStore;
|
|
455
|
+
}) => {
|
|
456
|
+
const { existingEditorStore } = props;
|
|
457
|
+
const updateState = existingEditorStore.updateState;
|
|
458
|
+
|
|
459
|
+
const enableRename = (): void => {
|
|
460
|
+
existingEditorStore.updateState.setIsQueryRenameDialogOpen(true);
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
return (
|
|
464
|
+
<>
|
|
465
|
+
<div
|
|
466
|
+
onDoubleClick={enableRename}
|
|
467
|
+
className="query-editor__header__content__main query-editor__header__content__title"
|
|
468
|
+
title="Double-click to rename query"
|
|
469
|
+
>
|
|
470
|
+
<div className="query-editor__header__content__title__text">
|
|
471
|
+
{existingEditorStore.lightQuery.name}
|
|
439
472
|
</div>
|
|
473
|
+
<button
|
|
474
|
+
className="query-editor__header__conten__title__btn panel__content__form__section__list__item__edit-btn"
|
|
475
|
+
onClick={enableRename}
|
|
476
|
+
>
|
|
477
|
+
<PencilIcon />
|
|
478
|
+
</button>
|
|
479
|
+
</div>
|
|
480
|
+
{updateState.isQueryRenameDialogOpen && (
|
|
481
|
+
<RenameQueryDialog existingEditorStore={existingEditorStore} />
|
|
440
482
|
)}
|
|
441
483
|
{existingEditorStore.updateState.saveModal && (
|
|
442
484
|
<SaveQueryDialog existingEditorStore={existingEditorStore} />
|
|
@@ -774,7 +816,7 @@ export const QueryEditor = observer(() => {
|
|
|
774
816
|
(editorStore.queryBuilderState instanceof
|
|
775
817
|
DataSpaceQueryBuilderState ||
|
|
776
818
|
editorStore.queryBuilderState instanceof
|
|
777
|
-
|
|
819
|
+
LegendQueryBareQueryBuilderState) &&
|
|
778
820
|
editorStore.queryBuilderState.canBuildQuery && (
|
|
779
821
|
<button
|
|
780
822
|
title="Open Query Chat."
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from '../LegendQueryFrameworkProvider.js';
|
|
25
25
|
import {
|
|
26
26
|
DataSpaceQueryCreatorStore,
|
|
27
|
-
type
|
|
27
|
+
type QueryableDataProduct,
|
|
28
28
|
} from '../../stores/data-space/DataSpaceQueryCreatorStore.js';
|
|
29
29
|
import { QueryEditorStoreContext } from '../QueryEditorStoreProvider.js';
|
|
30
30
|
import {
|
|
@@ -35,6 +35,7 @@ import {
|
|
|
35
35
|
import { QueryEditor } from '../QueryEditor.js';
|
|
36
36
|
import { LEGEND_QUERY_ROUTE_PATTERN } from '../../__lib__/LegendQueryNavigation.js';
|
|
37
37
|
import { useEffect } from 'react';
|
|
38
|
+
import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '@finos/legend-extension-dsl-data-space/graph';
|
|
38
39
|
|
|
39
40
|
const DataSpaceQueryCreatorStoreProvider: React.FC<{
|
|
40
41
|
children: React.ReactNode;
|
|
@@ -51,7 +52,7 @@ const DataSpaceQueryCreatorStoreProvider: React.FC<{
|
|
|
51
52
|
runtimePath,
|
|
52
53
|
classPath,
|
|
53
54
|
}) => {
|
|
54
|
-
let queryableDataSpace:
|
|
55
|
+
let queryableDataSpace: QueryableDataProduct | undefined = undefined;
|
|
55
56
|
if (gav && dataSpacePath && executionContext) {
|
|
56
57
|
const { groupId, artifactId, versionId } = parseGAVCoordinates(gav);
|
|
57
58
|
queryableDataSpace = {
|
|
@@ -62,6 +63,7 @@ const DataSpaceQueryCreatorStoreProvider: React.FC<{
|
|
|
62
63
|
executionContext,
|
|
63
64
|
runtimePath,
|
|
64
65
|
classPath,
|
|
66
|
+
classifier: DATA_SPACE_ELEMENT_CLASSIFIER_PATH,
|
|
65
67
|
};
|
|
66
68
|
}
|
|
67
69
|
const applicationStore = useLegendQueryApplicationStore();
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
import { observer } from 'mobx-react-lite';
|
|
18
18
|
import { useApplicationStore } from '@finos/legend-application';
|
|
19
19
|
import { useEffect, useRef } from 'react';
|
|
20
|
-
import { flowResult } from 'mobx';
|
|
21
20
|
import { QueryBuilderClassSelector } from '@finos/legend-query-builder';
|
|
22
21
|
import {
|
|
23
22
|
CustomSelectorInput,
|
|
@@ -26,13 +25,44 @@ import {
|
|
|
26
25
|
compareLabelFn,
|
|
27
26
|
type SelectComponent,
|
|
28
27
|
} from '@finos/legend-art';
|
|
29
|
-
import { type DataSpaceQuerySetupState } from '../../stores/data-space/DataSpaceQuerySetupState.js';
|
|
30
28
|
import {
|
|
31
29
|
DataSpaceAdvancedSearchModal,
|
|
32
|
-
buildDataSpaceOption,
|
|
33
30
|
formatDataSpaceOptionLabel,
|
|
34
31
|
type DataSpaceOption,
|
|
35
32
|
} from '@finos/legend-extension-dsl-data-space/application-query';
|
|
33
|
+
import { ResolvedDataSpaceEntityWithOrigin } from '@finos/legend-extension-dsl-data-space/application';
|
|
34
|
+
import type { LegendQueryBareQueryBuilderState } from '../../stores/data-space/LegendQueryBareQueryBuilderState.js';
|
|
35
|
+
import type {
|
|
36
|
+
DataProductOption,
|
|
37
|
+
DataProductWithLegacyOption,
|
|
38
|
+
} from '../../stores/data-space/DataSpaceQueryCreatorStore.js';
|
|
39
|
+
import { flowResult } from 'mobx';
|
|
40
|
+
import { DepotEntityWithOrigin } from '@finos/legend-storage';
|
|
41
|
+
|
|
42
|
+
// Custom format function to handle both DataSpace and DataProduct options
|
|
43
|
+
const formatDataSpaceOrProductOptionLabel = (
|
|
44
|
+
option: DataProductWithLegacyOption,
|
|
45
|
+
): React.ReactNode => {
|
|
46
|
+
// If it's a DataSpace (ResolvedDataSpaceEntityWithOrigin), use the standard formatter
|
|
47
|
+
if (option.value instanceof ResolvedDataSpaceEntityWithOrigin) {
|
|
48
|
+
return formatDataSpaceOptionLabel(option as DataSpaceOption);
|
|
49
|
+
}
|
|
50
|
+
// For DataProduct (DepotEntityWithOrigin), render a simpler label
|
|
51
|
+
return (
|
|
52
|
+
<div
|
|
53
|
+
className="query-builder__setup__data-space__option"
|
|
54
|
+
title={`${option.label} - ${option.value.path} - ${
|
|
55
|
+
option.value.origin
|
|
56
|
+
? `${option.value.origin.groupId}:${option.value.origin.artifactId}:${option.value.origin.versionId}`
|
|
57
|
+
: ''
|
|
58
|
+
}`}
|
|
59
|
+
>
|
|
60
|
+
<div className="query-builder__setup__data-space__option__label">
|
|
61
|
+
{option.label}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
36
66
|
|
|
37
67
|
/**
|
|
38
68
|
* This setup panel supports cascading in order: Data-space -> Execution context (-> Runtime) -> Class
|
|
@@ -41,34 +71,42 @@ import {
|
|
|
41
71
|
* - For runtime selector: the list of compatible runtimes with the selected execution context mapping
|
|
42
72
|
* - For class selector: the list of compatible class with the selected execution context mapping
|
|
43
73
|
*
|
|
44
|
-
* See details on propagation/cascading in {@link
|
|
74
|
+
* See details on propagation/cascading in {@link LegendQueryBareQueryBuilderState}
|
|
45
75
|
*/
|
|
46
|
-
const
|
|
47
|
-
(props: { queryBuilderState:
|
|
76
|
+
const DataProductQuerySetupSetupPanelContent = observer(
|
|
77
|
+
(props: { queryBuilderState: LegendQueryBareQueryBuilderState }) => {
|
|
48
78
|
const { queryBuilderState } = props;
|
|
49
79
|
const applicationStore = useApplicationStore();
|
|
50
80
|
const dataSpaceSearchRef = useRef<SelectComponent>(null);
|
|
51
|
-
// data
|
|
52
|
-
const
|
|
53
|
-
.
|
|
54
|
-
|
|
81
|
+
// Combine data spaces and data products
|
|
82
|
+
const dataProductOptions =
|
|
83
|
+
queryBuilderState.productSelectorState.dataProductOptions.sort(
|
|
84
|
+
compareLabelFn,
|
|
85
|
+
);
|
|
55
86
|
const selectedDataSpaceOption = null;
|
|
56
|
-
const onDataSpaceOptionChange = (
|
|
87
|
+
const onDataSpaceOptionChange = (
|
|
88
|
+
option: DataSpaceOption | DataProductOption | null,
|
|
89
|
+
): void => {
|
|
57
90
|
queryBuilderState.queryChatState?.abort();
|
|
58
|
-
|
|
91
|
+
const value = option?.value;
|
|
92
|
+
if (value instanceof ResolvedDataSpaceEntityWithOrigin) {
|
|
93
|
+
queryBuilderState.changeHandlers.onDataSpaceChange(value);
|
|
94
|
+
} else if (value instanceof DepotEntityWithOrigin) {
|
|
95
|
+
queryBuilderState.changeHandlers.onDataProductChange(value);
|
|
96
|
+
}
|
|
59
97
|
};
|
|
60
98
|
|
|
61
99
|
const openDataSpaceAdvancedSearch = (): void =>
|
|
62
100
|
queryBuilderState.showAdvancedSearchPanel();
|
|
63
101
|
|
|
102
|
+
useEffect(() => dataSpaceSearchRef.current?.focus());
|
|
103
|
+
|
|
64
104
|
useEffect(() => {
|
|
65
|
-
flowResult(queryBuilderState.
|
|
105
|
+
flowResult(queryBuilderState.productSelectorState.loadProducts()).catch(
|
|
66
106
|
applicationStore.alertUnhandledError,
|
|
67
107
|
);
|
|
68
108
|
}, [queryBuilderState, applicationStore]);
|
|
69
109
|
|
|
70
|
-
useEffect(() => dataSpaceSearchRef.current?.focus());
|
|
71
|
-
|
|
72
110
|
return (
|
|
73
111
|
<div className="query-builder__setup__config-group">
|
|
74
112
|
<PanelHeader title="properties" />
|
|
@@ -85,8 +123,11 @@ const DataSpaceQuerySetupSetupPanelContent = observer(
|
|
|
85
123
|
inputId="query-builder__setup__data-space-selector"
|
|
86
124
|
inputRef={dataSpaceSearchRef}
|
|
87
125
|
className="panel__content__form__section__dropdown query-builder__setup__config-group__item__selector"
|
|
88
|
-
options={
|
|
89
|
-
isLoading={
|
|
126
|
+
options={dataProductOptions}
|
|
127
|
+
isLoading={
|
|
128
|
+
queryBuilderState.productSelectorState.loadProductsState
|
|
129
|
+
.isInProgress
|
|
130
|
+
}
|
|
90
131
|
onChange={onDataSpaceOptionChange}
|
|
91
132
|
value={selectedDataSpaceOption}
|
|
92
133
|
placeholder="Search for data product..."
|
|
@@ -95,7 +136,7 @@ const DataSpaceQuerySetupSetupPanelContent = observer(
|
|
|
95
136
|
!applicationStore.layoutService
|
|
96
137
|
.TEMPORARY__isLightColorThemeEnabled
|
|
97
138
|
}
|
|
98
|
-
formatOptionLabel={
|
|
139
|
+
formatOptionLabel={formatDataSpaceOrProductOptionLabel}
|
|
99
140
|
/>
|
|
100
141
|
<button
|
|
101
142
|
tabIndex={-1}
|
|
@@ -126,7 +167,9 @@ const DataSpaceQuerySetupSetupPanelContent = observer(
|
|
|
126
167
|
);
|
|
127
168
|
|
|
128
169
|
export const renderDataSpaceQuerySetupSetupPanelContent = (
|
|
129
|
-
queryBuilderState:
|
|
170
|
+
queryBuilderState: LegendQueryBareQueryBuilderState,
|
|
130
171
|
): React.ReactNode => (
|
|
131
|
-
<
|
|
172
|
+
<DataProductQuerySetupSetupPanelContent
|
|
173
|
+
queryBuilderState={queryBuilderState}
|
|
174
|
+
/>
|
|
132
175
|
);
|
package/src/index.ts
CHANGED
|
@@ -45,7 +45,7 @@ export {
|
|
|
45
45
|
createViewProjectHandler,
|
|
46
46
|
createViewSDLCProjectHandler,
|
|
47
47
|
} from './stores/data-space/DataSpaceQueryBuilderHelper.js';
|
|
48
|
-
export {
|
|
48
|
+
export { LegendQueryBareQueryBuilderState } from './stores/data-space/LegendQueryBareQueryBuilderState.js';
|
|
49
49
|
|
|
50
50
|
// components
|
|
51
51
|
export {
|