@finos/legend-application-studio 20.0.10 → 20.1.1

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 (54) hide show
  1. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.d.ts.map +1 -1
  2. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js +1 -0
  3. package/lib/components/editor/edit-panel/service-editor/ServiceExecutionEditor.js.map +1 -1
  4. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestsEditor.d.ts.map +1 -1
  5. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestsEditor.js +10 -3
  6. package/lib/components/editor/edit-panel/service-editor/testable/ServiceTestsEditor.js.map +1 -1
  7. package/lib/components/shared/ProjectSelectorUtils.d.ts +2 -1
  8. package/lib/components/shared/ProjectSelectorUtils.d.ts.map +1 -1
  9. package/lib/components/shared/ProjectSelectorUtils.js +23 -5
  10. package/lib/components/shared/ProjectSelectorUtils.js.map +1 -1
  11. package/lib/components/workspace-setup/CreateWorkspaceModal.d.ts.map +1 -1
  12. package/lib/components/workspace-setup/CreateWorkspaceModal.js +2 -1
  13. package/lib/components/workspace-setup/CreateWorkspaceModal.js.map +1 -1
  14. package/lib/components/workspace-setup/WorkspaceSetup.d.ts.map +1 -1
  15. package/lib/components/workspace-setup/WorkspaceSetup.js +14 -2
  16. package/lib/components/workspace-setup/WorkspaceSetup.js.map +1 -1
  17. package/lib/index.css +2 -2
  18. package/lib/index.css.map +1 -1
  19. package/lib/index.d.ts +1 -0
  20. package/lib/index.d.ts.map +1 -1
  21. package/lib/index.js +1 -0
  22. package/lib/index.js.map +1 -1
  23. package/lib/package.json +2 -2
  24. package/lib/stores/EditorStore.js +1 -1
  25. package/lib/stores/EditorStore.js.map +1 -1
  26. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts +7 -0
  27. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.d.ts.map +1 -1
  28. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js +21 -2
  29. package/lib/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.js.map +1 -1
  30. package/lib/stores/shared/modifier/DSL_Service_GraphModifierHelper.d.ts +1 -0
  31. package/lib/stores/shared/modifier/DSL_Service_GraphModifierHelper.d.ts.map +1 -1
  32. package/lib/stores/shared/modifier/DSL_Service_GraphModifierHelper.js +3 -0
  33. package/lib/stores/shared/modifier/DSL_Service_GraphModifierHelper.js.map +1 -1
  34. package/lib/stores/workspace-setup/ProjectConfigurationStatus.d.ts +25 -0
  35. package/lib/stores/workspace-setup/ProjectConfigurationStatus.d.ts.map +1 -0
  36. package/lib/stores/workspace-setup/ProjectConfigurationStatus.js +43 -0
  37. package/lib/stores/workspace-setup/ProjectConfigurationStatus.js.map +1 -0
  38. package/lib/stores/workspace-setup/WorkspaceSetupStore.d.ts +2 -0
  39. package/lib/stores/workspace-setup/WorkspaceSetupStore.d.ts.map +1 -1
  40. package/lib/stores/workspace-setup/WorkspaceSetupStore.js +8 -1
  41. package/lib/stores/workspace-setup/WorkspaceSetupStore.js.map +1 -1
  42. package/package.json +11 -11
  43. package/src/components/editor/edit-panel/service-editor/ServiceExecutionEditor.tsx +5 -0
  44. package/src/components/editor/edit-panel/service-editor/testable/ServiceTestsEditor.tsx +47 -8
  45. package/src/components/shared/ProjectSelectorUtils.tsx +73 -13
  46. package/src/components/workspace-setup/CreateWorkspaceModal.tsx +4 -1
  47. package/src/components/workspace-setup/WorkspaceSetup.tsx +18 -1
  48. package/src/index.ts +1 -0
  49. package/src/stores/EditorStore.ts +1 -1
  50. package/src/stores/editor-state/element-editor-state/service/testable/ServiceTestEditorState.ts +32 -0
  51. package/src/stores/shared/modifier/DSL_Service_GraphModifierHelper.ts +6 -0
  52. package/src/stores/workspace-setup/ProjectConfigurationStatus.ts +62 -0
  53. package/src/stores/workspace-setup/WorkspaceSetupStore.ts +15 -1
  54. package/tsconfig.json +1 -0
