@finos/legend-application-studio 22.3.7 → 22.4.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 (44) hide show
  1. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectDependencyEditor.d.ts.map +1 -1
  2. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectDependencyEditor.js +2 -2
  3. package/lib/components/editor/edit-panel/project-configuration-editor/ProjectDependencyEditor.js.map +1 -1
  4. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  5. package/lib/components/editor/side-bar/Explorer.js +46 -29
  6. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  7. package/lib/components/editor/side-bar/ProjectDependantsEditor.d.ts +20 -0
  8. package/lib/components/editor/side-bar/ProjectDependantsEditor.d.ts.map +1 -0
  9. package/lib/components/editor/side-bar/ProjectDependantsEditor.js +62 -0
  10. package/lib/components/editor/side-bar/ProjectDependantsEditor.js.map +1 -0
  11. package/lib/components/editor/side-bar/ProjectOverview.d.ts.map +1 -1
  12. package/lib/components/editor/side-bar/ProjectOverview.js +4 -0
  13. package/lib/components/editor/side-bar/ProjectOverview.js.map +1 -1
  14. package/lib/index.css +2 -2
  15. package/lib/index.css.map +1 -1
  16. package/lib/package.json +4 -4
  17. package/lib/stores/ExplorerTreeState.d.ts.map +1 -1
  18. package/lib/stores/ExplorerTreeState.js +1 -0
  19. package/lib/stores/ExplorerTreeState.js.map +1 -1
  20. package/lib/stores/LegendStudioRouter.d.ts +2 -0
  21. package/lib/stores/LegendStudioRouter.d.ts.map +1 -1
  22. package/lib/stores/LegendStudioRouter.js +22 -0
  23. package/lib/stores/LegendStudioRouter.js.map +1 -1
  24. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js +1 -1
  25. package/lib/stores/editor-state/element-editor-state/service/ServiceExecutionState.js.map +1 -1
  26. package/lib/stores/sidebar-state/ProjectDependantEditorState.d.ts +31 -0
  27. package/lib/stores/sidebar-state/ProjectDependantEditorState.d.ts.map +1 -0
  28. package/lib/stores/sidebar-state/ProjectDependantEditorState.js +42 -0
  29. package/lib/stores/sidebar-state/ProjectDependantEditorState.js.map +1 -0
  30. package/lib/stores/sidebar-state/ProjectOverviewState.d.ts +4 -0
  31. package/lib/stores/sidebar-state/ProjectOverviewState.d.ts.map +1 -1
  32. package/lib/stores/sidebar-state/ProjectOverviewState.js +48 -0
  33. package/lib/stores/sidebar-state/ProjectOverviewState.js.map +1 -1
  34. package/package.json +13 -13
  35. package/src/components/editor/edit-panel/project-configuration-editor/ProjectDependencyEditor.tsx +2 -6
  36. package/src/components/editor/side-bar/Explorer.tsx +69 -41
  37. package/src/components/editor/side-bar/ProjectDependantsEditor.tsx +223 -0
  38. package/src/components/editor/side-bar/ProjectOverview.tsx +4 -0
  39. package/src/stores/ExplorerTreeState.ts +1 -0
  40. package/src/stores/LegendStudioRouter.ts +42 -0
  41. package/src/stores/editor-state/element-editor-state/service/ServiceExecutionState.ts +1 -1
  42. package/src/stores/sidebar-state/ProjectDependantEditorState.ts +50 -0
  43. package/src/stores/sidebar-state/ProjectOverviewState.ts +88 -0
  44. package/tsconfig.json +2 -0
