@finos/legend-application-studio 28.18.123 → 28.18.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__lib__/LegendStudioNavigation.d.ts +7 -0
- package/lib/__lib__/LegendStudioNavigation.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioNavigation.js +5 -0
- package/lib/__lib__/LegendStudioNavigation.js.map +1 -1
- package/lib/application/LegendIngestionConfiguration.d.ts +40 -0
- package/lib/application/LegendIngestionConfiguration.d.ts.map +1 -0
- package/lib/application/LegendIngestionConfiguration.js +57 -0
- package/lib/application/LegendIngestionConfiguration.js.map +1 -0
- package/lib/application/LegendStudioApplicationConfig.d.ts +2 -0
- package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendStudioApplicationConfig.js +6 -0
- package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
- package/lib/components/ElementIconUtils.d.ts.map +1 -1
- package/lib/components/ElementIconUtils.js +3 -1
- package/lib/components/ElementIconUtils.js.map +1 -1
- package/lib/components/LegendStudioWebApplication.d.ts.map +1 -1
- package/lib/components/LegendStudioWebApplication.js +16 -0
- package/lib/components/LegendStudioWebApplication.js.map +1 -1
- package/lib/components/editor/Editor.d.ts.map +1 -1
- package/lib/components/editor/Editor.js +3 -2
- package/lib/components/editor/Editor.js.map +1 -1
- package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
- package/lib/components/editor/editor-group/EditorGroup.js +5 -0
- package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
- package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.d.ts +19 -0
- package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.d.ts.map +1 -0
- package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.js +71 -0
- package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.js.map +1 -0
- package/lib/components/lazy-text-editor/LazyTextEditor.js +1 -1
- package/lib/components/lazy-text-editor/LazyTextEditor.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +3 -1
- package/lib/stores/editor/EditorGraphState.d.ts.map +1 -1
- package/lib/stores/editor/EditorGraphState.js +4 -1
- package/lib/stores/editor/EditorGraphState.js.map +1 -1
- package/lib/stores/editor/EditorStore.d.ts +6 -2
- package/lib/stores/editor/EditorStore.d.ts.map +1 -1
- package/lib/stores/editor/EditorStore.js +21 -4
- package/lib/stores/editor/EditorStore.js.map +1 -1
- package/lib/stores/editor/EditorTabManagerState.d.ts +2 -1
- package/lib/stores/editor/EditorTabManagerState.d.ts.map +1 -1
- package/lib/stores/editor/EditorTabManagerState.js +6 -2
- package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
- package/lib/stores/editor/GraphEditFormModeState.d.ts +2 -1
- package/lib/stores/editor/GraphEditFormModeState.d.ts.map +1 -1
- package/lib/stores/editor/GraphEditFormModeState.js +2 -2
- package/lib/stores/editor/GraphEditFormModeState.js.map +1 -1
- package/lib/stores/editor/GraphEditorMode.d.ts +2 -1
- package/lib/stores/editor/GraphEditorMode.d.ts.map +1 -1
- package/lib/stores/editor/GraphEditorMode.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.d.ts +30 -0
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.js +50 -0
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.js.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.d.ts +2 -1
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.js +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ElementEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.d.ts +37 -0
- package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js +107 -0
- package/lib/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js.map +1 -0
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts +2 -1
- package/lib/stores/editor/utils/ModelClassifierUtils.d.ts.map +1 -1
- package/lib/stores/editor/utils/ModelClassifierUtils.js +1 -0
- package/lib/stores/editor/utils/ModelClassifierUtils.js.map +1 -1
- package/lib/stores/ingestion/IngestDeploymentServerClient.d.ts +29 -0
- package/lib/stores/ingestion/IngestDeploymentServerClient.d.ts.map +1 -0
- package/lib/stores/ingestion/IngestDeploymentServerClient.js +49 -0
- package/lib/stores/ingestion/IngestDeploymentServerClient.js.map +1 -0
- package/lib/stores/ingestion/IngestDiscoveryServerClient.d.ts +26 -0
- package/lib/stores/ingestion/IngestDiscoveryServerClient.d.ts.map +1 -0
- package/lib/stores/ingestion/IngestDiscoveryServerClient.js +35 -0
- package/lib/stores/ingestion/IngestDiscoveryServerClient.js.map +1 -0
- package/lib/stores/ingestion/IngestionDeploymentResponse.d.ts +30 -0
- package/lib/stores/ingestion/IngestionDeploymentResponse.d.ts.map +1 -0
- package/lib/stores/ingestion/IngestionDeploymentResponse.js +37 -0
- package/lib/stores/ingestion/IngestionDeploymentResponse.js.map +1 -0
- package/lib/stores/ingestion/IngestionManager.d.ts +35 -0
- package/lib/stores/ingestion/IngestionManager.d.ts.map +1 -0
- package/lib/stores/ingestion/IngestionManager.js +80 -0
- package/lib/stores/ingestion/IngestionManager.js.map +1 -0
- package/package.json +10 -8
- package/src/__lib__/LegendStudioNavigation.ts +14 -0
- package/src/application/LegendIngestionConfiguration.ts +94 -0
- package/src/application/LegendStudioApplicationConfig.ts +15 -0
- package/src/components/ElementIconUtils.tsx +3 -0
- package/src/components/LegendStudioWebApplication.tsx +29 -0
- package/src/components/editor/Editor.tsx +8 -3
- package/src/components/editor/editor-group/EditorGroup.tsx +4 -1
- package/src/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.tsx +156 -0
- package/src/components/lazy-text-editor/LazyTextEditor.tsx +1 -1
- package/src/stores/editor/EditorGraphState.ts +3 -0
- package/src/stores/editor/EditorStore.ts +39 -1
- package/src/stores/editor/EditorTabManagerState.ts +6 -0
- package/src/stores/editor/GraphEditFormModeState.ts +9 -2
- package/src/stores/editor/GraphEditorMode.ts +5 -1
- package/src/stores/editor/editor-state/element-editor-state/ElementEditorInitialConfiguration.ts +97 -0
- package/src/stores/editor/editor-state/element-editor-state/ElementEditorState.ts +6 -1
- package/src/stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.ts +169 -0
- package/src/stores/editor/utils/ModelClassifierUtils.ts +1 -0
- package/src/stores/ingestion/IngestDeploymentServerClient.ts +83 -0
- package/src/stores/ingestion/IngestDiscoveryServerClient.ts +52 -0
- package/src/stores/ingestion/IngestionDeploymentResponse.ts +45 -0
- package/src/stores/ingestion/IngestionManager.ts +151 -0
- package/tsconfig.json +8 -0
@@ -0,0 +1,94 @@
|
|
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
|
+
assertNonEmptyString,
|
19
|
+
SerializationFactory,
|
20
|
+
usingModelSchema,
|
21
|
+
} from '@finos/legend-shared';
|
22
|
+
import type { AuthProviderProps } from 'react-oidc-context';
|
23
|
+
import { createModelSchema, primitive, raw } from 'serializr';
|
24
|
+
|
25
|
+
export class IngestDeploymentOIDC {
|
26
|
+
redirectPath!: string;
|
27
|
+
silentRedirectPath!: string;
|
28
|
+
authProviderProps!: AuthProviderProps;
|
29
|
+
|
30
|
+
static readonly serialization = new SerializationFactory(
|
31
|
+
createModelSchema(IngestDeploymentOIDC, {
|
32
|
+
redirectPath: primitive(),
|
33
|
+
silentRedirectPath: primitive(),
|
34
|
+
authProviderProps: raw(),
|
35
|
+
}),
|
36
|
+
);
|
37
|
+
}
|
38
|
+
|
39
|
+
export class IngestDeploymentServerConfig {
|
40
|
+
environmentClassification!: string;
|
41
|
+
ingestServerUrl!: string;
|
42
|
+
|
43
|
+
static readonly serialization = new SerializationFactory(
|
44
|
+
createModelSchema(IngestDeploymentServerConfig, {
|
45
|
+
environmentClassification: primitive(),
|
46
|
+
ingestServerUrl: primitive(),
|
47
|
+
}),
|
48
|
+
);
|
49
|
+
}
|
50
|
+
|
51
|
+
export class IngestionDeploymentConfiguration {
|
52
|
+
oidcConfig!: IngestDeploymentOIDC;
|
53
|
+
defaultServer!: IngestDeploymentServerConfig;
|
54
|
+
|
55
|
+
static readonly serialization = new SerializationFactory(
|
56
|
+
createModelSchema(IngestionDeploymentConfiguration, {
|
57
|
+
oidcConfig: usingModelSchema(IngestDeploymentOIDC.serialization.schema),
|
58
|
+
defaultServer: usingModelSchema(
|
59
|
+
IngestDeploymentServerConfig.serialization.schema,
|
60
|
+
),
|
61
|
+
}),
|
62
|
+
);
|
63
|
+
}
|
64
|
+
|
65
|
+
export class LegendIngestionConfiguration {
|
66
|
+
discoveryUrl!: string;
|
67
|
+
deployment!: IngestionDeploymentConfiguration;
|
68
|
+
|
69
|
+
static readonly serialization = new SerializationFactory(
|
70
|
+
createModelSchema(LegendIngestionConfiguration, {
|
71
|
+
discoveryUrl: primitive(),
|
72
|
+
deployment: usingModelSchema(
|
73
|
+
IngestionDeploymentConfiguration.serialization.schema,
|
74
|
+
),
|
75
|
+
}),
|
76
|
+
);
|
77
|
+
}
|
78
|
+
|
79
|
+
export const validateIngestionDeploymentConfiguration = (
|
80
|
+
config: LegendIngestionConfiguration,
|
81
|
+
): void => {
|
82
|
+
assertNonEmptyString(
|
83
|
+
config.deployment.defaultServer.environmentClassification,
|
84
|
+
'Ingestion deployment server environment classification is missing',
|
85
|
+
);
|
86
|
+
assertNonEmptyString(
|
87
|
+
config.deployment.defaultServer.ingestServerUrl,
|
88
|
+
'Ingestion deployment server URL is missing',
|
89
|
+
);
|
90
|
+
assertNonEmptyString(
|
91
|
+
config.discoveryUrl,
|
92
|
+
'Ingestion discovery URL is missing',
|
93
|
+
);
|
94
|
+
};
|
@@ -35,6 +35,10 @@ import {
|
|
35
35
|
type LegendApplicationConfigurationData,
|
36
36
|
} from '@finos/legend-application';
|
37
37
|
import { QueryBuilderConfig } from '@finos/legend-query-builder';
|
38
|
+
import {
|
39
|
+
LegendIngestionConfiguration,
|
40
|
+
validateIngestionDeploymentConfiguration,
|
41
|
+
} from './LegendIngestionConfiguration.js';
|
38
42
|
|
39
43
|
export class ServiceRegistrationEnvironmentConfig {
|
40
44
|
env!: string;
|
@@ -106,6 +110,8 @@ class LegendStudioApplicationCoreOptions {
|
|
106
110
|
*/
|
107
111
|
queryBuilderConfig: QueryBuilderConfig | undefined;
|
108
112
|
|
113
|
+
ingestDeploymentConfig: LegendIngestionConfiguration | undefined;
|
114
|
+
|
109
115
|
private static readonly serialization = new SerializationFactory(
|
110
116
|
createModelSchema(LegendStudioApplicationCoreOptions, {
|
111
117
|
enableGraphBuilderStrictMode: optional(primitive()),
|
@@ -120,6 +126,9 @@ class LegendStudioApplicationCoreOptions {
|
|
120
126
|
queryBuilderConfig: optional(
|
121
127
|
usingModelSchema(QueryBuilderConfig.serialization.schema),
|
122
128
|
),
|
129
|
+
ingestDeploymentConfig: optional(
|
130
|
+
usingModelSchema(LegendIngestionConfiguration.serialization.schema),
|
131
|
+
),
|
123
132
|
}),
|
124
133
|
);
|
125
134
|
|
@@ -229,6 +238,12 @@ export class LegendStudioApplicationConfig extends LegendApplicationConfig {
|
|
229
238
|
this.options = LegendStudioApplicationCoreOptions.create(
|
230
239
|
input.configData.extensions?.core ?? {},
|
231
240
|
);
|
241
|
+
|
242
|
+
if (this.options.ingestDeploymentConfig) {
|
243
|
+
validateIngestionDeploymentConfiguration(
|
244
|
+
this.options.ingestDeploymentConfig,
|
245
|
+
);
|
246
|
+
}
|
232
247
|
}
|
233
248
|
|
234
249
|
override getDefaultApplicationStorageKey(): string {
|
@@ -45,6 +45,7 @@ import {
|
|
45
45
|
LaunchIcon,
|
46
46
|
LinkIcon,
|
47
47
|
PURE_DataProductIcon,
|
48
|
+
PURE_IngestIcon,
|
48
49
|
} from '@finos/legend-art';
|
49
50
|
import { PACKAGEABLE_ELEMENT_TYPE } from '../stores/editor/utils/ModelClassifierUtils.js';
|
50
51
|
|
@@ -105,6 +106,8 @@ export const getElementTypeIcon = (
|
|
105
106
|
return <PURE_GenerationSpecificationIcon />;
|
106
107
|
case PACKAGEABLE_ELEMENT_TYPE.SNOWFLAKE_APP:
|
107
108
|
return <PURE_SnowflakeAppIcon />;
|
109
|
+
case PACKAGEABLE_ELEMENT_TYPE.INGEST_DEFINITION:
|
110
|
+
return <PURE_IngestIcon />;
|
108
111
|
default: {
|
109
112
|
if (type) {
|
110
113
|
const extraElementIconGetters = editorStore.pluginManager
|
@@ -42,6 +42,8 @@ import { LEGEND_STUDIO_DOCUMENTATION_KEY } from '../__lib__/LegendStudioDocument
|
|
42
42
|
import { LazyTextEditor } from './lazy-text-editor/LazyTextEditor.js';
|
43
43
|
import { PureCompatibilityTestManager } from './pct/PureCompatibilityTest.js';
|
44
44
|
import { ShowcaseViewer } from './showcase/ShowcaseViewer.js';
|
45
|
+
import { AuthProvider, type AuthProviderProps } from 'react-oidc-context';
|
46
|
+
import type { User } from 'oidc-client-ts';
|
45
47
|
|
46
48
|
const NotFoundPage = observer(() => {
|
47
49
|
const applicationStore = useApplicationStore();
|
@@ -287,6 +289,33 @@ export const LegendStudioWebApplication = observer(
|
|
287
289
|
(props: { baseUrl: string }) => {
|
288
290
|
const { baseUrl } = props;
|
289
291
|
|
292
|
+
const applicationStore = useLegendStudioApplicationStore();
|
293
|
+
const oidcConfig =
|
294
|
+
applicationStore.config.options.ingestDeploymentConfig?.deployment
|
295
|
+
.oidcConfig;
|
296
|
+
if (oidcConfig) {
|
297
|
+
const onSigninCallback = (_user: User | undefined) => {
|
298
|
+
window.location.href = (_user?.state as string | undefined) ?? '/';
|
299
|
+
};
|
300
|
+
|
301
|
+
const mergedOIDCConfig: AuthProviderProps = {
|
302
|
+
...oidcConfig.authProviderProps,
|
303
|
+
redirect_uri: `${window.location.origin}${oidcConfig.redirectPath}`,
|
304
|
+
silent_redirect_uri: `${window.location.origin}${oidcConfig.silentRedirectPath}`,
|
305
|
+
onSigninCallback,
|
306
|
+
};
|
307
|
+
|
308
|
+
return (
|
309
|
+
<AuthProvider {...mergedOIDCConfig}>
|
310
|
+
<BrowserEnvironmentProvider baseUrl={baseUrl}>
|
311
|
+
<LegendStudioFrameworkProvider>
|
312
|
+
<LegendStudioWebApplicationRouter />
|
313
|
+
</LegendStudioFrameworkProvider>
|
314
|
+
</BrowserEnvironmentProvider>
|
315
|
+
</AuthProvider>
|
316
|
+
);
|
317
|
+
}
|
318
|
+
|
290
319
|
return (
|
291
320
|
<BrowserEnvironmentProvider baseUrl={baseUrl}>
|
292
321
|
<LegendStudioFrameworkProvider>
|
@@ -35,7 +35,10 @@ import { GrammarTextEditor } from './editor-group/GrammarTextEditor.js';
|
|
35
35
|
import { StatusBar } from './StatusBar.js';
|
36
36
|
import { ActivityBar } from './ActivityBar.js';
|
37
37
|
import { ShowcaseSideBar } from './ShowcaseSideBar.js';
|
38
|
-
import type {
|
38
|
+
import type {
|
39
|
+
StudioQueryParams,
|
40
|
+
WorkspaceEditorPathParams,
|
41
|
+
} from '../../__lib__/LegendStudioNavigation.js';
|
39
42
|
import { ProjectSearchCommand } from '../editor/command-center/ProjectSearchCommand.js';
|
40
43
|
import { guaranteeNonNullable, isNonNullable } from '@finos/legend-shared';
|
41
44
|
import { flowResult } from 'mobx';
|
@@ -70,6 +73,8 @@ export const Editor = withEditorStore(
|
|
70
73
|
`Workspace/group workspace ID is not provided`,
|
71
74
|
);
|
72
75
|
const editorStore = useEditorStore();
|
76
|
+
const studioParams =
|
77
|
+
editorStore.applicationStore.navigationService.navigator.getCurrentLocationParameters<StudioQueryParams>();
|
73
78
|
const applicationStore = useApplicationStore();
|
74
79
|
const editable =
|
75
80
|
editorStore.graphManagerState.graphBuildState.hasCompleted &&
|
@@ -146,8 +151,8 @@ export const Editor = withEditorStore(
|
|
146
151
|
|
147
152
|
// initialize
|
148
153
|
useEffect(() => {
|
149
|
-
editorStore.internalizeEntityPath(params);
|
150
|
-
}, [editorStore, params]);
|
154
|
+
editorStore.internalizeEntityPath(params, studioParams);
|
155
|
+
}, [editorStore, params, studioParams]);
|
151
156
|
|
152
157
|
useEffect(() => {
|
153
158
|
flowResult(
|
@@ -90,6 +90,8 @@ import { HostedServiceFunctionActivatorEditorState } from '../../../stores/edito
|
|
90
90
|
import { HostedServiceFunctionActivatorEditor } from './function-activator/HostedServiceFunctionActivatorEditor.js';
|
91
91
|
import { DataProductEditorState } from '../../../stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js';
|
92
92
|
import { DataProductEditor } from './dataProduct/DataPoductEditor.js';
|
93
|
+
import { IngestDefinitionEditorState } from '../../../stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js';
|
94
|
+
import { IngestDefinitionEditor } from './ingest-editor/IngestDefinitionEditor.js';
|
93
95
|
|
94
96
|
export const ViewerEditorGroupSplashScreen: React.FC = () => {
|
95
97
|
const commandListWidth = 300;
|
@@ -238,7 +240,6 @@ export const EditorGroup = observer(() => {
|
|
238
240
|
.map((e) => e.name.toLowerCase())
|
239
241
|
.includes(file.key.toLowerCase()),
|
240
242
|
);
|
241
|
-
|
242
243
|
const renderActiveElementTab = (): React.ReactNode => {
|
243
244
|
if (currentTabState instanceof ElementEditorState) {
|
244
245
|
const generationViewState = currentTabState.generationModeState;
|
@@ -274,6 +275,8 @@ export const EditorGroup = observer(() => {
|
|
274
275
|
return <FunctionEditor key={currentTabState.uuid} />;
|
275
276
|
} else if (currentTabState instanceof MappingEditorState) {
|
276
277
|
return <MappingEditor key={currentTabState.uuid} />;
|
278
|
+
} else if (currentTabState instanceof IngestDefinitionEditorState) {
|
279
|
+
return <IngestDefinitionEditor key={currentTabState.uuid} />;
|
277
280
|
} else if (currentTabState instanceof ServiceEditorState) {
|
278
281
|
return <ServiceEditor key={currentTabState.uuid} />;
|
279
282
|
} else if (currentTabState instanceof DataProductEditorState) {
|
@@ -0,0 +1,156 @@
|
|
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 } from 'mobx-react-lite';
|
18
|
+
import { useEditorStore } from '../../EditorStoreProvider.js';
|
19
|
+
import {
|
20
|
+
Dialog,
|
21
|
+
Modal,
|
22
|
+
ModalBody,
|
23
|
+
ModalHeader,
|
24
|
+
ModalTitle,
|
25
|
+
PanelContent,
|
26
|
+
PanelHeader,
|
27
|
+
PanelHeaderActions,
|
28
|
+
RocketIcon,
|
29
|
+
} from '@finos/legend-art';
|
30
|
+
import {
|
31
|
+
generateUrlToDeployOnOpen,
|
32
|
+
IngestDefinitionEditorState,
|
33
|
+
} from '../../../../stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js';
|
34
|
+
import { CodeEditor } from '@finos/legend-lego/code-editor';
|
35
|
+
import { useEffect } from 'react';
|
36
|
+
import { CODE_EDITOR_LANGUAGE } from '@finos/legend-code-editor';
|
37
|
+
import { flowResult } from 'mobx';
|
38
|
+
import { useAuth } from 'react-oidc-context';
|
39
|
+
|
40
|
+
const IngestDepoymentModal = observer(
|
41
|
+
(props: { state: IngestDefinitionEditorState }) => {
|
42
|
+
const { state } = props;
|
43
|
+
const applicationStore = state.editorStore.applicationStore;
|
44
|
+
|
45
|
+
return (
|
46
|
+
<Dialog
|
47
|
+
open={state.deploymentState.isInProgress}
|
48
|
+
classes={{ container: 'search-modal__container' }}
|
49
|
+
>
|
50
|
+
<Modal
|
51
|
+
darkMode={
|
52
|
+
!applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
|
53
|
+
}
|
54
|
+
className="database-builder"
|
55
|
+
>
|
56
|
+
<ModalHeader>
|
57
|
+
<ModalTitle title="Deploy Ingestion" />
|
58
|
+
</ModalHeader>
|
59
|
+
<ModalBody>
|
60
|
+
<div>{state.deploymentState.message}</div>
|
61
|
+
</ModalBody>
|
62
|
+
</Modal>
|
63
|
+
</Dialog>
|
64
|
+
);
|
65
|
+
},
|
66
|
+
);
|
67
|
+
|
68
|
+
export const IngestDefinitionEditor = observer(() => {
|
69
|
+
const editorStore = useEditorStore();
|
70
|
+
const ingestDefinitionEditorState =
|
71
|
+
editorStore.tabManagerState.getCurrentEditorState(
|
72
|
+
IngestDefinitionEditorState,
|
73
|
+
);
|
74
|
+
const ingestDef = ingestDefinitionEditorState.ingest;
|
75
|
+
const auth = useAuth();
|
76
|
+
|
77
|
+
const deployIngest = (): void => {
|
78
|
+
// Trigger OAuth flow if not authenticated
|
79
|
+
if (!auth.isAuthenticated) {
|
80
|
+
// remove this redirect if we move to do oauth at the beginning of opening studio
|
81
|
+
auth
|
82
|
+
.signinRedirect({
|
83
|
+
state: generateUrlToDeployOnOpen(ingestDefinitionEditorState),
|
84
|
+
})
|
85
|
+
.catch(editorStore.applicationStore.alertUnhandledError);
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
// Use the token for deployment
|
89
|
+
const token = auth.user?.access_token;
|
90
|
+
if (token) {
|
91
|
+
flowResult(ingestDefinitionEditorState.deploy(token)).catch(
|
92
|
+
editorStore.applicationStore.alertUnhandledError,
|
93
|
+
);
|
94
|
+
} else {
|
95
|
+
editorStore.applicationStore.notificationService.notifyError(
|
96
|
+
'Authentication failed. No token available.',
|
97
|
+
);
|
98
|
+
}
|
99
|
+
};
|
100
|
+
|
101
|
+
const isValid = ingestDefinitionEditorState.validForDeployment;
|
102
|
+
useEffect(() => {
|
103
|
+
ingestDefinitionEditorState.generateElementGrammar();
|
104
|
+
}, [ingestDefinitionEditorState]);
|
105
|
+
|
106
|
+
useEffect(() => {
|
107
|
+
if (ingestDefinitionEditorState.deployOnOpen) {
|
108
|
+
flowResult(ingestDefinitionEditorState.init_with_deploy(auth)).catch(
|
109
|
+
editorStore.applicationStore.alertUnhandledError,
|
110
|
+
);
|
111
|
+
}
|
112
|
+
}, [
|
113
|
+
auth,
|
114
|
+
editorStore.applicationStore.alertUnhandledError,
|
115
|
+
ingestDefinitionEditorState,
|
116
|
+
]);
|
117
|
+
|
118
|
+
return (
|
119
|
+
<div className="data-product-editor">
|
120
|
+
<PanelHeader
|
121
|
+
title="Ingest"
|
122
|
+
titleContent={ingestDef.name}
|
123
|
+
darkMode={true}
|
124
|
+
isReadOnly={true}
|
125
|
+
></PanelHeader>
|
126
|
+
<PanelContent>
|
127
|
+
<PanelHeader title="deployment" darkMode={true}>
|
128
|
+
<PanelHeaderActions>
|
129
|
+
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
130
|
+
<button
|
131
|
+
className="btn__dropdown-combo__label"
|
132
|
+
onClick={deployIngest}
|
133
|
+
title={ingestDefinitionEditorState.validationMessage}
|
134
|
+
tabIndex={-1}
|
135
|
+
disabled={!isValid}
|
136
|
+
>
|
137
|
+
<RocketIcon className="btn__dropdown-combo__label__icon" />
|
138
|
+
<div className="btn__dropdown-combo__label__title">Deploy</div>
|
139
|
+
</button>
|
140
|
+
</div>
|
141
|
+
</PanelHeaderActions>
|
142
|
+
</PanelHeader>
|
143
|
+
<PanelContent>
|
144
|
+
<CodeEditor
|
145
|
+
inputValue={ingestDefinitionEditorState.textContent}
|
146
|
+
isReadOnly={true}
|
147
|
+
language={CODE_EDITOR_LANGUAGE.PURE}
|
148
|
+
/>
|
149
|
+
</PanelContent>
|
150
|
+
{ingestDefinitionEditorState.deploymentState.isInProgress && (
|
151
|
+
<IngestDepoymentModal state={ingestDefinitionEditorState} />
|
152
|
+
)}
|
153
|
+
</PanelContent>
|
154
|
+
</div>
|
155
|
+
);
|
156
|
+
});
|
@@ -365,7 +365,7 @@ export const LazyTextEditor = withEditorStore(
|
|
365
365
|
|
366
366
|
// initialize
|
367
367
|
useEffect(() => {
|
368
|
-
editorStore.internalizeEntityPath(params);
|
368
|
+
editorStore.internalizeEntityPath(params, undefined);
|
369
369
|
}, [editorStore, params]);
|
370
370
|
|
371
371
|
useEffect(() => {
|
@@ -91,6 +91,7 @@ import {
|
|
91
91
|
GraphEntities,
|
92
92
|
HostedService,
|
93
93
|
DataProduct,
|
94
|
+
IngestDefinition,
|
94
95
|
} from '@finos/legend-graph';
|
95
96
|
import { CONFIGURATION_EDITOR_TAB } from './editor-state/project-configuration-editor-state/ProjectConfigurationEditorState.js';
|
96
97
|
import { PACKAGEABLE_ELEMENT_TYPE } from './utils/ModelClassifierUtils.js';
|
@@ -857,6 +858,8 @@ export class EditorGraphState {
|
|
857
858
|
return PACKAGEABLE_ELEMENT_TYPE.HOSTED_SERVICE;
|
858
859
|
} else if (element instanceof DataProduct) {
|
859
860
|
return PACKAGEABLE_ELEMENT_TYPE._DATA_PRODUCT;
|
861
|
+
} else if (element instanceof IngestDefinition) {
|
862
|
+
return PACKAGEABLE_ELEMENT_TYPE.INGEST_DEFINITION;
|
860
863
|
}
|
861
864
|
const extraElementTypeLabelGetters = this.editorStore.pluginManager
|
862
865
|
.getApplicationPlugins()
|
@@ -56,6 +56,7 @@ import {
|
|
56
56
|
AssertionError,
|
57
57
|
guaranteeType,
|
58
58
|
type Clazz,
|
59
|
+
returnUndefOnError,
|
59
60
|
} from '@finos/legend-shared';
|
60
61
|
import { EditorSDLCState } from './EditorSDLCState.js';
|
61
62
|
import { ModelImporterState } from './editor-state/ModelImporterState.js';
|
@@ -69,6 +70,8 @@ import {
|
|
69
70
|
generateEditorRoute,
|
70
71
|
generateSetupRoute,
|
71
72
|
generateViewProjectRoute,
|
73
|
+
LEGEND_STUDIO_QUERY_PARAMS,
|
74
|
+
type StudioQueryParams,
|
72
75
|
type WorkspaceEditorPathParams,
|
73
76
|
} from '../../__lib__/LegendStudioNavigation.js';
|
74
77
|
import { PanelDisplayState } from '@finos/legend-art';
|
@@ -118,6 +121,8 @@ import {
|
|
118
121
|
LazyTextEditorStore,
|
119
122
|
} from '../lazy-text-editor/LazyTextEditorStore.js';
|
120
123
|
import type { QueryBuilderDataCubeViewerState } from '@finos/legend-query-builder';
|
124
|
+
import { IngestionManager } from '../ingestion/IngestionManager.js';
|
125
|
+
import { EditorInitialConfiguration } from './editor-state/element-editor-state/ElementEditorInitialConfiguration.js';
|
121
126
|
|
122
127
|
export abstract class EditorExtensionState {
|
123
128
|
/**
|
@@ -133,6 +138,7 @@ export class EditorStore implements CommandRegistrar {
|
|
133
138
|
readonly applicationStore: LegendStudioApplicationStore;
|
134
139
|
readonly sdlcServerClient: SDLCServerClient;
|
135
140
|
readonly depotServerClient: DepotServerClient;
|
141
|
+
readonly ingestionManager: IngestionManager | undefined;
|
136
142
|
readonly pluginManager: LegendStudioPluginManager;
|
137
143
|
|
138
144
|
/**
|
@@ -145,6 +151,7 @@ export class EditorStore implements CommandRegistrar {
|
|
145
151
|
readonly initState = ActionState.create();
|
146
152
|
|
147
153
|
initialEntityPath?: string | undefined;
|
154
|
+
editorConfig: EditorInitialConfiguration | undefined;
|
148
155
|
editorMode: EditorMode;
|
149
156
|
// NOTE: once we clear up the editor store to make modes more separated
|
150
157
|
// we should remove these sets of functions. They are basically hacks to
|
@@ -303,6 +310,16 @@ export class EditorStore implements CommandRegistrar {
|
|
303
310
|
this,
|
304
311
|
this.sdlcState,
|
305
312
|
);
|
313
|
+
// ingestion
|
314
|
+
const ingestionConifg =
|
315
|
+
applicationStore.config.options.ingestDeploymentConfig;
|
316
|
+
if (ingestionConifg) {
|
317
|
+
this.ingestionManager = new IngestionManager(
|
318
|
+
ingestionConifg,
|
319
|
+
this.applicationStore,
|
320
|
+
);
|
321
|
+
}
|
322
|
+
|
306
323
|
// extensions
|
307
324
|
this.extensionStates = this.pluginManager
|
308
325
|
.getApplicationPlugins()
|
@@ -549,17 +566,35 @@ export class EditorStore implements CommandRegistrar {
|
|
549
566
|
this.explorerTreeState = new ExplorerTreeState(this);
|
550
567
|
}
|
551
568
|
|
552
|
-
internalizeEntityPath(
|
569
|
+
internalizeEntityPath(
|
570
|
+
params: Partial<WorkspaceEditorPathParams>,
|
571
|
+
studioParams: Partial<StudioQueryParams> | undefined,
|
572
|
+
): void {
|
553
573
|
const { projectId, entityPath } = params;
|
554
574
|
const workspaceType = params.groupWorkspaceId
|
555
575
|
? WorkspaceType.GROUP
|
556
576
|
: WorkspaceType.USER;
|
577
|
+
const editorConfig =
|
578
|
+
studioParams?.[LEGEND_STUDIO_QUERY_PARAMS.EDITOR_CONFIG];
|
557
579
|
const workspaceId = guaranteeNonNullable(
|
558
580
|
params.groupWorkspaceId ?? params.workspaceId,
|
559
581
|
`Workspace/group workspace ID is not provided`,
|
560
582
|
);
|
561
583
|
if (entityPath) {
|
562
584
|
this.initialEntityPath = entityPath;
|
585
|
+
if (editorConfig) {
|
586
|
+
const _config = returnUndefOnError(() =>
|
587
|
+
EditorInitialConfiguration.serialization.fromJson(
|
588
|
+
JSON.parse(atob(editorConfig)),
|
589
|
+
),
|
590
|
+
);
|
591
|
+
const config = guaranteeNonNullable(
|
592
|
+
_config,
|
593
|
+
`error reading and serializing config ${editorConfig}`,
|
594
|
+
);
|
595
|
+
|
596
|
+
this.editorConfig = config;
|
597
|
+
}
|
563
598
|
this.applicationStore.navigationService.navigator.updateCurrentLocation(
|
564
599
|
generateEditorRoute(
|
565
600
|
guaranteeNonNullable(projectId),
|
@@ -1031,7 +1066,10 @@ export class EditorStore implements CommandRegistrar {
|
|
1031
1066
|
try {
|
1032
1067
|
this.graphEditorMode.openElement(
|
1033
1068
|
this.graphManagerState.graph.getElement(this.initialEntityPath),
|
1069
|
+
this.editorConfig,
|
1034
1070
|
);
|
1071
|
+
// we may not want to set as undefined if using it for other things
|
1072
|
+
this.editorConfig = undefined;
|
1035
1073
|
} catch {
|
1036
1074
|
const elementPath = this.initialEntityPath;
|
1037
1075
|
this.initialEntityPath = undefined;
|
@@ -36,6 +36,7 @@ import {
|
|
36
36
|
SnowflakeApp,
|
37
37
|
HostedService,
|
38
38
|
DataProduct,
|
39
|
+
IngestDefinition,
|
39
40
|
} from '@finos/legend-graph';
|
40
41
|
import {
|
41
42
|
type Clazz,
|
@@ -66,6 +67,8 @@ import { SnowflakeAppFunctionActivatorEdtiorState } from './editor-state/element
|
|
66
67
|
import { HostedServiceFunctionActivatorEditorState } from './editor-state/element-editor-state/function-activator/HostedServiceFunctionActivatorEditorState.js';
|
67
68
|
import { ArtifactGenerationViewerState } from './editor-state/ArtifactGenerationViewerState.js';
|
68
69
|
import { DataProductEditorState } from './editor-state/element-editor-state/dataProduct/DataProductEditorState.js';
|
70
|
+
import { IngestDefinitionEditorState } from './editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js';
|
71
|
+
import type { EditorInitialConfiguration } from './editor-state/element-editor-state/ElementEditorInitialConfiguration.js';
|
69
72
|
|
70
73
|
export class EditorTabManagerState extends TabManagerState {
|
71
74
|
readonly editorStore: EditorStore;
|
@@ -146,6 +149,7 @@ export class EditorTabManagerState extends TabManagerState {
|
|
146
149
|
|
147
150
|
createElementEditorState(
|
148
151
|
element: PackageableElement,
|
152
|
+
config?: EditorInitialConfiguration,
|
149
153
|
): ElementEditorState | undefined {
|
150
154
|
if (element instanceof PrimitiveType) {
|
151
155
|
throw new UnsupportedOperationError(
|
@@ -173,6 +177,8 @@ export class EditorTabManagerState extends TabManagerState {
|
|
173
177
|
return new PackageableConnectionEditorState(this.editorStore, element);
|
174
178
|
} else if (element instanceof Mapping) {
|
175
179
|
return new MappingEditorState(this.editorStore, element);
|
180
|
+
} else if (element instanceof IngestDefinition) {
|
181
|
+
return new IngestDefinitionEditorState(this.editorStore, element, config);
|
176
182
|
} else if (element instanceof Service) {
|
177
183
|
return new ServiceEditorState(this.editorStore, element);
|
178
184
|
} else if (element instanceof DataProduct) {
|
@@ -55,6 +55,7 @@ import { ElementEditorState } from './editor-state/element-editor-state/ElementE
|
|
55
55
|
import { LegendStudioTelemetryHelper } from '../../__lib__/LegendStudioTelemetryHelper.js';
|
56
56
|
import { GraphEditorMode } from './GraphEditorMode.js';
|
57
57
|
import { GlobalBulkServiceRegistrationState } from './sidebar-state/BulkServiceRegistrationState.js';
|
58
|
+
import type { EditorInitialConfiguration } from './editor-state/element-editor-state/ElementEditorInitialConfiguration.js';
|
58
59
|
|
59
60
|
export class GraphEditFormModeState extends GraphEditorMode {
|
60
61
|
*initialize(): GeneratorFn<void> {
|
@@ -567,7 +568,10 @@ export class GraphEditFormModeState extends GraphEditorMode {
|
|
567
568
|
return;
|
568
569
|
}
|
569
570
|
|
570
|
-
openElement(
|
571
|
+
openElement(
|
572
|
+
element: PackageableElement,
|
573
|
+
config?: EditorInitialConfiguration | undefined,
|
574
|
+
): void {
|
571
575
|
if (!(element instanceof Package)) {
|
572
576
|
const existingElementState = this.editorStore.tabManagerState.tabs.find(
|
573
577
|
(state) =>
|
@@ -575,7 +579,10 @@ export class GraphEditFormModeState extends GraphEditorMode {
|
|
575
579
|
);
|
576
580
|
const newTab =
|
577
581
|
existingElementState ??
|
578
|
-
this.editorStore.tabManagerState.createElementEditorState(
|
582
|
+
this.editorStore.tabManagerState.createElementEditorState(
|
583
|
+
element,
|
584
|
+
config,
|
585
|
+
);
|
579
586
|
if (newTab) {
|
580
587
|
this.editorStore.tabManagerState.openTab(newTab);
|
581
588
|
} else {
|
@@ -22,6 +22,7 @@ import type { EditorStore } from './EditorStore.js';
|
|
22
22
|
|
23
23
|
import type { GRAPH_EDITOR_MODE } from './EditorConfig.js';
|
24
24
|
import type { Problem } from './EditorGraphState.js';
|
25
|
+
import type { EditorInitialConfiguration } from './editor-state/element-editor-state/ElementEditorInitialConfiguration.js';
|
25
26
|
|
26
27
|
export abstract class GraphEditorMode {
|
27
28
|
readonly editorStore: EditorStore;
|
@@ -81,5 +82,8 @@ export abstract class GraphEditorMode {
|
|
81
82
|
isGraphBuildFailure?: boolean;
|
82
83
|
}): GeneratorFn<void>;
|
83
84
|
abstract handleCleanupFailure(error: unknown): GeneratorFn<void>;
|
84
|
-
abstract openElement(
|
85
|
+
abstract openElement(
|
86
|
+
element: PackageableElement,
|
87
|
+
config?: EditorInitialConfiguration | undefined,
|
88
|
+
): void;
|
85
89
|
}
|