@finos/legend-application-studio 28.15.2 → 28.15.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. package/lib/__lib__/LegendStudioNavigation.d.ts +1 -1
  2. package/lib/components/LegendStudioWebApplication.js +2 -2
  3. package/lib/components/editor/editor-group/diff-editor/ProjectConfigDiffView.d.ts +22 -0
  4. package/lib/components/editor/editor-group/diff-editor/ProjectConfigDiffView.d.ts.map +1 -0
  5. package/lib/components/editor/editor-group/diff-editor/ProjectConfigDiffView.js +26 -0
  6. package/lib/components/editor/editor-group/diff-editor/ProjectConfigDiffView.js.map +1 -0
  7. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.d.ts.map +1 -1
  8. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js +0 -2
  9. package/lib/components/extensions/Core_LegendStudioApplicationPlugin.js.map +1 -1
  10. package/lib/components/{workspace-review/WorkspaceReviewSideBar.d.ts → project-reviewer/ProjectReviewSideBar.d.ts} +2 -2
  11. package/lib/components/project-reviewer/ProjectReviewSideBar.d.ts.map +1 -0
  12. package/lib/components/{workspace-review/WorkspaceReviewSideBar.js → project-reviewer/ProjectReviewSideBar.js} +34 -18
  13. package/lib/components/project-reviewer/ProjectReviewSideBar.js.map +1 -0
  14. package/lib/components/{workspace-review/WorkspaceReviewStoreProvider.d.ts → project-reviewer/ProjectReviewStoreProvider.d.ts} +5 -5
  15. package/lib/components/project-reviewer/ProjectReviewStoreProvider.d.ts.map +1 -0
  16. package/lib/components/{workspace-review/WorkspaceReviewStoreProvider.js → project-reviewer/ProjectReviewStoreProvider.js} +9 -9
  17. package/lib/components/project-reviewer/ProjectReviewStoreProvider.js.map +1 -0
  18. package/lib/components/{workspace-review/WorkspaceReview.d.ts → project-reviewer/ProjectReviewer.d.ts} +2 -2
  19. package/lib/components/project-reviewer/ProjectReviewer.d.ts.map +1 -0
  20. package/lib/components/{workspace-review/WorkspaceReview.js → project-reviewer/ProjectReviewer.js} +19 -28
  21. package/lib/components/project-reviewer/ProjectReviewer.js.map +1 -0
  22. package/lib/components/{workspace-review/WorkspaceReviewPanel.d.ts → project-reviewer/ProjectReviewerPanel.d.ts} +2 -2
  23. package/lib/components/project-reviewer/ProjectReviewerPanel.d.ts.map +1 -0
  24. package/lib/components/{workspace-review/WorkspaceReviewPanel.js → project-reviewer/ProjectReviewerPanel.js} +26 -10
  25. package/lib/components/project-reviewer/ProjectReviewerPanel.js.map +1 -0
  26. package/lib/index.css +1 -1
  27. package/lib/package.json +1 -1
  28. package/lib/stores/editor/editor-state/diff-viewer-state/EditorDiffViewerState.d.ts +24 -0
  29. package/lib/stores/editor/editor-state/diff-viewer-state/EditorDiffViewerState.d.ts.map +1 -0
  30. package/lib/stores/editor/editor-state/diff-viewer-state/EditorDiffViewerState.js +26 -0
  31. package/lib/stores/editor/editor-state/diff-viewer-state/EditorDiffViewerState.js.map +1 -0
  32. package/lib/stores/editor/editor-state/diff-viewer-state/ProjectConfigurationDiffEditorState.d.ts +31 -0
  33. package/lib/stores/editor/editor-state/diff-viewer-state/ProjectConfigurationDiffEditorState.d.ts.map +1 -0
  34. package/lib/stores/editor/editor-state/diff-viewer-state/ProjectConfigurationDiffEditorState.js +39 -0
  35. package/lib/stores/editor/editor-state/diff-viewer-state/ProjectConfigurationDiffEditorState.js.map +1 -0
  36. package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.d.ts.map +1 -1
  37. package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.js +2 -2
  38. package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.js.map +1 -1
  39. package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.d.ts +1 -1
  40. package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.d.ts.map +1 -1
  41. package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js +5 -4
  42. package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js.map +1 -1
  43. package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.js +1 -1
  44. package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.js.map +1 -1
  45. package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityDiffEditorState.d.ts +2 -2
  46. package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityDiffEditorState.d.ts.map +1 -1
  47. package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityDiffEditorState.js +2 -2
  48. package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityDiffEditorState.js.map +1 -1
  49. package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityDiffViewState.d.ts +0 -2
  50. package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityDiffViewState.d.ts.map +1 -1
  51. package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityDiffViewState.js +1 -3
  52. package/lib/stores/editor/editor-state/entity-diff-editor-state/EntityDiffViewState.js.map +1 -1
  53. package/lib/stores/project-reviewer/ProjectReviewerStore.d.ts +73 -0
  54. package/lib/stores/project-reviewer/ProjectReviewerStore.d.ts.map +1 -0
  55. package/lib/stores/project-reviewer/ProjectReviewerStore.js +303 -0
  56. package/lib/stores/project-reviewer/ProjectReviewerStore.js.map +1 -0
  57. package/package.json +7 -7
  58. package/src/__lib__/LegendStudioNavigation.ts +1 -1
  59. package/src/components/LegendStudioWebApplication.tsx +2 -2
  60. package/src/components/editor/editor-group/diff-editor/ProjectConfigDiffView.tsx +60 -0
  61. package/src/components/extensions/Core_LegendStudioApplicationPlugin.tsx +0 -2
  62. package/src/components/{workspace-review/WorkspaceReviewSideBar.tsx → project-reviewer/ProjectReviewSideBar.tsx} +91 -11
  63. package/src/components/{workspace-review/WorkspaceReviewStoreProvider.tsx → project-reviewer/ProjectReviewStoreProvider.tsx} +13 -13
  64. package/src/components/{workspace-review/WorkspaceReview.tsx → project-reviewer/ProjectReviewer.tsx} +25 -55
  65. package/src/components/{workspace-review/WorkspaceReviewPanel.tsx → project-reviewer/ProjectReviewerPanel.tsx} +54 -36
  66. package/src/stores/editor/editor-state/diff-viewer-state/EditorDiffViewerState.ts +34 -0
  67. package/src/stores/editor/editor-state/diff-viewer-state/ProjectConfigurationDiffEditorState.ts +56 -0
  68. package/src/stores/editor/editor-state/element-editor-state/FunctionActivatorState.ts +2 -1
  69. package/src/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.ts +6 -3
  70. package/src/stores/editor/editor-state/entity-diff-editor-state/EntityChangeConflictEditorState.ts +1 -1
  71. package/src/stores/editor/editor-state/entity-diff-editor-state/EntityDiffEditorState.ts +2 -2
  72. package/src/stores/editor/editor-state/entity-diff-editor-state/EntityDiffViewState.ts +1 -3
  73. package/src/stores/{workspace-review/WorkspaceReviewStore.ts → project-reviewer/ProjectReviewerStore.ts} +235 -57
  74. package/tsconfig.json +8 -5
  75. package/lib/components/workspace-review/WorkspaceReview.d.ts.map +0 -1
  76. package/lib/components/workspace-review/WorkspaceReview.js.map +0 -1
  77. package/lib/components/workspace-review/WorkspaceReviewPanel.d.ts.map +0 -1
  78. package/lib/components/workspace-review/WorkspaceReviewPanel.js.map +0 -1
  79. package/lib/components/workspace-review/WorkspaceReviewSideBar.d.ts.map +0 -1
  80. package/lib/components/workspace-review/WorkspaceReviewSideBar.js.map +0 -1
  81. package/lib/components/workspace-review/WorkspaceReviewStoreProvider.d.ts.map +0 -1
  82. package/lib/components/workspace-review/WorkspaceReviewStoreProvider.js.map +0 -1
  83. package/lib/stores/workspace-review/WorkspaceReviewStore.d.ts +0 -47
  84. package/lib/stores/workspace-review/WorkspaceReviewStore.d.ts.map +0 -1
  85. package/lib/stores/workspace-review/WorkspaceReviewStore.js +0 -207
  86. package/lib/stores/workspace-review/WorkspaceReviewStore.js.map +0 -1
