@finos/legend-application-query 13.5.56 → 13.6.1
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/__lib__/LegendQueryNavigation.d.ts +1 -0
- package/lib/__lib__/LegendQueryNavigation.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryNavigation.js +1 -0
- package/lib/__lib__/LegendQueryNavigation.js.map +1 -1
- package/lib/components/CloneQueryServiceSetup.d.ts.map +1 -1
- package/lib/components/CloneQueryServiceSetup.js +6 -2
- package/lib/components/CloneQueryServiceSetup.js.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.js +4 -4
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/CreateMappingQuerySetup.d.ts.map +1 -1
- package/lib/components/CreateMappingQuerySetup.js +6 -2
- package/lib/components/CreateMappingQuerySetup.js.map +1 -1
- package/lib/components/LegendQueryWebApplication.d.ts.map +1 -1
- package/lib/components/LegendQueryWebApplication.js +5 -30
- package/lib/components/LegendQueryWebApplication.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +8 -8
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/QueryEdtiorExistingQueryVersionRevertModal.d.ts.map +1 -1
- package/lib/components/QueryEdtiorExistingQueryVersionRevertModal.js +1 -1
- package/lib/components/QueryEdtiorExistingQueryVersionRevertModal.js.map +1 -1
- package/lib/components/UpdateExistingServiceQuerySetup.js +1 -1
- package/lib/components/UpdateExistingServiceQuerySetup.js.map +1 -1
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts.map +1 -1
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js +3 -1
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js.map +1 -1
- package/lib/components/data-cube/ExistingQueryDataCubeViewer.d.ts +22 -0
- package/lib/components/data-cube/ExistingQueryDataCubeViewer.d.ts.map +1 -0
- package/lib/components/data-cube/ExistingQueryDataCubeViewer.js +44 -0
- package/lib/components/data-cube/ExistingQueryDataCubeViewer.js.map +1 -0
- package/lib/components/data-cube/ExistingQueryEditorStoreProviderProvider.d.ts +23 -0
- package/lib/components/data-cube/ExistingQueryEditorStoreProviderProvider.d.ts.map +1 -0
- package/lib/components/data-cube/ExistingQueryEditorStoreProviderProvider.js +30 -0
- package/lib/components/data-cube/ExistingQueryEditorStoreProviderProvider.js.map +1 -0
- package/lib/components/data-space/DataSpaceQueryCreator.d.ts.map +1 -1
- package/lib/components/data-space/DataSpaceQueryCreator.js +3 -3
- package/lib/components/data-space/DataSpaceQueryCreator.js.map +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.js +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.js.map +1 -1
- package/lib/components/data-space/DataSpaceTemplateQueryCreator.d.ts.map +1 -1
- package/lib/components/data-space/DataSpaceTemplateQueryCreator.js +4 -3
- package/lib/components/data-space/DataSpaceTemplateQueryCreator.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +6 -5
- package/lib/stores/data-cube/ExistingQueryDataCubeViewer.d.ts +30 -0
- package/lib/stores/data-cube/ExistingQueryDataCubeViewer.d.ts.map +1 -0
- package/lib/stores/data-cube/ExistingQueryDataCubeViewer.js +59 -0
- package/lib/stores/data-cube/ExistingQueryDataCubeViewer.js.map +1 -0
- package/package.json +17 -16
- package/src/__lib__/LegendQueryNavigation.ts +1 -0
- package/src/components/CloneQueryServiceSetup.tsx +10 -2
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +4 -4
- package/src/components/CreateMappingQuerySetup.tsx +10 -2
- package/src/components/LegendQueryWebApplication.tsx +35 -80
- package/src/components/QueryEditor.tsx +24 -10
- package/src/components/QueryEdtiorExistingQueryVersionRevertModal.tsx +1 -3
- package/src/components/UpdateExistingServiceQuerySetup.tsx +1 -1
- package/src/components/__test-utils__/QueryEditorComponentTestUtils.tsx +14 -2
- package/src/components/data-cube/ExistingQueryDataCubeViewer.tsx +67 -0
- package/src/components/data-cube/ExistingQueryEditorStoreProviderProvider.tsx +56 -0
- package/src/components/data-space/DataSpaceQueryCreator.tsx +4 -6
- package/src/components/data-space/DataSpaceQuerySetup.tsx +1 -1
- package/src/components/data-space/DataSpaceTemplateQueryCreator.tsx +10 -6
- package/src/stores/data-cube/ExistingQueryDataCubeViewer.ts +98 -0
- package/tsconfig.json +3 -0
@@ -279,7 +279,11 @@ const CreateMappingQuerySetupContent = observer(() => {
|
|
279
279
|
!projectOptions.length
|
280
280
|
}
|
281
281
|
isLoading={setupStore.loadProjectsState.isInProgress}
|
282
|
-
onChange={
|
282
|
+
onChange={(option: ProjectOption | null) => {
|
283
|
+
onProjectOptionChange(option).catch(
|
284
|
+
applicationStore.alertUnhandledError,
|
285
|
+
);
|
286
|
+
}}
|
283
287
|
value={selectedProjectOption}
|
284
288
|
placeholder={projectSelectorPlaceholder}
|
285
289
|
isClearable={true}
|
@@ -297,7 +301,11 @@ const CreateMappingQuerySetupContent = observer(() => {
|
|
297
301
|
options={versionOptions}
|
298
302
|
disabled={!setupStore.currentProject}
|
299
303
|
isLoading={fetchSelectedProjectVersionsStatus.isInProgress}
|
300
|
-
onChange={
|
304
|
+
onChange={(option: VersionOption | null) => {
|
305
|
+
onVersionOptionChange(option).catch(
|
306
|
+
applicationStore.alertUnhandledError,
|
307
|
+
);
|
308
|
+
}}
|
301
309
|
value={selectedVersionOption}
|
302
310
|
placeholder={
|
303
311
|
fetchSelectedProjectVersionsStatus.isInProgress
|
@@ -25,9 +25,8 @@ import {
|
|
25
25
|
import {
|
26
26
|
BrowserEnvironmentProvider,
|
27
27
|
Route,
|
28
|
-
|
28
|
+
Routes,
|
29
29
|
generateExtensionUrlPattern,
|
30
|
-
type TEMPORARY__ReactRouterComponentType,
|
31
30
|
} from '@finos/legend-application/browser';
|
32
31
|
import {
|
33
32
|
LegendQueryFrameworkProvider,
|
@@ -41,6 +40,7 @@ import { flowResult } from 'mobx';
|
|
41
40
|
import { LEGACY_DATA_SPACE_QUERY_ROUTE_PATTERN } from '../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
|
42
41
|
import { DataSpaceTemplateQueryCreator } from './data-space/DataSpaceTemplateQueryCreator.js';
|
43
42
|
import { DataSpaceQueryCreator } from './data-space/DataSpaceQueryCreator.js';
|
43
|
+
import { ExistingQueryDataCubeViewer } from './data-cube/ExistingQueryDataCubeViewer.js';
|
44
44
|
|
45
45
|
const LegendQueryWebApplicationRouter = observer(() => {
|
46
46
|
const applicationStore = useLegendQueryApplicationStore();
|
@@ -58,117 +58,72 @@ const LegendQueryWebApplicationRouter = observer(() => {
|
|
58
58
|
return (
|
59
59
|
<div className="app">
|
60
60
|
{baseStore.initState.hasCompleted && (
|
61
|
-
<
|
61
|
+
<Routes>
|
62
62
|
<Route
|
63
|
-
exact={true}
|
64
63
|
path={LEGEND_QUERY_ROUTE_PATTERN.DEFAULT}
|
65
|
-
|
66
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
67
|
-
DataSpaceQueryCreator as TEMPORARY__ReactRouterComponentType
|
68
|
-
}
|
64
|
+
element={<DataSpaceQueryCreator />}
|
69
65
|
/>
|
70
66
|
<Route
|
71
|
-
exact={true}
|
72
67
|
path={LEGEND_QUERY_ROUTE_PATTERN.EDIT_EXISTING_QUERY_SETUP}
|
73
|
-
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
75
|
-
EditExistingQuerySetup as TEMPORARY__ReactRouterComponentType
|
76
|
-
}
|
68
|
+
element={<EditExistingQuerySetup />}
|
77
69
|
/>
|
78
70
|
|
79
71
|
<Route
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
),
|
85
|
-
]}
|
86
|
-
component={
|
87
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
88
|
-
DataSpaceTemplateQueryCreator as TEMPORARY__ReactRouterComponentType
|
89
|
-
}
|
72
|
+
path={generateExtensionUrlPattern(
|
73
|
+
LEGACY_DATA_SPACE_QUERY_ROUTE_PATTERN.TEMPLATE_QUERY,
|
74
|
+
)}
|
75
|
+
element={<DataSpaceTemplateQueryCreator />}
|
90
76
|
/>
|
91
77
|
|
92
78
|
<Route
|
93
|
-
exact={true}
|
94
79
|
path={LEGEND_QUERY_ROUTE_PATTERN.SETUP}
|
95
|
-
|
96
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
97
|
-
QuerySetupLandingPage as TEMPORARY__ReactRouterComponentType
|
98
|
-
}
|
80
|
+
element={<QuerySetupLandingPage />}
|
99
81
|
/>
|
100
82
|
|
101
83
|
<Route
|
102
|
-
exact={true}
|
103
84
|
path={LEGEND_QUERY_ROUTE_PATTERN.CREATE_MAPPING_QUERY_SETUP}
|
104
|
-
|
105
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
106
|
-
CreateMappingQuerySetup as TEMPORARY__ReactRouterComponentType
|
107
|
-
}
|
85
|
+
element={<CreateMappingQuerySetup />}
|
108
86
|
/>
|
109
87
|
<Route
|
110
|
-
exact={true}
|
111
88
|
path={LEGEND_QUERY_ROUTE_PATTERN.EDIT_EXISTING_QUERY}
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
}
|
89
|
+
element={<ExistingQueryEditor />}
|
90
|
+
/>
|
91
|
+
<Route
|
92
|
+
path={LEGEND_QUERY_ROUTE_PATTERN.DATA_CUBE_EXISTING_QUERY}
|
93
|
+
element={<ExistingQueryDataCubeViewer />}
|
116
94
|
/>
|
117
95
|
<Route
|
118
|
-
exact={true}
|
119
96
|
path={LEGEND_QUERY_ROUTE_PATTERN.CREATE_FROM_SERVICE_QUERY}
|
120
|
-
|
121
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
122
|
-
ServiceQueryCreator as TEMPORARY__ReactRouterComponentType
|
123
|
-
}
|
97
|
+
element={<ServiceQueryCreator />}
|
124
98
|
/>
|
125
99
|
<Route
|
126
|
-
exact={true}
|
127
100
|
path={LEGEND_QUERY_ROUTE_PATTERN.CREATE_FROM_MAPPING_QUERY}
|
128
|
-
|
129
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
130
|
-
MappingQueryCreator as TEMPORARY__ReactRouterComponentType
|
131
|
-
}
|
101
|
+
element={<MappingQueryCreator />}
|
132
102
|
/>
|
103
|
+
|
133
104
|
{/* LEGACY DATA SPACE */}
|
134
105
|
<Route
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
),
|
140
|
-
]}
|
141
|
-
component={
|
142
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
143
|
-
DataSpaceQueryCreator as TEMPORARY__ReactRouterComponentType
|
144
|
-
}
|
106
|
+
path={generateExtensionUrlPattern(
|
107
|
+
LEGACY_DATA_SPACE_QUERY_ROUTE_PATTERN.SETUP,
|
108
|
+
)}
|
109
|
+
element={<DataSpaceQueryCreator />}
|
145
110
|
/>
|
146
111
|
|
147
112
|
<Route
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
),
|
153
|
-
]}
|
154
|
-
component={
|
155
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
156
|
-
DataSpaceQueryCreator as TEMPORARY__ReactRouterComponentType
|
157
|
-
}
|
113
|
+
path={generateExtensionUrlPattern(
|
114
|
+
LEGACY_DATA_SPACE_QUERY_ROUTE_PATTERN.CREATE,
|
115
|
+
)}
|
116
|
+
element={<DataSpaceQueryCreator />}
|
158
117
|
/>
|
159
118
|
|
160
|
-
{extraApplicationPageEntries.
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
}
|
169
|
-
/>
|
170
|
-
))}
|
171
|
-
</Switch>
|
119
|
+
{extraApplicationPageEntries.flatMap((entry) =>
|
120
|
+
entry.addressPatterns
|
121
|
+
.map(generateExtensionUrlPattern)
|
122
|
+
.map((path) => (
|
123
|
+
<Route key={entry.key} path={path} element={entry.renderer()} />
|
124
|
+
)),
|
125
|
+
)}
|
126
|
+
</Routes>
|
172
127
|
)}
|
173
128
|
</div>
|
174
129
|
);
|
@@ -89,7 +89,11 @@ import {
|
|
89
89
|
import { LATEST_VERSION_ALIAS } from '@finos/legend-server-depot';
|
90
90
|
import { buildVersionOption, type VersionOption } from './QuerySetup.js';
|
91
91
|
import { QueryEditorExistingQueryVersionRevertModal } from './QueryEdtiorExistingQueryVersionRevertModal.js';
|
92
|
-
import {
|
92
|
+
import {
|
93
|
+
debounce,
|
94
|
+
compareSemVerVersions,
|
95
|
+
guaranteeNonNullable,
|
96
|
+
} from '@finos/legend-shared';
|
93
97
|
import { LegendQueryInfo } from './LegendQueryAppInfo.js';
|
94
98
|
import { QueryEditorDataspaceInfoModal } from './data-space/DataSpaceInfo.js';
|
95
99
|
import { DataSpaceQueryBuilderState } from '@finos/legend-extension-dsl-data-space/application';
|
@@ -422,9 +426,7 @@ const QueryEditorExistingQueryInfoModal = observer(
|
|
422
426
|
const selectedVersionOption = updateState.queryVersionId
|
423
427
|
? buildVersionOption(updateState.queryVersionId)
|
424
428
|
: buildVersionOption(query.versionId);
|
425
|
-
const onVersionOptionChange =
|
426
|
-
option: VersionOption | null,
|
427
|
-
): Promise<void> => {
|
429
|
+
const onVersionOptionChange = (option: VersionOption | null) => {
|
428
430
|
if (option?.value && option.value !== updateState.queryVersionId) {
|
429
431
|
updateState.setQueryVersionId(option.value);
|
430
432
|
}
|
@@ -816,7 +818,9 @@ const processQueryParams = (
|
|
816
818
|
export const ExistingQueryEditor = observer(() => {
|
817
819
|
const applicationStore = useApplicationStore();
|
818
820
|
const params = useParams<ExistingQueryEditorPathParams>();
|
819
|
-
const queryId =
|
821
|
+
const queryId = guaranteeNonNullable(
|
822
|
+
params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.QUERY_ID],
|
823
|
+
);
|
820
824
|
const queryParams =
|
821
825
|
applicationStore.navigationService.navigator.getCurrentLocationParameters();
|
822
826
|
const processed = processQueryParams(queryParams);
|
@@ -839,8 +843,12 @@ export const ExistingQueryEditor = observer(() => {
|
|
839
843
|
export const ServiceQueryCreator = observer(() => {
|
840
844
|
const applicationStore = useApplicationStore();
|
841
845
|
const parameters = useParams<ServiceQueryCreatorPathParams>();
|
842
|
-
const gav =
|
843
|
-
|
846
|
+
const gav = guaranteeNonNullable(
|
847
|
+
parameters[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.GAV],
|
848
|
+
);
|
849
|
+
const servicePath = guaranteeNonNullable(
|
850
|
+
parameters[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.SERVICE_PATH],
|
851
|
+
);
|
844
852
|
const executionKey =
|
845
853
|
applicationStore.navigationService.navigator.getCurrentLocationParameterValue(
|
846
854
|
LEGEND_QUERY_QUERY_PARAM_TOKEN.SERVICE_EXECUTION_KEY,
|
@@ -859,9 +867,15 @@ export const ServiceQueryCreator = observer(() => {
|
|
859
867
|
|
860
868
|
export const MappingQueryCreator = observer(() => {
|
861
869
|
const params = useParams<MappingQueryCreatorPathParams>();
|
862
|
-
const gav =
|
863
|
-
|
864
|
-
|
870
|
+
const gav = guaranteeNonNullable(
|
871
|
+
params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.GAV],
|
872
|
+
);
|
873
|
+
const mappingPath = guaranteeNonNullable(
|
874
|
+
params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.MAPPING_PATH],
|
875
|
+
);
|
876
|
+
const runtimePath = guaranteeNonNullable(
|
877
|
+
params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.RUNTIME_PATH],
|
878
|
+
);
|
865
879
|
|
866
880
|
return (
|
867
881
|
<MappingQueryCreatorStoreProvider
|
@@ -49,9 +49,7 @@ export const QueryEditorExistingQueryVersionRevertModal = observer(
|
|
49
49
|
const selectedVersionOption = queryVersion
|
50
50
|
? buildVersionOption(queryVersion)
|
51
51
|
: null;
|
52
|
-
const onVersionOptionChange =
|
53
|
-
option: VersionOption | null,
|
54
|
-
): Promise<void> => {
|
52
|
+
const onVersionOptionChange = (option: VersionOption | null) => {
|
55
53
|
if (option?.value && option.value !== queryVersion) {
|
56
54
|
setQueryVersion(option.value);
|
57
55
|
}
|
@@ -131,7 +131,7 @@ const UpdateExistingServiceQuerySetupContent = observer(() => {
|
|
131
131
|
<SearchIcon />
|
132
132
|
</div>
|
133
133
|
<CustomSelectorInput
|
134
|
-
|
134
|
+
inputRef={serviceSearchRef}
|
135
135
|
className="query-setup__wizard__selector"
|
136
136
|
options={serviceOptions}
|
137
137
|
isLoading={setupStore.loadServicesState.isInProgress}
|
@@ -44,6 +44,11 @@ import {
|
|
44
44
|
import { LegendQueryFrameworkProvider } from '../LegendQueryFrameworkProvider.js';
|
45
45
|
import { TEST__BrowserEnvironmentProvider } from '@finos/legend-application/test';
|
46
46
|
import { Core_LegendQueryApplicationPlugin } from '../Core_LegendQueryApplicationPlugin.js';
|
47
|
+
import { Route, Routes } from '@finos/legend-application/browser';
|
48
|
+
import {
|
49
|
+
generateExistingQueryEditorRoute,
|
50
|
+
LEGEND_QUERY_ROUTE_PATTERN,
|
51
|
+
} from '../../__lib__/LegendQueryNavigation.js';
|
47
52
|
|
48
53
|
const TEST_QUERY_ID = 'test-query-id';
|
49
54
|
export const TEST_QUERY_NAME = 'MyTestQuery';
|
@@ -170,9 +175,16 @@ export const TEST__setUpQueryEditor = async (
|
|
170
175
|
|
171
176
|
const renderResult = render(
|
172
177
|
<ApplicationStoreProvider store={MOCK__editorStore.applicationStore}>
|
173
|
-
<TEST__BrowserEnvironmentProvider
|
178
|
+
<TEST__BrowserEnvironmentProvider
|
179
|
+
initialEntries={[generateExistingQueryEditorRoute(lightQuery.id)]}
|
180
|
+
>
|
174
181
|
<LegendQueryFrameworkProvider>
|
175
|
-
<
|
182
|
+
<Routes>
|
183
|
+
<Route
|
184
|
+
path={LEGEND_QUERY_ROUTE_PATTERN.EDIT_EXISTING_QUERY}
|
185
|
+
element={<ExistingQueryEditor />}
|
186
|
+
/>
|
187
|
+
</Routes>
|
176
188
|
</LegendQueryFrameworkProvider>
|
177
189
|
</TEST__BrowserEnvironmentProvider>
|
178
190
|
</ApplicationStoreProvider>,
|
@@ -0,0 +1,67 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
import { useApplicationStore } from '@finos/legend-application';
|
18
|
+
import { observer } from 'mobx-react-lite';
|
19
|
+
import {
|
20
|
+
LEGEND_QUERY_ROUTE_PATTERN_TOKEN,
|
21
|
+
type ExistingQueryEditorPathParams,
|
22
|
+
} from '../../__lib__/LegendQueryNavigation.js';
|
23
|
+
import { useParams } from '@finos/legend-application/browser';
|
24
|
+
import {
|
25
|
+
ExistingQueryDataCubeEditorStoreProvider,
|
26
|
+
useExistingQueryDataCubeEditorStore,
|
27
|
+
} from './ExistingQueryEditorStoreProviderProvider.js';
|
28
|
+
import { useEffect } from 'react';
|
29
|
+
import { flowResult } from 'mobx';
|
30
|
+
import { DataCube, DataCubeProvider } from '@finos/legend-data-cube';
|
31
|
+
import { QueryBuilderDataCubeApplicationEngine } from '@finos/legend-query-builder';
|
32
|
+
import { guaranteeNonNullable } from '@finos/legend-shared';
|
33
|
+
|
34
|
+
export const DataCubeWrapper = observer(() => {
|
35
|
+
const applicationStore = useApplicationStore();
|
36
|
+
const store = useExistingQueryDataCubeEditorStore();
|
37
|
+
|
38
|
+
useEffect(() => {
|
39
|
+
flowResult(store.initialize()).catch(applicationStore.alertUnhandledError);
|
40
|
+
}, [applicationStore, store]);
|
41
|
+
|
42
|
+
if (!store.engine) {
|
43
|
+
return null;
|
44
|
+
}
|
45
|
+
const _appEngine = new QueryBuilderDataCubeApplicationEngine(
|
46
|
+
applicationStore,
|
47
|
+
);
|
48
|
+
|
49
|
+
return (
|
50
|
+
<DataCubeProvider application={_appEngine} engine={store.engine}>
|
51
|
+
<DataCube />
|
52
|
+
</DataCubeProvider>
|
53
|
+
);
|
54
|
+
});
|
55
|
+
|
56
|
+
export const ExistingQueryDataCubeViewer = observer(() => {
|
57
|
+
const params = useParams<ExistingQueryEditorPathParams>();
|
58
|
+
const queryId = guaranteeNonNullable(
|
59
|
+
params[LEGEND_QUERY_ROUTE_PATTERN_TOKEN.QUERY_ID],
|
60
|
+
);
|
61
|
+
|
62
|
+
return (
|
63
|
+
<ExistingQueryDataCubeEditorStoreProvider queryId={queryId}>
|
64
|
+
<DataCubeWrapper />
|
65
|
+
</ExistingQueryDataCubeEditorStoreProvider>
|
66
|
+
);
|
67
|
+
});
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
import { createContext, useContext } from 'react';
|
18
|
+
import { useLocalObservable } from 'mobx-react-lite';
|
19
|
+
import { ExistingQueryDataCubeEditorStore } from '../../stores/data-cube/ExistingQueryDataCubeViewer.js';
|
20
|
+
import {
|
21
|
+
useLegendQueryApplicationStore,
|
22
|
+
useLegendQueryBaseStore,
|
23
|
+
} from '../LegendQueryFrameworkProvider.js';
|
24
|
+
import { guaranteeNonNullable } from '@finos/legend-shared';
|
25
|
+
|
26
|
+
export const ExistingQueryDataCubeEditorStoreContext = createContext<
|
27
|
+
ExistingQueryDataCubeEditorStore | undefined
|
28
|
+
>(undefined);
|
29
|
+
|
30
|
+
export const ExistingQueryDataCubeEditorStoreProvider: React.FC<{
|
31
|
+
children: React.ReactNode;
|
32
|
+
queryId: string;
|
33
|
+
}> = ({ children, queryId }) => {
|
34
|
+
const applicationStore = useLegendQueryApplicationStore();
|
35
|
+
const baseStore = useLegendQueryBaseStore();
|
36
|
+
const store = useLocalObservable(
|
37
|
+
() =>
|
38
|
+
new ExistingQueryDataCubeEditorStore(
|
39
|
+
applicationStore,
|
40
|
+
baseStore.depotServerClient,
|
41
|
+
queryId,
|
42
|
+
),
|
43
|
+
);
|
44
|
+
return (
|
45
|
+
<ExistingQueryDataCubeEditorStoreContext.Provider value={store}>
|
46
|
+
{children}
|
47
|
+
</ExistingQueryDataCubeEditorStoreContext.Provider>
|
48
|
+
);
|
49
|
+
};
|
50
|
+
|
51
|
+
export const useExistingQueryDataCubeEditorStore =
|
52
|
+
(): ExistingQueryDataCubeEditorStore =>
|
53
|
+
guaranteeNonNullable(
|
54
|
+
useContext(ExistingQueryDataCubeEditorStoreContext),
|
55
|
+
`Can't find query editor store in context`,
|
56
|
+
);
|
@@ -88,14 +88,12 @@ const DataSpaceQueryCreatorStoreProvider: React.FC<{
|
|
88
88
|
|
89
89
|
export const DataSpaceQueryCreator = observer(() => {
|
90
90
|
const applicationStore = useApplicationStore();
|
91
|
-
const parameters = useParams<DataSpaceQueryCreatorPathParams
|
92
|
-
const gav = parameters
|
91
|
+
const parameters = useParams<DataSpaceQueryCreatorPathParams>();
|
92
|
+
const gav = parameters[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV];
|
93
93
|
const dataSpacePath =
|
94
|
-
parameters
|
94
|
+
parameters[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH];
|
95
95
|
const executionContext =
|
96
|
-
parameters
|
97
|
-
DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.EXECUTION_CONTEXT
|
98
|
-
];
|
96
|
+
parameters[DATA_SPACE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.EXECUTION_CONTEXT];
|
99
97
|
const runtimePath =
|
100
98
|
applicationStore.navigationService.navigator.getCurrentLocationParameterValue(
|
101
99
|
DATA_SPACE_QUERY_CREATOR_QUERY_PARAM_TOKEN.RUNTIME_PATH,
|
@@ -82,7 +82,7 @@ const DataSpaceQuerySetupSetupPanelContent = observer(
|
|
82
82
|
</label>
|
83
83
|
<CustomSelectorInput
|
84
84
|
inputId="query-builder__setup__data-space-selector"
|
85
|
-
|
85
|
+
inputRef={dataSpaceSearchRef}
|
86
86
|
className="panel__content__form__section__dropdown query-builder__setup__config-group__item__selector"
|
87
87
|
options={dataSpaceOptions}
|
88
88
|
isLoading={queryBuilderState.loadDataSpacesState.isInProgress}
|
@@ -28,6 +28,7 @@ import {
|
|
28
28
|
type DataSpaceTemplateQueryCreatorPathParams,
|
29
29
|
} from '../../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
|
30
30
|
import { QueryEditor } from '../QueryEditor.js';
|
31
|
+
import { guaranteeNonNullable } from '@finos/legend-shared';
|
31
32
|
|
32
33
|
const DataSpaceTemplateQueryCreatorStoreProvider: React.FC<{
|
33
34
|
children: React.ReactNode;
|
@@ -59,16 +60,19 @@ const DataSpaceTemplateQueryCreatorStoreProvider: React.FC<{
|
|
59
60
|
|
60
61
|
export const DataSpaceTemplateQueryCreator = observer(() => {
|
61
62
|
const parameters = useParams<DataSpaceTemplateQueryCreatorPathParams>();
|
62
|
-
const gav =
|
63
|
-
parameters[DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV]
|
64
|
-
|
63
|
+
const gav = guaranteeNonNullable(
|
64
|
+
parameters[DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV],
|
65
|
+
);
|
66
|
+
const dataSpacePath = guaranteeNonNullable(
|
65
67
|
parameters[
|
66
68
|
DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH
|
67
|
-
]
|
68
|
-
|
69
|
+
],
|
70
|
+
);
|
71
|
+
const templateQueryId = guaranteeNonNullable(
|
69
72
|
parameters[
|
70
73
|
DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.TEMPLATE_QUERY_ID
|
71
|
-
]
|
74
|
+
],
|
75
|
+
);
|
72
76
|
|
73
77
|
return (
|
74
78
|
<DataSpaceTemplateQueryCreatorStoreProvider
|
@@ -0,0 +1,98 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright (c) 2020-present, Goldman Sachs
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
import type { DepotServerClient } from '@finos/legend-server-depot';
|
18
|
+
import type { LegendQueryApplicationStore } from '../LegendQueryBaseStore.js';
|
19
|
+
import {
|
20
|
+
GraphManagerState,
|
21
|
+
type RawLambda,
|
22
|
+
type QueryInfo,
|
23
|
+
} from '@finos/legend-graph';
|
24
|
+
import { DEFAULT_TAB_SIZE } from '@finos/legend-application';
|
25
|
+
import { assertErrorThrown, type GeneratorFn } from '@finos/legend-shared';
|
26
|
+
import { QueryBuilderDataCubeEngine } from '@finos/legend-query-builder';
|
27
|
+
|
28
|
+
export class ExistingQueryDataCubeEditorStore {
|
29
|
+
readonly applicationStore: LegendQueryApplicationStore;
|
30
|
+
readonly depotServerClient: DepotServerClient;
|
31
|
+
readonly graphManagerState: GraphManagerState;
|
32
|
+
readonly queryId: string;
|
33
|
+
engine: QueryBuilderDataCubeEngine | undefined;
|
34
|
+
|
35
|
+
constructor(
|
36
|
+
applicationStore: LegendQueryApplicationStore,
|
37
|
+
depotServerClient: DepotServerClient,
|
38
|
+
queryId: string,
|
39
|
+
) {
|
40
|
+
this.applicationStore = applicationStore;
|
41
|
+
this.depotServerClient = depotServerClient;
|
42
|
+
this.graphManagerState = new GraphManagerState(
|
43
|
+
applicationStore.pluginManager,
|
44
|
+
applicationStore.logService,
|
45
|
+
);
|
46
|
+
this.queryId = queryId;
|
47
|
+
}
|
48
|
+
|
49
|
+
*initialize(): GeneratorFn<void> {
|
50
|
+
try {
|
51
|
+
// initialize the graph manager
|
52
|
+
yield this.graphManagerState.graphManager.initialize(
|
53
|
+
{
|
54
|
+
env: this.applicationStore.config.env,
|
55
|
+
tabSize: DEFAULT_TAB_SIZE,
|
56
|
+
clientConfig: {
|
57
|
+
baseUrl: this.applicationStore.config.engineServerUrl,
|
58
|
+
queryBaseUrl: this.applicationStore.config.engineQueryServerUrl,
|
59
|
+
enableCompression: true,
|
60
|
+
},
|
61
|
+
},
|
62
|
+
{
|
63
|
+
tracerService: this.applicationStore.tracerService,
|
64
|
+
},
|
65
|
+
);
|
66
|
+
const queryInfo = (yield this.graphManagerState.graphManager.getQueryInfo(
|
67
|
+
this.queryId,
|
68
|
+
)) as unknown as QueryInfo;
|
69
|
+
const content = queryInfo.content;
|
70
|
+
const execConext =
|
71
|
+
(yield this.graphManagerState.graphManager.resolveQueryInfoExecutionContext(
|
72
|
+
queryInfo,
|
73
|
+
() =>
|
74
|
+
this.depotServerClient.getVersionEntities(
|
75
|
+
queryInfo.groupId,
|
76
|
+
queryInfo.artifactId,
|
77
|
+
queryInfo.versionId,
|
78
|
+
),
|
79
|
+
)) as { mapping: string | undefined; runtime: string };
|
80
|
+
const lambda =
|
81
|
+
(yield this.graphManagerState.graphManager.pureCodeToLambda(
|
82
|
+
content,
|
83
|
+
)) as unknown as RawLambda;
|
84
|
+
const engine = new QueryBuilderDataCubeEngine(
|
85
|
+
lambda,
|
86
|
+
execConext.mapping,
|
87
|
+
execConext.runtime,
|
88
|
+
this.graphManagerState,
|
89
|
+
);
|
90
|
+
this.engine = engine;
|
91
|
+
} catch (error) {
|
92
|
+
assertErrorThrown(error);
|
93
|
+
this.applicationStore.notificationService.notifyError(
|
94
|
+
`Unable to initialize cube with query ${this.queryId}: ${error.message}`,
|
95
|
+
);
|
96
|
+
}
|
97
|
+
}
|
98
|
+
}
|
package/tsconfig.json
CHANGED
@@ -73,6 +73,7 @@
|
|
73
73
|
"./src/stores/QuerySetupStore.ts",
|
74
74
|
"./src/stores/UpdateExistingServiceQuerySetupStore.ts",
|
75
75
|
"./src/stores/__test-utils__/LegendQueryApplicationTestUtils.ts",
|
76
|
+
"./src/stores/data-cube/ExistingQueryDataCubeViewer.ts",
|
76
77
|
"./src/stores/data-space/DataSpaceQueryBuilderHelper.ts",
|
77
78
|
"./src/stores/data-space/DataSpaceQueryCreatorStore.ts",
|
78
79
|
"./src/stores/data-space/DataSpaceQuerySetupState.ts",
|
@@ -93,6 +94,8 @@
|
|
93
94
|
"./src/components/QuerySetup.tsx",
|
94
95
|
"./src/components/UpdateExistingServiceQuerySetup.tsx",
|
95
96
|
"./src/components/__test-utils__/QueryEditorComponentTestUtils.tsx",
|
97
|
+
"./src/components/data-cube/ExistingQueryDataCubeViewer.tsx",
|
98
|
+
"./src/components/data-cube/ExistingQueryEditorStoreProviderProvider.tsx",
|
96
99
|
"./src/components/data-space/DataSpaceInfo.tsx",
|
97
100
|
"./src/components/data-space/DataSpaceQueryCreator.tsx",
|
98
101
|
"./src/components/data-space/DataSpaceQuerySetup.tsx",
|