@@ -23,11 +23,13 @@ import {
23
23
  ParameterValue,
24
24
  buildLambdaVariableExpressions,
25
25
  VariableExpression,
26
+ PureMultiExecution,
26
27
  } from '@finos/legend-graph';
27
28
  import { action, flow, makeObservable, observable } from 'mobx';
28
29
  import { TestableTestEditorState } from '../../testable/TestableEditorState.js';
29
30
  import type { ServiceTestSuiteState } from './ServiceTestableState.js';
30
31
  import {
32
+ service_addAssertKeyForTest,
31
33
  service_addParameterValue,
32
34
  service_deleteParameterValue,
33
35
  service_setParameterName,
@@ -77,6 +79,11 @@ export type SerializationFormatOption = {
77
79
  label: string;
78
80
  };
79
81
 
82
+ export type KeyOption = {
83
+ value: string;
84
+ label: string;
85
+ };
86
+
80
87
  export class ServiceTestParameterState {
81
88
  readonly uuid = uuid();
82
89
  readonly editorStore: EditorStore;
@@ -167,6 +174,7 @@ export class ServiceTestSetupState {
167
174
  setShowNewParameterModal: action,
168
175
  openNewParamModal: action,
169
176
  addParameterValue: action,
177
+ addServiceTestAssertKeys: action,
170
178
  syncWithQuery: action,
171
179
  removeParamValueState: action,
172
180
  });
@@ -193,6 +201,30 @@ export class ServiceTestSetupState {
193
201
  }));
194
202
  }
195
203
 
204
+ get keyOptions(): KeyOption[] {
205
+ const keys =
206
+ this.testState.testable.execution instanceof PureMultiExecution
207
+ ? this.testState.testable.execution.executionParameters.map(
208
+ (p) => p.key,
209
+ )
210
+ : [];
211
+ return keys.map((k) => ({
212
+ value: k,
213
+ label: k,
214
+ }));
215
+ }
216
+
217
+ getSelectedKeyOptions(): KeyOption[] {
218
+ return this.testState.test.keys.map((k) => ({
219
+ value: k,
220
+ label: k,
221
+ }));
222
+ }
223
+
224
+ addServiceTestAssertKeys(val: string[]): void {
225
+ service_addAssertKeyForTest(this.testState.test, val);
226
+ }
227
+
196
228
  get newParamOptions(): { value: string; label: string }[] {
197
229
  const queryVarExpressions = this.queryVariableExpressions;
198
230
  const currentParams = this.testState.test.parameters;
@@ -87,6 +87,12 @@ export const service_setSerializationFormat = action(
87
87
  },
88
88
  );
89
89
 
