@finos/legend-application-studio 28.2.6 → 28.3.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.
Files changed (42) hide show
  1. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js +1 -1
  2. package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
  3. package/lib/components/editor/panel-group/DevToolPanel.d.ts.map +1 -1
  4. package/lib/components/editor/panel-group/DevToolPanel.js +27 -3
  5. package/lib/components/editor/panel-group/DevToolPanel.js.map +1 -1
  6. package/lib/components/editor/side-bar/CreateNewElementModal.d.ts.map +1 -1
  7. package/lib/components/editor/side-bar/CreateNewElementModal.js +3 -2
  8. package/lib/components/editor/side-bar/CreateNewElementModal.js.map +1 -1
  9. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  10. package/lib/components/editor/side-bar/Explorer.js +19 -15
  11. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  12. package/lib/components/extensions/DSL_ExternalFormat_LegendStudioApplicationPlugin.d.ts +1 -0
  13. package/lib/components/extensions/DSL_ExternalFormat_LegendStudioApplicationPlugin.d.ts.map +1 -1
  14. package/lib/components/extensions/DSL_ExternalFormat_LegendStudioApplicationPlugin.js +6 -0
  15. package/lib/components/extensions/DSL_ExternalFormat_LegendStudioApplicationPlugin.js.map +1 -1
  16. package/lib/index.css +2 -2
  17. package/lib/index.css.map +1 -1
  18. package/lib/index.d.ts +1 -0
  19. package/lib/index.d.ts.map +1 -1
  20. package/lib/index.js +1 -0
  21. package/lib/index.js.map +1 -1
  22. package/lib/package.json +7 -7
  23. package/lib/stores/LegendStudioApplicationPlugin.d.ts +4 -0
  24. package/lib/stores/LegendStudioApplicationPlugin.d.ts.map +1 -1
  25. package/lib/stores/editor/EditorStore.d.ts +2 -0
  26. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  27. package/lib/stores/editor/EditorStore.js +93 -1
  28. package/lib/stores/editor/EditorStore.js.map +1 -1
  29. package/lib/stores/editor/utils/ModelClassifierUtils.d.ts +8 -0
  30. package/lib/stores/editor/utils/ModelClassifierUtils.d.ts.map +1 -1
  31. package/lib/stores/editor/utils/ModelClassifierUtils.js +9 -0
  32. package/lib/stores/editor/utils/ModelClassifierUtils.js.map +1 -1
  33. package/package.json +18 -18
  34. package/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx +1 -1
  35. package/src/components/editor/panel-group/DevToolPanel.tsx +94 -1
  36. package/src/components/editor/side-bar/CreateNewElementModal.tsx +4 -3
  37. package/src/components/editor/side-bar/Explorer.tsx +65 -35
  38. package/src/components/extensions/DSL_ExternalFormat_LegendStudioApplicationPlugin.tsx +10 -0
  39. package/src/index.ts +1 -0
  40. package/src/stores/LegendStudioApplicationPlugin.ts +5 -0
  41. package/src/stores/editor/EditorStore.ts +134 -1
  42. package/src/stores/editor/utils/ModelClassifierUtils.ts +9 -0
@@ -93,7 +93,10 @@ import { LEGEND_STUDIO_APP_EVENT } from '../../__lib__/LegendStudioEvent.js';
93
93
  import type { EditorMode } from './EditorMode.js';
94
94
  import { StandardEditorMode } from './StandardEditorMode.js';
95
95
  import { WorkspaceUpdateConflictResolutionState } from './sidebar-state/WorkspaceUpdateConflictResolutionState.js';
96
- import { PACKAGEABLE_ELEMENT_TYPE } from './utils/ModelClassifierUtils.js';
96
+ import {
97
+ PACKAGEABLE_ELEMENT_TYPE,
98
+ PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY,
99
+ } from './utils/ModelClassifierUtils.js';
97
100
  import { GlobalTestRunnerState } from './sidebar-state/testable/GlobalTestRunnerState.js';
98
101
  import type { LegendStudioApplicationStore } from '../LegendStudioBaseStore.js';
99
102
  import { EmbeddedQueryBuilderState } from './EmbeddedQueryBuilderState.js';
@@ -188,6 +191,7 @@ export class EditorStore implements CommandRegistrar {
188
191
  snap: 150,
189
192
  });
190
193
  readonly tabManagerState = new EditorTabManagerState(this);
194
+ supportedElementTypesWithCategory: Map<string, string[]>;
191
195
 
192
196
  constructor(
193
197
  applicationStore: LegendStudioApplicationStore,
@@ -285,6 +289,8 @@ export class EditorStore implements CommandRegistrar {
285
289
  )
286
290
  .map((creator) => creator(this))
287
291
  .filter(isNonNullable);
292
+ this.supportedElementTypesWithCategory =
293
+ this.getSupportedElementTypesWithCategory();
288
294
  }
289
295
 
290
296
  get isInitialized(): boolean {
@@ -926,6 +932,133 @@ export class EditorStore implements CommandRegistrar {
926
932
  }
927
933
  }
928
934
 
