@finos/legend-application-studio 28.20.0 → 28.21.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 (61) hide show
  1. package/lib/__lib__/LegendStudioUserDataHelper.d.ts +4 -1
  2. package/lib/__lib__/LegendStudioUserDataHelper.d.ts.map +1 -1
  3. package/lib/__lib__/LegendStudioUserDataHelper.js +18 -0
  4. package/lib/__lib__/LegendStudioUserDataHelper.js.map +1 -1
  5. package/lib/components/editor/editor-group/EditorGroup.d.ts.map +1 -1
  6. package/lib/components/editor/editor-group/EditorGroup.js +5 -0
  7. package/lib/components/editor/editor-group/EditorGroup.js.map +1 -1
  8. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.d.ts.map +1 -1
  9. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js +13 -44
  10. package/lib/components/editor/editor-group/dataProduct/DataProductEditor.js.map +1 -1
  11. package/lib/components/editor/editor-group/database-editor/DatabaseAnnotationDisplay.d.ts +26 -0
  12. package/lib/components/editor/editor-group/database-editor/DatabaseAnnotationDisplay.d.ts.map +1 -0
  13. package/lib/components/editor/editor-group/database-editor/DatabaseAnnotationDisplay.js +101 -0
  14. package/lib/components/editor/editor-group/database-editor/DatabaseAnnotationDisplay.js.map +1 -0
  15. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramCanvas.d.ts +23 -0
  16. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramCanvas.d.ts.map +1 -0
  17. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramCanvas.js +434 -0
  18. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramCanvas.js.map +1 -0
  19. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramHelper.d.ts +242 -0
  20. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramHelper.d.ts.map +1 -0
  21. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramHelper.js +371 -0
  22. package/lib/components/editor/editor-group/database-editor/DatabaseDiagramHelper.js.map +1 -0
  23. package/lib/components/editor/editor-group/database-editor/DatabaseEditor.d.ts +29 -0
  24. package/lib/components/editor/editor-group/database-editor/DatabaseEditor.d.ts.map +1 -0
  25. package/lib/components/editor/editor-group/database-editor/DatabaseEditor.js +78 -0
  26. package/lib/components/editor/editor-group/database-editor/DatabaseEditor.js.map +1 -0
  27. package/lib/components/editor/editor-group/database-editor/DatabaseSchemaTree.d.ts +30 -0
  28. package/lib/components/editor/editor-group/database-editor/DatabaseSchemaTree.d.ts.map +1 -0
  29. package/lib/components/editor/editor-group/database-editor/DatabaseSchemaTree.js +331 -0
  30. package/lib/components/editor/editor-group/database-editor/DatabaseSchemaTree.js.map +1 -0
  31. package/lib/components/editor/editor-group/database-editor/DatabaseTableNode.d.ts +104 -0
  32. package/lib/components/editor/editor-group/database-editor/DatabaseTableNode.d.ts.map +1 -0
  33. package/lib/components/editor/editor-group/database-editor/DatabaseTableNode.js +151 -0
  34. package/lib/components/editor/editor-group/database-editor/DatabaseTableNode.js.map +1 -0
  35. package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.d.ts.map +1 -1
  36. package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.js +3 -78
  37. package/lib/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.js.map +1 -1
  38. package/lib/index.css +2 -2
  39. package/lib/index.css.map +1 -1
  40. package/lib/package.json +4 -1
  41. package/lib/stores/editor/EditorTabManagerState.d.ts.map +1 -1
  42. package/lib/stores/editor/EditorTabManagerState.js +5 -3
  43. package/lib/stores/editor/EditorTabManagerState.js.map +1 -1
  44. package/lib/stores/editor/editor-state/element-editor-state/DatabaseEditorState.d.ts +252 -0
  45. package/lib/stores/editor/editor-state/element-editor-state/DatabaseEditorState.d.ts.map +1 -0
  46. package/lib/stores/editor/editor-state/element-editor-state/DatabaseEditorState.js +755 -0
  47. package/lib/stores/editor/editor-state/element-editor-state/DatabaseEditorState.js.map +1 -0
  48. package/package.json +12 -9
  49. package/src/__lib__/LegendStudioUserDataHelper.ts +30 -0
  50. package/src/components/editor/editor-group/EditorGroup.tsx +4 -0
  51. package/src/components/editor/editor-group/dataProduct/DataProductEditor.tsx +0 -52
  52. package/src/components/editor/editor-group/database-editor/DatabaseAnnotationDisplay.tsx +200 -0
  53. package/src/components/editor/editor-group/database-editor/DatabaseDiagramCanvas.tsx +701 -0
  54. package/src/components/editor/editor-group/database-editor/DatabaseDiagramHelper.ts +555 -0
  55. package/src/components/editor/editor-group/database-editor/DatabaseEditor.tsx +246 -0
  56. package/src/components/editor/editor-group/database-editor/DatabaseSchemaTree.tsx +1053 -0
  57. package/src/components/editor/editor-group/database-editor/DatabaseTableNode.tsx +465 -0
  58. package/src/components/editor/editor-group/ingest-editor/IngestDefinitionEditor.tsx +2 -242
  59. package/src/stores/editor/EditorTabManagerState.ts +4 -5
  60. package/src/stores/editor/editor-state/element-editor-state/DatabaseEditorState.ts +938 -0
  61. package/tsconfig.json +7 -0
