@finos/legend-application-studio 22.3.1 → 22.3.2

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 (57) hide show
  1. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.d.ts.map +1 -1
  2. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.js +28 -4
  3. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.js.map +1 -1
  4. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.d.ts.map +1 -1
  5. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js +5 -2
  6. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.js.map +1 -1
  7. package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
  8. package/lib/components/editor/side-bar/Explorer.js +34 -8
  9. package/lib/components/editor/side-bar/Explorer.js.map +1 -1
  10. package/lib/index.css +1 -1
  11. package/lib/index.d.ts +1 -1
  12. package/lib/index.d.ts.map +1 -1
  13. package/lib/index.js +1 -1
  14. package/lib/index.js.map +1 -1
  15. package/lib/package.json +1 -1
  16. package/lib/stores/editor/EditorMode.d.ts +5 -0
  17. package/lib/stores/editor/EditorMode.d.ts.map +1 -1
  18. package/lib/stores/editor/EditorMode.js.map +1 -1
  19. package/lib/stores/editor/StandardEditorMode.d.ts +2 -0
  20. package/lib/stores/editor/StandardEditorMode.d.ts.map +1 -1
  21. package/lib/stores/editor/StandardEditorMode.js +8 -1
  22. package/lib/stores/editor/StandardEditorMode.js.map +1 -1
  23. package/lib/stores/editor-state/GrammarTextEditorState.d.ts.map +1 -1
  24. package/lib/stores/editor-state/GrammarTextEditorState.js +1 -1
  25. package/lib/stores/editor-state/GrammarTextEditorState.js.map +1 -1
  26. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.d.ts +2 -1
  27. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
  28. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.js +8 -1
  29. package/lib/stores/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
  30. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts +1 -2
  31. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
  32. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +4 -10
  33. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
  34. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestableState.d.ts +1 -0
  35. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestableState.d.ts.map +1 -1
  36. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestableState.js +12 -1
  37. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestableState.js.map +1 -1
  38. package/lib/stores/project-viewer/ProjectViewerEditorMode.d.ts +2 -0
  39. package/lib/stores/project-viewer/ProjectViewerEditorMode.d.ts.map +1 -1
  40. package/lib/stores/project-viewer/ProjectViewerEditorMode.js +7 -0
  41. package/lib/stores/project-viewer/ProjectViewerEditorMode.js.map +1 -1
  42. package/lib/stores/shared/PackageTreeUtils.d.ts.map +1 -1
  43. package/lib/stores/shared/PackageTreeUtils.js +10 -1
  44. package/lib/stores/shared/PackageTreeUtils.js.map +1 -1
  45. package/package.json +1 -1
  46. package/src/components/editor/edit-panel/service-editor/testable/ServiceTestDataEditor.tsx +34 -6
  47. package/src/components/editor/edit-panel/service-editor/testable/ServiceTestableEditor.tsx +6 -2
  48. package/src/components/editor/side-bar/Explorer.tsx +82 -16
  49. package/src/index.ts +4 -1
  50. package/src/stores/editor/EditorMode.ts +10 -0
  51. package/src/stores/editor/StandardEditorMode.ts +24 -1
  52. package/src/stores/editor-state/GrammarTextEditorState.ts +1 -1
  53. package/src/stores/editor-state/element-editor-state/service/ServiceEditorState.ts +10 -0
  54. package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +4 -12
  55. package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestableState.ts +15 -0
  56. package/src/stores/project-viewer/ProjectViewerEditorMode.ts +20 -0
  57. package/src/stores/shared/PackageTreeUtils.ts +12 -1
@@ -91,6 +91,7 @@ import {
91
91
  isMainGraphElement,
92
92
  getFunctionSignature,
93
93
  getFunctionNameWithPath,
94
+ getElementRootPackage,
94
95
  } from '@finos/legend-graph';
95
96
  import { useApplicationStore } from '@finos/legend-application';
96
97
  import { PACKAGEABLE_ELEMENT_TYPE } from '../../../stores/shared/ModelClassifierUtils.js';
