@finos/legend-extension-dsl-data-space 10.3.0 → 10.3.2
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/__lib__/{query/DSL_DataSpace_LegendQueryNavigation.d.ts → to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.d.ts} +5 -20
- package/lib/__lib__/to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.d.ts.map +1 -0
- package/lib/__lib__/{query/DSL_DataSpace_LegendQueryNavigation.js → to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.js} +34 -2
- package/lib/__lib__/to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.js.map +1 -0
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js +2 -2
- package/lib/components/DSL_DataSpace_LegendApplicationPlugin.js.map +1 -1
- package/lib/components/index.d.ts +4 -4
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +4 -4
- package/lib/components/index.js.map +1 -1
- package/lib/components/query-builder/DataSpaceAdvancedSearchModal.d.ts.map +1 -0
- package/lib/components/query-builder/DataSpaceAdvancedSearchModal.js.map +1 -0
- package/lib/components/query-builder/DataSpaceQueryBuilder.d.ts.map +1 -0
- package/lib/components/query-builder/DataSpaceQueryBuilder.js.map +1 -0
- package/lib/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.d.ts.map +1 -0
- package/lib/components/{query → query-builder}/DataSpaceQueryBuilderTemplateQueryPanelContent.js +2 -2
- package/lib/components/query-builder/DataSpaceQueryBuilderTemplateQueryPanelContent.js.map +1 -0
- package/lib/components/query-builder/QueryDataSpaceUtil.d.ts.map +1 -0
- package/lib/components/query-builder/QueryDataSpaceUtil.js.map +1 -0
- package/lib/components/{query → query-builder}/index.d.ts +3 -1
- package/lib/components/query-builder/index.d.ts.map +1 -0
- package/lib/components/{query → query-builder}/index.js +3 -1
- package/lib/components/query-builder/index.js.map +1 -0
- package/lib/graph-manager/index.d.ts +1 -0
- package/lib/graph-manager/index.d.ts.map +1 -1
- package/lib/graph-manager/index.js +1 -0
- package/lib/graph-manager/index.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +3 -5
- package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -1
- package/lib/stores/query/DataSpaceAdvancedSearchState.js +1 -2
- package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -1
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.js +1 -1
- package/lib/stores/query-builder/DataSpaceQueryBuilderState.js.map +1 -1
- package/lib/{components/query/DataSpaceQueryCreator.d.ts → stores/shared/DataSpaceUtils.d.ts} +4 -4
- package/lib/stores/shared/DataSpaceUtils.d.ts.map +1 -0
- package/lib/stores/shared/DataSpaceUtils.js +32 -0
- package/lib/stores/shared/DataSpaceUtils.js.map +1 -0
- package/package.json +8 -10
- package/src/__lib__/{query/DSL_DataSpace_LegendQueryNavigation.ts → to-delete/DSL_DataSpace_LegendQueryNavigation_to_delete.ts} +47 -18
- package/src/components/DSL_DataSpace_LegendApplicationPlugin.tsx +5 -5
- package/src/components/index.ts +11 -4
- package/src/components/{query → query-builder}/DataSpaceQueryBuilderTemplateQueryPanelContent.tsx +3 -3
- package/src/components/{query → query-builder}/index.ts +7 -1
- package/src/graph-manager/index.ts +1 -0
- package/src/stores/query/DataSpaceAdvancedSearchState.ts +4 -2
- package/src/stores/query-builder/DataSpaceQueryBuilderState.ts +1 -1
- package/src/stores/shared/DataSpaceUtils.ts +42 -0
- package/tsconfig.json +7 -13
- package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.d.ts.map +0 -1
- package/lib/__lib__/query/DSL_DataSpace_LegendQueryNavigation.js.map +0 -1
- package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.d.ts +0 -29
- package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.d.ts.map +0 -1
- package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js +0 -243
- package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js.map +0 -1
- package/lib/components/query/DataSpaceAdvancedSearchModal.d.ts.map +0 -1
- package/lib/components/query/DataSpaceAdvancedSearchModal.js.map +0 -1
- package/lib/components/query/DataSpaceQueryBuilder.d.ts.map +0 -1
- package/lib/components/query/DataSpaceQueryBuilder.js.map +0 -1
- package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.d.ts.map +0 -1
- package/lib/components/query/DataSpaceQueryBuilderTemplateQueryPanelContent.js.map +0 -1
- package/lib/components/query/DataSpaceQueryCreator.d.ts.map +0 -1
- package/lib/components/query/DataSpaceQueryCreator.js +0 -41
- package/lib/components/query/DataSpaceQueryCreator.js.map +0 -1
- package/lib/components/query/DataSpaceQuerySetup.d.ts +0 -21
- package/lib/components/query/DataSpaceQuerySetup.d.ts.map +0 -1
- package/lib/components/query/DataSpaceQuerySetup.js +0 -63
- package/lib/components/query/DataSpaceQuerySetup.js.map +0 -1
- package/lib/components/query/DataSpaceTemplateQueryCreator.d.ts +0 -19
- package/lib/components/query/DataSpaceTemplateQueryCreator.d.ts.map +0 -1
- package/lib/components/query/DataSpaceTemplateQueryCreator.js +0 -37
- package/lib/components/query/DataSpaceTemplateQueryCreator.js.map +0 -1
- package/lib/components/query/QueryDataSpaceUtil.d.ts.map +0 -1
- package/lib/components/query/QueryDataSpaceUtil.js.map +0 -1
- package/lib/components/query/index.d.ts.map +0 -1
- package/lib/components/query/index.js.map +0 -1
- package/lib/stores/query/DataSpaceQueryCreatorStore.d.ts +0 -38
- package/lib/stores/query/DataSpaceQueryCreatorStore.d.ts.map +0 -1
- package/lib/stores/query/DataSpaceQueryCreatorStore.js +0 -149
- package/lib/stores/query/DataSpaceQueryCreatorStore.js.map +0 -1
- package/lib/stores/query/DataSpaceQuerySetupStore.d.ts +0 -51
- package/lib/stores/query/DataSpaceQuerySetupStore.d.ts.map +0 -1
- package/lib/stores/query/DataSpaceQuerySetupStore.js +0 -107
- package/lib/stores/query/DataSpaceQuerySetupStore.js.map +0 -1
- package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.d.ts +0 -35
- package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.d.ts.map +0 -1
- package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js +0 -108
- package/lib/stores/query/DataSpaceTemplateQueryCreatorStore.js.map +0 -1
- package/src/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.tsx +0 -445
- package/src/components/query/DataSpaceQueryCreator.tsx +0 -99
- package/src/components/query/DataSpaceQuerySetup.tsx +0 -165
- package/src/components/query/DataSpaceTemplateQueryCreator.tsx +0 -82
- package/src/stores/query/DataSpaceQueryCreatorStore.ts +0 -308
- package/src/stores/query/DataSpaceQuerySetupStore.ts +0 -208
- package/src/stores/query/DataSpaceTemplateQueryCreatorStore.ts +0 -207
- /package/lib/components/{query → query-builder}/DataSpaceAdvancedSearchModal.d.ts +0 -0
- /package/lib/components/{query → query-builder}/DataSpaceAdvancedSearchModal.js +0 -0
- /package/lib/components/{query → query-builder}/DataSpaceQueryBuilder.d.ts +0 -0
- /package/lib/components/{query → query-builder}/DataSpaceQueryBuilder.js +0 -0
- /package/lib/components/{query → query-builder}/DataSpaceQueryBuilderTemplateQueryPanelContent.d.ts +0 -0
- /package/lib/components/{query → query-builder}/QueryDataSpaceUtil.d.ts +0 -0
- /package/lib/components/{query → query-builder}/QueryDataSpaceUtil.js +0 -0
- /package/src/components/{query → query-builder}/DataSpaceAdvancedSearchModal.tsx +0 -0
- /package/src/components/{query → query-builder}/DataSpaceQueryBuilder.tsx +0 -0
- /package/src/components/{query → query-builder}/QueryDataSpaceUtil.ts +0 -0
@@ -1,165 +0,0 @@
|
|
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 { observer, useLocalObservable } from 'mobx-react-lite';
|
18
|
-
import { useApplicationStore } from '@finos/legend-application';
|
19
|
-
import {
|
20
|
-
QueryEditor,
|
21
|
-
QueryEditorStoreContext,
|
22
|
-
useLegendQueryApplicationStore,
|
23
|
-
useLegendQueryBaseStore,
|
24
|
-
} from '@finos/legend-application-query';
|
25
|
-
import { useEffect, useRef } from 'react';
|
26
|
-
import { flowResult } from 'mobx';
|
27
|
-
import { QueryBuilderClassSelector } from '@finos/legend-query-builder';
|
28
|
-
import {
|
29
|
-
CustomSelectorInput,
|
30
|
-
SearchIcon,
|
31
|
-
type SelectComponent,
|
32
|
-
} from '@finos/legend-art';
|
33
|
-
import { DataSpaceIcon } from '../shared/DSL_DataSpace_Icon.js';
|
34
|
-
import {
|
35
|
-
type DataSpaceQuerySetupState,
|
36
|
-
DataSpaceQuerySetupStore,
|
37
|
-
} from '../../stores/query/DataSpaceQuerySetupStore.js';
|
38
|
-
import {
|
39
|
-
buildDataSpaceOption,
|
40
|
-
formatDataSpaceOptionLabel,
|
41
|
-
type DataSpaceOption,
|
42
|
-
} from './DataSpaceQueryBuilder.js';
|
43
|
-
import { DataSpaceAdvancedSearchModal } from './DataSpaceAdvancedSearchModal.js';
|
44
|
-
|
45
|
-
const DataSpaceQuerySetupStoreProvider: React.FC<{
|
46
|
-
children: React.ReactNode;
|
47
|
-
}> = ({ children }) => {
|
48
|
-
const applicationStore = useLegendQueryApplicationStore();
|
49
|
-
const baseStore = useLegendQueryBaseStore();
|
50
|
-
const store = useLocalObservable(
|
51
|
-
() =>
|
52
|
-
new DataSpaceQuerySetupStore(
|
53
|
-
applicationStore,
|
54
|
-
baseStore.depotServerClient,
|
55
|
-
),
|
56
|
-
);
|
57
|
-
return (
|
58
|
-
<QueryEditorStoreContext.Provider value={store}>
|
59
|
-
{children}
|
60
|
-
</QueryEditorStoreContext.Provider>
|
61
|
-
);
|
62
|
-
};
|
63
|
-
|
64
|
-
export const DataSpaceQuerySetup = observer(() => (
|
65
|
-
<DataSpaceQuerySetupStoreProvider>
|
66
|
-
<QueryEditor />
|
67
|
-
</DataSpaceQuerySetupStoreProvider>
|
68
|
-
));
|
69
|
-
|
70
|
-
/**
|
71
|
-
* This setup panel supports cascading in order: Data-space -> Execution context (-> Runtime) -> Class
|
72
|
-
*
|
73
|
-
* In other words, we will only show:
|
74
|
-
* - For runtime selector: the list of compatible runtimes with the selected execution context mapping
|
75
|
-
* - For class selector: the list of compatible class with the selected execution context mapping
|
76
|
-
*
|
77
|
-
* See details on propagation/cascading in {@link DataSpaceQuerySetupState}
|
78
|
-
*/
|
79
|
-
const DataSpaceQuerySetupSetupPanelContent = observer(
|
80
|
-
(props: { queryBuilderState: DataSpaceQuerySetupState }) => {
|
81
|
-
const { queryBuilderState } = props;
|
82
|
-
const applicationStore = useApplicationStore();
|
83
|
-
const dataSpaceSearchRef = useRef<SelectComponent>(null);
|
84
|
-
// data space
|
85
|
-
const dataSpaceOptions =
|
86
|
-
queryBuilderState.dataSpaces.map(buildDataSpaceOption);
|
87
|
-
const selectedDataSpaceOption = null;
|
88
|
-
const onDataSpaceOptionChange = (option: DataSpaceOption): void => {
|
89
|
-
queryBuilderState.onDataSpaceChange(option.value);
|
90
|
-
};
|
91
|
-
|
92
|
-
const openDataSpaceAdvancedSearch = (): void =>
|
93
|
-
queryBuilderState.showAdvancedSearchPanel();
|
94
|
-
|
95
|
-
useEffect(() => {
|
96
|
-
flowResult(queryBuilderState.loadDataSpaces()).catch(
|
97
|
-
applicationStore.alertUnhandledError,
|
98
|
-
);
|
99
|
-
}, [queryBuilderState, applicationStore]);
|
100
|
-
|
101
|
-
useEffect(() => dataSpaceSearchRef.current?.focus());
|
102
|
-
|
103
|
-
return (
|
104
|
-
<>
|
105
|
-
<div className="query-builder__setup__config-group">
|
106
|
-
<div className="query-builder__setup__config-group__header">
|
107
|
-
<div className="query-builder__setup__config-group__header__title">
|
108
|
-
data space execution context
|
109
|
-
</div>
|
110
|
-
</div>
|
111
|
-
<div className="query-builder__setup__config-group__content">
|
112
|
-
<div className="query-builder__setup__config-group__item">
|
113
|
-
<div
|
114
|
-
className="btn--sm query-builder__setup__config-group__item__label"
|
115
|
-
title="data space"
|
116
|
-
>
|
117
|
-
<DataSpaceIcon />
|
118
|
-
</div>
|
119
|
-
<CustomSelectorInput
|
120
|
-
ref={dataSpaceSearchRef}
|
121
|
-
className="panel__content__form__section__dropdown query-builder__setup__config-group__item__selector"
|
122
|
-
options={dataSpaceOptions}
|
123
|
-
isLoading={queryBuilderState.loadDataSpacesState.isInProgress}
|
124
|
-
onChange={onDataSpaceOptionChange}
|
125
|
-
value={selectedDataSpaceOption}
|
126
|
-
placeholder="Search for data space..."
|
127
|
-
escapeClearsValue={true}
|
128
|
-
darkMode={
|
129
|
-
!applicationStore.layoutService
|
130
|
-
.TEMPORARY__isLightColorThemeEnabled
|
131
|
-
}
|
132
|
-
formatOptionLabel={formatDataSpaceOptionLabel}
|
133
|
-
/>
|
134
|
-
<button
|
135
|
-
tabIndex={-1}
|
136
|
-
className="query-builder__setup__data-space-searcher__btn btn--dark"
|
137
|
-
onClick={openDataSpaceAdvancedSearch}
|
138
|
-
title="Open advanced search for data space..."
|
139
|
-
>
|
140
|
-
<SearchIcon />
|
141
|
-
</button>
|
142
|
-
{queryBuilderState.advancedSearchState && (
|
143
|
-
<DataSpaceAdvancedSearchModal
|
144
|
-
searchState={queryBuilderState.advancedSearchState}
|
145
|
-
onClose={() => queryBuilderState.hideAdvancedSearchPanel()}
|
146
|
-
/>
|
147
|
-
)}
|
148
|
-
</div>
|
149
|
-
</div>
|
150
|
-
</div>
|
151
|
-
<QueryBuilderClassSelector
|
152
|
-
queryBuilderState={queryBuilderState}
|
153
|
-
classes={[]}
|
154
|
-
noMatchMessage="No compatible class found"
|
155
|
-
/>
|
156
|
-
</>
|
157
|
-
);
|
158
|
-
},
|
159
|
-
);
|
160
|
-
|
161
|
-
export const renderDataSpaceQuerySetupSetupPanelContent = (
|
162
|
-
queryBuilderState: DataSpaceQuerySetupState,
|
163
|
-
): React.ReactNode => (
|
164
|
-
<DataSpaceQuerySetupSetupPanelContent queryBuilderState={queryBuilderState} />
|
165
|
-
);
|
@@ -1,82 +0,0 @@
|
|
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 { observer, useLocalObservable } from 'mobx-react-lite';
|
18
|
-
import { useParams } from '@finos/legend-application/browser';
|
19
|
-
import {
|
20
|
-
QueryEditor,
|
21
|
-
QueryEditorStoreContext,
|
22
|
-
useLegendQueryApplicationStore,
|
23
|
-
useLegendQueryBaseStore,
|
24
|
-
} from '@finos/legend-application-query';
|
25
|
-
import {
|
26
|
-
DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN,
|
27
|
-
type DataSpaceTemplateQueryCreatorPathParams,
|
28
|
-
} from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
|
29
|
-
import { parseGAVCoordinates } from '@finos/legend-storage';
|
30
|
-
import { DataSpaceTemplateQueryCreatorStore } from '../../stores/query/DataSpaceTemplateQueryCreatorStore.js';
|
31
|
-
|
32
|
-
const DataSpaceTemplateQueryCreatorStoreProvider: React.FC<{
|
33
|
-
children: React.ReactNode;
|
34
|
-
gav: string;
|
35
|
-
dataSpacePath: string;
|
36
|
-
templateQueryId: string;
|
37
|
-
}> = ({ children, gav, dataSpacePath, templateQueryId }) => {
|
38
|
-
const { groupId, artifactId, versionId } = parseGAVCoordinates(gav);
|
39
|
-
const applicationStore = useLegendQueryApplicationStore();
|
40
|
-
const baseStore = useLegendQueryBaseStore();
|
41
|
-
const store = useLocalObservable(
|
42
|
-
() =>
|
43
|
-
new DataSpaceTemplateQueryCreatorStore(
|
44
|
-
applicationStore,
|
45
|
-
baseStore.depotServerClient,
|
46
|
-
groupId,
|
47
|
-
artifactId,
|
48
|
-
versionId,
|
49
|
-
dataSpacePath,
|
50
|
-
templateQueryId,
|
51
|
-
),
|
52
|
-
);
|
53
|
-
return (
|
54
|
-
<QueryEditorStoreContext.Provider value={store}>
|
55
|
-
{children}
|
56
|
-
</QueryEditorStoreContext.Provider>
|
57
|
-
);
|
58
|
-
};
|
59
|
-
|
60
|
-
export const DataSpaceTemplateQueryCreator = observer(() => {
|
61
|
-
const parameters = useParams<DataSpaceTemplateQueryCreatorPathParams>();
|
62
|
-
const gav =
|
63
|
-
parameters[DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.GAV];
|
64
|
-
const dataSpacePath =
|
65
|
-
parameters[
|
66
|
-
DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.DATA_SPACE_PATH
|
67
|
-
];
|
68
|
-
const templateQueryId =
|
69
|
-
parameters[
|
70
|
-
DATA_SPACE_TEMPLATE_QUERY_CREATOR_ROUTE_PATTERN_TOKEN.TEMPLATE_QUERY_ID
|
71
|
-
];
|
72
|
-
|
73
|
-
return (
|
74
|
-
<DataSpaceTemplateQueryCreatorStoreProvider
|
75
|
-
gav={gav}
|
76
|
-
dataSpacePath={dataSpacePath}
|
77
|
-
templateQueryId={templateQueryId}
|
78
|
-
>
|
79
|
-
<QueryEditor />
|
80
|
-
</DataSpaceTemplateQueryCreatorStoreProvider>
|
81
|
-
);
|
82
|
-
});
|
@@ -1,308 +0,0 @@
|
|
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 {
|
18
|
-
type Query,
|
19
|
-
extractElementNameFromPath,
|
20
|
-
QueryTaggedValue,
|
21
|
-
RuntimePointer,
|
22
|
-
PackageableElementExplicitReference,
|
23
|
-
type Runtime,
|
24
|
-
type Class,
|
25
|
-
type RawLambda,
|
26
|
-
} from '@finos/legend-graph';
|
27
|
-
import {
|
28
|
-
QueryEditorStore,
|
29
|
-
type QueryPersistConfiguration,
|
30
|
-
type LegendQueryApplicationStore,
|
31
|
-
createViewProjectHandler,
|
32
|
-
createViewSDLCProjectHandler,
|
33
|
-
} from '@finos/legend-application-query';
|
34
|
-
import {
|
35
|
-
type DepotServerClient,
|
36
|
-
StoreProjectData,
|
37
|
-
LATEST_VERSION_ALIAS,
|
38
|
-
} from '@finos/legend-server-depot';
|
39
|
-
import {
|
40
|
-
guaranteeNonNullable,
|
41
|
-
guaranteeType,
|
42
|
-
uuid,
|
43
|
-
} from '@finos/legend-shared';
|
44
|
-
import {
|
45
|
-
QUERY_PROFILE_PATH,
|
46
|
-
QUERY_PROFILE_TAG_CLASS,
|
47
|
-
QUERY_PROFILE_TAG_DATA_SPACE,
|
48
|
-
} from '../../graph/DSL_DataSpace_MetaModelConst.js';
|
49
|
-
import { getDataSpace } from '../../graph-manager/DSL_DataSpace_GraphManagerHelper.js';
|
50
|
-
import {
|
51
|
-
DataSpaceQueryBuilderState,
|
52
|
-
DataSpaceProjectInfo,
|
53
|
-
} from '../query-builder/DataSpaceQueryBuilderState.js';
|
54
|
-
import type { DataSpaceInfo } from '../shared/DataSpaceInfo.js';
|
55
|
-
import { generateDataSpaceQueryCreatorRoute } from '../../__lib__/query/DSL_DataSpace_LegendQueryNavigation.js';
|
56
|
-
import type { DataSpaceExecutionContext } from '../../graph/metamodel/pure/model/packageableElements/dataSpace/DSL_DataSpace_DataSpace.js';
|
57
|
-
import type { QueryBuilderState } from '@finos/legend-query-builder';
|
58
|
-
import type { ProjectGAVCoordinates } from '@finos/legend-storage';
|
59
|
-
import { DSL_DataSpace_getGraphManagerExtension } from '../../graph-manager/protocol/pure/DSL_DataSpace_PureGraphManagerExtension.js';
|
60
|
-
import { retrieveAnalyticsResultCache } from '../../graph-manager/action/analytics/DataSpaceAnalysisHelper.js';
|
61
|
-
|
62
|
-
export const createQueryDataSpaceTaggedValue = (
|
63
|
-
dataSpacePath: string,
|
64
|
-
): QueryTaggedValue => {
|
65
|
-
const taggedValue = new QueryTaggedValue();
|
66
|
-
taggedValue.profile = QUERY_PROFILE_PATH;
|
67
|
-
taggedValue.tag = QUERY_PROFILE_TAG_DATA_SPACE;
|
68
|
-
taggedValue.value = dataSpacePath;
|
69
|
-
return taggedValue;
|
70
|
-
};
|
71
|
-
|
72
|
-
export const createQueryClassTaggedValue = (
|
73
|
-
classPath: string,
|
74
|
-
): QueryTaggedValue => {
|
75
|
-
const taggedValue = new QueryTaggedValue();
|
76
|
-
taggedValue.profile = QUERY_PROFILE_PATH;
|
77
|
-
taggedValue.tag = QUERY_PROFILE_TAG_CLASS;
|
78
|
-
taggedValue.value = classPath;
|
79
|
-
return taggedValue;
|
80
|
-
};
|
81
|
-
|
82
|
-
export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
83
|
-
readonly groupId: string;
|
84
|
-
readonly artifactId: string;
|
85
|
-
readonly versionId: string;
|
86
|
-
readonly dataSpacePath: string;
|
87
|
-
readonly executionContext: string;
|
88
|
-
readonly runtimePath: string | undefined;
|
89
|
-
readonly classPath: string | undefined;
|
90
|
-
|
91
|
-
constructor(
|
92
|
-
applicationStore: LegendQueryApplicationStore,
|
93
|
-
depotServerClient: DepotServerClient,
|
94
|
-
groupId: string,
|
95
|
-
artifactId: string,
|
96
|
-
versionId: string,
|
97
|
-
dataSpacePath: string,
|
98
|
-
executionContext: string,
|
99
|
-
runtimePath: string | undefined,
|
100
|
-
executionKey: string | undefined,
|
101
|
-
) {
|
102
|
-
super(applicationStore, depotServerClient);
|
103
|
-
|
104
|
-
this.groupId = groupId;
|
105
|
-
this.artifactId = artifactId;
|
106
|
-
this.versionId = versionId;
|
107
|
-
this.dataSpacePath = dataSpacePath;
|
108
|
-
this.executionContext = executionContext;
|
109
|
-
this.runtimePath = runtimePath;
|
110
|
-
this.classPath = executionKey;
|
111
|
-
}
|
112
|
-
|
113
|
-
getProjectInfo(): ProjectGAVCoordinates {
|
114
|
-
return {
|
115
|
-
groupId: this.groupId,
|
116
|
-
artifactId: this.artifactId,
|
117
|
-
versionId: this.versionId,
|
118
|
-
};
|
119
|
-
}
|
120
|
-
|
121
|
-
async initializeQueryBuilderState(): Promise<QueryBuilderState> {
|
122
|
-
const dataSpace = getDataSpace(
|
123
|
-
this.dataSpacePath,
|
124
|
-
this.graphManagerState.graph,
|
125
|
-
);
|
126
|
-
const executionContext = guaranteeNonNullable(
|
127
|
-
dataSpace.executionContexts.find(
|
128
|
-
(context) => context.name === this.executionContext,
|
129
|
-
),
|
130
|
-
`Can't find execution context '${this.executionContext}'`,
|
131
|
-
);
|
132
|
-
let dataSpaceAnalysisResult;
|
133
|
-
try {
|
134
|
-
const project = StoreProjectData.serialization.fromJson(
|
135
|
-
await this.depotServerClient.getProject(this.groupId, this.artifactId),
|
136
|
-
);
|
137
|
-
dataSpaceAnalysisResult = await DSL_DataSpace_getGraphManagerExtension(
|
138
|
-
this.graphManagerState.graphManager,
|
139
|
-
).retrieveDataSpaceAnalysisFromCache(() =>
|
140
|
-
retrieveAnalyticsResultCache(
|
141
|
-
project,
|
142
|
-
this.versionId,
|
143
|
-
dataSpace.path,
|
144
|
-
this.depotServerClient,
|
145
|
-
),
|
146
|
-
);
|
147
|
-
} catch {
|
148
|
-
// do nothing
|
149
|
-
}
|
150
|
-
const projectInfo = new DataSpaceProjectInfo(
|
151
|
-
this.groupId,
|
152
|
-
this.artifactId,
|
153
|
-
this.versionId,
|
154
|
-
createViewProjectHandler(this.applicationStore),
|
155
|
-
createViewSDLCProjectHandler(
|
156
|
-
this.applicationStore,
|
157
|
-
this.depotServerClient,
|
158
|
-
),
|
159
|
-
);
|
160
|
-
const sourceInfo = {
|
161
|
-
groupId: projectInfo.groupId,
|
162
|
-
artifactId: projectInfo.artifactId,
|
163
|
-
versionId: projectInfo.versionId,
|
164
|
-
dataSpace: dataSpace.path,
|
165
|
-
};
|
166
|
-
const queryBuilderState = new DataSpaceQueryBuilderState(
|
167
|
-
this.applicationStore,
|
168
|
-
this.graphManagerState,
|
169
|
-
this.depotServerClient,
|
170
|
-
dataSpace,
|
171
|
-
executionContext,
|
172
|
-
(dataSpaceInfo: DataSpaceInfo) => {
|
173
|
-
if (dataSpaceInfo.defaultExecutionContext) {
|
174
|
-
this.applicationStore.navigationService.navigator.goToLocation(
|
175
|
-
generateDataSpaceQueryCreatorRoute(
|
176
|
-
guaranteeNonNullable(dataSpaceInfo.groupId),
|
177
|
-
guaranteeNonNullable(dataSpaceInfo.artifactId),
|
178
|
-
LATEST_VERSION_ALIAS, //always default to latest
|
179
|
-
dataSpaceInfo.path,
|
180
|
-
dataSpaceInfo.defaultExecutionContext,
|
181
|
-
undefined,
|
182
|
-
undefined,
|
183
|
-
),
|
184
|
-
);
|
185
|
-
} else {
|
186
|
-
this.applicationStore.notificationService.notifyWarning(
|
187
|
-
`Can't switch data space: default execution context not specified`,
|
188
|
-
);
|
189
|
-
}
|
190
|
-
},
|
191
|
-
true,
|
192
|
-
dataSpaceAnalysisResult,
|
193
|
-
(ec: DataSpaceExecutionContext) => {
|
194
|
-
// runtime should already be set
|
195
|
-
const runtimePointer = guaranteeType(
|
196
|
-
queryBuilderState.executionContextState.runtimeValue,
|
197
|
-
RuntimePointer,
|
198
|
-
);
|
199
|
-
this.applicationStore.navigationService.navigator.updateCurrentLocation(
|
200
|
-
generateDataSpaceQueryCreatorRoute(
|
201
|
-
this.groupId,
|
202
|
-
this.artifactId,
|
203
|
-
this.versionId,
|
204
|
-
dataSpace.path,
|
205
|
-
ec.name,
|
206
|
-
runtimePointer.packageableRuntime.value ===
|
207
|
-
queryBuilderState.executionContext.defaultRuntime.value
|
208
|
-
? undefined
|
209
|
-
: runtimePointer.packageableRuntime.value.path,
|
210
|
-
queryBuilderState.class?.path,
|
211
|
-
),
|
212
|
-
);
|
213
|
-
},
|
214
|
-
(runtimeValue: Runtime) => {
|
215
|
-
const runtimePointer = guaranteeType(runtimeValue, RuntimePointer);
|
216
|
-
queryBuilderState.applicationStore.navigationService.navigator.updateCurrentLocation(
|
217
|
-
generateDataSpaceQueryCreatorRoute(
|
218
|
-
guaranteeNonNullable(queryBuilderState.projectInfo).groupId,
|
219
|
-
guaranteeNonNullable(queryBuilderState.projectInfo).artifactId,
|
220
|
-
guaranteeNonNullable(queryBuilderState.projectInfo).versionId,
|
221
|
-
queryBuilderState.dataSpace.path,
|
222
|
-
queryBuilderState.executionContext.name,
|
223
|
-
runtimePointer.packageableRuntime.value ===
|
224
|
-
queryBuilderState.executionContext.defaultRuntime.value
|
225
|
-
? undefined
|
226
|
-
: runtimePointer.packageableRuntime.value.path,
|
227
|
-
queryBuilderState.class?.path,
|
228
|
-
),
|
229
|
-
);
|
230
|
-
},
|
231
|
-
(_class: Class) => {
|
232
|
-
// runtime should already be set
|
233
|
-
const runtimePointer = guaranteeType(
|
234
|
-
queryBuilderState.executionContextState.runtimeValue,
|
235
|
-
RuntimePointer,
|
236
|
-
);
|
237
|
-
queryBuilderState.applicationStore.navigationService.navigator.updateCurrentLocation(
|
238
|
-
generateDataSpaceQueryCreatorRoute(
|
239
|
-
guaranteeNonNullable(queryBuilderState.projectInfo).groupId,
|
240
|
-
guaranteeNonNullable(queryBuilderState.projectInfo).artifactId,
|
241
|
-
guaranteeNonNullable(queryBuilderState.projectInfo).versionId,
|
242
|
-
queryBuilderState.dataSpace.path,
|
243
|
-
queryBuilderState.executionContext.name,
|
244
|
-
runtimePointer.packageableRuntime.value ===
|
245
|
-
queryBuilderState.executionContext.defaultRuntime.value
|
246
|
-
? undefined
|
247
|
-
: runtimePointer.packageableRuntime.value.path,
|
248
|
-
_class.path,
|
249
|
-
),
|
250
|
-
);
|
251
|
-
},
|
252
|
-
projectInfo,
|
253
|
-
this.applicationStore.config.options.queryBuilderConfig,
|
254
|
-
sourceInfo,
|
255
|
-
);
|
256
|
-
queryBuilderState.setExecutionContext(executionContext);
|
257
|
-
queryBuilderState.propagateExecutionContextChange(executionContext);
|
258
|
-
|
259
|
-
// set runtime if already chosen
|
260
|
-
if (this.runtimePath) {
|
261
|
-
queryBuilderState.changeRuntime(
|
262
|
-
new RuntimePointer(
|
263
|
-
PackageableElementExplicitReference.create(
|
264
|
-
this.graphManagerState.graph.getRuntime(this.runtimePath),
|
265
|
-
),
|
266
|
-
),
|
267
|
-
);
|
268
|
-
}
|
269
|
-
|
270
|
-
// set class if already chosen
|
271
|
-
if (this.classPath) {
|
272
|
-
queryBuilderState.changeClass(
|
273
|
-
this.graphManagerState.graph.getClass(this.classPath),
|
274
|
-
);
|
275
|
-
}
|
276
|
-
|
277
|
-
return queryBuilderState;
|
278
|
-
}
|
279
|
-
|
280
|
-
getPersistConfiguration(
|
281
|
-
lambda: RawLambda,
|
282
|
-
options?: { update?: boolean | undefined },
|
283
|
-
): QueryPersistConfiguration {
|
284
|
-
return {
|
285
|
-
defaultName: options?.update
|
286
|
-
? `${extractElementNameFromPath(this.dataSpacePath)}`
|
287
|
-
: `New Query for ${extractElementNameFromPath(this.dataSpacePath)}[${
|
288
|
-
this.executionContext
|
289
|
-
}]`,
|
290
|
-
decorator: (query: Query): void => {
|
291
|
-
query.id = uuid();
|
292
|
-
query.groupId = this.groupId;
|
293
|
-
query.artifactId = this.artifactId;
|
294
|
-
query.versionId = this.versionId;
|
295
|
-
if (this.queryBuilderState?.class) {
|
296
|
-
query.taggedValues = [
|
297
|
-
createQueryDataSpaceTaggedValue(this.dataSpacePath),
|
298
|
-
createQueryClassTaggedValue(this.queryBuilderState.class.path),
|
299
|
-
];
|
300
|
-
} else {
|
301
|
-
query.taggedValues = [
|
302
|
-
createQueryDataSpaceTaggedValue(this.dataSpacePath),
|
303
|
-
];
|
304
|
-
}
|
305
|
-
},
|
306
|
-
};
|
307
|
-
}
|
308
|
-
}
|