@finos/legend-application-studio 22.1.4 → 22.1.5

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.
Files changed (25) hide show
  1. package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.d.ts.map +1 -1
  2. package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.js +9 -11
  3. package/lib/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.js.map +1 -1
  4. package/lib/index.css +2 -2
  5. package/lib/index.css.map +1 -1
  6. package/lib/package.json +1 -1
  7. package/lib/stores/editor-state/FileGenerationState.d.ts.map +1 -1
  8. package/lib/stores/editor-state/FileGenerationState.js +3 -3
  9. package/lib/stores/editor-state/FileGenerationState.js.map +1 -1
  10. package/lib/stores/editor-state/ModelImporterState.js +1 -1
  11. package/lib/stores/editor-state/ModelImporterState.js.map +1 -1
  12. package/lib/stores/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.d.ts +2 -1
  13. package/lib/stores/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.d.ts.map +1 -1
  14. package/lib/stores/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.js +26 -12
  15. package/lib/stores/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.js.map +1 -1
  16. package/lib/stores/shared/modifier/DSL_Generation_GraphModifierHelper.d.ts +1 -1
  17. package/lib/stores/shared/modifier/DSL_Generation_GraphModifierHelper.d.ts.map +1 -1
  18. package/lib/stores/shared/modifier/DSL_Generation_GraphModifierHelper.js +3 -3
  19. package/lib/stores/shared/modifier/DSL_Generation_GraphModifierHelper.js.map +1 -1
  20. package/package.json +1 -1
  21. package/src/components/editor/edit-panel/external-format-editor/DSL_ExternalFormat_SchemaSetModelGenerationEditor.tsx +27 -26
  22. package/src/stores/editor-state/FileGenerationState.ts +9 -3
  23. package/src/stores/editor-state/ModelImporterState.ts +1 -1
  24. package/src/stores/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.ts +44 -15
  25. package/src/stores/shared/modifier/DSL_Generation_GraphModifierHelper.ts +10 -9