@@ -236,6 +237,12 @@ const ExplorerContextMenu = observer(
236
237
  ));
237
238
  const projectId = editorStore.sdlcState.currentProject?.projectId;
238
239
  const isReadOnly = editorStore.isInViewerMode || Boolean(nodeIsImmutable);
240
+ const isDependencyProjectElement =
241
+ node &&
242
+ isDependencyElement(
243
+ node.packageableElement,
244
+ editorStore.graphManagerState.graph,
245
+ );
239
246
  const _package = node
240
247
  ? node.packageableElement instanceof Package
241
248
  ? node.packageableElement
@@ -283,20 +290,74 @@ const ExplorerContextMenu = observer(
283
290
  };
284
291
  const copyWorkspaceElementLink = (): void => {
285
292
  if (node) {
286
- applicationStore
287
- .copyTextToClipboard(
288
- applicationStore.navigator.generateAddress(
289
- editorStore.editorMode.generateElementLink(
290
- node.packageableElement.path,
293
+ const dependency =
294
+ editorStore.projectConfigurationEditorState.projectConfiguration?.projectDependencies.find(
295
+ (dep) =>
296
+ dep.projectId ===
297
+ getElementRootPackage(node.packageableElement).name,
298
+ );
299
+ if (dependency) {
300
+ applicationStore
301
+ .copyTextToClipboard(
302
+ applicationStore.navigator.generateAddress(
303
+ editorStore.editorMode.generateDependencyElementLink(
304
+ node.packageableElement.path,
305
+ dependency,
306
+ ),
291
307
  ),
292
- ),
293
- )
294
- .then(() =>
295
- applicationStore.notifySuccess(
296
- 'Copied workspace element link to clipboard',
297
- ),
298
- )
299
- .catch(applicationStore.alertUnhandledError);
308
+ )
309
+ .then(() =>
310
+ applicationStore.notifySuccess(
311
+ 'Copied workspace element link to clipboard',
312
+ ),
313
+ )
314
+ .catch(applicationStore.alertUnhandledError);
315
+ } else {
316
+ applicationStore
317
+ .copyTextToClipboard(
318
+ applicationStore.navigator.generateAddress(
319
+ editorStore.editorMode.generateElementLink(
320
+ node.packageableElement.path,
321
+ ),
322
+ ),
323
+ )
324
+ .then(() =>
325
+ applicationStore.notifySuccess(
326
+ 'Copied workspace element link to clipboard',
327
+ ),
328
+ )
329
+ .catch(applicationStore.alertUnhandledError);
330
+ }
331
+ }
332
+ };
333
+ const copySDLCProjectLink = (): void => {
334
+ if (node) {
335
+ const dependency =
336
+ editorStore.projectConfigurationEditorState.projectConfiguration?.projectDependencies.find(
337
+ (dep) =>
338
+ dep.projectId ===
339
+ getElementRootPackage(node.packageableElement).name,
340
+ );
341
+ if (dependency) {
342
+ applicationStore
343
+ .copyTextToClipboard(
344
+ applicationStore.navigator.generateAddress(
345
+ generateViewProjectByGAVRoute(
346
+ guaranteeNonNullable(dependency.groupId),
347
+ guaranteeNonNullable(dependency.artifactId),
348
+ dependency.versionId === MASTER_SNAPSHOT_ALIAS
349
+ ? SNAPSHOT_VERSION_ALIAS
350
+ : dependency.versionId,
351
+ ),
352
+ ),
353
+ )
354
+ .then(() =>
355
+ applicationStore.notifySuccess(
356
+ 'Copied SDLC project link to clipboard',
357
+ ),
358
+ )
359
+ .catch(applicationStore.alertUnhandledError);
360
+ }
300
361
  }
301
362
  };
302
363
  const createNewElement =
@@ -311,7 +372,7 @@ const ExplorerContextMenu = observer(
311
372
  const viewProject = (): void => {
312
373
  const projectDependency =
313
374
  editorStore.projectConfigurationEditorState.projectConfiguration?.projectDependencies.find(
314
- (dep) => dep.projectId === node?.label,
375
+ (dep) => dep.projectId === node?.packageableElement.name,
315
376
  );
316
377
  if (projectDependency && !projectDependency.isLegacyDependency) {
317
378
  applicationStore.navigator.visitAddress(
@@ -330,7 +391,7 @@ const ExplorerContextMenu = observer(
330
391
  const viewSDLCProject = (): void => {
331
392
  const dependency =
332
393
  editorStore.projectConfigurationEditorState.projectConfiguration?.projectDependencies.find(
333
- (dep) => dep.projectId === node?.label,
394
+ (dep) => dep.projectId === node?.packageableElement.name,
334
395
  );
335
396
  if (dependency) {
336
397
  createViewSDLCProjectHandler(
@@ -397,7 +458,7 @@ const ExplorerContextMenu = observer(
397
458
  )}
398
459
  {node && (
399
460
  <>
400
- {!editorStore.isInViewerMode && (
461
+ {!editorStore.isInViewerMode && !isDependencyProjectElement && (
401
462
  <MenuContentItem onClick={openElementInViewerMode}>
402
463
  View in Project
403
464
  </MenuContentItem>
@@ -405,6 +466,11 @@ const ExplorerContextMenu = observer(
405
466
  <MenuContentItem onClick={copyWorkspaceElementLink}>
406
467
  Copy Link
407
468
  </MenuContentItem>
469
+ {isDependencyProjectElement && (
470
+ <MenuContentItem onClick={copySDLCProjectLink}>
471
+ Copy SDLC Project Link
472
+ </MenuContentItem>
473
+ )}
408
474
  </>
409
475
  )}
410
476
  </MenuContent>
package/src/index.ts CHANGED
@@ -95,7 +95,10 @@ export * from './stores/DSL_Generation_LegendStudioApplicationPlugin_Extension.j
95
95
  export * from './stores/STO_Relational_LegendStudioApplicationPlugin_Extension.js';
96
96
 
97
97
  export { MINIMUM_SERVICE_OWNERS } from './stores/editor-state/element-editor-state/service/ServiceEditorState.js';
98
- export { generateServiceManagementUrl } from './stores/editor-state/element-editor-state/service/ServiceRegistrationState.js';
98
+ export {
99
+ LATEST_PROJECT_REVISION,
100
+ generateServiceManagementUrl,
101
+ } from './stores/editor-state/element-editor-state/service/ServiceRegistrationState.js';
99
102
  export { ServicePureExecutionState } from './stores/editor-state/element-editor-state/service/ServiceExecutionState.js';
100
103
  export { NewServiceModal } from './components/editor/edit-panel/service-editor/NewServiceModal.js';
101
104
  export { FileSystem_File as GenerationFile } from './stores/shared/FileSystemTreeUtils.js';
@@ -14,9 +14,19 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ import type { ProjectDependency } from '@finos/legend-server-sdlc';
18
+
17
19
  export abstract class EditorMode {
18
20
  /**
19
21
  * Using information about the current project to generate a sharable link to the element.
20
22
  */
21
23
  abstract generateElementLink(elementPath: string): string;
24
+
25
+ /**
26
+ * Using information about the dependency project to generate a sharable link to the element.
27
+ */
28
+ abstract generateDependencyElementLink(
29
+ elementPath: string,
30
+ dependencyProject: ProjectDependency,
31
+ ): string;
22
32
  }
@@ -14,8 +14,17 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ import {
18
+ MASTER_SNAPSHOT_ALIAS,
19
+ SNAPSHOT_VERSION_ALIAS,
20
+ } from '@finos/legend-server-depot';
21
+ import type { ProjectDependency } from '@finos/legend-server-sdlc';
22
+ import { guaranteeNonNullable } from '@finos/legend-shared';
17
23
  import type { EditorStore } from '../EditorStore.js';
18
- import { generateEditorRoute } from '../LegendStudioRouter.js';
24
+ import {
25
+ generateEditorRoute,
26
+ generateViewProjectByGAVRoute,
27
+ } from '../LegendStudioRouter.js';
19
28
  import { EditorMode } from './EditorMode.js';
20
29
 
21
30
  export class StandardEditorMode extends EditorMode {
@@ -34,4 +43,18 @@ export class StandardEditorMode extends EditorMode {
34
43
  elementPath,
35
44
  );
36
45
  }
46
+
47
+ generateDependencyElementLink(
48
+ elementPath: string,
49
+ dependencyProject: ProjectDependency,
50
+ ): string {
51
+ return generateViewProjectByGAVRoute(
52
+ guaranteeNonNullable(dependencyProject.groupId),
53
+ guaranteeNonNullable(dependencyProject.artifactId),
54
+ dependencyProject.versionId === MASTER_SNAPSHOT_ALIAS
55
+ ? SNAPSHOT_VERSION_ALIAS
56
+ : dependencyProject.versionId,
57
+ elementPath,
58
+ );
59
+ }
37
60
  }
@@ -63,7 +63,7 @@ export class GrammarTextEditorState {
63
63
 
64
64
  graphGrammarText = '';
65
65
  currentElementLabelRegexString?: string | undefined;
66
- wrapText = false;
66
+ wrapText = true;
67
67
  forcedCursorPosition?: TextEditorPosition | undefined;
68
68
 
69
69
  constructor(editorStore: EditorStore) {
@@ -33,9 +33,11 @@ import { ServiceRegistrationState } from '../../../editor-state/element-editor-s
33
33
  import { ElementEditorState } from '../../../editor-state/element-editor-state/ElementEditorState.js';
34
34
  import {
35
35
  type PackageableElement,
36
+ type RawLambda,
36
37
  Service,
37
38
  PureSingleExecution,
38
39
  PureMultiExecution,
40
+ PureExecution,
39
41
  } from '@finos/legend-graph';
40
42
  import { ServiceTestableState } from './testable/ServiceTestableState.js';
41
43
  import { User } from '@finos/legend-server-sdlc';
@@ -126,6 +128,14 @@ export class ServiceEditorState extends ElementEditorState {
126
128
  );
127
129
  }
128
130
 
131
+ get serviceQuery(): RawLambda | undefined {
132
+ const execution = this.service.execution;
133
+ if (execution instanceof PureExecution) {
134
+ return execution.func;
135
+ }
136
+ return undefined;
137
+ }
138
+
129
139
  *searchUsers(name: string): GeneratorFn<User[]> {
130
140
  try {
131
141
  return (
@@ -18,13 +18,11 @@ import {
18
18
  type ServiceTest,
19
19
  type Service,
20
20
  type ValueSpecification,
21
- type RawLambda,
22
21
  observe_ValueSpecification,
23
22
  ParameterValue,
24
23
  buildLambdaVariableExpressions,
25
24
  VariableExpression,
26
25
  PureMultiExecution,
27
- PureExecution,
28
26
  } from '@finos/legend-graph';
29
27
  import { action, flow, makeObservable, observable } from 'mobx';
30
28
  import { TestableTestEditorState } from '../../testable/TestableEditorState.js';
@@ -183,18 +181,12 @@ export class ServiceTestSetupState {
183
181
  this.parameterValueStates = this.buildParameterStates();
184
182
  }
185
183
 
186
- get serviceQuery(): RawLambda | undefined {
187
- const execution = this.testState.testable.execution;
188
- if (execution instanceof PureExecution) {
189
- return execution.func;
190
- }
191
- return undefined;
192
- }
193
-
194
184
  get queryVariableExpressions(): VariableExpression[] {
195
- return this.serviceQuery
185
+ const query =
186
+ this.testState.suiteState.testableState.serviceEditorState.serviceQuery;
187
+ return query
196
188
  ? buildLambdaVariableExpressions(
197
- this.serviceQuery,
189
+ query,
198
190
  this.editorStore.graphManagerState,
199
191
  ).filter(filterByType(VariableExpression))
200
192
  : [];
@@ -28,6 +28,7 @@ import {
28
28
  DEFAULT_TEST_PREFIX,
29
29
  TestError,
30
30
  MultiExecutionServiceTestResult,
31
+ isStubbed_RawLambda,
31
32
  } from '@finos/legend-graph';
32
33
  import {
33
34
  type GeneratorFn,
@@ -240,6 +241,7 @@ export class ServiceTestableState {
240
241
  selectedSuiteState: observable,
241
242
  suiteToRename: observable,
242
243
  initSuites: action,
244
+ init: action,
243
245
  addTestSuite: action,
244
246
  changeSuite: action,
245
247
  setSuiteToRename: action,
@@ -250,6 +252,19 @@ export class ServiceTestableState {
250
252
  this.initSuites();
251
253
  }
252
254
 
255
+ init(): void {
256
+ const service = this.serviceEditorState.service;
257
+ const query = this.serviceEditorState.serviceQuery;
258
+ if (
259
+ query &&
260
+ !isStubbed_RawLambda(query) &&
261
+ !service.tests.length &&
262
+ !service.test
263
+ ) {
264
+ this.addTestSuite();
265
+ }
266
+ }
267
+
253
268
  setSuiteToRename(testSuite: ServiceTestSuite | undefined): void {
254
269
  this.suiteToRename = testSuite;
255
270
  }
@@ -22,6 +22,12 @@ import {
22
22
  } from '../LegendStudioRouter.js';
23
23
  import { EditorMode } from '../editor/EditorMode.js';
24
24
  import type { ProjectViewerStore } from './ProjectViewerStore.js';
25
+ import type { ProjectDependency } from '@finos/legend-server-sdlc';
26
+ import {
27
+ MASTER_SNAPSHOT_ALIAS,
28
+ SNAPSHOT_VERSION_ALIAS,
29
+ } from '@finos/legend-server-depot';
30
+ import { guaranteeNonNullable } from '@finos/legend-shared';
25
31
 
26
32
  export class ProjectViewerEditorMode extends EditorMode {
27
33
  viewerStore: ProjectViewerStore;
@@ -56,4 +62,18 @@ export class ProjectViewerEditorMode extends EditorMode {
56
62
  elementPath,
57
63
  );
58
64
  }
65
+
66
+ generateDependencyElementLink(
67
+ elementPath: string,
68
+ dependencyProject: ProjectDependency,
69
+ ): string {
70
+ return generateViewProjectByGAVRoute(
71
+ guaranteeNonNullable(dependencyProject.groupId),
72
+ guaranteeNonNullable(dependencyProject.artifactId),
73
+ dependencyProject.versionId === MASTER_SNAPSHOT_ALIAS
74
+ ? SNAPSHOT_VERSION_ALIAS
75
+ : dependencyProject.versionId,
76
+ elementPath,
77
+ );
78
+ }
59
79
  }
@@ -48,6 +48,17 @@ import {
48
48
  getElementRootPackage,
49
49
  } from '@finos/legend-graph';
50
50
  import { ExplorerTreeRootPackageLabel } from '../ExplorerTreeState.js';
51
+ import { GAV_DELIMITER } from '@finos/legend-storage';
52
+
53
+ /**
54
+ *
55
+ * Returns the explorer tree label for a dependency project. We return artifactId if
56
+ * the dependency is not a legacy dependency otherwise we return the projectId.
57
+ */
58
+ const getDependecyElementLabelFromProjectId = (projectId: string): string =>
59
+ projectId.includes(GAV_DELIMITER)
60
+ ? guaranteeNonNullable(projectId.split(GAV_DELIMITER)[1])
61
+ : projectId;
51
62
 
52
63
  const getElementProjectExplorerDnDType = (
53
64
  editorStore: EditorStore,
@@ -226,7 +237,7 @@ export const getDependenciesPackableElementTreeData = (
226
237
  true,
227
238
  childFilter,
228
239
  );
229
- childRootNode.label = _package.name;
240
+ childRootNode.label = getDependecyElementLabelFromProjectId(_package.name);
230
241
  childRootNode.id = _package.name;
231
242
  addUniqueEntry(rootIds, childRootNode.id);
232
243
  nodes.set(childRootNode.id, childRootNode);