@finos/legend-application-studio 28.5.8 → 28.6.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 (21) hide show
  1. package/lib/components/editor/editor-group/service-editor/ServiceEditor.d.ts.map +1 -1
  2. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js +52 -5
  3. package/lib/components/editor/editor-group/service-editor/ServiceEditor.js.map +1 -1
  4. package/lib/components/editor/panel-group/DevToolPanel.d.ts.map +1 -1
  5. package/lib/components/editor/panel-group/DevToolPanel.js +2 -1
  6. package/lib/components/editor/panel-group/DevToolPanel.js.map +1 -1
  7. package/lib/index.css +1 -1
  8. package/lib/package.json +1 -1
  9. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.d.ts +17 -0
  10. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.d.ts.map +1 -1
  11. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js +54 -1
  12. package/lib/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.js.map +1 -1
  13. package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.d.ts +6 -1
  14. package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.d.ts.map +1 -1
  15. package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.js +17 -2
  16. package/lib/stores/graph-modifier/DSL_Service_GraphModifierHelper.js.map +1 -1
  17. package/package.json +4 -4
  18. package/src/components/editor/editor-group/service-editor/ServiceEditor.tsx +400 -135
  19. package/src/components/editor/panel-group/DevToolPanel.tsx +11 -0
  20. package/src/stores/editor/editor-state/element-editor-state/service/ServiceEditorState.ts +74 -0
  21. package/src/stores/graph-modifier/DSL_Service_GraphModifierHelper.ts +35 -1