@@ -1 +1 @@
1
- {"version":3,"file":"DSL_Generation_GraphModifierHelper.js","sourceRoot":"","sources":["../../../../src/stores/shared/modifier/DSL_Generation_GraphModifierHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,2BAA2B,EAG3B,2BAA2B,EAC3B,kBAAkB,EAClB,mCAAmC,EACnC,4BAA4B,EAC5B,mCAAmC,EACnC,mCAAmC,EACnC,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,WAAW,EACX,WAAW,EACX,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,sGAAsG;AAEtG,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAClD,CAAC,EAAyB,EAAE,KAAc,EAAQ,EAAE;IAClD,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,CAAC,CACF,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAC1C,CAAC,EAA+B,EAAE,KAAa,EAAQ,EAAE;IACvD,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC;AAClB,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,uCAAuC,GAAG,MAAM,CAC3D,CAAC,EAA+B,EAAE,EAAyB,EAAQ,EAAE;IACnE,cAAc,CACZ,EAAE,CAAC,uBAAuB,EAC1B,6BAA6B,CAAC,EAAE,CAAC,CAClC,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAAG,MAAM,CAC1D,CAAC,EAA+B,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EAAE;QAClD,yCAAyC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KAC7D;SAAM;QACL,+BAA+B,CAC7B,OAAO,EACP,0BAA0B,CACxB,IAAI,kBAAkB,CACpB,mCAAmC,CAAC,MAAM,CAAC,OAAO,CAAC,CACpD,CACF,CACF,CAAC;KACH;AACH,CAAC,CACF,CAAC"}
1
+ {"version":3,"file":"DSL_Generation_GraphModifierHelper.js","sourceRoot":"","sources":["../../../../src/stores/shared/modifier/DSL_Generation_GraphModifierHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,2BAA2B,EAG3B,2BAA2B,EAC3B,kBAAkB,EAClB,mCAAmC,EACnC,4BAA4B,EAC5B,mCAAmC,EACnC,mCAAmC,EACnC,0BAA0B,EAC1B,6BAA6B,GAC9B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,cAAc,EACd,WAAW,EACX,WAAW,EACX,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9B,sGAAsG;AAEtG,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAClD,CAAC,EAAyB,EAAE,KAAc,EAAQ,EAAE;IAClD,EAAE,CAAC,KAAK,GAAG,KAAK,CAAC;AACnB,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,8CAA8C,GAAG,MAAM,CAClE,CACE,uBAAgD,EAChD,EAAyB,EACnB,EAAE;IACR,cAAc,CAAC,uBAAuB,EAAE,6BAA6B,CAAC,EAAE,CAAC,CAAC,CAAC;AAC7E,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,MAAM,CAC1C,CAAC,EAA+B,EAAE,KAAa,EAAQ,EAAE;IACvD,EAAE,CAAC,IAAI,GAAG,KAAK,CAAC;AAClB,CAAC,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAAG,MAAM,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OAAO,YAAY,2BAA2B,EAAE;QAClD,yCAAyC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KAC7D;SAAM;QACL,+BAA+B,CAC7B,OAAO,EACP,0BAA0B,CACxB,IAAI,kBAAkB,CACpB,mCAAmC,CAAC,MAAM,CAAC,OAAO,CAAC,CACpD,CACF,CACF,CAAC;KACH;AACH,CAAC,CACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-application-studio",
3
- "version": "22.1.4",
3
+ "version": "22.1.5",
4
4
  "description": "Legend Studio application core",
5
5
  "keywords": [
6
6
  "legend",
@@ -21,7 +21,6 @@ import { useMemo } from 'react';
21
21
  import type { SchemaSetModelGenerationState } from '../../../../stores/editor-state/element-editor-state/external-format/DSL_ExternalFormat_SchemaSetEditorState.js';
22
22
  import { debounce } from '@finos/legend-shared';
23
23
  import {
24
- clsx,
25
24
  InputWithInlineValidation,
26
25
  PanelContent,
27
26
  PanelLoadingIndicator,
@@ -49,8 +48,7 @@ export const SchemaSetModelGenerationEditor = observer(
49
48
  const description = modelGenerationState.description;
50
49
  const properties = description?.modelGenerationProperties ?? [];
51
50
  const debouncedRegenerate = useMemo(
52
- () =>
53
- debounce(() => flowResult(modelGenerationState.generateModel()), 500),
51
+ () => debounce(() => flowResult(modelGenerationState.generate()), 500),
54
52
  [modelGenerationState],
55
53
  );
56
54
  const update = (
@@ -65,7 +63,10 @@ export const SchemaSetModelGenerationEditor = observer(
65
63
  debouncedRegenerate()?.catch(applicationStore.alertUnhandledError);
66
64
  };
67
65
  const regenerate = (): void => {
68
- modelGenerationState.generateModel();
66
+ modelGenerationState.generate();
67
+ };
68
+ const resetProperties = (): void => {
69
+ modelGenerationState.setConfigurationProperty([]);
69
70
  };
70
71
  const getConfigValue = (name: string): unknown | undefined =>
71
72
  modelGenerationState.getConfigValue(name);
@@ -102,15 +103,18 @@ export const SchemaSetModelGenerationEditor = observer(
102
103
  <div className="panel__header__title__label">{`${format} configuration`}</div>
103
104
  </div>
104
105
  <div className="panel__header__actions">
105
- <button
106
- className="panel__header__action file-generation-editor__configuration__reset-btn"
107
- tabIndex={-1}
108
- disabled={isReadOnly || !properties.length}
109
- onClick={regenerate}
110
- title="Reset to default configuration"
111
- >
112
- <RefreshIcon />
113
- </button>
106
+ <div className="panel__header__actions">
107
+ <div className="panel__header__actions"></div>
108
+ <button
109
+ className="panel__header__action file-generation-editor__configuration__reset-btn"
110
+ tabIndex={-1}
111
+ disabled={isReadOnly || !properties.length}
112
+ onClick={resetProperties}
113
+ title="Reset to default configuration"
114
+ >
115
+ <RefreshIcon />
116
+ </button>
117
+ </div>
114
118
  </div>
115
119
  </div>
116
120
  <PanelContent>
@@ -169,27 +173,24 @@ export const SchemaSetModelGenerationEditor = observer(
169
173
  </div>
170
174
  <div className="panel__header__actions">
171
175
  <button
172
- className={clsx(
173
- 'panel__header__action generation-result-viewer__regenerate-btn',
174
- {
175
- ' generation-result-viewer__regenerate-btn--loading':
176
- modelGenerationState.generatingModelsState
177
- .isInProgress ||
178
- modelGenerationState.importGeneratedElementsState
179
- .isInProgress,
180
- },
181
- )}
182
- tabIndex={-1}
176
+ className="panel__header__action generation-result-viewer__generate-btn"
177
+ onClick={regenerate}
183
178
  disabled={
184
179
  modelGenerationState.generatingModelsState.isInProgress ||
185
180
  modelGenerationState.importGeneratedElementsState
186
181
  .isInProgress
187
182
  }
188
- onClick={regenerate}
189
183
  title="Regenerate"
184
+ tabIndex={-1}
190
185
  >
191
- <RefreshIcon />
186
+ <div className="generation-result-viewer__generate-btn__label">
187
+ <RefreshIcon className="generation-result-viewer__generate-btn__label__icon" />
188
+ <div className="generation-result-viewer__generate-btn__label__title">
189
+ Generate
190
+ </div>
191
+ </div>
192
192
  </button>
193
+
193
194
  {!modelGenerationState.isolatedGraph && (
194
195
  <button
195
196
  className="btn--dark model-loader__header__load-btn"
@@ -51,7 +51,7 @@ import {
51
51
  } from '@finos/legend-graph';
52
52
  import {
53
53
  configurationProperty_setValue,
54
- fileGeneration_addConfigurationProperty,
54
+ configurationProperty_addConfigurationProperty,
55
55
  fileGeneration_addScopeElement,
56
56
  fileGeneration_deleteScopeElement,
57
57
  } from '../shared/modifier/DSL_Generation_GraphModifierHelper.js';
@@ -294,7 +294,10 @@ export class FileGenerationState {
294
294
  generationProperty.name,
295
295
  newValue,
296
296
  );
297
- fileGeneration_addConfigurationProperty(fileGeneration, newItem);
297
+ configurationProperty_addConfigurationProperty(
298
+ fileGeneration.configurationProperties,
299
+ newItem,
300
+ );
298
301
  }
299
302
  }
300
303
  } else {
@@ -317,7 +320,10 @@ export class FileGenerationState {
317
320
  generationProperty.name,
318
321
  newConfigValue,
319
322
  );
320
- fileGeneration_addConfigurationProperty(fileGeneration, newItem);
323
+ configurationProperty_addConfigurationProperty(
324
+ fileGeneration.configurationProperties,
325
+ newItem,
326
+ );
321
327
  }
322
328
  } else {
323
329
  fileGeneration.configurationProperties =
@@ -478,7 +478,7 @@ export class ModelImporterState extends EditorState {
478
478
  }
479
479
 
480
480
  override match(tab: EditorState): boolean {
481
- return tab instanceof ModelImporterEditorState;
481
+ return tab instanceof ModelImporterState;
482
482
  }
483
483
 
484
484
  setReplaceFlag(val: boolean): void {
@@ -27,7 +27,6 @@ import {
27
27
  readFileAsText,
28
28
  assertErrorThrown,
29
29
  LogEvent,
30
- addUniqueEntry,
31
30
  deepEqual,
32
31
  guaranteeType,
33
32
  isEmpty,
@@ -55,7 +54,10 @@ import { type EntityChange, EntityChangeType } from '@finos/legend-server-sdlc';
55
54
  import type { EditorStore } from '../../../EditorStore.js';
56
55
  import { ElementEditorState } from '../ElementEditorState.js';
57
56
  import { LEGEND_STUDIO_APP_EVENT } from '../../../LegendStudioAppEvent.js';
58
- import { configurationProperty_setValue } from '../../../shared/modifier/DSL_Generation_GraphModifierHelper.js';
57
+ import {
58
+ configurationProperty_addConfigurationProperty,
59
+ configurationProperty_setValue,
60
+ } from '../../../shared/modifier/DSL_Generation_GraphModifierHelper.js';
59
61
 
60
62
  export enum SCHEMA_SET_TAB_TYPE {
61
63
  SCHEMAS = 'SCHEMAS',
@@ -92,8 +94,9 @@ export class SchemaSetModelGenerationState {
92
94
  setGenerationValue: action,
93
95
  setTargetBindingPath: action,
94
96
  handleTargetBindingPathChange: action,
97
+ updateGenerationParameters: action,
95
98
  canGenerate: computed,
96
- generateModel: flow,
99
+ generate: flow,
97
100
  importGeneratedModelsIntoGraph: flow,
98
101
  getImportEntities: flow,
99
102
  });
@@ -197,7 +200,10 @@ export class SchemaSetModelGenerationState {
197
200
  generationProperty.name,
198
201
  newValue,
199
202
  );
200
- addUniqueEntry(this.configurationProperties, newItem);
203
+ configurationProperty_addConfigurationProperty(
204
+ this.configurationProperties,
205
+ newItem,
206
+ );
201
207
  }
202
208
  }
203
209
  } else {
@@ -208,7 +214,8 @@ export class SchemaSetModelGenerationState {
208
214
  (generationProperty.defaultValue === 'true') ===
209
215
  (newValue as boolean);
210
216
  }
211
- const newConfigValue = useDefaultValue ? undefined : newValue;
217
+ const newConfigValue =
218
+ useDefaultValue && !generationProperty.required ? undefined : newValue;
212
219
  if (newConfigValue !== undefined) {
213
220
  if (configProperty) {
214
221
  configurationProperty_setValue(configProperty, newConfigValue);
@@ -217,7 +224,10 @@ export class SchemaSetModelGenerationState {
217
224
  generationProperty.name,
218
225
  newConfigValue,
219
226
  );
220
- addUniqueEntry(this.configurationProperties, newItem);
227
+ configurationProperty_addConfigurationProperty(
228
+ this.configurationProperties,
229
+ newItem,
230
+ );
221
231
  }
222
232
  } else {
223
233
  this.configurationProperties = this.configurationProperties.filter(
@@ -227,18 +237,37 @@ export class SchemaSetModelGenerationState {
227
237
  }
228
238
  }
229
239
 
230
- *generateModel(): GeneratorFn<boolean> {
240
+ addInferredConfigurationProperties(
241
+ properties: ConfigurationProperty[],
242
+ ): void {
243
+ const modelGenerationProperties = this.modelGenerationProperties;
244
+ const SCHEMA_FORMAT_PROPERTY_NAME = 'format';
245
+ if (!properties.find((e) => e.name === SCHEMA_FORMAT_PROPERTY_NAME)) {
246
+ const genProperty = new ConfigurationProperty(
247
+ SCHEMA_FORMAT_PROPERTY_NAME,
248
+ this.schemaSet.format,
249
+ );
250
+ properties.push(genProperty);
251
+ }
252
+ modelGenerationProperties
253
+ .filter(
254
+ (property) =>
255
+ property.required &&
256
+ property.defaultValue &&
257
+ !properties.find((pv) => pv.name === property.name),
258
+ )
259
+ .forEach((toAdd) => {
260
+ const value = new ConfigurationProperty(toAdd.name, toAdd.defaultValue);
261
+ configurationProperty_addConfigurationProperty(properties, value);
262
+ });
263
+ }
264
+
265
+ *generate(): GeneratorFn<boolean> {
231
266
  this.generatingModelsState.inProgress();
267
+ this.editorStore.applicationStore.setNotification(undefined);
232
268
  try {
233
- const SCHEMA_FORMAT_PROPERTY_NAME = 'format';
234
269
  const properties = [...this.configurationProperties];
235
- if (!properties.find((e) => e.name === SCHEMA_FORMAT_PROPERTY_NAME)) {
236
- const genProperty = new ConfigurationProperty(
237
- SCHEMA_FORMAT_PROPERTY_NAME,
238
- this.schemaSet.format,
239
- );
240
- properties.push(genProperty);
241
- }
270
+ this.addInferredConfigurationProperties(properties);
242
271
  const val =
243
272
  (yield this.editorStore.graphManagerState.graphManager.generateModelFromExternalFormat(
244
273
  this.schemaSet,
@@ -43,18 +43,19 @@ export const configurationProperty_setValue = action(
43
43
  cp.value = value;
44
44
  },
45
45
  );
46
- export const fileGeneration_setType = action(
47
- (fg: FileGenerationSpecification, value: string): void => {
48
- fg.type = value;
46
+
47
+ export const configurationProperty_addConfigurationProperty = action(
48
+ (
49
+ configurationProperties: ConfigurationProperty[],
50
+ cp: ConfigurationProperty,
51
+ ): void => {
52
+ addUniqueEntry(configurationProperties, observe_ConfigurationProperty(cp));
49
53
  },
50
54
  );
51
55
 
52
- export const fileGeneration_addConfigurationProperty = action(
53
- (fg: FileGenerationSpecification, cp: ConfigurationProperty): void => {
54
- addUniqueEntry(
55
- fg.configurationProperties,
56
- observe_ConfigurationProperty(cp),
57
- );
56
+ export const fileGeneration_setType = action(
57
+ (fg: FileGenerationSpecification, value: string): void => {
58
+ fg.type = value;
58
59
  },
59
60
  );
60
61