@finos/legend-extension-dsl-data-space 10.4.190 → 10.4.192
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/components/index.d.ts +2 -2
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +2 -2
- package/lib/components/index.js.map +1 -1
- package/lib/components/query-builder/DataSpaceAdvancedSearchModal.d.ts.map +1 -1
- package/lib/components/query-builder/DataSpaceAdvancedSearchModal.js.map +1 -1
- package/lib/components/query-builder/DataSpaceQueryBuilder.d.ts +4 -4
- package/lib/components/query-builder/DataSpaceQueryBuilder.d.ts.map +1 -1
- package/lib/components/query-builder/DataSpaceQueryBuilder.js +32 -57
- package/lib/components/query-builder/DataSpaceQueryBuilder.js.map +1 -1
- package/lib/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.d.ts.map +1 -1
- package/lib/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.js +3 -3
- package/lib/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.js.map +1 -1
- package/lib/components/query-builder/index.d.ts +1 -1
- package/lib/components/query-builder/index.d.ts.map +1 -1
- package/lib/components/query-builder/index.js +1 -1
- package/lib/components/query-builder/index.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts +6 -6
- package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -1
- package/lib/stores/query/DataSpaceAdvancedSearchState.js +4 -3
- package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -1
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.d.ts +27 -43
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.d.ts.map +1 -1
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.js +79 -152
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.js.map +1 -1
- package/lib/stores/shared/DataSpaceInfo.d.ts +5 -8
- package/lib/stores/shared/DataSpaceInfo.d.ts.map +1 -1
- package/lib/stores/shared/DataSpaceInfo.js +24 -13
- package/lib/stores/shared/DataSpaceInfo.js.map +1 -1
- package/package.json +10 -10
- package/src/components/index.ts +2 -7
- package/src/components/query-builder/DataSpaceAdvancedSearchModal.tsx +8 -3
- package/src/components/query-builder/DataSpaceQueryBuilder.tsx +49 -102
- package/src/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.tsx +3 -5
- package/src/components/query-builder/index.ts +0 -1
- package/src/stores/query/DataSpaceAdvancedSearchState.ts +14 -9
- package/src/stores/query-builder/DataSpaceQueryBuilderState.ts +142 -272
- package/src/stores/shared/DataSpaceInfo.ts +38 -25
|
@@ -36,12 +36,12 @@ import { useApplicationStore } from '@finos/legend-application';
|
|
|
36
36
|
import {
|
|
37
37
|
type DataSpaceQueryBuilderState,
|
|
38
38
|
resolveUsableDataSpaceClasses,
|
|
39
|
-
DataSpacesDepotRepository,
|
|
40
39
|
} from '../../stores/query-builder/DataSpaceQueryBuilderState.js';
|
|
41
40
|
import {
|
|
42
41
|
buildRuntimeValueOption,
|
|
43
42
|
getRuntimeOptionFormatter,
|
|
44
43
|
QueryBuilderClassSelector,
|
|
44
|
+
type EntityWithOriginOption,
|
|
45
45
|
} from '@finos/legend-query-builder';
|
|
46
46
|
import {
|
|
47
47
|
type Runtime,
|
|
@@ -50,36 +50,33 @@ import {
|
|
|
50
50
|
PackageableElementExplicitReference,
|
|
51
51
|
RuntimePointer,
|
|
52
52
|
} from '@finos/legend-graph';
|
|
53
|
-
import
|
|
54
|
-
import {
|
|
53
|
+
import { ResolvedDataSpaceEntityWithOrigin } from '../../stores/shared/DataSpaceInfo.js';
|
|
54
|
+
import {
|
|
55
|
+
DepotEntityWithOrigin,
|
|
56
|
+
generateGAVCoordinates,
|
|
57
|
+
} from '@finos/legend-storage';
|
|
55
58
|
import { useEffect } from 'react';
|
|
56
59
|
import { guaranteeNonNullable, guaranteeType } from '@finos/legend-shared';
|
|
57
60
|
import { flowResult } from 'mobx';
|
|
58
61
|
import { type DataSpaceExecutionContext } from '../../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
|
|
59
62
|
import { DataSpaceAdvancedSearchModal } from './DataSpaceAdvancedSearchModal.js';
|
|
60
|
-
import { generateDataSpaceQueryCreatorRoute } from '../../__lib__/to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.js';
|
|
61
63
|
|
|
62
64
|
export type DataSpaceOption = {
|
|
63
65
|
label: string;
|
|
64
|
-
value:
|
|
66
|
+
value: ResolvedDataSpaceEntityWithOrigin;
|
|
65
67
|
};
|
|
66
|
-
|
|
67
|
-
value: DataSpaceInfo,
|
|
68
|
-
): DataSpaceOption => ({
|
|
69
|
-
label: value.title ?? value.name,
|
|
70
|
-
value,
|
|
71
|
-
});
|
|
68
|
+
|
|
72
69
|
export const formatDataSpaceOptionLabel = (
|
|
73
|
-
option:
|
|
70
|
+
option: EntityWithOriginOption,
|
|
74
71
|
): React.ReactNode => (
|
|
75
72
|
<div
|
|
76
73
|
className="query-builder__setup__data-space__option"
|
|
77
74
|
title={`${option.label} - ${option.value.path} - ${
|
|
78
|
-
option.value.
|
|
75
|
+
option.value.origin
|
|
79
76
|
? generateGAVCoordinates(
|
|
80
|
-
option.value.groupId,
|
|
81
|
-
option.value.artifactId,
|
|
82
|
-
option.value.versionId,
|
|
77
|
+
option.value.origin.groupId,
|
|
78
|
+
option.value.origin.artifactId,
|
|
79
|
+
option.value.origin.versionId,
|
|
83
80
|
)
|
|
84
81
|
: ''
|
|
85
82
|
}`}
|
|
@@ -134,53 +131,37 @@ const DataSpaceQueryBuilderSetupPanelContent = observer(
|
|
|
134
131
|
(props: { queryBuilderState: DataSpaceQueryBuilderState }) => {
|
|
135
132
|
const { queryBuilderState } = props;
|
|
136
133
|
const applicationStore = useApplicationStore();
|
|
137
|
-
const repo = queryBuilderState.dataSpaceRepo;
|
|
138
|
-
const depotRepo =
|
|
139
|
-
repo instanceof DataSpacesDepotRepository ? repo : undefined;
|
|
140
|
-
const project = depotRepo?.project;
|
|
141
134
|
|
|
142
135
|
// data product
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const dataSpaceOptions = prioritizeDataSpaceFunc
|
|
150
|
-
? [
|
|
151
|
-
...sortedAllOptions.filter((val) =>
|
|
152
|
-
prioritizeDataSpaceFunc(val.value),
|
|
153
|
-
),
|
|
154
|
-
...sortedAllOptions.filter(
|
|
155
|
-
(val) => !prioritizeDataSpaceFunc(val.value),
|
|
156
|
-
),
|
|
157
|
-
]
|
|
158
|
-
: sortedAllOptions;
|
|
136
|
+
const dataSpaceOptions = queryBuilderState.dataSpaceOptions;
|
|
137
|
+
const allOptions = [
|
|
138
|
+
...dataSpaceOptions,
|
|
139
|
+
...(queryBuilderState.extraOptionsConfig?.options ?? []),
|
|
140
|
+
];
|
|
159
141
|
|
|
160
|
-
const selectedDataSpaceOption:
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
.catch(queryBuilderState.applicationStore.alertUnhandledError);
|
|
142
|
+
const selectedDataSpaceOption: EntityWithOriginOption =
|
|
143
|
+
queryBuilderState.selectedDataSpaceOption;
|
|
144
|
+
const onDataSpaceOptionChange = (
|
|
145
|
+
option: EntityWithOriginOption | null,
|
|
146
|
+
): void => {
|
|
147
|
+
const value = option?.value;
|
|
148
|
+
if (value instanceof ResolvedDataSpaceEntityWithOrigin) {
|
|
149
|
+
queryBuilderState.queryChatState?.abort();
|
|
150
|
+
queryBuilderState
|
|
151
|
+
.onDataSpaceChange(value)
|
|
152
|
+
.catch(queryBuilderState.applicationStore.alertUnhandledError);
|
|
153
|
+
} else if (
|
|
154
|
+
value instanceof DepotEntityWithOrigin &&
|
|
155
|
+
queryBuilderState.extraOptionsConfig
|
|
156
|
+
) {
|
|
157
|
+
queryBuilderState.queryChatState?.abort();
|
|
158
|
+
queryBuilderState.extraOptionsConfig.onChange(value);
|
|
159
|
+
}
|
|
179
160
|
};
|
|
180
161
|
|
|
181
162
|
const openDataSpaceAdvancedSearch = (): void => {
|
|
182
|
-
if (
|
|
183
|
-
|
|
163
|
+
if (queryBuilderState.isAdvancedDataSpaceSearchEnabled) {
|
|
164
|
+
queryBuilderState.showAdvancedSearchPanel(queryBuilderState.dataSpace);
|
|
184
165
|
}
|
|
185
166
|
};
|
|
186
167
|
|
|
@@ -255,48 +236,15 @@ const DataSpaceQueryBuilderSetupPanelContent = observer(
|
|
|
255
236
|
);
|
|
256
237
|
|
|
257
238
|
useEffect(() => {
|
|
258
|
-
flowResult(queryBuilderState.
|
|
239
|
+
flowResult(queryBuilderState.loadEntities()).catch(
|
|
259
240
|
applicationStore.alertUnhandledError,
|
|
260
241
|
);
|
|
261
242
|
}, [queryBuilderState, applicationStore]);
|
|
262
243
|
|
|
263
244
|
const copyDataSpaceLinkToClipboard = (): void => {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
);
|
|
268
|
-
const dataSpace = queryBuilderState.dataSpace;
|
|
269
|
-
const executionContext = queryBuilderState.executionContext;
|
|
270
|
-
const runtimePath =
|
|
271
|
-
queryBuilderState.executionContextState.runtimeValue instanceof
|
|
272
|
-
RuntimePointer
|
|
273
|
-
? queryBuilderState.executionContextState.runtimeValue
|
|
274
|
-
.packageableRuntime.value.path
|
|
275
|
-
: undefined;
|
|
276
|
-
const route =
|
|
277
|
-
applicationStore.navigationService.navigator.generateAddress(
|
|
278
|
-
generateDataSpaceQueryCreatorRoute(
|
|
279
|
-
nonNullableProject.groupId,
|
|
280
|
-
nonNullableProject.artifactId,
|
|
281
|
-
nonNullableProject.versionId,
|
|
282
|
-
dataSpace.path,
|
|
283
|
-
executionContext.name,
|
|
284
|
-
runtimePath,
|
|
285
|
-
queryBuilderState.class?.path,
|
|
286
|
-
),
|
|
287
|
-
);
|
|
288
|
-
|
|
289
|
-
navigator.clipboard
|
|
290
|
-
.writeText(route)
|
|
291
|
-
.catch(() =>
|
|
292
|
-
applicationStore.notificationService.notifyError(
|
|
293
|
-
'Error copying data product query set up link to clipboard',
|
|
294
|
-
),
|
|
295
|
-
);
|
|
296
|
-
|
|
297
|
-
applicationStore.notificationService.notifySuccess(
|
|
298
|
-
'Copied data product query set up link to clipboard',
|
|
299
|
-
);
|
|
245
|
+
if (queryBuilderState.isDataSpaceLinkable) {
|
|
246
|
+
queryBuilderState.copyDataSpaceLinkToClipboard();
|
|
247
|
+
}
|
|
300
248
|
};
|
|
301
249
|
|
|
302
250
|
return (
|
|
@@ -306,6 +254,7 @@ const DataSpaceQueryBuilderSetupPanelContent = observer(
|
|
|
306
254
|
<PanelHeaderActionItem
|
|
307
255
|
title="copy data product query set up link to clipboard"
|
|
308
256
|
onClick={copyDataSpaceLinkToClipboard}
|
|
257
|
+
disabled={!queryBuilderState.isDataSpaceLinkable}
|
|
309
258
|
>
|
|
310
259
|
<AnchorLinkIcon />
|
|
311
260
|
</PanelHeaderActionItem>
|
|
@@ -353,10 +302,8 @@ const DataSpaceQueryBuilderSetupPanelContent = observer(
|
|
|
353
302
|
<CustomSelectorInput
|
|
354
303
|
inputId="query-builder__setup__data-space-selector"
|
|
355
304
|
className="panel__content__form__section__dropdown query-builder__setup__config-group__item__selector"
|
|
356
|
-
options={
|
|
357
|
-
isLoading={
|
|
358
|
-
queryBuilderState.dataSpaceRepo.loadDataSpacesState.isInProgress
|
|
359
|
-
}
|
|
305
|
+
options={allOptions}
|
|
306
|
+
isLoading={queryBuilderState.loadEntitiesState.isInProgress}
|
|
360
307
|
onChange={onDataSpaceOptionChange}
|
|
361
308
|
value={selectedDataSpaceOption}
|
|
362
309
|
placeholder="Search for data product..."
|
|
@@ -367,7 +314,7 @@ const DataSpaceQueryBuilderSetupPanelContent = observer(
|
|
|
367
314
|
}
|
|
368
315
|
formatOptionLabel={formatDataSpaceOptionLabel}
|
|
369
316
|
/>
|
|
370
|
-
{
|
|
317
|
+
{queryBuilderState.isAdvancedDataSpaceSearchEnabled && (
|
|
371
318
|
<>
|
|
372
319
|
<button
|
|
373
320
|
tabIndex={-1}
|
|
@@ -377,10 +324,10 @@ const DataSpaceQueryBuilderSetupPanelContent = observer(
|
|
|
377
324
|
>
|
|
378
325
|
<SearchIcon />
|
|
379
326
|
</button>
|
|
380
|
-
{
|
|
327
|
+
{queryBuilderState.advancedSearchState && (
|
|
381
328
|
<DataSpaceAdvancedSearchModal
|
|
382
|
-
searchState={
|
|
383
|
-
onClose={() =>
|
|
329
|
+
searchState={queryBuilderState.advancedSearchState}
|
|
330
|
+
onClose={() => queryBuilderState.hideAdvancedSearchPanel()}
|
|
384
331
|
/>
|
|
385
332
|
)}
|
|
386
333
|
</>
|
|
@@ -111,8 +111,8 @@ const DataSpaceTemplateQueryDialog = observer(
|
|
|
111
111
|
const visitTemplateQuery = (
|
|
112
112
|
template: DataSpaceExecutableAnalysisResult,
|
|
113
113
|
): void => {
|
|
114
|
-
if (queryBuilderState.
|
|
115
|
-
queryBuilderState.
|
|
114
|
+
if (queryBuilderState.canVisitTemplateQuery) {
|
|
115
|
+
queryBuilderState.visitTemplateQuery(
|
|
116
116
|
queryBuilderState.dataSpace,
|
|
117
117
|
template,
|
|
118
118
|
);
|
|
@@ -179,9 +179,7 @@ const DataSpaceTemplateQueryDialog = observer(
|
|
|
179
179
|
<button
|
|
180
180
|
className="query-builder__data-space__template-query-panel__query__share"
|
|
181
181
|
title="Visit..."
|
|
182
|
-
disabled={
|
|
183
|
-
!queryBuilderState.dataSpaceRepo.canVisitTemplateQuery
|
|
184
|
-
}
|
|
182
|
+
disabled={!queryBuilderState.canVisitTemplateQuery}
|
|
185
183
|
onClick={() => visitTemplateQuery(query)}
|
|
186
184
|
>
|
|
187
185
|
<ShareIcon />
|
|
@@ -18,7 +18,6 @@ export {
|
|
|
18
18
|
type DataSpaceOption,
|
|
19
19
|
type ExecutionContextOption,
|
|
20
20
|
buildExecutionContextOption,
|
|
21
|
-
buildDataSpaceOption,
|
|
22
21
|
formatDataSpaceOptionLabel,
|
|
23
22
|
} from './DataSpaceQueryBuilder.js';
|
|
24
23
|
export { DataSpaceAdvancedSearchModal } from './DataSpaceAdvancedSearchModal.js';
|
|
@@ -40,7 +40,7 @@ import { DSL_DataSpace_getGraphManagerExtension } from '../../graph-manager/prot
|
|
|
40
40
|
import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '../../graph-manager/protocol/pure/DSL_DataSpace_PureProtocolProcessorPlugin.js';
|
|
41
41
|
import { DataSpaceViewerState } from '../DataSpaceViewerState.js';
|
|
42
42
|
import {
|
|
43
|
-
type
|
|
43
|
+
type ResolvedDataSpaceEntityWithOrigin,
|
|
44
44
|
extractDataSpaceInfo,
|
|
45
45
|
} from '../shared/DataSpaceInfo.js';
|
|
46
46
|
import {
|
|
@@ -70,10 +70,10 @@ export class DataSpaceAdvancedSearchState {
|
|
|
70
70
|
entityPath: string | undefined,
|
|
71
71
|
) => Promise<void>;
|
|
72
72
|
|
|
73
|
-
dataSpaces:
|
|
73
|
+
dataSpaces: ResolvedDataSpaceEntityWithOrigin[] = [];
|
|
74
74
|
readonly loadDataSpacesState = ActionState.create();
|
|
75
75
|
readonly loadDataSpaceState = ActionState.create();
|
|
76
|
-
currentDataSpace?:
|
|
76
|
+
currentDataSpace?: ResolvedDataSpaceEntityWithOrigin | undefined;
|
|
77
77
|
dataSpaceViewerState?: DataSpaceViewerState | undefined;
|
|
78
78
|
toGetSnapShot = false;
|
|
79
79
|
|
|
@@ -94,7 +94,7 @@ export class DataSpaceAdvancedSearchState {
|
|
|
94
94
|
entityPath: string | undefined,
|
|
95
95
|
) => Promise<void>;
|
|
96
96
|
},
|
|
97
|
-
currentDataSpace?:
|
|
97
|
+
currentDataSpace?: ResolvedDataSpaceEntityWithOrigin | undefined,
|
|
98
98
|
toGetSnapshot?: boolean | undefined,
|
|
99
99
|
) {
|
|
100
100
|
makeObservable(this, {
|
|
@@ -121,7 +121,9 @@ export class DataSpaceAdvancedSearchState {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
setCurrentDataSpace(
|
|
124
|
+
setCurrentDataSpace(
|
|
125
|
+
val: ResolvedDataSpaceEntityWithOrigin | undefined,
|
|
126
|
+
): void {
|
|
125
127
|
this.currentDataSpace = val;
|
|
126
128
|
}
|
|
127
129
|
|
|
@@ -160,13 +162,16 @@ export class DataSpaceAdvancedSearchState {
|
|
|
160
162
|
}
|
|
161
163
|
}
|
|
162
164
|
|
|
163
|
-
*loadDataSpace(
|
|
165
|
+
*loadDataSpace(
|
|
166
|
+
dataSpace: ResolvedDataSpaceEntityWithOrigin,
|
|
167
|
+
): GeneratorFn<void> {
|
|
164
168
|
this.loadDataSpaceState.inProgress();
|
|
165
169
|
this.loadDataSpaceState.setMessage(`Initializing...`);
|
|
166
170
|
try {
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
const
|
|
171
|
+
const origin = guaranteeNonNullable(dataSpace.origin);
|
|
172
|
+
const groupId = origin.groupId;
|
|
173
|
+
const artifactId = origin.artifactId;
|
|
174
|
+
const versionId = origin.versionId;
|
|
170
175
|
// fetch project
|
|
171
176
|
this.loadDataSpaceState.setMessage(`Fetching project...`);
|
|
172
177
|
const project = StoreProjectData.serialization.fromJson(
|