@@ -56,6 +56,7 @@ import {
56
56
  import { useEditorStore } from '../EditorStoreProvider.js';
57
57
  import { useApplicationStore } from '@finos/legend-application';
58
58
  import { useLegendStudioApplicationStore } from '../../LegendStudioBaseStoreProvider.js';
59
+ import { ProjectDependantsEditor } from './ProjectDependantsEditor.js';
59
60
 
60
61
  const ShareProjectModal = observer(
61
62
  (props: { open: boolean; closeModal: () => void }) => {
@@ -811,6 +812,7 @@ export const ProjectOverviewActivityBar = observer(() => {
811
812
  mode: PROJECT_OVERVIEW_ACTIVITY_MODE.RELEASE,
812
813
  title: 'Release',
813
814
  },
815
+ { mode: PROJECT_OVERVIEW_ACTIVITY_MODE.DEPENDANTS, title: 'Dependants' },
814
816
  { mode: PROJECT_OVERVIEW_ACTIVITY_MODE.VERSIONS, title: 'Versions' },
815
817
  { mode: PROJECT_OVERVIEW_ACTIVITY_MODE.WORKSPACES, title: 'Workspaces' },
816
818
  ].filter((activity): activity is ProjectOverviewActivityDisplay =>
@@ -861,6 +863,8 @@ export const ProjectOverview = observer(() => {
861
863
  return <OverviewViewer />;
862
864
  case PROJECT_OVERVIEW_ACTIVITY_MODE.RELEASE:
863
865
  return <ReleaseEditor />;
866
+ case PROJECT_OVERVIEW_ACTIVITY_MODE.DEPENDANTS:
867
+ return <ProjectDependantsEditor />;
864
868
  case PROJECT_OVERVIEW_ACTIVITY_MODE.VERSIONS:
865
869
  return <VersionsViewer />;
866
870
  case PROJECT_OVERVIEW_ACTIVITY_MODE.WORKSPACES:
@@ -78,6 +78,7 @@ export class ExplorerTreeState {
78
78
  dependencyTreeData: observable.ref,
79
79
  selectedNode: observable.ref,
80
80
  fileGenerationTreeData: observable.ref,
81
+ elementToRename: observable.ref,
81
82
  setTreeData: action,
82
83
  setGenerationTreeData: action,
83
84
  setSystemTreeData: action,
@@ -51,6 +51,8 @@ export const LEGEND_STUDIO_SDLC_BYPASSED_ROUTE_PATTERN = Object.freeze({
51
51
  VIEW_BY_GAV_ENTITY: `/view/archive/:${LEGEND_STUDIO_PATH_PARAM_TOKEN.GAV}/entity/:${LEGEND_STUDIO_PATH_PARAM_TOKEN.ENTITY_PATH}`,
52
52
  });
53
53
 
54
+ export const LEGEND_DEPENDENCY_ROUTE_PATTERN = `/dependencies/:${LEGEND_STUDIO_PATH_PARAM_TOKEN.PROJECT_ID}?/:${LEGEND_STUDIO_PATH_PARAM_TOKEN.GAV}?/:testsBatchId?`;
55
+
54
56
  export interface ReviewPathParams {
55
57
  [LEGEND_STUDIO_PATH_PARAM_TOKEN.PROJECT_ID]: string;
56
58
  [LEGEND_STUDIO_PATH_PARAM_TOKEN.REVIEW_ID]: string;
@@ -229,3 +231,43 @@ export const generateViewRevisionRoute = (
229
231
  revisionId,
230
232
  entityPath,
231
233
  });
234
+
235
+ const generateDependencyDashboardGavRoute = (
236
+ projectId: string,
237
+ groupId: string,
238
+ artifactId: string,
239
+ versionId?: string,
240
+ testsBatchId?: string | undefined,
241
+ ): string => {
242
+ if (testsBatchId) {
243
+ return generatePath(LEGEND_DEPENDENCY_ROUTE_PATTERN, {
244
+ projectId: projectId,
245
+ gav: generateGAVCoordinates(groupId, artifactId, versionId),
246
+ testsBatchId: testsBatchId,
247
+ });
248
+ }
249
+ return generatePath(LEGEND_DEPENDENCY_ROUTE_PATTERN, {
250
+ projectId: projectId,
251
+ gav: generateGAVCoordinates(groupId, artifactId, versionId),
252
+ });
253
+ };
254
+
255
+ export const generateDependencyDashboardRoute = (
256
+ projectId?: string | undefined,
257
+ groupId?: string | undefined,
258
+ artifactId?: string | undefined,
259
+ versionId?: string | undefined,
260
+ testsBatchId?: string | undefined,
261
+ ): string => {
262
+ if (groupId && artifactId && projectId) {
263
+ return generateDependencyDashboardGavRoute(
264
+ projectId,
265
+ groupId,
266
+ artifactId,
267
+ versionId,
268
+ testsBatchId ?? undefined,
269
+ );
270
+ } else {
271
+ return generatePath(LEGEND_DEPENDENCY_ROUTE_PATTERN);
272
+ }
273
+ };
@@ -132,7 +132,7 @@ export class ServiceExecutionParameterState extends LambdaParametersState {
132
132
  flowResult(this.executionState.runQuery()).catch(
133
133
  this.executionState.editorStore.applicationStore.alertUnhandledError,
134
134
  ),
135
- PARAMETER_SUBMIT_ACTION.EXECUTE,
135
+ PARAMETER_SUBMIT_ACTION.RUN,
136
136
  );
137
137
  }
138
138
 
@@ -0,0 +1,50 @@
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 { observable, makeObservable, action } from 'mobx';
19
+ import { ActionState } from '@finos/legend-shared';
20
+ import type { ProjectVersionPlatformDependency } from '@finos/legend-server-depot';
21
+ import type { ProjectConfiguration } from '@finos/legend-server-sdlc';
22
+ import type { ProjectOverviewState } from './ProjectOverviewState.js';
23
+
24
+ export class ProjectDependantEditorState {
25
+ configState: ProjectOverviewState;
26
+ editorStore: EditorStore;
27
+ isReadOnly: boolean;
28
+ dependants: ProjectVersionPlatformDependency[] | undefined;
29
+ fetchingDependantInfoState = ActionState.create();
30
+
31
+ constructor(configState: ProjectOverviewState, editorStore: EditorStore) {
32
+ makeObservable(this, {
33
+ dependants: observable,
34
+ fetchingDependantInfoState: observable,
35
+ setDependants: action,
36
+ });
37
+ this.configState = configState;
38
+ this.editorStore = editorStore;
39
+ this.isReadOnly = editorStore.isInViewerMode;
40
+ }
41
+
42
+ get projectConfiguration(): ProjectConfiguration | undefined {
43
+ return this.editorStore.projectConfigurationEditorState
44
+ .projectConfiguration;
45
+ }
46
+
47
+ setDependants(value: ProjectVersionPlatformDependency[] | undefined): void {
48
+ this.dependants = value;
49
+ }
50
+ }
@@ -37,10 +37,17 @@ import {
37
37
  areWorkspacesEquivalent,
38
38
  } from '@finos/legend-server-sdlc';
39
39
  import { LEGEND_STUDIO_APP_EVENT } from '../LegendStudioAppEvent.js';
40
+ import { ProjectDependantEditorState } from './ProjectDependantEditorState.js';
41
+ import {
42
+ ProjectData,
43
+ ProjectVersionPlatformDependency,
44
+ } from '@finos/legend-server-depot';
45
+ import { compareSemVerVersions } from '@finos/legend-storage';
40
46
 
41
47
  export enum PROJECT_OVERVIEW_ACTIVITY_MODE {
42
48
  RELEASE = 'RELEASE',
43
49
  OVERVIEW = 'OVERVIEW',
50
+ DEPENDANTS = 'DEPENDANTS',
44
51
  VERSIONS = 'VERSIONS',
45
52
  WORKSPACES = 'WORKSPACES',
46
53
  }
@@ -54,6 +61,7 @@ export class ProjectOverviewState {
54
61
  latestProjectVersion?: Version | null; // `undefined` if API is not yet called, `null` if fetched but no version exists
55
62
  currentProjectRevision?: Revision | undefined;
56
63
  projectWorkspaces: Workspace[] = [];
64
+ projectDependantEditorState: ProjectDependantEditorState;
57
65
 
58
66
  isCreatingVersion = false;
59
67
  isFetchingProjectWorkspaces = false;
@@ -76,17 +84,23 @@ export class ProjectOverviewState {
76
84
  isUpdatingProject: observable,
77
85
  isFetchingLatestVersion: observable,
78
86
  isFetchingCurrentProjectRevision: observable,
87
+ projectDependantEditorState: observable,
79
88
  setActivityMode: action,
80
89
  fetchProjectWorkspaces: flow,
81
90
  deleteWorkspace: flow,
82
91
  updateProject: flow,
83
92
  fetchLatestProjectVersion: flow,
93
+ fetchDependants: flow,
84
94
  createVersion: flow,
85
95
  });
86
96
 
87
97
  this.editorStore = editorStore;
88
98
  this.sdlcState = sdlcState;
89
99
  this.releaseVersion = new CreateVersionCommand();
100
+ this.projectDependantEditorState = new ProjectDependantEditorState(
101
+ this,
102
+ this.editorStore,
103
+ );
90
104
  }
91
105
 
92
106
  setActivityMode(activityMode: PROJECT_OVERVIEW_ACTIVITY_MODE): void {
@@ -183,6 +197,80 @@ export class ProjectOverviewState {
183
197
  }
184
198
  }
185
199
 
200
+ *fetchDependants(): GeneratorFn<void> {
201
+ const groupId =
202
+ this.editorStore.projectConfigurationEditorState
203
+ .currentProjectConfiguration.groupId;
204
+ const artifactId =
205
+ this.editorStore.projectConfigurationEditorState
206
+ .currentProjectConfiguration.artifactId;
207
+ const version = this.editorStore.sdlcState.projectVersions[0]?.id.id;
208
+
209
+ if (!groupId || !artifactId || !version) {
210
+ return;
211
+ }
212
+
213
+ try {
214
+ this.projectDependantEditorState.fetchingDependantInfoState.inProgress();
215
+
216
+ const fetchedDependants = (
217
+ (yield this.editorStore.depotServerClient.getIndexedDependantProjects(
218
+ groupId,
219
+ artifactId,
220
+ version,
221
+ )) as PlainObject<ProjectVersionPlatformDependency>[]
222
+ )
223
+ .map((v) => ProjectVersionPlatformDependency.serialization.fromJson(v))
224
+ .sort(
225
+ (
226
+ a: { groupId: string; artifactId: string },
227
+ b: { groupId: string; artifactId: string },
228
+ ) => (a.groupId + a.artifactId > b.groupId + b.artifactId ? 1 : -1),
229
+ )
230
+ .sort((a: { versionId: string }, b: { versionId: string }) =>
231
+ compareSemVerVersions(a.versionId, b.versionId) > 0 ? 1 : -1,
232
+ )
233
+ .filter(
234
+ (filteredDependant: ProjectVersionPlatformDependency) =>
235
+ filteredDependant.versionId !== 'master-SNAPSHOT',
236
+ );
237
+
238
+ const uniqueProjects = [
239
+ ...new Map(
240
+ fetchedDependants.map((item: ProjectVersionPlatformDependency) => [
241
+ `${item.groupId}:${item.artifactId}`,
242
+ item,
243
+ ]),
244
+ ).values(),
245
+ ];
246
+
247
+ this.projectDependantEditorState.setDependants(uniqueProjects);
248
+ this.projectDependantEditorState.dependants?.map(
249
+ async (dependant: ProjectVersionPlatformDependency): Promise<void> => {
250
+ try {
251
+ const project = ProjectData.serialization.fromJson(
252
+ await this.editorStore.depotServerClient.getProject(
253
+ dependant.groupId,
254
+ dependant.artifactId,
255
+ ),
256
+ );
257
+ dependant.projectId = project.projectId;
258
+ } catch (error) {
259
+ assertErrorThrown(error);
260
+ }
261
+ },
262
+ );
263
+ this.projectDependantEditorState.fetchingDependantInfoState.complete();
264
+ } catch (error) {
265
+ assertErrorThrown(error);
266
+ this.projectDependantEditorState.fetchingDependantInfoState.fail();
267
+ this.editorStore.applicationStore.log.error(
268
+ LogEvent.create(LEGEND_STUDIO_APP_EVENT.DEPOT_MANAGER_FAILURE),
269
+ error,
270
+ );
271
+ }
272
+ }
273
+
186
274
  *fetchLatestProjectVersion(): GeneratorFn<void> {
187
275
  try {
188
276
  this.isFetchingLatestVersion = true;
package/tsconfig.json CHANGED
@@ -141,6 +141,7 @@
141
141
  "./src/stores/shared/modifier/Testable_GraphModifierHelper.ts",
142
142
  "./src/stores/shared/testable/TestableUtils.ts",
143
143
  "./src/stores/sidebar-state/LocalChangesState.ts",
144
+ "./src/stores/sidebar-state/ProjectDependantEditorState.ts",
144
145
  "./src/stores/sidebar-state/ProjectOverviewState.ts",
145
146
  "./src/stores/sidebar-state/WorkflowManagerState.ts",
146
147
  "./src/stores/sidebar-state/WorkspaceReviewState.ts",
@@ -238,6 +239,7 @@
238
239
  "./src/components/editor/side-bar/CreateNewElementModal.tsx",
239
240
  "./src/components/editor/side-bar/Explorer.tsx",
240
241
  "./src/components/editor/side-bar/LocalChanges.tsx",
242
+ "./src/components/editor/side-bar/ProjectDependantsEditor.tsx",
241
243
  "./src/components/editor/side-bar/ProjectOverview.tsx",
242
244
  "./src/components/editor/side-bar/SideBar.tsx",
243
245
  "./src/components/editor/side-bar/WorkflowManager.tsx",