@@ -16,43 +16,43 @@
16
16
 
17
17
  import { createContext, useContext } from 'react';
18
18
  import { useLocalObservable } from 'mobx-react-lite';
19
- import { WorkspaceReviewStore } from '../../stores/workspace-review/WorkspaceReviewStore.js';
19
+ import { ProjectReviewerStore } from '../../stores/project-reviewer/ProjectReviewerStore.js';
20
20
  import { EDITOR_MODE } from '../../stores/editor/EditorConfig.js';
21
21
  import { guaranteeNonNullable } from '@finos/legend-shared';
22
22
  import { useEditorStore } from '../editor/EditorStoreProvider.js';
23
23
 
24
- const WorkspaceReviewStoreContext = createContext<
25
- WorkspaceReviewStore | undefined
24
+ const ProjectReviewerStoreContext = createContext<
25
+ ProjectReviewerStore | undefined
26
26
  >(undefined);
27
27
 
28
- export const WorkspaceReviewStoreProvider = ({
28
+ export const ProjectReviewerStoreProvider = ({
29
29
  children,
30
30
  }: {
31
31
  children: React.ReactNode;
32
32
  }): React.ReactElement => {
33
33
  const editorStore = useEditorStore();
34
34
  editorStore.setMode(EDITOR_MODE.REVIEW);
35
- const store = useLocalObservable(() => new WorkspaceReviewStore(editorStore));
35
+ const store = useLocalObservable(() => new ProjectReviewerStore(editorStore));
36
36
  return (
37
- <WorkspaceReviewStoreContext.Provider value={store}>
37
+ <ProjectReviewerStoreContext.Provider value={store}>
38
38
  {children}
39
- </WorkspaceReviewStoreContext.Provider>
39
+ </ProjectReviewerStoreContext.Provider>
40
40
  );
41
41
  };
42
42
 
43
- export const useWorkspaceReviewStore = (): WorkspaceReviewStore =>
43
+ export const useProjectReviewerStore = (): ProjectReviewerStore =>
44
44
  guaranteeNonNullable(
45
- useContext(WorkspaceReviewStoreContext),
45
+ useContext(ProjectReviewerStoreContext),
46
46
  `Can't find workspace review store in context`,
47
47
  );
48
48
 
49
- export const withWorkspaceReviewStore = (
49
+ export const withProjectReviewerStore = (
50
50
  WrappedComponent: React.FC,
51
51
  ): React.FC =>
52
- function WithWorkspaceReviewStore() {
52
+ function WithProjecteReviewerStore() {
53
53
  return (
54
- <WorkspaceReviewStoreProvider>
54
+ <ProjectReviewerStoreProvider>
55
55
  <WrappedComponent />
56
- </WorkspaceReviewStoreProvider>
56
+ </ProjectReviewerStoreProvider>
57
57
  );
58
58
  };
@@ -17,11 +17,11 @@
17
17
  import { useEffect } from 'react';
18
18
  import { observer } from 'mobx-react-lite';
19
19
  import {
20
- useWorkspaceReviewStore,
21
- withWorkspaceReviewStore,
22
- } from './WorkspaceReviewStoreProvider.js';
23
- import { WorkspaceReviewSideBar } from './WorkspaceReviewSideBar.js';
24
- import { WorkspaceReviewPanel } from './WorkspaceReviewPanel.js';
20
+ useProjectReviewerStore,
21
+ withProjectReviewerStore,
22
+ } from './ProjectReviewStoreProvider.js';
23
+ import { ProjectReviewerSideBar } from './ProjectReviewSideBar.js';
24
+ import { ProjectReviewerPanel } from './ProjectReviewerPanel.js';
25
25
  import { ACTIVITY_MODE } from '../../stores/editor/EditorConfig.js';
26
26
  import {
27
27
  type ResizablePanelHandlerProps,
@@ -33,15 +33,13 @@ import {
33
33
  ResizablePanelSplitter,
34
34
  CheckListIcon,
35
35
  CodeBranchIcon,
36
- CogIcon,
37
36
  UserIcon,
38
37
  AssistantIcon,
39
38
  } from '@finos/legend-art';
40
39
  import {
41
- type WorkspaceReviewPathParams,
40
+ type ProjectReviewerPathParams,
42
41
  generateSetupRoute,
43
42
  } from '../../__lib__/LegendStudioNavigation.js';
44
- import { flowResult } from 'mobx';
45
43
  import {
46
44
  useEditorStore,
47
45
  withEditorStore,
@@ -49,8 +47,8 @@ import {
49
47
  import { useApplicationStore } from '@finos/legend-application';
50
48
  import { useParams } from '@finos/legend-application/browser';
51
49
 
52
- const WorkspaceReviewStatusBar = observer(() => {
53
- const reviewStore = useWorkspaceReviewStore();
50
+ const ProjectReviewerStatusBar = observer(() => {
51
+ const reviewStore = useProjectReviewerStore();
54
52
  const editorStore = useEditorStore();
55
53
  const applicationStore = useApplicationStore();
56
54
  const currentUserId =
@@ -59,15 +57,15 @@ const WorkspaceReviewStatusBar = observer(() => {
59
57
  ? reviewStore.currentProject.name
60
58
  : reviewStore.projectId;
61
59
  const review = reviewStore.review;
62
- const reviewStatus = reviewStore.isApprovingReview
60
+ const reviewStatus = reviewStore.approveState.isInProgress
63
61
  ? 'approving review...'
64
- : reviewStore.isCommittingReview
62
+ : reviewStore.commitState.isInProgress
65
63
  ? 'committing review...'
66
- : reviewStore.isClosingReview
64
+ : reviewStore.closeState.isInProgress
67
65
  ? 'closing review...'
68
- : reviewStore.isReopeningReview
66
+ : reviewStore.reOpenState.isInProgress
69
67
  ? 'reopening review...'
70
- : reviewStore.isFetchingComparison
68
+ : reviewStore.fetchComparisonState.isInProgress
71
69
  ? 'loading changes...'
72
70
  : undefined;
73
71
  const toggleAssistant = (): void =>
@@ -149,10 +147,8 @@ const WorkspaceReviewStatusBar = observer(() => {
149
147
  );
150
148
  });
151
149
 
152
- const WorkspaceReviewExplorer = observer(() => {
153
- const reviewStore = useWorkspaceReviewStore();
150
+ const ProjectReviewerExplorer = observer(() => {
154
151
  const editorStore = useEditorStore();
155
- const applicationStore = useApplicationStore();
156
152
 
157
153
  // layout
158
154
  const resizeSideBar = (handleProps: ResizablePanelHandlerProps): void =>
@@ -166,64 +162,47 @@ const WorkspaceReviewExplorer = observer(() => {
166
162
  size: editorStore.sideBarDisplayState.size,
167
163
  },
168
164
  );
169
-
170
- useEffect(() => {
171
- flowResult(reviewStore.fetchReviewComparison()).catch(
172
- applicationStore.alertUnhandledError,
173
- );
174
- }, [applicationStore, reviewStore]);
175
-
176
165
  return (
177
166
  <ResizablePanelGroup orientation="vertical">
178
167
  <ResizablePanel
179
168
  {...sideBarCollapsiblePanelGroupProps.collapsiblePanel}
180
169
  direction={1}
181
170
  >
182
- <WorkspaceReviewSideBar />
171
+ <ProjectReviewerSideBar />
183
172
  </ResizablePanel>
184
173
  <ResizablePanelSplitter />
185
174
  <ResizablePanel
186
175
  {...sideBarCollapsiblePanelGroupProps.remainingPanel}
187
176
  minSize={300}
188
177
  >
189
- <WorkspaceReviewPanel />
178
+ <ProjectReviewerPanel />
190
179
  </ResizablePanel>
191
180
  </ResizablePanelGroup>
192
181
  );
193
182
  });
194
183
 
195
- export const WorkspaceReview = withEditorStore(
196
- withWorkspaceReviewStore(
184
+ export const ProjectReviewer = withEditorStore(
185
+ withProjectReviewerStore(
197
186
  observer(() => {
198
- const params = useParams<WorkspaceReviewPathParams>();
187
+ const params = useParams<ProjectReviewerPathParams>();
199
188
  const projectId = params.projectId;
200
189
  const reviewId = params.reviewId;
201
- const reviewStore = useWorkspaceReviewStore();
190
+ const reviewStore = useProjectReviewerStore();
202
191
  const editorStore = useEditorStore();
203
- const applicationStore = useApplicationStore();
204
192
  const changeActivity =
205
193
  (activity: ACTIVITY_MODE): (() => void) =>
206
194
  (): void =>
207
195
  editorStore.setActiveActivity(activity);
208
-
209
196
  useEffect(() => {
210
197
  reviewStore.setProjectIdAndReviewId(projectId, reviewId);
211
- flowResult(reviewStore.initialize()).catch(
212
- applicationStore.alertUnhandledError,
213
- );
214
- flowResult(reviewStore.getReview()).catch(
215
- applicationStore.alertUnhandledError,
216
- );
217
- flowResult(reviewStore.fetchProject()).catch(
218
- applicationStore.alertUnhandledError,
219
- );
220
- }, [applicationStore, reviewStore, projectId, reviewId]);
198
+ reviewStore.initialize();
199
+ }, [reviewStore, projectId, reviewId]);
221
200
 
222
201
  return (
223
202
  <div className="app__page">
224
203
  <div className="workspace-review">
225
204
  <PanelLoadingIndicator
226
- isLoading={reviewStore.isFetchingCurrentReview}
205
+ isLoading={reviewStore.fetchCurrentReviewState.isInProgress}
227
206
  />
228
207
  {reviewStore.currentReview && (
229
208
  <>
@@ -240,23 +219,14 @@ export const WorkspaceReview = withEditorStore(
240
219
  <CheckListIcon />
241
220
  </button>
242
221
  </div>
243
- <div className="activity-bar__setting">
244
- <button
245
- className="activity-bar__item"
246
- tabIndex={-1}
247
- title="Settings..."
248
- >
249
- <CogIcon />
250
- </button>
251
- </div>
252
222
  </div>
253
223
  <div className="workspace-review__content-container">
254
224
  <div className="workspace-review__content">
255
- <WorkspaceReviewExplorer />
225
+ <ProjectReviewerExplorer />
256
226
  </div>
257
227
  </div>
258
228
  </div>
259
- <WorkspaceReviewStatusBar />
229
+ <ProjectReviewerStatusBar />
260
230
  </>
261
231
  )}
262
232
  </div>
@@ -32,12 +32,15 @@ import { EntityDiffView } from '../editor/editor-group/diff-editor/EntityDiffVie
32
32
  import type { EditorState } from '../../stores/editor/editor-state/EditorState.js';
33
33
  import { useEditorStore } from '../editor/EditorStoreProvider.js';
34
34
  import { forwardRef } from 'react';
35
+ import { EditorDiffViewerState } from '../../stores/editor/editor-state/diff-viewer-state/EditorDiffViewerState.js';
36
+ import { ProjectConfigDiffView } from '../editor/editor-group/diff-editor/ProjectConfigDiffView.js';
37
+ import { ProjectConfigurationDiffEditorState } from '../../stores/editor/editor-state/diff-viewer-state/ProjectConfigurationDiffEditorState.js';
35
38
 
36
- const WorkspaceReviewPanelSplashScreen: React.FC = () => (
39
+ const ProjectReviewerPanelSplashScreen: React.FC = () => (
37
40
  <div className="workspace-review-panel__splash-screen"></div>
38
41
  );
39
42
 
40
- const WorkspaceReviewPanelHeaderTabContextMenu = observer(
43
+ const ProjectReviewerPanelHeaderTabContextMenu = observer(
41
44
  forwardRef<
42
45
  HTMLDivElement,
43
46
  {
@@ -65,14 +68,14 @@ const WorkspaceReviewPanelHeaderTabContextMenu = observer(
65
68
  }),
66
69
  );
67
70
 
68
- export const WorkspaceReviewPanel = observer(() => {
71
+ export const ProjectReviewerPanel = observer(() => {
69
72
  const editorStore = useEditorStore();
70
73
  const currentTabState =
71
- editorStore.tabManagerState.currentTab instanceof EntityDiffViewState
74
+ editorStore.tabManagerState.currentTab instanceof EditorDiffViewerState
72
75
  ? editorStore.tabManagerState.currentTab
73
76
  : undefined;
74
77
  const openedTabStates = editorStore.tabManagerState.tabs.filter(
75
- filterByType(EntityDiffViewState),
78
+ filterByType(EditorDiffViewerState),
76
79
  );
77
80
  const closeTab =
78
81
  (diffState: EditorState): React.MouseEventHandler =>
@@ -91,12 +94,25 @@ export const WorkspaceReviewPanel = observer(() => {
91
94
  editorStore.tabManagerState.openTab(editorState);
92
95
  const switchViewMode =
93
96
  (mode: DIFF_VIEW_MODE): (() => void) =>
94
- (): void =>
95
- currentTabState?.setDiffMode(mode);
97
+ (): void => {
98
+ if (currentTabState instanceof EntityDiffViewState) {
99
+ currentTabState.setDiffMode(mode);
100
+ }
101
+ };
96
102
 
97
103
  if (!currentTabState) {
98
- return <WorkspaceReviewPanelSplashScreen />;
104
+ return <ProjectReviewerPanelSplashScreen />;
99
105
  }
106
+ const renderActiveTabState = (
107
+ tab: EditorDiffViewerState,
108
+ ): React.ReactNode => {
109
+ if (tab instanceof EntityDiffViewState) {
110
+ return <EntityDiffView entityDiffViewState={tab} />;
111
+ } else if (tab instanceof ProjectConfigurationDiffEditorState) {
112
+ return <ProjectConfigDiffView configDiffState={tab} />;
113
+ }
114
+ return null;
115
+ };
100
116
  return (
101
117
  <div className="panel workspace-review-panel">
102
118
  <div className="panel__header workspace-review-panel__header">
@@ -113,7 +129,7 @@ export const WorkspaceReviewPanel = observer(() => {
113
129
  <ContextMenu
114
130
  className="workspace-review-panel__header__tab__content"
115
131
  content={
116
- <WorkspaceReviewPanelHeaderTabContextMenu
132
+ <ProjectReviewerPanelHeaderTabContextMenu
117
133
  editorState={editorState}
118
134
  />
119
135
  }
@@ -137,38 +153,40 @@ export const WorkspaceReviewPanel = observer(() => {
137
153
  ))}
138
154
  </div>
139
155
  <div className="workspace-review-panel__header__actions">
140
- <DropdownMenu
141
- className="workspace-review-panel__element-view__type"
142
- title="View as..."
143
- content={
144
- <div className="workspace-review-panel__element-view__options">
145
- <div
146
- className="workspace-review-panel__element-view__option"
147
- onClick={switchViewMode(DIFF_VIEW_MODE.GRAMMAR)}
148
- >
149
- {DIFF_VIEW_MODE.GRAMMAR}
150
- </div>
151
- <div
152
- className="workspace-review-panel__element-view__option"
153
- onClick={switchViewMode(DIFF_VIEW_MODE.JSON)}
154
- >
155
- {DIFF_VIEW_MODE.JSON}
156
+ {currentTabState instanceof EntityDiffViewState && (
157
+ <DropdownMenu
158
+ className="workspace-review-panel__element-view__type"
159
+ title="View as..."
160
+ content={
161
+ <div className="workspace-review-panel__element-view__options">
162
+ <div
163
+ className="workspace-review-panel__element-view__option"
164
+ onClick={switchViewMode(DIFF_VIEW_MODE.GRAMMAR)}
165
+ >
166
+ {DIFF_VIEW_MODE.GRAMMAR}
167
+ </div>
168
+ <div
169
+ className="workspace-review-panel__element-view__option"
170
+ onClick={switchViewMode(DIFF_VIEW_MODE.JSON)}
171
+ >
172
+ {DIFF_VIEW_MODE.JSON}
173
+ </div>
156
174
  </div>
175
+ }
176
+ menuProps={{
177
+ anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
178
+ transformOrigin: { vertical: 'top', horizontal: 'right' },
179
+ }}
180
+ >
181
+ <div className="workspace-review-panel__element-view__type__label">
182
+ {currentTabState.diffMode}
157
183
  </div>
158
- }
159
- menuProps={{
160
- anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
161
- transformOrigin: { vertical: 'top', horizontal: 'right' },
162
- }}
163
- >
164
- <div className="workspace-review-panel__element-view__type__label">
165
- {currentTabState.diffMode}
166
- </div>
167
- </DropdownMenu>
184
+ </DropdownMenu>
185
+ )}
168
186
  </div>
169
187
  </div>
170
188
  <div className="panel__content workspace-review-panel__content">
171
- <EntityDiffView entityDiffViewState={currentTabState} />
189
+ {renderActiveTabState(currentTabState)}
172
190
  </div>
173
191
  </div>
174
192
  );
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import type { EditorStore } from '../../EditorStore.js';
18
+ import { EditorState } from '../EditorState.js';
19
+ import type { SPECIAL_REVISION_ALIAS } from '../entity-diff-editor-state/EntityDiffEditorState.js';
20
+
21
+ export abstract class EditorDiffViewerState extends EditorState {
22
+ fromRevision: SPECIAL_REVISION_ALIAS | string;
23
+ toRevision: SPECIAL_REVISION_ALIAS | string;
24
+
25
+ constructor(
26
+ fromRevision: SPECIAL_REVISION_ALIAS | string,
27
+ toRevision: SPECIAL_REVISION_ALIAS | string,
28
+ editorStore: EditorStore,
29
+ ) {
30
+ super(editorStore);
31
+ this.fromRevision = fromRevision;
32
+ this.toRevision = toRevision;
33
+ }
34
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Copyright (c) 2020-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { prettyCONSTName, type PlainObject } from '@finos/legend-shared';
18
+ import type { ProjectConfiguration } from '@finos/legend-server-sdlc';
19
+ import type { EditorStore } from '../../EditorStore.js';
20
+ import { EditorDiffViewerState } from './EditorDiffViewerState.js';
21
+ import type { SPECIAL_REVISION_ALIAS } from '../entity-diff-editor-state/EntityDiffEditorState.js';
22
+ import type { EditorState } from '../EditorState.js';
23
+
24
+ export const PROJECT_CONFIGURATION = 'PROJECT_CONFIGURATION';
25
+
26
+ export class ProjectConfigurationDiffEditorState extends EditorDiffViewerState {
27
+ fromConfig: PlainObject<ProjectConfiguration>;
28
+ toConfig: PlainObject<ProjectConfiguration>;
29
+ constructor(
30
+ fromConfig: PlainObject<ProjectConfiguration>,
31
+ toConfig: PlainObject<ProjectConfiguration>,
32
+ editorStore: EditorStore,
33
+ fromRevision: SPECIAL_REVISION_ALIAS | string,
34
+ toRevision: SPECIAL_REVISION_ALIAS | string,
35
+ ) {
36
+ super(fromRevision, toRevision, editorStore);
37
+ this.fromConfig = fromConfig;
38
+ this.toConfig = toConfig;
39
+ }
40
+
41
+ override get label(): string {
42
+ return prettyCONSTName(PROJECT_CONFIGURATION);
43
+ }
44
+
45
+ override match(tab: EditorState): boolean {
46
+ return (
47
+ tab instanceof ProjectConfigurationDiffEditorState &&
48
+ tab.fromRevision === this.fromRevision &&
49
+ tab.toRevision === this.toRevision
50
+ );
51
+ }
52
+
53
+ override get description(): string {
54
+ return prettyCONSTName(PROJECT_CONFIGURATION);
55
+ }
56
+ }
@@ -24,6 +24,7 @@ import {
24
24
  extractElementNameFromPath,
25
25
  extractPackagePathFromPath,
26
26
  SnowflakeAppDeploymentConfiguration,
27
+ DeploymentOwner,
27
28
  } from '@finos/legend-graph';
28
29
  import { type GeneratorFn } from '@finos/legend-shared';
29
30
  import { FUNCTION_ACTIVATE_TYPE } from '../../../../components/editor/editor-group/function-activator/FunctionEditor.js';
@@ -92,7 +93,7 @@ export class FunctionActivatorState {
92
93
  const snowflakeApp = new SnowflakeApp(activatorName);
93
94
  snowflakeApp.applicationName = '';
94
95
  snowflakeApp.description = '';
95
- snowflakeApp.owner = undefined;
96
+ snowflakeApp.ownership = new DeploymentOwner('', snowflakeApp);
96
97
  snowflakeApp.function =
97
98
  PackageableElementExplicitReference.create(functionElement);
98
99
  snowflakeApp.activationConfiguration =
@@ -22,6 +22,8 @@ import {
22
22
  PackageableElementExplicitReference,
23
23
  observe_SnowflakeAppDeploymentConfiguration,
24
24
  observe_SnowflakeApp,
25
+ DeploymentOwner,
26
+ observe_DeploymentOwnership,
25
27
  } from '@finos/legend-graph';
26
28
  import {
27
29
  type GeneratorFn,
@@ -43,7 +45,7 @@ export class SnowflakeAppFunctionActivatorEdtiorState extends ElementEditorState
43
45
  makeObservable(this, {
44
46
  activator: computed,
45
47
  reprocess: action,
46
- updateOwner: action,
48
+ updateOwnership: action,
47
49
  updateAppDescription: action,
48
50
  updateApplicationName: action,
49
51
  updateConnection: action,
@@ -70,8 +72,9 @@ export class SnowflakeAppFunctionActivatorEdtiorState extends ElementEditorState
70
72
  );
71
73
  }
72
74
 
73
- updateOwner(val: string): void {
74
- this.activator.owner = val;
75
+ updateOwnership(val: string): void {
76
+ this.activator.ownership = new DeploymentOwner(val, this.activator);
77
+ observe_DeploymentOwnership(this.activator.ownership);
75
78
  }
76
79
 
77
80
  updateApplicationName(val: string): void {
@@ -181,7 +181,7 @@ export class EntityChangeConflictEditorState extends EntityDiffViewerState {
181
181
  entityPath: string | undefined,
182
182
  ) => Entity | undefined,
183
183
  ) {
184
- super(editorStore);
184
+ super(baseRevision, currentChangeRevision, editorStore);
185
185
 
186
186
  makeObservable<
187
187
  EntityChangeConflictEditorState,
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { EditorState } from '../../editor-state/EditorState.js';
17
+ import { EditorDiffViewerState } from '../diff-viewer-state/EditorDiffViewerState.js';
18
18
 
19
19
  export enum SPECIAL_REVISION_ALIAS {
20
20
  LOCAL = 'LOCAL_REVISION',
@@ -43,6 +43,6 @@ export const getPrettyLabelForRevision = (
43
43
  }
44
44
  };
45
45
 
46
- export abstract class EntityDiffViewerState extends EditorState {
46
+ export abstract class EntityDiffViewerState extends EditorDiffViewerState {
47
47
  abstract refresh(): void;
48
48
  }
@@ -49,8 +49,6 @@ export class EntityDiffViewState extends EntityDiffViewerState {
49
49
  diffMode = DIFF_VIEW_MODE.GRAMMAR;
50
50
  fromEntityPath?: string | undefined;
51
51
  toEntityPath?: string | undefined;
52
- fromRevision: SPECIAL_REVISION_ALIAS | string;
53
- toRevision: SPECIAL_REVISION_ALIAS | string;
54
52
  // to and from entities
55
53
  fromEntity?: Entity | undefined;
56
54
  toEntity?: Entity | undefined;
@@ -75,7 +73,7 @@ export class EntityDiffViewState extends EntityDiffViewerState {
75
73
  fromEntityGetter?: (entityPath: string | undefined) => Entity | undefined,
76
74
  toEntityGetter?: (entityPath: string | undefined) => Entity | undefined,
77
75
  ) {
78
- super(editorStore);
76
+ super(fromRevision, toRevision, editorStore);
79
77
 
80
78
  makeObservable<
81
79
  EntityDiffViewState,