@finos/legend-application-studio 13.1.0 → 14.0.0
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/EditorComponentTestUtils.d.ts +3 -13
- package/lib/components/EditorComponentTestUtils.d.ts.map +1 -1
- package/lib/components/EditorComponentTestUtils.js +3 -22
- package/lib/components/EditorComponentTestUtils.js.map +1 -1
- package/lib/components/editor/edit-panel/EditPanel.js +4 -4
- package/lib/components/editor/edit-panel/EditPanel.js.map +1 -1
- package/lib/components/editor/edit-panel/{ModelLoader.d.ts → ModelImporter.d.ts} +2 -2
- package/lib/components/editor/edit-panel/ModelImporter.d.ts.map +1 -0
- package/lib/components/editor/edit-panel/ModelImporter.js +132 -0
- package/lib/components/editor/edit-panel/ModelImporter.js.map +1 -0
- package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.js +10 -2
- package/lib/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.d.ts +7 -0
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.js +18 -42
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetModelGenerationEditor.d.ts +24 -0
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetModelGenerationEditor.d.ts.map +1 -0
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetModelGenerationEditor.js +75 -0
- package/lib/components/editor/edit-panel/external-format-editor/SchemaSetModelGenerationEditor.js.map +1 -0
- package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.js +6 -4
- package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.js.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.d.ts.map +1 -1
- package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js +2 -4
- package/lib/components/editor/edit-panel/uml-editor/AssociationEditor.js.map +1 -1
- package/lib/components/editor/side-bar/Explorer.js +4 -4
- package/lib/components/editor/side-bar/Explorer.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/EditorGraphState.d.ts +1 -1
- package/lib/stores/EditorGraphState.d.ts.map +1 -1
- package/lib/stores/EditorGraphState.js +10 -10
- package/lib/stores/EditorGraphState.js.map +1 -1
- package/lib/stores/EditorStore.d.ts +3 -3
- package/lib/stores/EditorStore.d.ts.map +1 -1
- package/lib/stores/EditorStore.js +6 -8
- package/lib/stores/EditorStore.js.map +1 -1
- package/lib/stores/LegendStudioApplicationPlugin.d.ts +3 -3
- package/lib/stores/LegendStudioApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.d.ts.map +1 -1
- package/lib/stores/editor/NewElementState.js +4 -3
- package/lib/stores/editor/NewElementState.js.map +1 -1
- package/lib/stores/editor-state/ExternalFormatState.d.ts +3 -2
- package/lib/stores/editor-state/ExternalFormatState.d.ts.map +1 -1
- package/lib/stores/editor-state/ExternalFormatState.js +11 -8
- package/lib/stores/editor-state/ExternalFormatState.js.map +1 -1
- package/lib/stores/editor-state/ModelImporterState.d.ts +95 -0
- package/lib/stores/editor-state/ModelImporterState.d.ts.map +1 -0
- package/lib/stores/editor-state/ModelImporterState.js +358 -0
- package/lib/stores/editor-state/ModelImporterState.js.map +1 -0
- package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.d.ts +2 -1
- package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.js +9 -1
- package/lib/stores/editor-state/element-editor-state/connection/ConnectionEditorState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.d.ts +35 -12
- package/lib/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.js +141 -34
- package/lib/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js +1 -1
- package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +2 -2
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +3 -3
- package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
- package/lib/stores/graphModifier/DSLExternalFormat_GraphModifierHelper.d.ts +1 -0
- package/lib/stores/graphModifier/DSLExternalFormat_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graphModifier/DSLExternalFormat_GraphModifierHelper.js +3 -0
- package/lib/stores/graphModifier/DSLExternalFormat_GraphModifierHelper.js.map +1 -1
- package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.d.ts +2 -1
- package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.js +3 -0
- package/lib/stores/graphModifier/StoreRelational_GraphModifierHelper.js.map +1 -1
- package/lib/stores/shared/testable/TestableUtils.d.ts.map +1 -1
- package/lib/stores/shared/testable/TestableUtils.js +2 -3
- package/lib/stores/shared/testable/TestableUtils.js.map +1 -1
- package/package.json +9 -9
- package/src/components/EditorComponentTestUtils.tsx +2 -29
- package/src/components/editor/edit-panel/EditPanel.tsx +4 -4
- package/src/components/editor/edit-panel/ModelImporter.tsx +376 -0
- package/src/components/editor/edit-panel/connection-editor/RelationalDatabaseConnectionEditor.tsx +36 -0
- package/src/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.tsx +47 -163
- package/src/components/editor/edit-panel/external-format-editor/SchemaSetModelGenerationEditor.tsx +226 -0
- package/src/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.tsx +63 -36
- package/src/components/editor/edit-panel/uml-editor/AssociationEditor.tsx +1 -7
- package/src/components/editor/side-bar/Explorer.tsx +8 -8
- package/src/stores/EditorGraphState.ts +13 -12
- package/src/stores/EditorStore.ts +7 -9
- package/src/stores/LegendStudioApplicationPlugin.ts +4 -4
- package/src/stores/editor/NewElementState.ts +4 -3
- package/src/stores/editor-state/ExternalFormatState.ts +15 -12
- package/src/stores/editor-state/ModelImporterState.ts +506 -0
- package/src/stores/editor-state/element-editor-state/connection/ConnectionEditorState.ts +10 -0
- package/src/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.ts +203 -46
- package/src/stores/editor-state/element-editor-state/service/ServiceExecutionState.ts +1 -0
- package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +2 -1
- package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +12 -3
- package/src/stores/graphModifier/DSLExternalFormat_GraphModifierHelper.ts +5 -0
- package/src/stores/graphModifier/StoreRelational_GraphModifierHelper.ts +10 -0
- package/src/stores/shared/testable/TestableUtils.ts +4 -3
- package/tsconfig.json +3 -2
- package/lib/components/editor/edit-panel/ModelLoader.d.ts.map +0 -1
- package/lib/components/editor/edit-panel/ModelLoader.js +0 -95
- package/lib/components/editor/edit-panel/ModelLoader.js.map +0 -1
- package/lib/stores/editor-state/ModelLoaderState.d.ts +0 -52
- package/lib/stores/editor-state/ModelLoaderState.d.ts.map +0 -1
- package/lib/stores/editor-state/ModelLoaderState.js +0 -199
- package/lib/stores/editor-state/ModelLoaderState.js.map +0 -1
- package/src/components/editor/edit-panel/ModelLoader.tsx +0 -259
- package/src/stores/editor-state/ModelLoaderState.ts +0 -280
package/src/stores/editor-state/element-editor-state/external-format/SchemaSetEditorState.ts
CHANGED
|
@@ -33,16 +33,22 @@ import {
|
|
|
33
33
|
isEmpty,
|
|
34
34
|
ActionState,
|
|
35
35
|
deleteEntry,
|
|
36
|
+
assertTrue,
|
|
37
|
+
generateEnumerableNameFromToken,
|
|
36
38
|
} from '@finos/legend-shared';
|
|
37
39
|
import {
|
|
38
40
|
type GenerationProperty,
|
|
39
41
|
type PackageableElement,
|
|
42
|
+
GenerationPropertyItemType,
|
|
40
43
|
type ExternalFormatDescription,
|
|
44
|
+
type PureModel,
|
|
41
45
|
CompilationError,
|
|
42
46
|
ConfigurationProperty,
|
|
43
|
-
GenerationPropertyItemType,
|
|
44
47
|
ExternalFormatSchema as Schema,
|
|
45
48
|
SchemaSet,
|
|
49
|
+
isValidFullPath,
|
|
50
|
+
resolvePackagePathAndElementName,
|
|
51
|
+
Package,
|
|
46
52
|
} from '@finos/legend-graph';
|
|
47
53
|
import type { Entity } from '@finos/legend-storage';
|
|
48
54
|
import { type EntityChange, EntityChangeType } from '@finos/legend-server-sdlc';
|
|
@@ -52,43 +58,72 @@ import { LEGEND_STUDIO_APP_EVENT } from '../../../LegendStudioAppEvent.js';
|
|
|
52
58
|
import { configurationProperty_setValue } from '../../../graphModifier/DSLGeneration_GraphModifierHelper.js';
|
|
53
59
|
|
|
54
60
|
export enum SCHEMA_SET_TAB_TYPE {
|
|
55
|
-
|
|
56
|
-
|
|
61
|
+
SCHEMAS = 'SCHEMAS',
|
|
62
|
+
GENERATE_MODEL = 'GENERATE_MODEL',
|
|
57
63
|
}
|
|
58
64
|
|
|
65
|
+
const DEFAULT_SCHEMA_NAME = 'MyShemaSet';
|
|
66
|
+
|
|
59
67
|
export class SchemaSetModelGenerationState {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
readonly editorStore: EditorStore;
|
|
69
|
+
readonly schemaSet: SchemaSet;
|
|
70
|
+
generatingModelsState = ActionState.create();
|
|
71
|
+
importGeneratedElementsState = ActionState.create();
|
|
72
|
+
|
|
63
73
|
configurationProperties: ConfigurationProperty[] = [];
|
|
64
74
|
generationValue = '';
|
|
75
|
+
targetBinding = '';
|
|
76
|
+
isolatedGraph: PureModel | undefined;
|
|
65
77
|
|
|
66
|
-
constructor(
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
constructor(
|
|
79
|
+
schemaSet: SchemaSet,
|
|
80
|
+
editorStore: EditorStore,
|
|
81
|
+
graph?: PureModel | undefined,
|
|
82
|
+
) {
|
|
83
|
+
this.schemaSet = schemaSet;
|
|
84
|
+
this.editorStore = editorStore;
|
|
69
85
|
makeObservable(this, {
|
|
70
86
|
configurationProperties: observable,
|
|
71
|
-
|
|
87
|
+
generatingModelsState: observable,
|
|
88
|
+
importGeneratedElementsState: observable,
|
|
72
89
|
generationValue: observable,
|
|
90
|
+
targetBinding: observable,
|
|
73
91
|
setConfigurationProperty: action,
|
|
74
92
|
setGenerationValue: action,
|
|
93
|
+
setTargetBindingPath: action,
|
|
94
|
+
handleTargetBindingPathChange: action,
|
|
95
|
+
canGenerate: computed,
|
|
75
96
|
generateModel: flow,
|
|
76
|
-
|
|
97
|
+
importGeneratedModelsIntoGraph: flow,
|
|
98
|
+
getImportEntities: flow,
|
|
77
99
|
});
|
|
100
|
+
this.isolatedGraph = graph;
|
|
101
|
+
assertTrue(this.isolatedGraph !== this.editorStore.graphManagerState.graph);
|
|
78
102
|
}
|
|
79
103
|
|
|
80
104
|
setConfigurationProperty(val: ConfigurationProperty[]): void {
|
|
81
105
|
this.configurationProperties = val;
|
|
82
106
|
}
|
|
83
107
|
|
|
84
|
-
get description(): ExternalFormatDescription {
|
|
85
|
-
return this.
|
|
86
|
-
this.
|
|
108
|
+
get description(): ExternalFormatDescription | undefined {
|
|
109
|
+
return this.editorStore.graphState.graphGenerationState.externalFormatState.getTypeDescription(
|
|
110
|
+
this.schemaSet.format,
|
|
87
111
|
);
|
|
88
112
|
}
|
|
89
113
|
|
|
90
114
|
get modelGenerationProperties(): GenerationProperty[] {
|
|
91
|
-
return this.description
|
|
115
|
+
return this.description?.modelGenerationProperties ?? [];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
get canGenerate(): boolean {
|
|
119
|
+
if (this.targetBinding === '') {
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
return isValidFullPath(this.targetBinding);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
setTargetBindingPath(val: string): void {
|
|
126
|
+
this.targetBinding = val;
|
|
92
127
|
}
|
|
93
128
|
|
|
94
129
|
getConfigValue(name: string): unknown | undefined {
|
|
@@ -105,6 +140,39 @@ export class SchemaSetModelGenerationState {
|
|
|
105
140
|
this.generationValue = val;
|
|
106
141
|
}
|
|
107
142
|
|
|
143
|
+
handleTargetBindingPathChange(): void {
|
|
144
|
+
const isolatedGraph = this.isolatedGraph;
|
|
145
|
+
if (isolatedGraph && isValidFullPath(this.targetBinding)) {
|
|
146
|
+
try {
|
|
147
|
+
const [packagePath, bindingName] = resolvePackagePathAndElementName(
|
|
148
|
+
this.targetBinding,
|
|
149
|
+
);
|
|
150
|
+
const schemaName = `${DEFAULT_SCHEMA_NAME}For${bindingName}`;
|
|
151
|
+
const _package =
|
|
152
|
+
this.editorStore.graphManagerState.graph.getNullableElement(
|
|
153
|
+
packagePath,
|
|
154
|
+
true,
|
|
155
|
+
);
|
|
156
|
+
let reservedNames: string[] = [];
|
|
157
|
+
if (_package instanceof Package) {
|
|
158
|
+
reservedNames = _package.children.map((e) => e.name);
|
|
159
|
+
}
|
|
160
|
+
const newSchemaName = reservedNames.includes(schemaName)
|
|
161
|
+
? generateEnumerableNameFromToken(reservedNames, schemaName)
|
|
162
|
+
: schemaName;
|
|
163
|
+
const newPath = `${packagePath}::${newSchemaName}`;
|
|
164
|
+
if (newPath !== this.schemaSet.path) {
|
|
165
|
+
isolatedGraph.renameElement(
|
|
166
|
+
this.schemaSet,
|
|
167
|
+
`${packagePath}::${newSchemaName}`,
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
} catch (error) {
|
|
171
|
+
assertErrorThrown(error);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
108
176
|
updateGenerationParameters(
|
|
109
177
|
generationProperty: GenerationProperty,
|
|
110
178
|
newValue: unknown,
|
|
@@ -159,85 +227,101 @@ export class SchemaSetModelGenerationState {
|
|
|
159
227
|
}
|
|
160
228
|
}
|
|
161
229
|
|
|
162
|
-
*generateModel(): GeneratorFn<
|
|
163
|
-
this.
|
|
230
|
+
*generateModel(): GeneratorFn<boolean> {
|
|
231
|
+
this.generatingModelsState.inProgress();
|
|
164
232
|
try {
|
|
165
|
-
const SCHEMA_SET_PROPERTY_NAME = 'sourceSchemaSet';
|
|
166
233
|
const SCHEMA_FORMAT_PROPERTY_NAME = 'format';
|
|
167
234
|
const properties = [...this.configurationProperties];
|
|
168
|
-
if (!properties.find((e) => e.name === SCHEMA_SET_PROPERTY_NAME)) {
|
|
169
|
-
const genProperty = new ConfigurationProperty(
|
|
170
|
-
SCHEMA_SET_PROPERTY_NAME,
|
|
171
|
-
this.schemaSetEditorState.schemaSet.path,
|
|
172
|
-
);
|
|
173
|
-
properties.push(genProperty);
|
|
174
|
-
}
|
|
175
235
|
if (!properties.find((e) => e.name === SCHEMA_FORMAT_PROPERTY_NAME)) {
|
|
176
236
|
const genProperty = new ConfigurationProperty(
|
|
177
237
|
SCHEMA_FORMAT_PROPERTY_NAME,
|
|
178
|
-
this.
|
|
238
|
+
this.schemaSet.format,
|
|
179
239
|
);
|
|
180
240
|
properties.push(genProperty);
|
|
181
241
|
}
|
|
182
242
|
const val =
|
|
183
|
-
(yield this.
|
|
243
|
+
(yield this.editorStore.graphManagerState.graphManager.generateModelFromExternalFormat(
|
|
244
|
+
this.schemaSet,
|
|
245
|
+
this.targetBinding,
|
|
184
246
|
properties,
|
|
185
|
-
this.
|
|
247
|
+
this.isolatedGraph ?? this.editorStore.graphManagerState.graph,
|
|
186
248
|
)) as string;
|
|
187
249
|
this.setGenerationValue(val);
|
|
250
|
+
return true;
|
|
188
251
|
} catch (error) {
|
|
189
252
|
assertErrorThrown(error);
|
|
190
|
-
this.
|
|
253
|
+
this.editorStore.applicationStore.log.error(
|
|
191
254
|
LogEvent.create(LEGEND_STUDIO_APP_EVENT.EXTERNAL_FORMAT_FAILURE),
|
|
192
255
|
error,
|
|
193
256
|
);
|
|
194
|
-
this.
|
|
257
|
+
this.editorStore.applicationStore.notifyError(error);
|
|
258
|
+
this.setGenerationValue('');
|
|
259
|
+
return false;
|
|
195
260
|
} finally {
|
|
196
|
-
this.
|
|
261
|
+
this.generatingModelsState.complete();
|
|
197
262
|
}
|
|
198
263
|
}
|
|
199
264
|
|
|
200
|
-
*
|
|
265
|
+
*importGeneratedModelsIntoGraph(): GeneratorFn<void> {
|
|
201
266
|
try {
|
|
202
|
-
this.
|
|
203
|
-
const entities =
|
|
204
|
-
(yield this.schemaSetEditorState.editorStore.graphManagerState.graphManager.pureCodeToEntities(
|
|
205
|
-
this.generationValue,
|
|
206
|
-
)) as Entity[];
|
|
267
|
+
this.importGeneratedElementsState.inProgress();
|
|
268
|
+
const entities = (yield flowResult(this.getImportEntities())) as Entity[];
|
|
207
269
|
const newEntities: EntityChange[] = entities.map((e) => ({
|
|
208
270
|
type: EntityChangeType.CREATE,
|
|
209
271
|
entityPath: e.path,
|
|
210
272
|
content: e.content,
|
|
211
273
|
}));
|
|
212
274
|
yield flowResult(
|
|
213
|
-
this.
|
|
275
|
+
this.editorStore.graphState.loadEntityChangesToGraph(
|
|
214
276
|
newEntities,
|
|
215
277
|
undefined,
|
|
216
278
|
),
|
|
217
279
|
);
|
|
218
|
-
this.
|
|
280
|
+
this.editorStore.applicationStore.notifySuccess(
|
|
219
281
|
'Generated elements imported into project',
|
|
220
282
|
);
|
|
221
283
|
} catch (error) {
|
|
222
284
|
assertErrorThrown(error);
|
|
223
|
-
this.
|
|
285
|
+
this.editorStore.applicationStore.log.error(
|
|
224
286
|
LogEvent.create(LEGEND_STUDIO_APP_EVENT.EXTERNAL_FORMAT_FAILURE),
|
|
225
287
|
error,
|
|
226
288
|
);
|
|
227
|
-
this.
|
|
289
|
+
this.editorStore.applicationStore.notifyError(error);
|
|
228
290
|
} finally {
|
|
229
|
-
this.
|
|
291
|
+
this.importGeneratedElementsState.complete();
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
*getImportEntities(): GeneratorFn<Entity[]> {
|
|
296
|
+
try {
|
|
297
|
+
this.importGeneratedElementsState.inProgress();
|
|
298
|
+
const entities =
|
|
299
|
+
(yield this.editorStore.graphManagerState.graphManager.pureCodeToEntities(
|
|
300
|
+
this.generationValue,
|
|
301
|
+
)) as Entity[];
|
|
302
|
+
return entities;
|
|
303
|
+
} catch (error) {
|
|
304
|
+
assertErrorThrown(error);
|
|
305
|
+
this.editorStore.applicationStore.log.error(
|
|
306
|
+
LogEvent.create(LEGEND_STUDIO_APP_EVENT.EXTERNAL_FORMAT_FAILURE),
|
|
307
|
+
error,
|
|
308
|
+
);
|
|
309
|
+
this.editorStore.applicationStore.notifyError(error);
|
|
310
|
+
throw error;
|
|
311
|
+
} finally {
|
|
312
|
+
this.importGeneratedElementsState.complete();
|
|
230
313
|
}
|
|
231
314
|
}
|
|
232
315
|
}
|
|
316
|
+
|
|
233
317
|
export class ImportSchemaContentState {
|
|
234
318
|
editorStore: EditorStore;
|
|
235
|
-
schemaSetEditorState: SchemaSetEditorState;
|
|
319
|
+
schemaSetEditorState: InnerSchemaSetEditorState | SchemaSetEditorState;
|
|
236
320
|
loadingSchemaContentState = ActionState.create();
|
|
237
321
|
files: File[] | undefined;
|
|
238
322
|
importSchemaModal = false;
|
|
239
323
|
constructor(
|
|
240
|
-
schemaSetEditorState: SchemaSetEditorState,
|
|
324
|
+
schemaSetEditorState: InnerSchemaSetEditorState | SchemaSetEditorState,
|
|
241
325
|
editorStore: EditorStore,
|
|
242
326
|
) {
|
|
243
327
|
this.editorStore = editorStore;
|
|
@@ -304,9 +388,81 @@ export class ImportSchemaContentState {
|
|
|
304
388
|
}
|
|
305
389
|
}
|
|
306
390
|
|
|
391
|
+
export class InnerSchemaSetEditorState {
|
|
392
|
+
readonly editorStore: EditorStore;
|
|
393
|
+
isReadOnly: boolean;
|
|
394
|
+
schemaSet: SchemaSet;
|
|
395
|
+
currentSchema?: Schema | undefined;
|
|
396
|
+
selectedTab = SCHEMA_SET_TAB_TYPE.SCHEMAS;
|
|
397
|
+
schemaValidationError?: CompilationError;
|
|
398
|
+
importSchemaContentState: ImportSchemaContentState;
|
|
399
|
+
schemaSetModelGenerationState: SchemaSetModelGenerationState;
|
|
400
|
+
|
|
401
|
+
constructor(
|
|
402
|
+
isReadOnly: boolean,
|
|
403
|
+
schemaSet: SchemaSet,
|
|
404
|
+
editorStore: EditorStore,
|
|
405
|
+
graph: PureModel,
|
|
406
|
+
) {
|
|
407
|
+
this.editorStore = editorStore;
|
|
408
|
+
makeObservable(this, {
|
|
409
|
+
schemaValidationError: observable,
|
|
410
|
+
currentSchema: observable,
|
|
411
|
+
selectedTab: observable,
|
|
412
|
+
schemaSet: observable,
|
|
413
|
+
schemaSetModelGenerationState: observable,
|
|
414
|
+
setSelectedTab: action,
|
|
415
|
+
setCurrentSchema: action,
|
|
416
|
+
setSchemaValidationerror: action,
|
|
417
|
+
reset: action,
|
|
418
|
+
});
|
|
419
|
+
this.schemaSet = schemaSet;
|
|
420
|
+
this.isReadOnly = isReadOnly;
|
|
421
|
+
if (this.schemaSet.schemas.length !== 0) {
|
|
422
|
+
this.currentSchema =
|
|
423
|
+
this.schemaSet.schemas[this.schemaSet.schemas.length - 1];
|
|
424
|
+
}
|
|
425
|
+
this.schemaSetModelGenerationState = new SchemaSetModelGenerationState(
|
|
426
|
+
this.schemaSet,
|
|
427
|
+
this.editorStore,
|
|
428
|
+
graph,
|
|
429
|
+
);
|
|
430
|
+
this.importSchemaContentState = new ImportSchemaContentState(
|
|
431
|
+
this,
|
|
432
|
+
this.editorStore,
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
reset(): void {
|
|
437
|
+
this.currentSchema = undefined;
|
|
438
|
+
this.selectedTab = SCHEMA_SET_TAB_TYPE.SCHEMAS;
|
|
439
|
+
this.schemaSetModelGenerationState = new SchemaSetModelGenerationState(
|
|
440
|
+
this.schemaSet,
|
|
441
|
+
this.editorStore,
|
|
442
|
+
this.schemaSetModelGenerationState.isolatedGraph,
|
|
443
|
+
);
|
|
444
|
+
this.importSchemaContentState = new ImportSchemaContentState(
|
|
445
|
+
this,
|
|
446
|
+
this.editorStore,
|
|
447
|
+
);
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
setCurrentSchema(value: Schema | undefined): void {
|
|
451
|
+
this.currentSchema = value;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
setSelectedTab(tab: SCHEMA_SET_TAB_TYPE): void {
|
|
455
|
+
this.selectedTab = tab;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
setSchemaValidationerror(error: CompilationError): void {
|
|
459
|
+
this.schemaValidationError = error;
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
|
|
307
463
|
export class SchemaSetEditorState extends ElementEditorState {
|
|
308
464
|
currentSchema?: Schema | undefined;
|
|
309
|
-
selectedTab = SCHEMA_SET_TAB_TYPE.
|
|
465
|
+
selectedTab = SCHEMA_SET_TAB_TYPE.SCHEMAS;
|
|
310
466
|
schemaValidationError?: CompilationError;
|
|
311
467
|
importSchemaContentState: ImportSchemaContentState;
|
|
312
468
|
|
|
@@ -331,7 +487,8 @@ export class SchemaSetEditorState extends ElementEditorState {
|
|
|
331
487
|
this.schemaSet.schemas[this.schemaSet.schemas.length - 1];
|
|
332
488
|
}
|
|
333
489
|
this.schemaSetModelGenerationState = new SchemaSetModelGenerationState(
|
|
334
|
-
this,
|
|
490
|
+
this.schemaSet,
|
|
491
|
+
this.editorStore,
|
|
335
492
|
);
|
|
336
493
|
this.importSchemaContentState = new ImportSchemaContentState(
|
|
337
494
|
this,
|
|
@@ -125,6 +125,7 @@ export class ServiceExecutionParameterState extends LambdaParametersState {
|
|
|
125
125
|
const parmeterState = new LambdaParameterState(
|
|
126
126
|
p,
|
|
127
127
|
this.executionState.editorStore.changeDetectionState.observerContext,
|
|
128
|
+
this.executionState.editorStore.graphManagerState.graph,
|
|
128
129
|
);
|
|
129
130
|
parmeterState.mockParameterValue();
|
|
130
131
|
return parmeterState;
|
package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts
CHANGED
|
@@ -44,6 +44,7 @@ import {
|
|
|
44
44
|
isNonNullable,
|
|
45
45
|
returnUndefOnError,
|
|
46
46
|
getNullableFirstElement,
|
|
47
|
+
uniq,
|
|
47
48
|
} from '@finos/legend-shared';
|
|
48
49
|
import { action, flow, makeObservable, observable } from 'mobx';
|
|
49
50
|
import type { EditorStore } from '../../../../EditorStore.js';
|
|
@@ -360,6 +361,6 @@ export class ServiceTestDataState {
|
|
|
360
361
|
} else if (execution instanceof PureMultiExecution) {
|
|
361
362
|
runtimes = execution.executionParameters.map((t) => t.runtime);
|
|
362
363
|
}
|
|
363
|
-
return runtimes.flatMap(getAllIdentifiedConnectionsFromRuntime);
|
|
364
|
+
return uniq(runtimes.flatMap(getAllIdentifiedConnectionsFromRuntime));
|
|
364
365
|
}
|
|
365
366
|
}
|
package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts
CHANGED
|
@@ -136,7 +136,10 @@ export class ServiceValueSpecificationTestParameterState extends ServiceTestPara
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
resetValueSpec(): void {
|
|
139
|
-
const mockValue = generateVariableExpressionMockValue(
|
|
139
|
+
const mockValue = generateVariableExpressionMockValue(
|
|
140
|
+
this.varExpression,
|
|
141
|
+
this.editorStore.graphManagerState.graph,
|
|
142
|
+
);
|
|
140
143
|
if (mockValue) {
|
|
141
144
|
this.updateValueSpecification(mockValue);
|
|
142
145
|
}
|
|
@@ -258,7 +261,10 @@ export class ServiceTestSetupState {
|
|
|
258
261
|
addExpressionParameterValue(expression: VariableExpression): void {
|
|
259
262
|
try {
|
|
260
263
|
const mockValue = guaranteeNonNullable(
|
|
261
|
-
generateVariableExpressionMockValue(
|
|
264
|
+
generateVariableExpressionMockValue(
|
|
265
|
+
expression,
|
|
266
|
+
this.editorStore.graphManagerState.graph,
|
|
267
|
+
),
|
|
262
268
|
);
|
|
263
269
|
const paramValue = new ParameterValue();
|
|
264
270
|
paramValue.name = expression.name;
|
|
@@ -338,7 +344,10 @@ export class ServiceTestSetupState {
|
|
|
338
344
|
const varExpressions = this.queryVariableExpressions;
|
|
339
345
|
const parameterValueStates = varExpressions
|
|
340
346
|
.map((varExpression) => {
|
|
341
|
-
const mockValue = generateVariableExpressionMockValue(
|
|
347
|
+
const mockValue = generateVariableExpressionMockValue(
|
|
348
|
+
varExpression,
|
|
349
|
+
this.editorStore.graphManagerState.graph,
|
|
350
|
+
);
|
|
342
351
|
if (mockValue) {
|
|
343
352
|
const paramValue = new ParameterValue();
|
|
344
353
|
paramValue.name = varExpression.name;
|
|
@@ -55,6 +55,11 @@ export const externalFormat_schemaSet_setFormat = action(
|
|
|
55
55
|
ss.format = value;
|
|
56
56
|
},
|
|
57
57
|
);
|
|
58
|
+
export const externalFormat_schemaSet_setSchemas = action(
|
|
59
|
+
(ss: SchemaSet, value: ExternalFormatSchema[]): void => {
|
|
60
|
+
ss.schemas = value;
|
|
61
|
+
},
|
|
62
|
+
);
|
|
58
63
|
export const externalFormat_schemaSet_addSchema = action(
|
|
59
64
|
(ss: SchemaSet, value: ExternalFormatSchema): void => {
|
|
60
65
|
addUniqueEntry(ss.schemas, observe_ExternalFormatSchema(value));
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
type StaticDatasourceSpecification,
|
|
39
39
|
type UsernamePasswordAuthenticationStrategy,
|
|
40
40
|
type GCPWorkloadIdentityFederationAuthenticationStrategy,
|
|
41
|
+
type MiddleTierUsernamePasswordAuthenticationStrategy,
|
|
41
42
|
type ObserverContext,
|
|
42
43
|
type EnumerationMappingReference,
|
|
43
44
|
type TableAlias,
|
|
@@ -163,6 +164,15 @@ export const gcpWorkloadIdentityFederationAuthenticationStrategy_setAdditionalGc
|
|
|
163
164
|
},
|
|
164
165
|
);
|
|
165
166
|
|
|
167
|
+
export const middleTierUsernamePasswordAuthenticationStrategy_setVaultReference =
|
|
168
|
+
action(
|
|
169
|
+
(
|
|
170
|
+
v: MiddleTierUsernamePasswordAuthenticationStrategy,
|
|
171
|
+
val: string,
|
|
172
|
+
): void => {
|
|
173
|
+
v.vaultReference = val;
|
|
174
|
+
},
|
|
175
|
+
);
|
|
166
176
|
// --------------------------------------------- DatasourceSpecification -------------------------------------
|
|
167
177
|
export const staticDatasourceSpecification_setHost = action(
|
|
168
178
|
(v: StaticDatasourceSpecification, val: string): void => {
|
|
@@ -63,13 +63,14 @@ export const getAllIdentifiedConnectionsFromRuntime = (
|
|
|
63
63
|
): IdentifiedConnection[] => {
|
|
64
64
|
const resolvedRuntimes: EngineRuntime[] = [];
|
|
65
65
|
if (runtime instanceof RuntimePointer) {
|
|
66
|
-
|
|
67
|
-
resolvedRuntimes.push(engineRuntime);
|
|
66
|
+
resolvedRuntimes.push(runtime.packageableRuntime.value.runtimeValue);
|
|
68
67
|
} else if (runtime instanceof EngineRuntime) {
|
|
69
68
|
resolvedRuntimes.push(runtime);
|
|
70
69
|
}
|
|
71
70
|
return resolvedRuntimes
|
|
72
|
-
.flatMap((e) =>
|
|
71
|
+
.flatMap((e) =>
|
|
72
|
+
e.connections.map((connection) => connection.storeConnections),
|
|
73
|
+
)
|
|
73
74
|
.flat();
|
|
74
75
|
};
|
|
75
76
|
|
package/tsconfig.json
CHANGED
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"./src/stores/editor-state/GenerationSpecificationEditorState.ts",
|
|
73
73
|
"./src/stores/editor-state/GrammarTextEditorState.ts",
|
|
74
74
|
"./src/stores/editor-state/GraphGenerationState.ts",
|
|
75
|
-
"./src/stores/editor-state/
|
|
75
|
+
"./src/stores/editor-state/ModelImporterState.ts",
|
|
76
76
|
"./src/stores/editor-state/ProjectConfigurationEditorState.ts",
|
|
77
77
|
"./src/stores/editor-state/UnsupportedElementEditorState.ts",
|
|
78
78
|
"./src/stores/editor-state/element-editor-state/ClassEditorState.ts",
|
|
@@ -160,7 +160,7 @@
|
|
|
160
160
|
"./src/components/editor/edit-panel/FunctionEditor.tsx",
|
|
161
161
|
"./src/components/editor/edit-panel/GenerationSpecificationEditor.tsx",
|
|
162
162
|
"./src/components/editor/edit-panel/GrammarTextEditor.tsx",
|
|
163
|
-
"./src/components/editor/edit-panel/
|
|
163
|
+
"./src/components/editor/edit-panel/ModelImporter.tsx",
|
|
164
164
|
"./src/components/editor/edit-panel/RuntimeEditor.tsx",
|
|
165
165
|
"./src/components/editor/edit-panel/UnsupportedElementEditor.tsx",
|
|
166
166
|
"./src/components/editor/edit-panel/connection-editor/ConnectionEditor.tsx",
|
|
@@ -179,6 +179,7 @@
|
|
|
179
179
|
"./src/components/editor/edit-panel/external-format-editor/ExternalFormatConnectionEditor.tsx",
|
|
180
180
|
"./src/components/editor/edit-panel/external-format-editor/NewSchemaSetDriver.tsx",
|
|
181
181
|
"./src/components/editor/edit-panel/external-format-editor/SchemaSetElementEditor.tsx",
|
|
182
|
+
"./src/components/editor/edit-panel/external-format-editor/SchemaSetModelGenerationEditor.tsx",
|
|
182
183
|
"./src/components/editor/edit-panel/mapping-editor/ClassMappingEditor.tsx",
|
|
183
184
|
"./src/components/editor/edit-panel/mapping-editor/EnumerationMappingEditor.tsx",
|
|
184
185
|
"./src/components/editor/edit-panel/mapping-editor/FlatDataPropertyMappingEditor.tsx",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModelLoader.d.ts","sourceRoot":"","sources":["../../../../src/components/editor/edit-panel/ModelLoader.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AA8BH,eAAO,MAAM,WAAW;;CAsNtB,CAAC"}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { observer } from 'mobx-react-lite';
|
|
18
|
-
import { ModelLoaderState, MODEL_UPDATER_INPUT_TYPE, } from '../../../stores/editor-state/ModelLoaderState.js';
|
|
19
|
-
import { prettyCONSTName } from '@finos/legend-shared';
|
|
20
|
-
import { DropdownMenu, MenuContent, MenuContentItem, CaretDownIcon, CheckSquareIcon, TruckLoadingIcon, EmptySquareIcon, } from '@finos/legend-art';
|
|
21
|
-
import { flowResult } from 'mobx';
|
|
22
|
-
import { useEditorStore } from '../EditorStoreProvider.js';
|
|
23
|
-
import { ActionAlertType, ActionAlertActionType, useApplicationStore, EDITOR_LANGUAGE, useApplicationNavigationContext, } from '@finos/legend-application';
|
|
24
|
-
import { StudioTextInputEditor } from '../../shared/StudioTextInputEditor.js';
|
|
25
|
-
import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../stores/LegendStudioApplicationNavigationContext.js';
|
|
26
|
-
export const ModelLoader = observer(() => {
|
|
27
|
-
const editorStore = useEditorStore();
|
|
28
|
-
const applicationStore = useApplicationStore();
|
|
29
|
-
const modelLoaderState = editorStore.getCurrentEditorState(ModelLoaderState);
|
|
30
|
-
const nativeInputTypes = Object.values(MODEL_UPDATER_INPUT_TYPE);
|
|
31
|
-
const externalFormatInputTypes = modelLoaderState.modelImportDescriptions;
|
|
32
|
-
const extraModelLoaderExtensionsConfigs = modelLoaderState.modelLoaderExtensionConfigurations;
|
|
33
|
-
// input type
|
|
34
|
-
const currentModelLoadType = modelLoaderState.currentModelLoadType;
|
|
35
|
-
// replace flag
|
|
36
|
-
const replace = modelLoaderState.replace;
|
|
37
|
-
const toggleReplace = () => modelLoaderState.setReplaceFlag(!replace);
|
|
38
|
-
// actions
|
|
39
|
-
const loadCurrentProjectEntities = applicationStore.guardUnhandledError(() => flowResult(modelLoaderState.loadCurrentProjectEntities()));
|
|
40
|
-
const setCurrentInputType = (inputType) => () => {
|
|
41
|
-
modelLoaderState.setCurrentModelLoadType(inputType);
|
|
42
|
-
};
|
|
43
|
-
const loaderExtensionConfig = modelLoaderState.getLoaderExtensionConfiguration(currentModelLoadType);
|
|
44
|
-
const label = modelLoaderState.getImportConfigurationDescription(currentModelLoadType)
|
|
45
|
-
?.label ??
|
|
46
|
-
loaderExtensionConfig?.label ??
|
|
47
|
-
loaderExtensionConfig?.key ??
|
|
48
|
-
currentModelLoadType;
|
|
49
|
-
const allowHardReplace = !loaderExtensionConfig || loaderExtensionConfig.allowHardReplace;
|
|
50
|
-
const isNativeInput = Object.values(MODEL_UPDATER_INPUT_TYPE).includes(currentModelLoadType);
|
|
51
|
-
const loadModel = () => {
|
|
52
|
-
if (loaderExtensionConfig) {
|
|
53
|
-
loaderExtensionConfig
|
|
54
|
-
.load(editorStore)
|
|
55
|
-
.catch(applicationStore.alertUnhandledError);
|
|
56
|
-
}
|
|
57
|
-
else if (editorStore.hasUnpushedChanges) {
|
|
58
|
-
editorStore.setActionAlertInfo({
|
|
59
|
-
message: 'You have unpushed changes',
|
|
60
|
-
prompt: 'This action will discard these changes and refresh the application',
|
|
61
|
-
type: ActionAlertType.CAUTION,
|
|
62
|
-
onEnter: () => editorStore.setBlockGlobalHotkeys(true),
|
|
63
|
-
onClose: () => editorStore.setBlockGlobalHotkeys(false),
|
|
64
|
-
actions: [
|
|
65
|
-
{
|
|
66
|
-
label: 'Proceed to load model',
|
|
67
|
-
type: ActionAlertActionType.PROCEED_WITH_CAUTION,
|
|
68
|
-
handler: () => {
|
|
69
|
-
editorStore.setIgnoreNavigationBlocking(true);
|
|
70
|
-
flowResult(modelLoaderState.loadModel()).catch(applicationStore.alertUnhandledError);
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
label: 'Abort',
|
|
75
|
-
type: ActionAlertActionType.PROCEED,
|
|
76
|
-
default: true,
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
flowResult(modelLoaderState.loadModel()).catch(applicationStore.alertUnhandledError);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const updateModel = (val) => modelLoaderState.setModelText(val);
|
|
86
|
-
useApplicationNavigationContext(LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.MODEL_LOADER);
|
|
87
|
-
return (_jsxs("div", { className: "panel model-loader", children: [_jsxs("div", { className: "panel__header model-loader__header", children: [_jsxs("div", { className: "model-loader__header__configs", children: [_jsx(DropdownMenu, { content: _jsxs(MenuContent, { className: "model-loader__header__configs__type__menu", children: [_jsxs("div", { className: "model-loader__header__configs__type-option__group model-loader__header__configs__type-option__group--native", children: [_jsx("div", { className: "model-loader__header__configs__type-option__group__name", children: "native" }), _jsx("div", { className: "model-loader__header__configs__type-option__group__options", children: nativeInputTypes.map((inputType) => (_jsx(MenuContentItem, { className: "model-loader__header__configs__type-option__group__option", onClick: setCurrentInputType(inputType), children: prettyCONSTName(inputType) }, inputType))) })] }), Boolean(externalFormatInputTypes) && (_jsxs(_Fragment, { children: [_jsx("div", { className: "model-loader__header__configs__type-option__group__separator" }), _jsxs("div", { className: "model-loader__header__configs__type-option__group model-loader__header__configs__type-option__group--external", children: [_jsx("div", { className: "model-loader__header__configs__type-option__group__name", children: "external" }), _jsx("div", { className: "model-loader__header__configs__type-option__group__options", children: externalFormatInputTypes.map((inputType) => (_jsx(MenuContentItem, { className: "model-loader__header__configs__type-option__group__option", onClick: setCurrentInputType(inputType.key), children: inputType.label }, inputType.key))) })] })] })), Boolean(extraModelLoaderExtensionsConfigs.length > 0) && (_jsxs(_Fragment, { children: [_jsx("div", { className: "model-loader__header__configs__type-option__group__separator" }), _jsxs("div", { className: "model-loader__header__configs__type-option__group model-loader__header__configs__type-option__group--extension", children: [_jsx("div", { className: "model-loader__header__configs__type-option__group__name", children: "extensions" }), _jsx("div", { className: "model-loader__header__configs__type-option__group__options", children: extraModelLoaderExtensionsConfigs.map((config) => (_jsx(MenuContentItem, { className: "model-loader__header__configs__type-option__group__option", onClick: setCurrentInputType(config.key), children: config.label ?? prettyCONSTName(config.key) }, config.key))) })] })] }))] }), menuProps: {
|
|
88
|
-
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
|
|
89
|
-
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
|
90
|
-
}, children: _jsxs("div", { className: "model-loader__header__configs__type", children: [_jsx("div", { className: "model-loader__header__configs__type__label", children: prettyCONSTName(label) }), _jsx("div", { className: "model-loader__header__configs__type__icon", children: _jsx(CaretDownIcon, {}) })] }) }), allowHardReplace && (_jsxs("div", { className: "model-loader__header__configs__edit-mode", onClick: toggleReplace, children: [_jsx("div", { className: "model-loader__header__configs__edit-mode__icon", children: replace ? _jsx(CheckSquareIcon, {}) : _jsx(EmptySquareIcon, {}) }), _jsx("div", { className: "model-loader__header__configs__edit-mode__label", children: "replace" })] })), isNativeInput && (_jsx("button", { className: "model-loader__header__configs__load-project-entities-btn", tabIndex: -1, onClick: loadCurrentProjectEntities, title: "Load current project entities", children: _jsx(TruckLoadingIcon, {}) }))] }), _jsx("div", { className: "model-loader__header__action", children: _jsx("button", { className: "btn--dark model-loader__header__load-btn", onClick: loadModel, disabled: modelLoaderState.isLoadingModel, tabIndex: -1, title: "Load model", children: "Load" }) })] }), _jsx("div", { className: "panel__content model-loader__editor", children: loaderExtensionConfig?.renderer(editorStore) ?? (_jsx(StudioTextInputEditor, { language: modelLoaderState.currentModelLoadType ===
|
|
91
|
-
MODEL_UPDATER_INPUT_TYPE.PURE_GRAMMAR
|
|
92
|
-
? EDITOR_LANGUAGE.PURE
|
|
93
|
-
: EDITOR_LANGUAGE.JSON, inputValue: modelLoaderState.modelText, updateInput: updateModel, showMiniMap: true })) })] }));
|
|
94
|
-
});
|
|
95
|
-
//# sourceMappingURL=ModelLoader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ModelLoader.js","sourceRoot":"","sources":["../../../../src/components/editor/edit-panel/ModelLoader.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EACL,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,YAAY,EACZ,WAAW,EACX,eAAe,EACf,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AA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