@finos/legend-application-studio 28.21.46 → 28.21.48

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 (122) hide show
  1. package/lib/__lib__/LegendStudioEvent.d.ts +8 -0
  2. package/lib/__lib__/LegendStudioEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioEvent.js +13 -0
  4. package/lib/__lib__/LegendStudioEvent.js.map +1 -1
  5. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts +170 -6
  6. package/lib/__lib__/LegendStudioTelemetryHelper.d.ts.map +1 -1
  7. package/lib/__lib__/LegendStudioTelemetryHelper.js +116 -1
  8. package/lib/__lib__/LegendStudioTelemetryHelper.js.map +1 -1
  9. package/lib/components/editor/editor-group/LegendAISuggestTelemetryHooks.d.ts +30 -0
  10. package/lib/components/editor/editor-group/LegendAISuggestTelemetryHooks.d.ts.map +1 -0
  11. package/lib/components/editor/editor-group/LegendAISuggestTelemetryHooks.js +43 -0
  12. package/lib/components/editor/editor-group/LegendAISuggestTelemetryHooks.js.map +1 -0
  13. package/lib/components/editor/editor-group/RuntimeEditor.d.ts +4 -3
  14. package/lib/components/editor/editor-group/RuntimeEditor.d.ts.map +1 -1
  15. package/lib/components/editor/editor-group/RuntimeEditor.js +90 -36
  16. package/lib/components/editor/editor-group/RuntimeEditor.js.map +1 -1
  17. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.d.ts.map +1 -1
  18. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js +154 -35
  19. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js.map +1 -1
  20. package/lib/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.d.ts.map +1 -1
  21. package/lib/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.js +4 -6
  22. package/lib/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.js.map +1 -1
  23. package/lib/components/editor/editor-group/service-editor/ServiceEditor.d.ts.map +1 -1
  24. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js +31 -7
  25. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js.map +1 -1
  26. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.d.ts.map +1 -1
  27. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.js +4 -8
  28. package/lib/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.js.map +1 -1
  29. package/lib/index.css +1 -1
  30. package/lib/index.d.ts +3 -1
  31. package/lib/index.d.ts.map +1 -1
  32. package/lib/index.js +3 -1
  33. package/lib/index.js.map +1 -1
  34. package/lib/package.json +1 -1
  35. package/lib/stores/editor/EditorStore.d.ts +2 -0
  36. package/lib/stores/editor/EditorStore.d.ts.map +1 -1
  37. package/lib/stores/editor/EditorStore.js +2 -0
  38. package/lib/stores/editor/EditorStore.js.map +1 -1
  39. package/lib/stores/editor/GraphEditFormModeState.d.ts.map +1 -1
  40. package/lib/stores/editor/GraphEditFormModeState.js +21 -10
  41. package/lib/stores/editor/GraphEditFormModeState.js.map +1 -1
  42. package/lib/stores/editor/LegendAISuggestTelemetry.d.ts +143 -0
  43. package/lib/stores/editor/LegendAISuggestTelemetry.d.ts.map +1 -0
  44. package/lib/stores/editor/LegendAISuggestTelemetry.js +376 -0
  45. package/lib/stores/editor/LegendAISuggestTelemetry.js.map +1 -0
  46. package/lib/stores/editor/LegendSQLStudioPlaygroundState.js +3 -3
  47. package/lib/stores/editor/LegendSQLStudioPlaygroundState.js.map +1 -1
  48. package/lib/stores/editor/editor-state/GraphGenerationState.d.ts +14 -3
  49. package/lib/stores/editor/editor-state/GraphGenerationState.d.ts.map +1 -1
  50. package/lib/stores/editor/editor-state/GraphGenerationState.js +33 -21
  51. package/lib/stores/editor/editor-state/GraphGenerationState.js.map +1 -1
  52. package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.d.ts +35 -6
  53. package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.d.ts.map +1 -1
  54. package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.js +74 -29
  55. package/lib/stores/editor/editor-state/element-editor-state/RuntimeEditorState.js.map +1 -1
  56. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts +1 -0
  57. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.d.ts.map +1 -1
  58. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js +5 -5
  59. package/lib/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.js.map +1 -1
  60. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts +12 -0
  61. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.d.ts.map +1 -1
  62. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js +60 -14
  63. package/lib/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.js.map +1 -1
  64. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.js +2 -2
  65. package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.js.map +1 -1
  66. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.d.ts.map +1 -1
  67. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.js +34 -15
  68. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.js.map +1 -1
  69. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts +1 -1
  70. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.d.ts.map +1 -1
  71. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js +3 -11
  72. package/lib/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.js.map +1 -1
  73. package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.d.ts.map +1 -1
  74. package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.js +30 -2
  75. package/lib/stores/editor/sidebar-state/BulkServiceRegistrationState.js.map +1 -1
  76. package/lib/stores/editor/sidebar-state/LocalChangesState.d.ts.map +1 -1
  77. package/lib/stores/editor/sidebar-state/LocalChangesState.js +1 -0
  78. package/lib/stores/editor/sidebar-state/LocalChangesState.js.map +1 -1
  79. package/lib/stores/editor/sidebar-state/WorkflowManagerState.d.ts +1 -1
  80. package/lib/stores/editor/sidebar-state/WorkflowManagerState.d.ts.map +1 -1
  81. package/lib/stores/editor/sidebar-state/WorkflowManagerState.js +2 -12
  82. package/lib/stores/editor/sidebar-state/WorkflowManagerState.js.map +1 -1
  83. package/lib/stores/editor/utils/MockDataUtils.d.ts +12 -2
  84. package/lib/stores/editor/utils/MockDataUtils.d.ts.map +1 -1
  85. package/lib/stores/editor/utils/MockDataUtils.js +28 -28
  86. package/lib/stores/editor/utils/MockDataUtils.js.map +1 -1
  87. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts +2 -0
  88. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.d.ts.map +1 -1
  89. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js +13 -0
  90. package/lib/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.js.map +1 -1
  91. package/lib/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.d.ts +20 -2
  92. package/lib/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.d.ts.map +1 -1
  93. package/lib/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.js +38 -4
  94. package/lib/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.js.map +1 -1
  95. package/package.json +17 -17
  96. package/src/__lib__/LegendStudioEvent.ts +14 -0
  97. package/src/__lib__/LegendStudioTelemetryHelper.ts +277 -4
  98. package/src/components/editor/editor-group/LegendAISuggestTelemetryHooks.ts +57 -0
  99. package/src/components/editor/editor-group/RuntimeEditor.tsx +282 -132
  100. package/src/components/editor/editor-group/dataProduct/DataProductEditor.tsx +293 -106
  101. package/src/components/editor/editor-group/dataProduct/DataProductQueryBuilderHelper.ts +3 -13
  102. package/src/components/editor/editor-group/service-editor/ServiceEditor.tsx +41 -23
  103. package/src/components/editor/editor-group/service-editor/testable/ServiceTestDataEditor.tsx +5 -11
  104. package/src/index.ts +13 -0
  105. package/src/stores/editor/EditorStore.ts +3 -0
  106. package/src/stores/editor/GraphEditFormModeState.ts +31 -15
  107. package/src/stores/editor/LegendAISuggestTelemetry.ts +592 -0
  108. package/src/stores/editor/LegendSQLStudioPlaygroundState.ts +3 -3
  109. package/src/stores/editor/editor-state/GraphGenerationState.ts +48 -42
  110. package/src/stores/editor/editor-state/element-editor-state/RuntimeEditorState.ts +92 -31
  111. package/src/stores/editor/editor-state/element-editor-state/connection/DatabaseBuilderState.ts +6 -6
  112. package/src/stores/editor/editor-state/element-editor-state/dataProduct/DataProductEditorState.ts +75 -17
  113. package/src/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.ts +2 -2
  114. package/src/stores/editor/editor-state/element-editor-state/service/ServiceRegistrationState.ts +41 -23
  115. package/src/stores/editor/editor-state/element-editor-state/service/testable/ServiceTestDataState.ts +12 -21
  116. package/src/stores/editor/sidebar-state/BulkServiceRegistrationState.ts +49 -6
  117. package/src/stores/editor/sidebar-state/LocalChangesState.ts +4 -0
  118. package/src/stores/editor/sidebar-state/WorkflowManagerState.ts +3 -12
  119. package/src/stores/editor/utils/MockDataUtils.ts +33 -32
  120. package/src/stores/graph-modifier/DSL_DataProduct_GraphModifierHelper.ts +18 -0
  121. package/src/stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.ts +62 -7
  122. package/tsconfig.json +2 -0