@@ -38,6 +38,8 @@ import {
38
38
  Service,
39
39
  PureSingleExecution,
40
40
  PureMultiExecution,
41
+ DeploymentOwnership,
42
+ UserListOwnership,
41
43
  isStubbed_RawLambda,
42
44
  getValueSpecificationReturnType,
43
45
  type Type,
@@ -48,6 +50,7 @@ import { ServiceTestableState } from './testable/ServiceTestableState.js';
48
50
  import { User } from '@finos/legend-server-sdlc';
49
51
  import { ServicePostValidationsState } from './ServicePostValidationState.js';
50
52
  import { valueSpecReturnTDS } from '@finos/legend-query-builder';
53
+ import { service_setOwnership } from '../../../../graph-modifier/DSL_Service_GraphModifierHelper.js';
51
54
 
52
55
  export enum SERVICE_TAB {
53
56
  GENERAL = 'GENERAL',
@@ -57,6 +60,11 @@ export enum SERVICE_TAB {
57
60
  POST_VALIDATION = 'POST_VALIDATION',
58
61
  }
59
62
 
63
+ enum ServiceOwnershipType {
64
+ DEPLOYMENT_OWNERSHIP = 'deploymentOwnership',
65
+ USERLIST_OWNERSHIP = 'userListOwnership',
66
+ }
67
+
60
68
  export const resolveServiceQueryValueSpec = (
61
69
  service: Service,
62
70
  editorStore: EditorStore,
@@ -101,6 +109,24 @@ export const isServiceQueryTDS = (
101
109
  };
102
110
 
103
111
  export const MINIMUM_SERVICE_OWNERS = 2;
112
+ export const DeploymentOwnershipLabel = 'Deployment';
113
+ export const UserlistOwnershipLabel = 'User List';
114
+ export const OWNERSHIP_OPTIONS = [
115
+ {
116
+ label: DeploymentOwnershipLabel,
117
+ value: ServiceOwnershipType.DEPLOYMENT_OWNERSHIP,
118
+ },
119
+ {
120
+ label: UserlistOwnershipLabel,
121
+ value: ServiceOwnershipType.USERLIST_OWNERSHIP,
122
+ },
123
+ ];
124
+
125
+ export type ServiceOwnerOption = {
126
+ label: string;
127
+ value: string;
128
+ };
129
+
104
130
  export class ServiceEditorState extends ElementEditorState {
105
131
  executionState: ServiceExecutionState;
106
132
  registrationState: ServiceRegistrationState;
@@ -113,10 +139,12 @@ export class ServiceEditorState extends ElementEditorState {
113
139
 
114
140
  makeObservable(this, {
115
141
  executionState: observable,
142
+ selectedOwnership: computed,
116
143
  registrationState: observable,
117
144
  selectedTab: observable,
118
145
  postValidationState: observable,
119
146
  setSelectedTab: action,
147
+ setSelectedOwnership: action,
120
148
  resetExecutionState: action,
121
149
  openToTestTab: action,
122
150
  service: computed,
@@ -153,6 +181,52 @@ export class ServiceEditorState extends ElementEditorState {
153
181
  this.selectedTab = SERVICE_TAB.TEST;
154
182
  }
155
183
 
184
+ get selectedOwnership(): ServiceOwnerOption | undefined {
185
+ const ownership = this.service.ownership;
186
+ if (ownership instanceof DeploymentOwnership) {
187
+ return {
188
+ label: DeploymentOwnershipLabel,
189
+ value: ServiceOwnershipType.DEPLOYMENT_OWNERSHIP,
190
+ };
191
+ } else if (ownership instanceof UserListOwnership) {
192
+ return {
193
+ label: UserlistOwnershipLabel,
194
+ value: ServiceOwnershipType.USERLIST_OWNERSHIP,
195
+ };
196
+ }
197
+ return undefined;
198
+ }
199
+
200
+ setSelectedOwnership(o: ServiceOwnerOption): void {
201
+ switch (o.value) {
202
+ case ServiceOwnershipType.DEPLOYMENT_OWNERSHIP: {
203
+ service_setOwnership(
204
+ this.service,
205
+ new DeploymentOwnership('', this.service),
206
+ );
207
+ break;
208
+ }
209
+ case ServiceOwnershipType.USERLIST_OWNERSHIP: {
210
+ const currentUserId =
211
+ this.editorStore.graphManagerState.graphManager.TEMPORARY__getEngineConfig()
212
+ .currentUserId;
213
+ service_setOwnership(
214
+ this.service,
215
+ new UserListOwnership(
216
+ currentUserId ? [currentUserId] : [],
217
+ this.service,
218
+ ),
219
+ );
220
+ break;
221
+ }
222
+ default: {
223
+ this.editorStore.applicationStore.notificationService.notifyError(
224
+ 'Unsupported ownership type',
225
+ );
226
+ }
227
+ }
228
+ }
229
+
156
230
  resetExecutionState(): void {
157
231
  this.executionState = this.buildExecutionState();
158
232
  }
@@ -23,6 +23,9 @@ import {
23
23
  type RawLambda,
24
24
  type Runtime,
25
25
  type Service,
26
+ DeploymentOwnership,
27
+ type UserListOwnership,
28
+ type ServiceOwnership,
26
29
  type ServiceExecution,
27
30
  type ObserverContext,
28
31
  type ServiceTestSuite,
@@ -47,6 +50,7 @@ import {
47
50
  observe_PostValidationAssertion,
48
51
  TestData,
49
52
  observe_TestData,
53
+ observe_Ownership,
50
54
  } from '@finos/legend-graph';
51
55
  import { addUniqueEntry, deleteEntry, uuid } from '@finos/legend-shared';
52
56
  import { action } from 'mobx';
@@ -162,7 +166,7 @@ export const service_initNewService = action(
162
166
  (service: Service, userId?: string): void => {
163
167
  service.pattern = `/${uuid()}`; // initialize the service pattern with an UUID to avoid people leaving the pattern as /
164
168
  if (userId) {
165
- service.owners.push(userId);
169
+ service.ownership = new DeploymentOwnership('', service);
166
170
  } // this is used to add the current user as the first owner by default
167
171
  },
168
172
  );
@@ -180,6 +184,36 @@ export const service_setPattern = action(
180
184
  service.pattern = value;
181
185
  },
182
186
  );
187
+
188
+ export const service_setOwnership = action(
189
+ (service: Service, value: ServiceOwnership | undefined): void => {
190
+ service.ownership = value ? observe_Ownership(value) : undefined;
191
+ },
192
+ );
193
+ export const service_deploymentOwnership = action(
194
+ (deployment: DeploymentOwnership, value: string): void => {
195
+ deployment.identifier = value;
196
+ },
197
+ );
198
+
199
+ export const service_addUserOwnership = action(
200
+ (userList: UserListOwnership, value: string): void => {
201
+ userList.users.push(value);
202
+ },
203
+ );
204
+
205
+ export const service_updateUserOwnership = action(
206
+ (userList: UserListOwnership, value: string, index: number): void => {
207
+ userList.users[index] = value;
208
+ },
209
+ );
210
+
211
+ export const service_deleteValueFromUserOwnership = action(
212
+ (userList: UserListOwnership, index: number): void => {
213
+ userList.users.splice(index, 1);
214
+ },
215
+ );
216
+
183
217
  export const service_setDocumentation = action(
184
218
  (service: Service, value: string): void => {
185
219
  service.documentation = value;