@finos/legend-extension-dsl-data-space-studio 0.1.340 → 0.1.342
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/DSL_DataProduct_ElementDriver.d.ts.map +1 -1
- package/lib/components/DSL_DataProduct_ElementDriver.js +1 -10
- package/lib/components/DSL_DataProduct_ElementDriver.js.map +1 -1
- package/lib/components/DataSpaceEditor.js +9 -4
- package/lib/components/DataSpaceEditor.js.map +1 -1
- package/lib/components/DataSpaceExecutableQueryAction.d.ts +20 -0
- package/lib/components/DataSpaceExecutableQueryAction.d.ts.map +1 -0
- package/lib/components/DataSpaceExecutableQueryAction.js +85 -0
- package/lib/components/DataSpaceExecutableQueryAction.js.map +1 -0
- package/lib/components/DataSpaceExecutionContextEditor.d.ts +1 -12
- package/lib/components/DataSpaceExecutionContextEditor.d.ts.map +1 -1
- package/lib/components/DataSpaceExecutionContextEditor.js +206 -134
- package/lib/components/DataSpaceExecutionContextEditor.js.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.d.ts.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.js +130 -26
- package/lib/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.js.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.d.ts.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.js +16 -75
- package/lib/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.js.map +1 -1
- package/lib/components/DataSpaceGeneralEditor/{DataSpaceDefaultExecutionContextSection.d.ts → DataSpaceHomeTab.d.ts} +3 -3
- package/lib/components/DataSpaceGeneralEditor/DataSpaceHomeTab.d.ts.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceHomeTab.js +100 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceHomeTab.js.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSidebar.d.ts +23 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSidebar.d.ts.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSidebar.js +31 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceSidebar.js.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceValidation.d.ts +28 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceValidation.d.ts.map +1 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceValidation.js +45 -0
- package/lib/components/DataSpaceGeneralEditor/DataSpaceValidation.js.map +1 -0
- package/lib/components/DataSpaceQueryAction.d.ts.map +1 -1
- package/lib/components/DataSpaceQueryAction.js +11 -8
- package/lib/components/DataSpaceQueryAction.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/DataSpaceEditorState.d.ts +9 -0
- package/lib/stores/DataSpaceEditorState.d.ts.map +1 -1
- package/lib/stores/DataSpaceEditorState.js +15 -0
- package/lib/stores/DataSpaceEditorState.js.map +1 -1
- package/lib/stores/DataSpaceExecutableTemplateState.d.ts +48 -0
- package/lib/stores/DataSpaceExecutableTemplateState.d.ts.map +1 -0
- package/lib/stores/DataSpaceExecutableTemplateState.js +105 -0
- package/lib/stores/DataSpaceExecutableTemplateState.js.map +1 -0
- package/lib/stores/DataSpaceExecutionContextState.d.ts +4 -9
- package/lib/stores/DataSpaceExecutionContextState.d.ts.map +1 -1
- package/lib/stores/DataSpaceExecutionContextState.js +13 -39
- package/lib/stores/DataSpaceExecutionContextState.js.map +1 -1
- package/lib/stores/studio/DSL_DataSpace_GraphModifierHelper.d.ts +12 -6
- package/lib/stores/studio/DSL_DataSpace_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/studio/DSL_DataSpace_GraphModifierHelper.js +45 -3
- package/lib/stores/studio/DSL_DataSpace_GraphModifierHelper.js.map +1 -1
- package/package.json +9 -9
- package/src/components/DSL_DataProduct_ElementDriver.tsx +0 -14
- package/src/components/DataSpaceEditor.tsx +10 -10
- package/src/components/DataSpaceExecutableQueryAction.tsx +159 -0
- package/src/components/DataSpaceExecutionContextEditor.tsx +699 -558
- package/src/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.tsx +517 -60
- package/src/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.tsx +22 -198
- package/src/components/DataSpaceGeneralEditor/DataSpaceHomeTab.tsx +235 -0
- package/src/components/DataSpaceGeneralEditor/DataSpaceSidebar.tsx +60 -0
- package/src/components/DataSpaceGeneralEditor/DataSpaceValidation.tsx +83 -0
- package/src/components/DataSpaceQueryAction.tsx +19 -12
- package/src/stores/DataSpaceEditorState.ts +18 -0
- package/src/stores/DataSpaceExecutableTemplateState.ts +152 -0
- package/src/stores/DataSpaceExecutionContextState.ts +17 -70
- package/src/stores/studio/DSL_DataSpace_GraphModifierHelper.ts +79 -6
- package/tsconfig.json +6 -2
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDefaultExecutionContextSection.d.ts.map +0 -1
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDefaultExecutionContextSection.js +0 -138
- package/lib/components/DataSpaceGeneralEditor/DataSpaceDefaultExecutionContextSection.js.map +0 -1
- package/src/components/DataSpaceGeneralEditor/DataSpaceDefaultExecutionContextSection.tsx +0 -393
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
useEditorStore,
|
|
22
22
|
} from '@finos/legend-application-studio';
|
|
23
23
|
import { flowResult } from 'mobx';
|
|
24
|
-
import { guaranteeType } from '@finos/legend-shared';
|
|
24
|
+
import { guaranteeNonNullable, guaranteeType } from '@finos/legend-shared';
|
|
25
25
|
import {
|
|
26
26
|
DataSpace,
|
|
27
27
|
resolveUsableDataSpaceClasses,
|
|
@@ -41,6 +41,10 @@ export const queryDataSpace = async (
|
|
|
41
41
|
editorStore: EditorStore,
|
|
42
42
|
): Promise<void> => {
|
|
43
43
|
const embeddedQueryBuilderState = editorStore.embeddedQueryBuilderState;
|
|
44
|
+
const initialDefaultExecutionContext = guaranteeNonNullable(
|
|
45
|
+
dataSpace.defaultExecutionContext,
|
|
46
|
+
`Can't query data product '${dataSpace.path}': no default execution context defined`,
|
|
47
|
+
);
|
|
44
48
|
await flowResult(
|
|
45
49
|
embeddedQueryBuilderState.setEmbeddedQueryBuilderConfiguration({
|
|
46
50
|
setupQueryBuilderState: async () => {
|
|
@@ -57,7 +61,7 @@ export const queryDataSpace = async (
|
|
|
57
61
|
QueryBuilderAdvancedWorkflowState.INSTANCE,
|
|
58
62
|
QueryBuilderActionConfig.INSTANCE,
|
|
59
63
|
dataSpace,
|
|
60
|
-
|
|
64
|
+
initialDefaultExecutionContext,
|
|
61
65
|
false,
|
|
62
66
|
undefined,
|
|
63
67
|
async (dataSpaceInfo: ResolvedDataSpaceEntityWithOrigin) => {
|
|
@@ -67,9 +71,11 @@ export const queryDataSpace = async (
|
|
|
67
71
|
),
|
|
68
72
|
DataSpace,
|
|
69
73
|
);
|
|
70
|
-
|
|
74
|
+
const targetDefault = guaranteeNonNullable(
|
|
71
75
|
queryBuilderState.dataSpace.defaultExecutionContext,
|
|
76
|
+
`Can't query data product '${queryBuilderState.dataSpace.path}': no default execution context defined`,
|
|
72
77
|
);
|
|
78
|
+
queryBuilderState.setExecutionContext(targetDefault);
|
|
73
79
|
await queryBuilderState.propagateExecutionContextChange();
|
|
74
80
|
},
|
|
75
81
|
undefined,
|
|
@@ -79,10 +85,11 @@ export const queryDataSpace = async (
|
|
|
79
85
|
editorStore.applicationStore.config.options.queryBuilderConfig,
|
|
80
86
|
sourceInfo,
|
|
81
87
|
);
|
|
82
|
-
queryBuilderState.setExecutionContext(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
queryBuilderState.setExecutionContext(initialDefaultExecutionContext);
|
|
89
|
+
const mapping = guaranteeNonNullable(
|
|
90
|
+
queryBuilderState.executionContext.mapping,
|
|
91
|
+
`Can't query execution context '${queryBuilderState.executionContext.name}': no mapping configured`,
|
|
92
|
+
).value;
|
|
86
93
|
queryBuilderState.changeMapping(mapping);
|
|
87
94
|
const mappingModelCoverageAnalysisResult =
|
|
88
95
|
queryBuilderState.dataSpaceAnalysisResult?.mappingToMappingCoverageResult?.get(
|
|
@@ -92,16 +99,16 @@ export const queryDataSpace = async (
|
|
|
92
99
|
queryBuilderState.explorerState.mappingModelCoverageAnalysisResult =
|
|
93
100
|
mappingModelCoverageAnalysisResult;
|
|
94
101
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
)
|
|
102
|
+
const defaultRuntime =
|
|
103
|
+
queryBuilderState.executionContext.defaultRuntime;
|
|
104
|
+
if (defaultRuntime) {
|
|
105
|
+
queryBuilderState.changeRuntime(new RuntimePointer(defaultRuntime));
|
|
106
|
+
}
|
|
98
107
|
const compatibleClasses = resolveUsableDataSpaceClasses(
|
|
99
108
|
queryBuilderState.dataSpace,
|
|
100
109
|
mapping,
|
|
101
110
|
queryBuilderState.graphManagerState,
|
|
102
111
|
);
|
|
103
|
-
// if there is no chosen class or the chosen one is not compatible
|
|
104
|
-
// with the mapping then pick a compatible class if possible
|
|
105
112
|
if (
|
|
106
113
|
!queryBuilderState.sourceClass ||
|
|
107
114
|
!compatibleClasses.includes(queryBuilderState.sourceClass)
|
|
@@ -36,24 +36,42 @@ import {
|
|
|
36
36
|
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
37
37
|
import { guaranteeType } from '@finos/legend-shared';
|
|
38
38
|
import { DataSpaceExecutionContextState } from './DataSpaceExecutionContextState.js';
|
|
39
|
+
import { DataSpaceExecutableTemplateStateCache } from './DataSpaceExecutableTemplateState.js';
|
|
40
|
+
|
|
41
|
+
export enum DATA_SPACE_TAB {
|
|
42
|
+
HOME = 'Home',
|
|
43
|
+
EXECUTION_CONTEXTS = 'Execution Contexts',
|
|
44
|
+
EXECUTABLES = 'Executables',
|
|
45
|
+
}
|
|
39
46
|
|
|
40
47
|
export class DataSpaceEditorState extends ElementEditorState {
|
|
41
48
|
executionContextState: DataSpaceExecutionContextState;
|
|
49
|
+
readonly executableTemplateStates: DataSpaceExecutableTemplateStateCache;
|
|
50
|
+
selectedTab = DATA_SPACE_TAB.HOME;
|
|
42
51
|
|
|
43
52
|
constructor(editorStore: EditorStore, element: PackageableElement) {
|
|
44
53
|
super(editorStore, element);
|
|
45
54
|
|
|
46
55
|
makeObservable(this, {
|
|
47
56
|
executionContextState: observable,
|
|
57
|
+
selectedTab: observable,
|
|
48
58
|
dataSpace: computed,
|
|
49
59
|
reprocess: action,
|
|
50
60
|
isValidDataSpaceElement: action,
|
|
51
61
|
getDataSpaceElementOptions: action,
|
|
52
62
|
getDiagramOptions: action,
|
|
53
63
|
getDataSpaceExecutableOptions: action,
|
|
64
|
+
setSelectedTab: action,
|
|
54
65
|
});
|
|
55
66
|
|
|
56
67
|
this.executionContextState = new DataSpaceExecutionContextState(this);
|
|
68
|
+
this.executableTemplateStates = new DataSpaceExecutableTemplateStateCache(
|
|
69
|
+
editorStore,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
setSelectedTab(tab: DATA_SPACE_TAB): void {
|
|
74
|
+
this.selectedTab = tab;
|
|
57
75
|
}
|
|
58
76
|
|
|
59
77
|
isValidDataSpaceElement(
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2026-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 { EditorStore } from '@finos/legend-application-studio';
|
|
18
|
+
import {
|
|
19
|
+
GRAPH_MANAGER_EVENT,
|
|
20
|
+
isStubbed_RawLambda,
|
|
21
|
+
LAMBDA_PIPE,
|
|
22
|
+
ParserError,
|
|
23
|
+
RawLambda,
|
|
24
|
+
} from '@finos/legend-graph';
|
|
25
|
+
import { LambdaEditorState } from '@finos/legend-query-builder';
|
|
26
|
+
import {
|
|
27
|
+
assertErrorThrown,
|
|
28
|
+
LogEvent,
|
|
29
|
+
type GeneratorFn,
|
|
30
|
+
} from '@finos/legend-shared';
|
|
31
|
+
import type { DataSpaceExecutableTemplate } from '@finos/legend-extension-dsl-data-space/graph';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* A fully empty `RawLambda` (no body, no parameters) is not valid PURE and
|
|
35
|
+
* will fail to compile once it's part of the graph — e.g. the very first
|
|
36
|
+
* `analyzeMappingModelCoverage` call made when opening Query Builder sends
|
|
37
|
+
* the full graph model to engine for compilation. A newly created inline
|
|
38
|
+
* executable therefore needs a self-contained, always-valid placeholder
|
|
39
|
+
* query (an empty string literal) rather than `stub_RawLambda()`.
|
|
40
|
+
*/
|
|
41
|
+
export const stub_DataSpaceExecutableTemplateQuery = (): RawLambda =>
|
|
42
|
+
new RawLambda([], [{ _type: 'string', value: '' }]);
|
|
43
|
+
|
|
44
|
+
export class DataSpaceExecutableTemplateLambdaState extends LambdaEditorState {
|
|
45
|
+
readonly editorStore: EditorStore;
|
|
46
|
+
readonly executableTemplate: DataSpaceExecutableTemplate;
|
|
47
|
+
lastComputedLambdaString: string | undefined;
|
|
48
|
+
|
|
49
|
+
constructor(
|
|
50
|
+
editorStore: EditorStore,
|
|
51
|
+
executableTemplate: DataSpaceExecutableTemplate,
|
|
52
|
+
) {
|
|
53
|
+
super('', LAMBDA_PIPE, { typeAheadEnabled: true });
|
|
54
|
+
this.editorStore = editorStore;
|
|
55
|
+
this.executableTemplate = executableTemplate;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
override get lambdaId(): string {
|
|
59
|
+
return `data-space-executable-template-${this.executableTemplate.title}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
*convertLambdaGrammarStringToObject(): GeneratorFn<void> {
|
|
63
|
+
if (this.lambdaString === this.lastComputedLambdaString) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (this.lambdaString) {
|
|
67
|
+
try {
|
|
68
|
+
const lambda =
|
|
69
|
+
(yield this.editorStore.graphManagerState.graphManager.pureCodeToLambda(
|
|
70
|
+
this.fullLambdaString,
|
|
71
|
+
this.lambdaId,
|
|
72
|
+
)) as RawLambda;
|
|
73
|
+
this.setParserError(undefined);
|
|
74
|
+
this.executableTemplate.query = lambda;
|
|
75
|
+
this.lastComputedLambdaString = this.lambdaString;
|
|
76
|
+
} catch (error) {
|
|
77
|
+
assertErrorThrown(error);
|
|
78
|
+
if (error instanceof ParserError) {
|
|
79
|
+
this.setParserError(error);
|
|
80
|
+
}
|
|
81
|
+
this.editorStore.applicationStore.logService.error(
|
|
82
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
|
|
83
|
+
error,
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
} else {
|
|
87
|
+
this.clearErrors();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
*convertLambdaObjectToGrammarString(options?: {
|
|
92
|
+
pretty?: boolean | undefined;
|
|
93
|
+
preserveCompilationError?: boolean | undefined;
|
|
94
|
+
}): GeneratorFn<void> {
|
|
95
|
+
if (!isStubbed_RawLambda(this.executableTemplate.query)) {
|
|
96
|
+
try {
|
|
97
|
+
const lambdas = new Map<string, RawLambda>();
|
|
98
|
+
lambdas.set(this.lambdaId, this.executableTemplate.query);
|
|
99
|
+
const isolatedLambdas =
|
|
100
|
+
(yield this.editorStore.graphManagerState.graphManager.lambdasToPureCode(
|
|
101
|
+
lambdas,
|
|
102
|
+
options?.pretty,
|
|
103
|
+
)) as Map<string, string>;
|
|
104
|
+
const grammarText = isolatedLambdas.get(this.lambdaId);
|
|
105
|
+
const nextLambdaString =
|
|
106
|
+
grammarText !== undefined
|
|
107
|
+
? this.extractLambdaString(grammarText)
|
|
108
|
+
: '';
|
|
109
|
+
this.setLambdaString(nextLambdaString);
|
|
110
|
+
this.lastComputedLambdaString = nextLambdaString || undefined;
|
|
111
|
+
this.clearErrors({
|
|
112
|
+
preserveCompilationError: options?.preserveCompilationError,
|
|
113
|
+
});
|
|
114
|
+
} catch (error) {
|
|
115
|
+
assertErrorThrown(error);
|
|
116
|
+
this.editorStore.applicationStore.logService.error(
|
|
117
|
+
LogEvent.create(GRAPH_MANAGER_EVENT.PARSING_FAILURE),
|
|
118
|
+
error,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
this.clearErrors();
|
|
123
|
+
this.setLambdaString('');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export class DataSpaceExecutableTemplateStateCache {
|
|
129
|
+
readonly editorStore: EditorStore;
|
|
130
|
+
private readonly states = new Map<
|
|
131
|
+
DataSpaceExecutableTemplate,
|
|
132
|
+
DataSpaceExecutableTemplateLambdaState
|
|
133
|
+
>();
|
|
134
|
+
|
|
135
|
+
constructor(editorStore: EditorStore) {
|
|
136
|
+
this.editorStore = editorStore;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
getLambdaState(
|
|
140
|
+
executableTemplate: DataSpaceExecutableTemplate,
|
|
141
|
+
): DataSpaceExecutableTemplateLambdaState {
|
|
142
|
+
let state = this.states.get(executableTemplate);
|
|
143
|
+
if (!state) {
|
|
144
|
+
state = new DataSpaceExecutableTemplateLambdaState(
|
|
145
|
+
this.editorStore,
|
|
146
|
+
executableTemplate,
|
|
147
|
+
);
|
|
148
|
+
this.states.set(executableTemplate, state);
|
|
149
|
+
}
|
|
150
|
+
return state;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -15,50 +15,35 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import type { EditorStore } from '@finos/legend-application-studio';
|
|
18
|
-
import { action, makeObservable, observable } from 'mobx';
|
|
18
|
+
import { action, computed, makeObservable, observable } from 'mobx';
|
|
19
19
|
import type { DataSpaceEditorState } from './DataSpaceEditorState.js';
|
|
20
|
-
import {
|
|
20
|
+
import type {
|
|
21
|
+
DataSpace,
|
|
21
22
|
DataSpaceExecutionContext,
|
|
22
|
-
type DataSpace,
|
|
23
23
|
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
24
24
|
import {
|
|
25
25
|
dataSpace_addExecutionContext,
|
|
26
26
|
dataSpace_removeExecutionContext,
|
|
27
|
-
dataSpace_setExecutionContextDefaultRuntime,
|
|
28
|
-
dataSpace_setExecutionContextName,
|
|
29
27
|
} from './studio/DSL_DataSpace_GraphModifierHelper.js';
|
|
30
|
-
import {
|
|
31
|
-
PackageableElementExplicitReference,
|
|
32
|
-
stub_Mapping,
|
|
33
|
-
stub_PackageableRuntime,
|
|
34
|
-
type Mapping,
|
|
35
|
-
type PackageableRuntime,
|
|
36
|
-
} from '@finos/legend-graph';
|
|
37
28
|
|
|
38
29
|
export class DataSpaceExecutionContextState {
|
|
39
30
|
readonly dataSpaceEditorState: DataSpaceEditorState;
|
|
40
31
|
readonly editorStore: EditorStore;
|
|
41
|
-
executionContexts: DataSpaceExecutionContext[];
|
|
42
32
|
selectedExecutionContext: DataSpaceExecutionContext | undefined;
|
|
43
33
|
newExecutionContextModal = false;
|
|
44
|
-
executionContextToRename: DataSpaceExecutionContext | undefined;
|
|
45
34
|
|
|
46
35
|
constructor(dataSpaceEditorState: DataSpaceEditorState) {
|
|
47
36
|
makeObservable(this, {
|
|
48
|
-
executionContexts: observable,
|
|
49
37
|
selectedExecutionContext: observable,
|
|
50
|
-
executionContextToRename: observable,
|
|
51
38
|
newExecutionContextModal: observable,
|
|
39
|
+
executionContexts: computed,
|
|
52
40
|
addExecutionContext: action,
|
|
53
41
|
removeExecutionContext: action,
|
|
54
|
-
renameExecutionContext: action,
|
|
55
42
|
setSelectedExecutionContext: action,
|
|
56
|
-
setExecutionContextToRename: action,
|
|
57
43
|
setNewExecutionContextModal: action,
|
|
58
44
|
});
|
|
59
|
-
this.executionContexts = dataSpaceEditorState.dataSpace.executionContexts;
|
|
60
45
|
this.selectedExecutionContext =
|
|
61
|
-
dataSpaceEditorState.dataSpace.executionContexts[0];
|
|
46
|
+
dataSpaceEditorState.dataSpace.executionContexts?.[0];
|
|
62
47
|
this.dataSpaceEditorState = dataSpaceEditorState;
|
|
63
48
|
this.editorStore = dataSpaceEditorState.editorStore;
|
|
64
49
|
}
|
|
@@ -67,69 +52,31 @@ export class DataSpaceExecutionContextState {
|
|
|
67
52
|
return this.dataSpaceEditorState.dataSpace;
|
|
68
53
|
}
|
|
69
54
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
val.name = name;
|
|
73
|
-
const mapping = this.editorStore.graphManagerState.usableMappings[0];
|
|
74
|
-
const runtime = mapping
|
|
75
|
-
? this.editorStore.graphManagerState.graph.ownRuntimes.filter(
|
|
76
|
-
(_runtime) =>
|
|
77
|
-
_runtime.runtimeValue.mappings
|
|
78
|
-
.map((m) => m.value)
|
|
79
|
-
.includes(mapping),
|
|
80
|
-
)[0]
|
|
81
|
-
: undefined;
|
|
82
|
-
val.mapping = PackageableElementExplicitReference.create(
|
|
83
|
-
mapping ?? stub_Mapping(),
|
|
84
|
-
);
|
|
85
|
-
val.defaultRuntime = PackageableElementExplicitReference.create(
|
|
86
|
-
runtime ?? stub_PackageableRuntime(),
|
|
87
|
-
);
|
|
88
|
-
dataSpace_addExecutionContext(this.dataSpace, val);
|
|
89
|
-
this.selectedExecutionContext = val;
|
|
55
|
+
get executionContexts(): DataSpaceExecutionContext[] {
|
|
56
|
+
return this.dataSpace.executionContexts ?? [];
|
|
90
57
|
}
|
|
91
58
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
dataSpace_removeExecutionContext(this.dataSpace, dataSpaceExecutionContext);
|
|
59
|
+
addExecutionContext(executionContext: DataSpaceExecutionContext): void {
|
|
60
|
+
dataSpace_addExecutionContext(this.dataSpace, executionContext);
|
|
61
|
+
this.selectedExecutionContext = executionContext;
|
|
96
62
|
}
|
|
97
63
|
|
|
98
|
-
|
|
64
|
+
removeExecutionContext(
|
|
99
65
|
dataSpaceExecutionContext: DataSpaceExecutionContext,
|
|
100
|
-
newName: string,
|
|
101
66
|
): void {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
this.selectedExecutionContext = val;
|
|
67
|
+
dataSpace_removeExecutionContext(this.dataSpace, dataSpaceExecutionContext);
|
|
68
|
+
if (this.selectedExecutionContext === dataSpaceExecutionContext) {
|
|
69
|
+
this.selectedExecutionContext = this.executionContexts[0];
|
|
70
|
+
}
|
|
107
71
|
}
|
|
108
72
|
|
|
109
|
-
|
|
73
|
+
setSelectedExecutionContext(
|
|
110
74
|
val: DataSpaceExecutionContext | undefined,
|
|
111
75
|
): void {
|
|
112
|
-
this.
|
|
76
|
+
this.selectedExecutionContext = val;
|
|
113
77
|
}
|
|
114
78
|
|
|
115
79
|
setNewExecutionContextModal(val: boolean): void {
|
|
116
80
|
this.newExecutionContextModal = val;
|
|
117
81
|
}
|
|
118
|
-
|
|
119
|
-
autoSelectRuntimeOnMappingChange(mapping: Mapping): void {
|
|
120
|
-
if (this.selectedExecutionContext) {
|
|
121
|
-
const runtimes =
|
|
122
|
-
this.editorStore.graphManagerState.graph.ownRuntimes.filter((runtime) =>
|
|
123
|
-
runtime.runtimeValue.mappings.map((m) => m.value).includes(mapping),
|
|
124
|
-
);
|
|
125
|
-
if (runtimes.length) {
|
|
126
|
-
dataSpace_setExecutionContextDefaultRuntime(
|
|
127
|
-
this.selectedExecutionContext,
|
|
128
|
-
PackageableElementExplicitReference.create(
|
|
129
|
-
runtimes[0] as PackageableRuntime,
|
|
130
|
-
),
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
82
|
}
|
|
@@ -21,15 +21,19 @@ import {
|
|
|
21
21
|
type DataSpaceElementPointer,
|
|
22
22
|
type DataSpaceExecutable,
|
|
23
23
|
type DataSpaceExecutionContext,
|
|
24
|
+
type DataSpaceMappingProvider,
|
|
24
25
|
type DataSpaceSupportCombinedInfo,
|
|
25
26
|
type DataSpaceSupportEmail,
|
|
26
27
|
type DataSpaceSupportInfo,
|
|
27
28
|
observe_DataSpaceDiagram,
|
|
28
29
|
observe_DataSpaceElementPointer,
|
|
30
|
+
observe_DataSpaceExecutable,
|
|
29
31
|
observe_DataSpaceExecutionContext,
|
|
32
|
+
observe_DataSpaceMappingProvider,
|
|
30
33
|
observe_DataSpaceSupportInfo,
|
|
31
34
|
} from '@finos/legend-extension-dsl-data-space/graph';
|
|
32
35
|
import type {
|
|
36
|
+
PackageableElement,
|
|
33
37
|
PackageableElementReference,
|
|
34
38
|
Mapping,
|
|
35
39
|
PackageableRuntime,
|
|
@@ -54,7 +58,7 @@ export const dataSpace_setDescription = action(
|
|
|
54
58
|
export const dataSpace_setExecutionContexts = action(
|
|
55
59
|
(
|
|
56
60
|
dataSpace: DataSpace,
|
|
57
|
-
executionContexts: DataSpaceExecutionContext[],
|
|
61
|
+
executionContexts: DataSpaceExecutionContext[] | undefined,
|
|
58
62
|
): void => {
|
|
59
63
|
dataSpace.executionContexts = executionContexts;
|
|
60
64
|
},
|
|
@@ -63,7 +67,7 @@ export const dataSpace_setExecutionContexts = action(
|
|
|
63
67
|
export const dataSpace_setDefaultExecutionContext = action(
|
|
64
68
|
(
|
|
65
69
|
dataSpace: DataSpace,
|
|
66
|
-
defaultExecutionContext: DataSpaceExecutionContext,
|
|
70
|
+
defaultExecutionContext: DataSpaceExecutionContext | undefined,
|
|
67
71
|
): void => {
|
|
68
72
|
dataSpace.defaultExecutionContext = defaultExecutionContext;
|
|
69
73
|
},
|
|
@@ -108,6 +112,9 @@ export const dataSpace_setSupportInfo = action(
|
|
|
108
112
|
// Array item management
|
|
109
113
|
export const dataSpace_addExecutionContext = action(
|
|
110
114
|
(dataSpace: DataSpace, executionContext: DataSpaceExecutionContext): void => {
|
|
115
|
+
if (!dataSpace.executionContexts) {
|
|
116
|
+
dataSpace.executionContexts = [];
|
|
117
|
+
}
|
|
111
118
|
addUniqueEntry(
|
|
112
119
|
dataSpace.executionContexts,
|
|
113
120
|
observe_DataSpaceExecutionContext(executionContext),
|
|
@@ -120,10 +127,21 @@ export const dataSpace_removeExecutionContext = action(
|
|
|
120
127
|
dataSpace: DataSpace,
|
|
121
128
|
dataSpaceExecutionContext: DataSpaceExecutionContext,
|
|
122
129
|
): void => {
|
|
130
|
+
if (!dataSpace.executionContexts) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
123
133
|
const index = dataSpace.executionContexts.indexOf(
|
|
124
134
|
dataSpaceExecutionContext,
|
|
125
135
|
);
|
|
126
|
-
|
|
136
|
+
if (index !== -1) {
|
|
137
|
+
dataSpace.executionContexts.splice(index, 1);
|
|
138
|
+
}
|
|
139
|
+
if (dataSpace.executionContexts.length === 0) {
|
|
140
|
+
dataSpace.executionContexts = undefined;
|
|
141
|
+
}
|
|
142
|
+
if (dataSpace.defaultExecutionContext === dataSpaceExecutionContext) {
|
|
143
|
+
dataSpace.defaultExecutionContext = undefined;
|
|
144
|
+
}
|
|
127
145
|
},
|
|
128
146
|
);
|
|
129
147
|
|
|
@@ -159,7 +177,7 @@ export const dataSpace_addExecutable = action(
|
|
|
159
177
|
if (!dataSpace.executables) {
|
|
160
178
|
dataSpace.executables = [];
|
|
161
179
|
}
|
|
162
|
-
dataSpace.executables.push(executable);
|
|
180
|
+
dataSpace.executables.push(observe_DataSpaceExecutable(executable));
|
|
163
181
|
},
|
|
164
182
|
);
|
|
165
183
|
|
|
@@ -172,6 +190,27 @@ export const dataSpace_removeExecutable = action(
|
|
|
172
190
|
},
|
|
173
191
|
);
|
|
174
192
|
|
|
193
|
+
export const dataSpace_setExecutableTitle = action(
|
|
194
|
+
(executable: DataSpaceExecutable, title: string): void => {
|
|
195
|
+
executable.title = title;
|
|
196
|
+
},
|
|
197
|
+
);
|
|
198
|
+
|
|
199
|
+
export const dataSpace_setExecutableDescription = action(
|
|
200
|
+
(executable: DataSpaceExecutable, description: string | undefined): void => {
|
|
201
|
+
executable.description = description;
|
|
202
|
+
},
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
export const dataSpace_setExecutableExecutionContextKey = action(
|
|
206
|
+
(
|
|
207
|
+
executable: DataSpaceExecutable,
|
|
208
|
+
executionContextKey: string | undefined,
|
|
209
|
+
): void => {
|
|
210
|
+
executable.executionContextKey = executionContextKey;
|
|
211
|
+
},
|
|
212
|
+
);
|
|
213
|
+
|
|
175
214
|
export const dataSpace_addDiagram = action(
|
|
176
215
|
(dataSpace: DataSpace, diagram: DataSpaceDiagram): void => {
|
|
177
216
|
if (!dataSpace.diagrams) {
|
|
@@ -232,21 +271,55 @@ export const dataSpace_setExecutionContextDescription = action(
|
|
|
232
271
|
export const dataSpace_setExecutionContextMapping = action(
|
|
233
272
|
(
|
|
234
273
|
executionContext: DataSpaceExecutionContext,
|
|
235
|
-
mapping: PackageableElementReference<Mapping
|
|
274
|
+
mapping: PackageableElementReference<Mapping> | undefined,
|
|
236
275
|
): void => {
|
|
237
276
|
executionContext.mapping = mapping;
|
|
277
|
+
if (mapping) {
|
|
278
|
+
executionContext.mappingProvider = undefined;
|
|
279
|
+
}
|
|
238
280
|
},
|
|
239
281
|
);
|
|
240
282
|
|
|
241
283
|
export const dataSpace_setExecutionContextDefaultRuntime = action(
|
|
242
284
|
(
|
|
243
285
|
executionContext: DataSpaceExecutionContext,
|
|
244
|
-
defaultRuntime: PackageableElementReference<PackageableRuntime
|
|
286
|
+
defaultRuntime: PackageableElementReference<PackageableRuntime> | undefined,
|
|
245
287
|
): void => {
|
|
246
288
|
executionContext.defaultRuntime = defaultRuntime;
|
|
247
289
|
},
|
|
248
290
|
);
|
|
249
291
|
|
|
292
|
+
export const dataSpace_setExecutionContextMappingProvider = action(
|
|
293
|
+
(
|
|
294
|
+
executionContext: DataSpaceExecutionContext,
|
|
295
|
+
mappingProvider: DataSpaceMappingProvider | undefined,
|
|
296
|
+
): void => {
|
|
297
|
+
executionContext.mappingProvider =
|
|
298
|
+
mappingProvider !== undefined
|
|
299
|
+
? observe_DataSpaceMappingProvider(mappingProvider)
|
|
300
|
+
: undefined;
|
|
301
|
+
if (mappingProvider) {
|
|
302
|
+
executionContext.mapping = undefined;
|
|
303
|
+
}
|
|
304
|
+
},
|
|
305
|
+
);
|
|
306
|
+
|
|
307
|
+
export const dataSpace_setMappingProviderElement = action(
|
|
308
|
+
(
|
|
309
|
+
mappingProvider: DataSpaceMappingProvider,
|
|
310
|
+
element: PackageableElementReference<PackageableElement>,
|
|
311
|
+
): void => {
|
|
312
|
+
mappingProvider.element = element;
|
|
313
|
+
mappingProvider.keys = [];
|
|
314
|
+
},
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
export const dataSpace_setMappingProviderKeys = action(
|
|
318
|
+
(mappingProvider: DataSpaceMappingProvider, keys: string[]): void => {
|
|
319
|
+
mappingProvider.keys = keys;
|
|
320
|
+
},
|
|
321
|
+
);
|
|
322
|
+
|
|
250
323
|
export const dataSpace_setExecutionContextTestData = action(
|
|
251
324
|
(
|
|
252
325
|
executionContext: DataSpaceExecutionContext,
|
package/tsconfig.json
CHANGED
|
@@ -55,6 +55,7 @@
|
|
|
55
55
|
"./src/__lib__/DSL_DataSpace_LegendStudioCodeSnippet.ts",
|
|
56
56
|
"./src/__lib__/DSL_DataSpace_LegendStudioDocumentation.ts",
|
|
57
57
|
"./src/stores/DataSpaceEditorState.ts",
|
|
58
|
+
"./src/stores/DataSpaceExecutableTemplateState.ts",
|
|
58
59
|
"./src/stores/DataSpaceExecutionContextState.ts",
|
|
59
60
|
"./src/stores/DataSpacePreviewState.ts",
|
|
60
61
|
"./src/stores/DataSpaceTemplateQueryPromotionReviewerStore.ts",
|
|
@@ -63,16 +64,19 @@
|
|
|
63
64
|
"./src/components/DSL_DataSpace_LegendStudioApplicationPlugin.tsx",
|
|
64
65
|
"./src/components/DSL_NewDataProductEditor.tsx",
|
|
65
66
|
"./src/components/DataSpaceEditor.tsx",
|
|
67
|
+
"./src/components/DataSpaceExecutableQueryAction.tsx",
|
|
66
68
|
"./src/components/DataSpaceExecutionContextEditor.tsx",
|
|
67
69
|
"./src/components/DataSpacePreviewAction.tsx",
|
|
68
70
|
"./src/components/DataSpaceQueryAction.tsx",
|
|
69
71
|
"./src/components/DataSpaceTemplateQueryPromoteReview.tsx",
|
|
70
|
-
"./src/components/DataSpaceGeneralEditor/DataSpaceDefaultExecutionContextSection.tsx",
|
|
71
72
|
"./src/components/DataSpaceGeneralEditor/DataSpaceDiagramsSection.tsx",
|
|
72
73
|
"./src/components/DataSpaceGeneralEditor/DataSpaceElementsSection.tsx",
|
|
73
74
|
"./src/components/DataSpaceGeneralEditor/DataSpaceExecutablesSection.tsx",
|
|
74
75
|
"./src/components/DataSpaceGeneralEditor/DataSpaceGeneralEditor.tsx",
|
|
75
|
-
"./src/components/DataSpaceGeneralEditor/
|
|
76
|
+
"./src/components/DataSpaceGeneralEditor/DataSpaceHomeTab.tsx",
|
|
77
|
+
"./src/components/DataSpaceGeneralEditor/DataSpaceSidebar.tsx",
|
|
78
|
+
"./src/components/DataSpaceGeneralEditor/DataSpaceSupportInfoSection.tsx",
|
|
79
|
+
"./src/components/DataSpaceGeneralEditor/DataSpaceValidation.tsx"
|
|
76
80
|
],
|
|
77
81
|
"include": [
|
|
78
82
|
"src/**/*.ts",
|
package/lib/components/DataSpaceGeneralEditor/DataSpaceDefaultExecutionContextSection.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataSpaceDefaultExecutionContextSection.d.ts","sourceRoot":"","sources":["../../../src/components/DataSpaceGeneralEditor/DataSpaceDefaultExecutionContextSection.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgDH,eAAO,MAAM,uCAAuC;;CA0UlD,CAAC"}
|