@@ -17,8 +17,6 @@
17
17
  import { observer } from 'mobx-react-lite';
18
18
  import { useEditorStore } from '../../EditorStoreProvider.js';
19
19
  import {
20
- CheckCircleIcon,
21
- CopyIcon,
22
20
  Dialog,
23
21
  Modal,
24
22
  ModalBody,
@@ -29,24 +27,16 @@ import {
29
27
  PanelContent,
30
28
  PanelHeader,
31
29
  PanelHeaderActions,
32
- RocketIcon,
33
30
  EyeIcon,
34
31
  ModalHeaderActions,
35
32
  CustomSelectorInput,
36
33
  } from '@finos/legend-art';
37
- import {
38
- generateUrlToDeployOnOpen,
39
- IngestDefinitionEditorState,
40
- } from '../../../../stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js';
34
+ import { IngestDefinitionEditorState } from '../../../../stores/editor/editor-state/element-editor-state/ingest/IngestDefinitionEditorState.js';
41
35
  import { CodeEditor } from '@finos/legend-lego/code-editor';
42
36
  import React, { useEffect, useState } from 'react';
43
37
  import { CODE_EDITOR_LANGUAGE } from '@finos/legend-code-editor';
44
38
  import { flowResult } from 'mobx';
45
- import { useAuth } from 'react-oidc-context';
46
- import {
47
- IngestDefinitionDeploymentResponse,
48
- IngestDefinitionValidationResponse,
49
- } from '@finos/legend-server-lakehouse';
39
+
50
40
  import { useApplicationNavigationContext } from '@finos/legend-application';
51
41
  import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../../__lib__/LegendStudioApplicationNavigationContext.js';
52
42
  import {
@@ -55,145 +45,6 @@ import {
55
45
  } from '@finos/legend-query-builder';
56
46
  import type { MatViewDataSet } from '@finos/legend-graph';
57
47
 
58
- const IngestValidationError = observer(
59
- (props: {
60
- state: IngestDefinitionEditorState;
61
- validateResponse: IngestDefinitionValidationResponse;
62
- }) => {
63
- const { state, validateResponse } = props;
64
- const applicationStore = state.editorStore.applicationStore;
65
- const closeModal = (): void =>
66
- state.setValidateAndDeployResponse(undefined);
67
- return (
68
- <Dialog
69
- open={true}
70
- classes={{
71
- root: 'editor-modal__root-container',
72
- container: 'editor-modal__container',
73
- paper: 'editor-modal__content',
74
- }}
75
- onClose={closeModal}
76
- >
77
- <Modal
78
- darkMode={
79
- !applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
80
- }
81
- className="editor-modal"
82
- >
83
- <ModalHeader>
84
- <ModalTitle title={'Validation Error'} />
85
- </ModalHeader>
86
- <ModalBody>
87
- <PanelContent>
88
- <CodeEditor
89
- inputValue={JSON.stringify(validateResponse, null, 2)}
90
- isReadOnly={true}
91
- language={CODE_EDITOR_LANGUAGE.JSON}
92
- />
93
- </PanelContent>
94
- </ModalBody>
95
- <ModalFooter>
96
- <ModalFooterButton
97
- onClick={closeModal}
98
- text="Close"
99
- type="secondary"
100
- />
101
- </ModalFooter>
102
- </Modal>
103
- </Dialog>
104
- );
105
- },
106
- );
107
-
108
- const IngestDeploymentResponseModal = observer(
109
- (props: {
110
- closeModal: () => void;
111
- deploymentResponse: IngestDefinitionDeploymentResponse;
112
- copyHandler: (text: string, successMessage: string) => void;
113
- }) => {
114
- const { closeModal, deploymentResponse, copyHandler } = props;
115
- const copyURN = (text: string): void => {
116
- copyHandler(text, 'Ingest URN copied to clipboard');
117
- };
118
- return (
119
- <Dialog
120
- open={true}
121
- classes={{
122
- root: 'ingestion-modal__root-container',
123
- container: 'ingestion-modal__container',
124
- paper: 'ingestion-modal__content',
125
- }}
126
- >
127
- <Modal darkMode={true} className="ingestion-modal">
128
- <ModalHeader>
129
- <ModalTitle
130
- icon={<CheckCircleIcon className="ingestion-modal--success" />}
131
- title="Deployment Response"
132
- ></ModalTitle>
133
- </ModalHeader>
134
- <ModalBody>
135
- <div className="ingestion-modal__urn">
136
- <div className="ingestion-modal__urn__info">
137
- <div className="panel__content__form__section__header__label">
138
- Deployment URN
139
- </div>
140
- <div className="ingestion-modal__urn__value">
141
- {deploymentResponse.ingestDefinitionUrn}
142
- </div>
143
- </div>
144
- <div className="ingestion-modal__urn__copy">
145
- <button
146
- className="ingestion-modal__urn__copy--btn"
147
- tabIndex={-1}
148
- title="Copy"
149
- onClick={() => {
150
- copyURN(deploymentResponse.ingestDefinitionUrn);
151
- }}
152
- >
153
- <CopyIcon />
154
- </button>
155
- </div>
156
- </div>
157
- <div className="ingestion-modal__write">
158
- <div className="ingestion-modal__write__label">
159
- Write Location
160
- </div>
161
- <div className="ingestion-modal__write--value">
162
- {deploymentResponse.write_location ? (
163
- <CodeEditor
164
- inputValue={JSON.stringify(
165
- deploymentResponse.write_location,
166
- null,
167
- 2,
168
- )}
169
- isReadOnly={true}
170
- language={CODE_EDITOR_LANGUAGE.JSON}
171
- extraEditorOptions={{
172
- wordWrap: 'on',
173
- }}
174
- hideActionBar={true}
175
- />
176
- ) : (
177
- <div className="ingestion-modal__write--no-value">
178
- No write location provided
179
- </div>
180
- )}
181
- </div>
182
- </div>
183
- </ModalBody>
184
- <ModalFooter>
185
- <ModalFooterButton
186
- onClick={closeModal}
187
- text="Close"
188
- type="secondary"
189
- />
190
- </ModalFooter>
191
- </Modal>
192
- </Dialog>
193
- );
194
- },
195
- );
196
-
197
48
  export const IngestLineageModal = observer(
198
49
  (props: { ingestDefinitionEditorState: IngestDefinitionEditorState }) => {
199
50
  const { ingestDefinitionEditorState } = props;
@@ -319,70 +170,6 @@ export const IngestDefinitionEditor = observer(() => {
319
170
  IngestDefinitionEditorState,
320
171
  );
321
172
  const ingestDef = ingestDefinitionEditorState.ingest;
322
- const auth = useAuth();
323
- const deployIngest = (): void => {
324
- // Trigger OAuth flow if not authenticated
325
- if (!auth.isAuthenticated) {
326
- // remove this redirect if we move to do oauth at the beginning of opening studio
327
- auth
328
- .signinRedirect({
329
- state: generateUrlToDeployOnOpen(ingestDefinitionEditorState),
330
- })
331
- .catch(editorStore.applicationStore.alertUnhandledError);
332
- return;
333
- }
334
- // Use the token for deployment
335
- const token = auth.user?.access_token;
336
- if (token) {
337
- flowResult(ingestDefinitionEditorState.deploy(token)).catch(
338
- editorStore.applicationStore.alertUnhandledError,
339
- );
340
- } else {
341
- editorStore.applicationStore.notificationService.notifyError(
342
- 'Authentication failed. No token available.',
343
- );
344
- }
345
- };
346
-
347
- const renderDeploymentResponse = (): React.ReactNode => {
348
- const response = ingestDefinitionEditorState.deploymentResponse;
349
- if (response instanceof IngestDefinitionValidationResponse) {
350
- return (
351
- <IngestValidationError
352
- state={ingestDefinitionEditorState}
353
- validateResponse={response}
354
- />
355
- );
356
- } else if (response instanceof IngestDefinitionDeploymentResponse) {
357
- const copyHanlder = (text: string, successMessage: string): void => {
358
- ingestDefinitionEditorState.editorStore.applicationStore.clipboardService
359
- .copyTextToClipboard(text)
360
- .then(() =>
361
- ingestDefinitionEditorState.editorStore.applicationStore.notificationService.notifySuccess(
362
- successMessage,
363
- undefined,
364
- 2500,
365
- ),
366
- )
367
- .catch(
368
- ingestDefinitionEditorState.editorStore.applicationStore
369
- .alertUnhandledError,
370
- );
371
- };
372
- return (
373
- <IngestDeploymentResponseModal
374
- closeModal={() =>
375
- ingestDefinitionEditorState.setValidateAndDeployResponse(undefined)
376
- }
377
- deploymentResponse={response}
378
- copyHandler={copyHanlder}
379
- />
380
- );
381
- }
382
- return null;
383
- };
384
-
385
- const isValid = ingestDefinitionEditorState.validForDeployment;
386
173
  const isValidForLineage = ingestDefinitionEditorState.validForLineageViewer;
387
174
  useEffect(() => {
388
175
  ingestDefinitionEditorState.generateElementGrammar();
@@ -392,18 +179,6 @@ export const IngestDefinitionEditor = observer(() => {
392
179
  LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY.INGEST_DEFINITION_EDITOR,
393
180
  );
394
181
 
395
- useEffect(() => {
396
- if (ingestDefinitionEditorState.deployOnOpen) {
397
- flowResult(ingestDefinitionEditorState.init_with_deploy(auth)).catch(
398
- editorStore.applicationStore.alertUnhandledError,
399
- );
400
- }
401
- }, [
402
- auth,
403
- editorStore.applicationStore.alertUnhandledError,
404
- ingestDefinitionEditorState,
405
- ]);
406
-
407
182
  const viewLineage = () => {
408
183
  const firstMatViewQuery =
409
184
  ingestDefinitionEditorState.ingest
@@ -444,20 +219,6 @@ export const IngestDefinitionEditor = observer(() => {
444
219
  </div>
445
220
  </button>
446
221
  </div>
447
- <div className="btn__dropdown-combo btn__dropdown-combo--primary">
448
- <button
449
- className="btn__dropdown-combo__label"
450
- onClick={deployIngest}
451
- title={ingestDefinitionEditorState.validationMessage}
452
- tabIndex={-1}
453
- disabled={!isValid}
454
- >
455
- <RocketIcon className="btn__dropdown-combo__label__icon" />
456
- <div className="btn__dropdown-combo__label__title">
457
- Deploy
458
- </div>
459
- </button>
460
- </div>
461
222
  </div>
462
223
  </PanelHeaderActions>
463
224
  </PanelHeader>
@@ -471,7 +232,6 @@ export const IngestDefinitionEditor = observer(() => {
471
232
  <IngestLineageModal
472
233
  ingestDefinitionEditorState={ingestDefinitionEditorState}
473
234
  />
474
- {renderDeploymentResponse()}
475
235
  </PanelContent>
476
236
  </div>
477
237
  );
@@ -49,6 +49,7 @@ import {
49
49
  import { makeObservable, action, observable } from 'mobx';
50
50
  import type { EditorState } from './editor-state/EditorState.js';
51
51
  import { ClassEditorState } from './editor-state/element-editor-state/ClassEditorState.js';
52
+ import { DatabaseEditorState } from './editor-state/element-editor-state/DatabaseEditorState.js';
52
53
  import { PackageableConnectionEditorState } from './editor-state/element-editor-state/connection/ConnectionEditorState.js';
53
54
  import { PackageableDataEditorState } from './editor-state/element-editor-state/data/DataEditorState.js';
54
55
  import { ElementEditorState } from './editor-state/element-editor-state/ElementEditorState.js';
@@ -169,11 +170,9 @@ export class EditorTabManagerState extends TabManagerState {
169
170
  return new UMLEditorState(this.editorStore, element);
170
171
  } else if (element instanceof ConcreteFunctionDefinition) {
171
172
  return new FunctionEditorState(this.editorStore, element);
172
- } else if (
173
- element instanceof Measure ||
174
- element instanceof Database ||
175
- element instanceof FlatData
176
- ) {
173
+ } else if (element instanceof Database) {
174
+ return new DatabaseEditorState(this.editorStore, element);
175
+ } else if (element instanceof Measure || element instanceof FlatData) {
177
176
  return new UnsupportedElementEditorState(this.editorStore, element);
178
177
  } else if (element instanceof PackageableRuntime) {
179
178
  return new PackageableRuntimeEditorState(this.editorStore, element);