@@ -18,6 +18,7 @@ import { useState, useEffect, useCallback, forwardRef } from 'react';
18
18
  import { observer } from 'mobx-react-lite';
19
19
  import {
20
20
  type RuntimeEditorState,
21
+ LakehouseBaseRuntimeEditorState,
21
22
  LakehouseRuntimeEditorState,
22
23
  PackageableRuntimeEditorState,
23
24
  RuntimeEditorRuntimeTabState,
@@ -84,6 +85,7 @@ import type { ConnectionEditorState } from '../../../stores/editor/editor-state/
84
85
  import { useEditorStore } from '../EditorStoreProvider.js';
85
86
  import {
86
87
  type PackageableElementReference,
88
+ type PackageableRuntime,
87
89
  Connection,
88
90
  ConnectionPointer,
89
91
  Runtime,
@@ -117,9 +119,16 @@ import {
117
119
  } from '../../../stores/graph-modifier/DSL_Mapping_GraphModifierHelper.js';
118
120
  import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../__lib__/LegendStudioApplicationNavigationContext.js';
119
121
  import { CUSTOM_LABEL } from '../../../stores/editor/NewElementState.js';
120
- import { lakehouseRuntime_setWarehouse } from '../../../stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.js';
121
- import { useAuth } from 'react-oidc-context';
122
- import { flowResult } from 'mobx';
122
+ import {
123
+ lakehouseRuntime_setWarehouse,
124
+ lakehouseRuntime_setConnection,
125
+ LakehouseComputeEngine,
126
+ LAKEHOUSE_COMPUTE_ENGINE_LABEL,
127
+ getLakehouseComputeEngine,
128
+ lakehouseRuntime_setComputeEngine,
129
+ } from '../../../stores/graph-modifier/DSL_LakehouseRuntime_GraphModifierHelper.js';
130
+ import { useAuth, type AuthContextProps } from 'react-oidc-context';
131
+ import { flowResult, runInAction } from 'mobx';
123
132
 
124
133
  const getConnectionTooltipText = (
125
134
  connection: Connection,
@@ -1054,17 +1063,175 @@ export const RuntimeEditor = observer(
1054
1063
  },
1055
1064
  );
1056
1065
 
1057
- export const LakehouseRuntimeEditor = observer(
1066
+ /**
1067
+ * NOTE: `useAuth()` is typed as always returning `AuthContextProps`, but its
1068
+ * implementation just reads `useContext(AuthContext)` and only warns (does
1069
+ * not throw) when there is no ancestor `AuthProvider`, so it can genuinely
1070
+ * be `undefined` at runtime, e.g. when this editor renders outside one.
1071
+ */
1072
+ const useLakehouseSummariesEffect = (
1073
+ editorStore: EditorStore,
1074
+ lakehouseRuntimeEditorState: LakehouseBaseRuntimeEditorState,
1075
+ ): void => {
1076
+ const auth = useAuth() as AuthContextProps | undefined;
1077
+ const applicationStore = editorStore.applicationStore;
1078
+ useEffect(() => {
1079
+ flowResult(
1080
+ lakehouseRuntimeEditorState.fetchLakehouseSummaries(
1081
+ auth?.user?.access_token,
1082
+ ),
1083
+ ).catch(applicationStore.alertUnhandledError);
1084
+ }, [
1085
+ applicationStore.alertUnhandledError,
1086
+ auth?.user?.access_token,
1087
+ lakehouseRuntimeEditorState,
1088
+ ]);
1089
+ };
1090
+
1091
+ const LakehouseBaseRuntimeEditor = (props: {
1092
+ isReadOnly: boolean;
1093
+ children: React.ReactNode;
1094
+ }): React.ReactElement => {
1095
+ const { isReadOnly, children } = props;
1096
+ return (
1097
+ <div className="data-product-editor">
1098
+ <div className="panel">
1099
+ <div className="panel__header">
1100
+ <div className="panel__header__title">
1101
+ {isReadOnly && (
1102
+ <div className="uml-element-editor__header__lock">
1103
+ <LockIcon />
1104
+ </div>
1105
+ )}
1106
+ <div className="panel__header__title__label">lakehouse runtime</div>
1107
+ </div>
1108
+ </div>
1109
+ <div className="panel" style={{ padding: '1rem', flex: 0 }}>
1110
+ {children}
1111
+ </div>
1112
+ </div>
1113
+ </div>
1114
+ );
1115
+ };
1116
+
1117
+ const LakehouseEnvironmentSelector = observer(
1118
+ (props: {
1119
+ lakehouseRuntimeEditorState: LakehouseBaseRuntimeEditorState;
1120
+ darkMode: boolean;
1121
+ }) => {
1122
+ const { lakehouseRuntimeEditorState, darkMode } = props;
1123
+ const lakehouseRuntime = lakehouseRuntimeEditorState.runtimeValue;
1124
+ const environmentOptions = lakehouseRuntimeEditorState.envOptions;
1125
+ const onEnvironmentSelectionChange = (
1126
+ val: {
1127
+ value: string;
1128
+ label: string;
1129
+ } | null,
1130
+ ): void => {
1131
+ runInAction(() => {
1132
+ if (!val) {
1133
+ lakehouseRuntime.environment = undefined;
1134
+ return;
1135
+ }
1136
+ if (val.value !== lakehouseRuntime.environment) {
1137
+ lakehouseRuntime.environment = val.value;
1138
+ }
1139
+ });
1140
+ };
1141
+ const selectedEnvironmentOption = lakehouseRuntime.environment
1142
+ ? {
1143
+ label: lakehouseRuntime.environment,
1144
+ value: lakehouseRuntime.environment,
1145
+ }
1146
+ : null;
1147
+
1148
+ return (
1149
+ <PanelFormSection>
1150
+ <div className="panel__content__form__section__header__label">
1151
+ Environment
1152
+ </div>
1153
+ <div className="explorer__new-element-modal__driver">
1154
+ <CustomSelectorInput
1155
+ className="explorer__new-element-modal__driver__dropdown"
1156
+ options={environmentOptions}
1157
+ onChange={onEnvironmentSelectionChange}
1158
+ value={selectedEnvironmentOption}
1159
+ darkMode={darkMode}
1160
+ />
1161
+ </div>
1162
+ </PanelFormSection>
1163
+ );
1164
+ },
1165
+ );
1166
+
1167
+ const LakehouseComputeEngineSelector = observer(
1168
+ (props: {
1169
+ runtimeEditorState: RuntimeEditorState;
1170
+ packageableRuntime: PackageableRuntime;
1171
+ lakehouseRuntimeEditorState: LakehouseBaseRuntimeEditorState;
1172
+ darkMode: boolean;
1173
+ }) => {
1174
+ const {
1175
+ runtimeEditorState,
1176
+ packageableRuntime,
1177
+ lakehouseRuntimeEditorState,
1178
+ darkMode,
1179
+ } = props;
1180
+ const computeEngine = getLakehouseComputeEngine(
1181
+ lakehouseRuntimeEditorState.runtimeValue,
1182
+ );
1183
+ const computeEngineOptions = Object.values(LakehouseComputeEngine).map(
1184
+ (engine) => ({
1185
+ label: LAKEHOUSE_COMPUTE_ENGINE_LABEL[engine],
1186
+ value: engine,
1187
+ }),
1188
+ );
1189
+ const selectedComputeEngineOption = {
1190
+ label: LAKEHOUSE_COMPUTE_ENGINE_LABEL[computeEngine],
1191
+ value: computeEngine,
1192
+ };
1193
+ const onComputeEngineChange = (val: {
1194
+ label: string;
1195
+ value: LakehouseComputeEngine;
1196
+ }): void => {
1197
+ if (val.value === computeEngine) {
1198
+ return;
1199
+ }
1200
+ const nextRuntimeValue = lakehouseRuntime_setComputeEngine(
1201
+ packageableRuntime,
1202
+ val.value,
1203
+ runtimeEditorState.editorStore.changeDetectionState.observerContext,
1204
+ );
1205
+ runtimeEditorState.setRuntimeValueEditorState(nextRuntimeValue);
1206
+ };
1207
+
1208
+ return (
1209
+ <PanelFormSection>
1210
+ <div className="panel__content__form__section__header__label">
1211
+ Compute Engine
1212
+ </div>
1213
+ <div className="explorer__new-element-modal__driver">
1214
+ <CustomSelectorInput
1215
+ className="explorer__new-element-modal__driver__dropdown"
1216
+ options={computeEngineOptions}
1217
+ onChange={onComputeEngineChange}
1218
+ value={selectedComputeEngineOption}
1219
+ darkMode={darkMode}
1220
+ />
1221
+ </div>
1222
+ </PanelFormSection>
1223
+ );
1224
+ },
1225
+ );
1226
+
1227
+ const SnowflakeRuntimeSourceFields = observer(
1058
1228
  (props: {
1059
1229
  runtimeEditorState: RuntimeEditorState;
1060
1230
  lakehouseRuntimeEditorState: LakehouseRuntimeEditorState;
1061
- isReadOnly: boolean;
1231
+ darkMode: boolean;
1062
1232
  }) => {
1063
- const { runtimeEditorState, lakehouseRuntimeEditorState, isReadOnly } =
1064
- props;
1233
+ const { runtimeEditorState, lakehouseRuntimeEditorState, darkMode } = props;
1065
1234
  const editorStore = runtimeEditorState.editorStore;
1066
- const auth = useAuth();
1067
- const applicationStore = editorStore.applicationStore;
1068
1235
  const lakehouseRuntime = lakehouseRuntimeEditorState.runtimeValue;
1069
1236
  // type
1070
1237
  const typeOptions = Object.values(LakehouseRuntimeType).map((type) => ({
@@ -1083,30 +1250,9 @@ export const LakehouseRuntimeEditor = observer(
1083
1250
  lakehouseRuntimeEditorState.setLakehouseRuntimeType(val.value);
1084
1251
  }
1085
1252
  };
1086
- const environmentOptions = lakehouseRuntimeEditorState.envOptions;
1087
- const onEnvironmentSelectionChange = (
1088
- val: {
1089
- value: string;
1090
- label: string;
1091
- } | null,
1092
- ): void => {
1093
- if (!val) {
1094
- lakehouseRuntime.environment = undefined;
1095
- return;
1096
- }
1097
- if (val.value !== lakehouseRuntime.environment) {
1098
- lakehouseRuntime.environment = val.value;
1099
- }
1100
- };
1101
1253
  const handleWarehouseChange = (val: string | undefined): void => {
1102
1254
  lakehouseRuntime_setWarehouse(lakehouseRuntime, val);
1103
1255
  };
1104
- const selectedEnvironmentOption = lakehouseRuntime.environment
1105
- ? {
1106
- label: lakehouseRuntime.environment,
1107
- value: lakehouseRuntime.environment,
1108
- }
1109
- : null;
1110
1256
 
1111
1257
  const connection =
1112
1258
  lakehouseRuntime.connectionPointer?.packageableConnection.value;
@@ -1119,113 +1265,113 @@ export const LakehouseRuntimeEditor = observer(
1119
1265
  val: PackageableElementOption<PackageableConnection>,
1120
1266
  ): void => {
1121
1267
  if (val.value !== connection) {
1122
- lakehouseRuntime.connectionPointer = new ConnectionPointer(
1123
- PackageableElementExplicitReference.create(val.value),
1124
- );
1268
+ lakehouseRuntime_setConnection(lakehouseRuntime, val.value);
1125
1269
  }
1126
1270
  };
1127
1271
 
1128
- useEffect(() => {
1129
- flowResult(
1130
- lakehouseRuntimeEditorState.fetchLakehouseSummaries(
1131
- auth.user?.access_token,
1132
- ),
1133
- ).catch(applicationStore.alertUnhandledError);
1134
- }, [
1135
- applicationStore.alertUnhandledError,
1136
- auth.user?.access_token,
1137
- lakehouseRuntimeEditorState,
1138
- ]);
1139
-
1140
1272
  return (
1141
1273
  <>
1142
- <div className="data-product-editor">
1143
- <div className="panel">
1144
- <div className="panel__header">
1145
- <div className="panel__header__title">
1146
- {isReadOnly && (
1147
- <div className="uml-element-editor__header__lock">
1148
- <LockIcon />
1149
- </div>
1150
- )}
1151
- <div className="panel__header__title__label">
1152
- lakehouse runtime
1153
- </div>
1154
- </div>
1274
+ <PanelFormSection>
1275
+ <div className="panel__content__form__section__header__label">
1276
+ Lakehouse Runtime Source
1277
+ </div>
1278
+ <div className="explorer__new-element-modal__driver">
1279
+ <CustomSelectorInput
1280
+ className="explorer__new-element-modal__driver__dropdown"
1281
+ options={typeOptions}
1282
+ onChange={onTypeChange}
1283
+ value={selectedType}
1284
+ darkMode={darkMode}
1285
+ />
1286
+ </div>
1287
+ </PanelFormSection>
1288
+ {lakehouseRuntimeEditorState.lakehouseRuntimeType ===
1289
+ LakehouseRuntimeType.ENVIRONMENT ? (
1290
+ <PanelFormTextField
1291
+ name="Warehouse"
1292
+ value={lakehouseRuntime.warehouse}
1293
+ prompt="Provide the warehouse"
1294
+ update={handleWarehouseChange}
1295
+ placeholder="Enter warehouse"
1296
+ />
1297
+ ) : (
1298
+ <PanelFormSection>
1299
+ <div className="panel__content__form__section__header__label">
1300
+ Connection
1155
1301
  </div>
1156
- <div className="panel" style={{ padding: '1rem', flex: 0 }}>
1157
- <PanelFormSection>
1158
- <div className="panel__content__form__section__header__label">
1159
- Lakehouse Runtime Source
1160
- </div>
1161
- <div className="explorer__new-element-modal__driver">
1162
- <CustomSelectorInput
1163
- className="explorer__new-element-modal__driver__dropdown"
1164
- options={typeOptions}
1165
- onChange={onTypeChange}
1166
- value={selectedType}
1167
- darkMode={
1168
- !applicationStore.layoutService
1169
- .TEMPORARY__isLightColorThemeEnabled
1170
- }
1171
- />
1172
- </div>
1173
- </PanelFormSection>
1174
- {lakehouseRuntimeEditorState.lakehouseRuntimeType ===
1175
- LakehouseRuntimeType.ENVIRONMENT ? (
1176
- <>
1177
- <PanelFormSection>
1178
- <div className="panel__content__form__section__header__label">
1179
- Environment
1180
- </div>
1181
- <div className="explorer__new-element-modal__driver">
1182
- <CustomSelectorInput
1183
- className="explorer__new-element-modal__driver__dropdown"
1184
- options={environmentOptions}
1185
- onChange={onEnvironmentSelectionChange}
1186
- value={selectedEnvironmentOption}
1187
- darkMode={
1188
- !applicationStore.layoutService
1189
- .TEMPORARY__isLightColorThemeEnabled
1190
- }
1191
- />
1192
- </div>
1193
- </PanelFormSection>
1194
- <PanelFormTextField
1195
- name="Warehouse"
1196
- value={lakehouseRuntime.warehouse}
1197
- prompt="Provide the warehouse"
1198
- update={handleWarehouseChange}
1199
- placeholder="Enter warehouse"
1200
- />
1201
- </>
1202
- ) : (
1203
- <PanelFormSection>
1204
- <div className="panel__content__form__section__header__label">
1205
- Connection
1206
- </div>
1207
- <div className="explorer__new-element-modal__driver">
1208
- <CustomSelectorInput
1209
- className="explorer__new-element-modal__driver__dropdown"
1210
- options={connectionOptions}
1211
- onChange={onConnectionSelectionChange}
1212
- value={selectedConnectionOption}
1213
- darkMode={
1214
- !applicationStore.layoutService
1215
- .TEMPORARY__isLightColorThemeEnabled
1216
- }
1217
- />
1218
- </div>
1219
- </PanelFormSection>
1220
- )}
1302
+ <div className="explorer__new-element-modal__driver">
1303
+ <CustomSelectorInput
1304
+ className="explorer__new-element-modal__driver__dropdown"
1305
+ options={connectionOptions}
1306
+ onChange={onConnectionSelectionChange}
1307
+ value={selectedConnectionOption}
1308
+ darkMode={darkMode}
1309
+ />
1221
1310
  </div>
1222
- </div>
1223
- </div>
1311
+ </PanelFormSection>
1312
+ )}
1224
1313
  </>
1225
1314
  );
1226
1315
  },
1227
1316
  );
1228
1317
 
1318
+ export const LakehouseRuntimeEditor = observer(
1319
+ (props: {
1320
+ runtimeEditorState: RuntimeEditorState;
1321
+ packageableRuntime: PackageableRuntime;
1322
+ lakehouseRuntimeEditorState: LakehouseBaseRuntimeEditorState;
1323
+ isReadOnly: boolean;
1324
+ }) => {
1325
+ const {
1326
+ runtimeEditorState,
1327
+ packageableRuntime,
1328
+ lakehouseRuntimeEditorState,
1329
+ isReadOnly,
1330
+ } = props;
1331
+ const editorStore = runtimeEditorState.editorStore;
1332
+ const applicationStore = editorStore.applicationStore;
1333
+ const darkMode =
1334
+ !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled;
1335
+ const computeEngine = getLakehouseComputeEngine(
1336
+ lakehouseRuntimeEditorState.runtimeValue,
1337
+ );
1338
+ // always true exactly when computeEngine === SNOWFLAKE (the two track the
1339
+ // same underlying runtime class); kept as a separate check only so TS can
1340
+ // narrow the type SnowflakeRuntimeSourceFields requires below
1341
+ const isSnowflakeRuntimeEditorState =
1342
+ lakehouseRuntimeEditorState instanceof LakehouseRuntimeEditorState;
1343
+
1344
+ useLakehouseSummariesEffect(editorStore, lakehouseRuntimeEditorState);
1345
+
1346
+ return (
1347
+ <LakehouseBaseRuntimeEditor isReadOnly={isReadOnly}>
1348
+ {lakehouseRuntimeEditorState.lakehouseRuntimeType ===
1349
+ LakehouseRuntimeType.ENVIRONMENT && (
1350
+ <LakehouseEnvironmentSelector
1351
+ lakehouseRuntimeEditorState={lakehouseRuntimeEditorState}
1352
+ darkMode={darkMode}
1353
+ />
1354
+ )}
1355
+ <LakehouseComputeEngineSelector
1356
+ runtimeEditorState={runtimeEditorState}
1357
+ packageableRuntime={packageableRuntime}
1358
+ lakehouseRuntimeEditorState={lakehouseRuntimeEditorState}
1359
+ darkMode={darkMode}
1360
+ />
1361
+ {computeEngine === LakehouseComputeEngine.SNOWFLAKE &&
1362
+ isSnowflakeRuntimeEditorState && (
1363
+ <SnowflakeRuntimeSourceFields
1364
+ key={lakehouseRuntimeEditorState.uuid}
1365
+ runtimeEditorState={runtimeEditorState}
1366
+ lakehouseRuntimeEditorState={lakehouseRuntimeEditorState}
1367
+ darkMode={darkMode}
1368
+ />
1369
+ )}
1370
+ </LakehouseBaseRuntimeEditor>
1371
+ );
1372
+ },
1373
+ );
1374
+
1229
1375
  export const PackageableRuntimeEditor = observer(() => {
1230
1376
  const editorStore = useEditorStore();
1231
1377
  const editorState = editorStore.tabManagerState.getCurrentEditorState(
@@ -1238,13 +1384,17 @@ export const PackageableRuntimeEditor = observer(() => {
1238
1384
  LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.RUNTIME_EDITOR,
1239
1385
  );
1240
1386
 
1241
- return engineState instanceof LakehouseRuntimeEditorState ? (
1242
- <LakehouseRuntimeEditor
1243
- lakehouseRuntimeEditorState={engineState}
1244
- isReadOnly={isReadOnly}
1245
- runtimeEditorState={editorState.runtimeEditorState}
1246
- />
1247
- ) : (
1387
+ if (engineState instanceof LakehouseBaseRuntimeEditorState) {
1388
+ return (
1389
+ <LakehouseRuntimeEditor
1390
+ lakehouseRuntimeEditorState={engineState}
1391
+ packageableRuntime={editorState.runtime}
1392
+ isReadOnly={isReadOnly}
1393
+ runtimeEditorState={editorState.runtimeEditorState}
1394
+ />
1395
+ );
1396
+ }
1397
+ return (
1248
1398
  <RuntimeEditor
1249
1399
  runtimeEditorState={editorState.runtimeEditorState}
1250
1400
  isReadOnly={isReadOnly}