90
+ export const service_addAssertKeyForTest = action(
91
+ (test: ServiceTest, keys: string[]) => {
92
+ test.keys = keys;
93
+ },
94
+ );
95
+
90
96
  export const service_addTestSuite = action(
91
97
  (
92
98
  service: Service,
@@ -0,0 +1,62 @@
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 { GenericLegendApplicationStore } from '@finos/legend-application';
18
+ import {
19
+ ProjectConfigurationStatusReport,
20
+ Review,
21
+ type SDLCServerClient,
22
+ } from '@finos/legend-server-sdlc';
23
+ import { guaranteeNonNullable } from '@finos/legend-shared';
24
+
25
+ export class ProjectConfigurationStatus {
26
+ projectId!: string;
27
+ isConfigured = false;
28
+ reviewUrl?: string | undefined;
29
+ seenReview = false;
30
+ }
31
+
32
+ export const fetchProjectConfigurationStatus = async (
33
+ projectId: string,
34
+ applicationStore: GenericLegendApplicationStore,
35
+ sdlcServerClient: SDLCServerClient,
36
+ ): Promise<ProjectConfigurationStatus> => {
37
+ const status = ProjectConfigurationStatusReport.serialization.fromJson(
38
+ await sdlcServerClient.projectConfigurationStatus(projectId),
39
+ );
40
+ const result = new ProjectConfigurationStatus();
41
+ result.projectId = projectId;
42
+ result.isConfigured = status.projectConfigured;
43
+ if (status.reviewIds.length) {
44
+ try {
45
+ const review = Review.serialization.fromJson(
46
+ await sdlcServerClient.getReview(
47
+ projectId,
48
+ guaranteeNonNullable(status.reviewIds[0]),
49
+ ),
50
+ );
51
+ result.reviewUrl = review.webURL;
52
+ } catch {
53
+ // do nothing
54
+ }
55
+ }
56
+ if (!status.projectConfigured) {
57
+ applicationStore.notifyWarning(
58
+ `Project is not configured: please check and commit the project setup review`,
59
+ );
60
+ }
61
+ return result;
62
+ };
@@ -38,6 +38,10 @@ import {
38
38
  DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
39
39
  DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
40
40
  } from '@finos/legend-application';
41
+ import {
42
+ fetchProjectConfigurationStatus,
43
+ type ProjectConfigurationStatus,
44
+ } from './ProjectConfigurationStatus.js';
41
45
 
42
46
  interface ImportProjectSuccessReport {
43
47
  projectId: string;
@@ -52,6 +56,7 @@ export class WorkspaceSetupStore {
52
56
 
53
57
  projects: Project[] = [];
54
58
  currentProject?: Project | undefined;
59
+ currentProjectConfigurationStatus?: ProjectConfigurationStatus | undefined;
55
60
  loadProjectsState = ActionState.create();
56
61
  createOrImportProjectState = ActionState.create();
57
62
  importProjectSuccessReport?: ImportProjectSuccessReport | undefined;
@@ -70,6 +75,7 @@ export class WorkspaceSetupStore {
70
75
  makeObservable(this, {
71
76
  projects: observable,
72
77
  currentProject: observable,
78
+ currentProjectConfigurationStatus: observable,
73
79
  importProjectSuccessReport: observable,
74
80
  showCreateProjectModal: observable,
75
81
  workspaces: observable,
@@ -114,6 +120,7 @@ export class WorkspaceSetupStore {
114
120
  this.applicationStore.navigator.updateCurrentLocation(
115
121
  generateSetupRoute(undefined, undefined, undefined),
116
122
  );
123
+ this.currentProjectConfigurationStatus = undefined;
117
124
  }
118
125
 
119
126
  resetWorkspace(): void {
@@ -208,10 +215,17 @@ export class WorkspaceSetupStore {
208
215
  }
209
216
  | undefined,
210
217
  ): GeneratorFn<void> {
218
+ this.currentProject = project;
219
+ this.currentProjectConfigurationStatus = undefined;
211
220
  this.loadWorkspacesState.inProgress();
212
221
 
213
222
  try {
214
- this.currentProject = project;
223
+ this.currentProjectConfigurationStatus =
224
+ (yield fetchProjectConfigurationStatus(
225
+ project.projectId,
226
+ this.applicationStore,
227
+ this.sdlcServerClient,
228
+ )) as ProjectConfigurationStatus;
215
229
 
216
230
  const workspacesInConflictResolutionIds = (
217
231
  (yield this.sdlcServerClient.getWorkspacesInConflictResolutionMode(
package/tsconfig.json CHANGED
@@ -143,6 +143,7 @@
143
143
  "./src/stores/sidebar-state/WorkspaceUpdaterState.ts",
144
144
  "./src/stores/sidebar-state/testable/GlobalTestRunnerState.ts",
145
145
  "./src/stores/workspace-review/WorkspaceReviewStore.ts",
146
+ "./src/stores/workspace-setup/ProjectConfigurationStatus.ts",
146
147
  "./src/stores/workspace-setup/WorkspaceSetupStore.ts",
147
148
  "./src/application/LegendStudio.tsx",
148
149
  "./src/components/Core_LegendStudioApplicationPlugin.tsx",