935
+ getSupportedElementTypesWithCategory(): Map<string, string[]> {
936
+ const elementTypesWithCategoryMap = new Map<string, string[]>();
937
+ Object.values(PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY).forEach((value) => {
938
+ switch (value) {
939
+ case PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.MODEL: {
940
+ const elements = [
941
+ PACKAGEABLE_ELEMENT_TYPE.PACKAGE,
942
+ PACKAGEABLE_ELEMENT_TYPE.CLASS,
943
+ PACKAGEABLE_ELEMENT_TYPE.ASSOCIATION,
944
+ PACKAGEABLE_ELEMENT_TYPE.ENUMERATION,
945
+ PACKAGEABLE_ELEMENT_TYPE.PROFILE,
946
+ PACKAGEABLE_ELEMENT_TYPE.FUNCTION,
947
+ PACKAGEABLE_ELEMENT_TYPE.MEASURE,
948
+ PACKAGEABLE_ELEMENT_TYPE.DATA,
949
+ ] as string[];
950
+ elementTypesWithCategoryMap.set(
951
+ PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.MODEL,
952
+ elements,
953
+ );
954
+ break;
955
+ }
956
+ case PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.STORE: {
957
+ const elements = [
958
+ PACKAGEABLE_ELEMENT_TYPE.DATABASE,
959
+ PACKAGEABLE_ELEMENT_TYPE.FLAT_DATA_STORE,
960
+ ] as string[];
961
+ elementTypesWithCategoryMap.set(
962
+ PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.STORE,
963
+ elements,
964
+ );
965
+ break;
966
+ }
967
+ case PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.QUERY: {
968
+ const elements = [
969
+ PACKAGEABLE_ELEMENT_TYPE.CONNECTION,
970
+ PACKAGEABLE_ELEMENT_TYPE.RUNTIME,
971
+ PACKAGEABLE_ELEMENT_TYPE.MAPPING,
972
+ PACKAGEABLE_ELEMENT_TYPE.SERVICE,
973
+ this.applicationStore.config.options
974
+ .TEMPORARY__enableLocalConnectionBuilder
975
+ ? PACKAGEABLE_ELEMENT_TYPE.TEMPORARY__LOCAL_CONNECTION
976
+ : undefined,
977
+ ] as (string | undefined)[];
978
+ elementTypesWithCategoryMap.set(
979
+ PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.QUERY,
980
+ elements.filter(isNonNullable),
981
+ );
982
+ break;
983
+ }
984
+ // for displaying categories in order
985
+ case PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.EXTERNAL_FORMAT: {
986
+ elementTypesWithCategoryMap.set(
987
+ PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.EXTERNAL_FORMAT,
988
+ [],
989
+ );
990
+ break;
991
+ }
992
+ case PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.GENERATION: {
993
+ const elements = [
994
+ PACKAGEABLE_ELEMENT_TYPE.FILE_GENERATION,
995
+ PACKAGEABLE_ELEMENT_TYPE.GENERATION_SPECIFICATION,
996
+ ] as string[];
997
+ elementTypesWithCategoryMap.set(
998
+ PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.GENERATION,
999
+ elements,
1000
+ );
1001
+ break;
1002
+ }
1003
+ // for displaying categories in order
1004
+ case PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.OTHER: {
1005
+ elementTypesWithCategoryMap.set(
1006
+ PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY.OTHER,
1007
+ [],
1008
+ );
1009
+ break;
1010
+ }
1011
+ default:
1012
+ break;
1013
+ }
1014
+ });
1015
+ const extensions = this.pluginManager
1016
+ .getApplicationPlugins()
1017
+ .flatMap(
1018
+ (plugin) =>
1019
+ (
1020
+ plugin as DSL_LegendStudioApplicationPlugin_Extension
1021
+ ).getExtraSupportedElementTypesWithCategory?.() ??
1022
+ new Map<string, string[]>(),
1023
+ );
1024
+ const elementTypesWithCategoryMapFromExtensions = new Map<
1025
+ string,
1026
+ string[]
1027
+ >();
1028
+ extensions.forEach((typeCategoryMap) => {
1029
+ Array.from(typeCategoryMap.entries()).forEach((entry) => {
1030
+ const [key, value] = entry;
1031
+ elementTypesWithCategoryMapFromExtensions.set(
1032
+ key,
1033
+ elementTypesWithCategoryMapFromExtensions.get(key) === undefined
1034
+ ? [...value]
1035
+ : [
1036
+ ...guaranteeNonNullable(
1037
+ elementTypesWithCategoryMapFromExtensions.get(key),
1038
+ ),
1039
+ ...value,
1040
+ ],
1041
+ );
1042
+ });
1043
+ });
1044
+ // sort extensions alphabetically and insert extensions into the base elementTypesWithCategoryMap
1045
+ Array.from(elementTypesWithCategoryMapFromExtensions.entries()).forEach(
1046
+ (entry) => {
1047
+ const [key, value] = entry;
1048
+ value.sort((a, b) => a.localeCompare(b));
1049
+ const existingValues = elementTypesWithCategoryMap.get(key);
1050
+ elementTypesWithCategoryMap.set(
1051
+ key,
1052
+ existingValues === undefined
1053
+ ? [...value]
1054
+ : [...guaranteeNonNullable(existingValues), ...value],
1055
+ );
1056
+ },
1057
+ );
1058
+
1059
+ return elementTypesWithCategoryMap;
1060
+ }
1061
+
929
1062
  getSupportedElementTypes(): string[] {
930
1063
  return (
931
1064
  [
@@ -73,3 +73,12 @@ export enum PACKAGEABLE_ELEMENT_TYPE {
73
73
  TEMPORARY__LOCAL_CONNECTION = 'LOCAL_CONNECTION',
74
74
  INTERNAL__UNKNOWN = 'UNKNOWN',
75
75
  }
76
+
77
+ export enum PACKAGEABLE_ELEMENT_GROUP_BY_CATEGORY {
78
+ MODEL = 'Model',
79
+ STORE = 'Store',
80
+ QUERY = 'Query',
81
+ EXTERNAL_FORMAT = 'External Format',
82
+ GENERATION = 'Generation',
83
+ OTHER = 'Other',
84
+ }