@finos/legend-application-query 8.1.2 → 9.0.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 (125) hide show
  1. package/lib/application/LegendQuery.d.ts.map +1 -1
  2. package/lib/application/LegendQuery.js +7 -9
  3. package/lib/application/LegendQuery.js.map +1 -1
  4. package/lib/application/LegendQueryApplicationConfig.d.ts +4 -0
  5. package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
  6. package/lib/application/LegendQueryApplicationConfig.js +4 -0
  7. package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
  8. package/lib/components/{QuerySetupStoreProvider.d.ts → CloneQueryServiceSetup.d.ts} +2 -7
  9. package/lib/components/CloneQueryServiceSetup.d.ts.map +1 -0
  10. package/lib/components/CloneQueryServiceSetup.js +137 -0
  11. package/lib/components/CloneQueryServiceSetup.js.map +1 -0
  12. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts +24 -0
  13. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -0
  14. package/lib/components/Core_LegendQueryApplicationPlugin.js +144 -0
  15. package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -0
  16. package/lib/components/CreateMappingQuerySetup.d.ts +18 -0
  17. package/lib/components/CreateMappingQuerySetup.d.ts.map +1 -0
  18. package/lib/components/CreateMappingQuerySetup.js +160 -0
  19. package/lib/components/CreateMappingQuerySetup.js.map +1 -0
  20. package/lib/components/EditExistingQuerySetup.d.ts +18 -0
  21. package/lib/components/EditExistingQuerySetup.d.ts.map +1 -0
  22. package/lib/components/EditExistingQuerySetup.js +107 -0
  23. package/lib/components/EditExistingQuerySetup.js.map +1 -0
  24. package/lib/components/LegendQueryApplication.d.ts.map +1 -1
  25. package/lib/components/LegendQueryApplication.js +4 -2
  26. package/lib/components/LegendQueryApplication.js.map +1 -1
  27. package/lib/components/LoadProjectServiceQuerySetup.d.ts +18 -0
  28. package/lib/components/LoadProjectServiceQuerySetup.d.ts.map +1 -0
  29. package/lib/components/LoadProjectServiceQuerySetup.js +63 -0
  30. package/lib/components/LoadProjectServiceQuerySetup.js.map +1 -0
  31. package/lib/components/QueryEditor.d.ts.map +1 -1
  32. package/lib/components/QueryEditor.js +31 -33
  33. package/lib/components/QueryEditor.js.map +1 -1
  34. package/lib/components/QueryProductionizerSetup.d.ts +18 -0
  35. package/lib/components/QueryProductionizerSetup.d.ts.map +1 -0
  36. package/lib/components/QueryProductionizerSetup.js +85 -0
  37. package/lib/components/QueryProductionizerSetup.js.map +1 -0
  38. package/lib/components/QuerySetup.d.ts +20 -5
  39. package/lib/components/QuerySetup.d.ts.map +1 -1
  40. package/lib/components/QuerySetup.js +69 -473
  41. package/lib/components/QuerySetup.js.map +1 -1
  42. package/lib/components/UpdateExistingServiceQuerySetup.d.ts +18 -0
  43. package/lib/components/UpdateExistingServiceQuerySetup.d.ts.map +1 -0
  44. package/lib/components/UpdateExistingServiceQuerySetup.js +69 -0
  45. package/lib/components/UpdateExistingServiceQuerySetup.js.map +1 -0
  46. package/lib/index.css +2 -2
  47. package/lib/index.css.map +1 -1
  48. package/lib/index.d.ts +2 -3
  49. package/lib/index.d.ts.map +1 -1
  50. package/lib/index.js +2 -3
  51. package/lib/index.js.map +1 -1
  52. package/lib/package.json +5 -8
  53. package/lib/stores/CloneServiceQuerySetupStore.d.ts +41 -0
  54. package/lib/stores/CloneServiceQuerySetupStore.d.ts.map +1 -0
  55. package/lib/stores/CloneServiceQuerySetupStore.js +98 -0
  56. package/lib/stores/CloneServiceQuerySetupStore.js.map +1 -0
  57. package/lib/stores/CreateMappingQuerySetupStore.d.ts +40 -0
  58. package/lib/stores/CreateMappingQuerySetupStore.d.ts.map +1 -0
  59. package/lib/stores/CreateMappingQuerySetupStore.js +97 -0
  60. package/lib/stores/CreateMappingQuerySetupStore.js.map +1 -0
  61. package/lib/stores/EditExistingQuerySetupStore.d.ts +33 -0
  62. package/lib/stores/EditExistingQuerySetupStore.d.ts.map +1 -0
  63. package/lib/stores/EditExistingQuerySetupStore.js +85 -0
  64. package/lib/stores/EditExistingQuerySetupStore.js.map +1 -0
  65. package/lib/stores/LegendQueryApplicationPlugin.d.ts +21 -16
  66. package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
  67. package/lib/stores/LegendQueryApplicationPlugin.js +4 -0
  68. package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
  69. package/lib/stores/LegendQueryRouter.d.ts +28 -1
  70. package/lib/stores/LegendQueryRouter.d.ts.map +1 -1
  71. package/lib/stores/LegendQueryRouter.js +33 -3
  72. package/lib/stores/LegendQueryRouter.js.map +1 -1
  73. package/lib/stores/LoadProjectServiceQuerySetupStore.d.ts +27 -0
  74. package/lib/stores/LoadProjectServiceQuerySetupStore.d.ts.map +1 -0
  75. package/lib/stores/LoadProjectServiceQuerySetupStore.js +61 -0
  76. package/lib/stores/LoadProjectServiceQuerySetupStore.js.map +1 -0
  77. package/lib/stores/QueryEditorStore.d.ts +6 -2
  78. package/lib/stores/QueryEditorStore.d.ts.map +1 -1
  79. package/lib/stores/QueryEditorStore.js +35 -17
  80. package/lib/stores/QueryEditorStore.js.map +1 -1
  81. package/lib/stores/QueryEditorStoreTestUtils.d.ts.map +1 -1
  82. package/lib/stores/QueryEditorStoreTestUtils.js +3 -0
  83. package/lib/stores/QueryEditorStoreTestUtils.js.map +1 -1
  84. package/lib/stores/QueryProductionizerSetupStore.d.ts +32 -0
  85. package/lib/stores/QueryProductionizerSetupStore.d.ts.map +1 -0
  86. package/lib/stores/QueryProductionizerSetupStore.js +101 -0
  87. package/lib/stores/QueryProductionizerSetupStore.js.map +1 -0
  88. package/lib/stores/QuerySetupStore.d.ts +22 -85
  89. package/lib/stores/QuerySetupStore.d.ts.map +1 -1
  90. package/lib/stores/QuerySetupStore.js +78 -408
  91. package/lib/stores/QuerySetupStore.js.map +1 -1
  92. package/lib/stores/UpdateExistingServiceQuerySetupStore.d.ts +28 -0
  93. package/lib/stores/UpdateExistingServiceQuerySetupStore.d.ts.map +1 -0
  94. package/lib/stores/UpdateExistingServiceQuerySetupStore.js +73 -0
  95. package/lib/stores/UpdateExistingServiceQuerySetupStore.js.map +1 -0
  96. package/package.json +13 -16
  97. package/src/application/LegendQuery.tsx +7 -8
  98. package/src/application/LegendQueryApplicationConfig.ts +14 -0
  99. package/src/components/CloneQueryServiceSetup.tsx +312 -0
  100. package/src/components/Core_LegendQueryApplicationPlugin.tsx +184 -0
  101. package/src/components/CreateMappingQuerySetup.tsx +352 -0
  102. package/src/components/EditExistingQuerySetup.tsx +280 -0
  103. package/src/components/LegendQueryApplication.tsx +14 -2
  104. package/src/components/LoadProjectServiceQuerySetup.tsx +131 -0
  105. package/src/components/QueryEditor.tsx +127 -81
  106. package/src/components/QueryProductionizerSetup.tsx +206 -0
  107. package/src/components/QuerySetup.tsx +285 -1183
  108. package/src/components/UpdateExistingServiceQuerySetup.tsx +153 -0
  109. package/src/index.ts +3 -2
  110. package/src/stores/CloneServiceQuerySetupStore.ts +151 -0
  111. package/src/stores/CreateMappingQuerySetupStore.ts +155 -0
  112. package/src/stores/EditExistingQuerySetupStore.ts +111 -0
  113. package/src/stores/LegendQueryApplicationPlugin.ts +27 -27
  114. package/src/stores/LegendQueryRouter.ts +95 -12
  115. package/src/stores/LoadProjectServiceQuerySetupStore.ts +87 -0
  116. package/src/stores/QueryEditorStore.ts +90 -24
  117. package/src/stores/QueryEditorStoreTestUtils.ts +3 -0
  118. package/src/stores/QueryProductionizerSetupStore.ts +143 -0
  119. package/src/stores/QuerySetupStore.ts +111 -604
  120. package/src/stores/UpdateExistingServiceQuerySetupStore.ts +118 -0
  121. package/tsconfig.json +13 -1
  122. package/lib/components/QuerySetupStoreProvider.d.ts.map +0 -1
  123. package/lib/components/QuerySetupStoreProvider.js +0 -34
  124. package/lib/components/QuerySetupStoreProvider.js.map +0 -1
  125. package/src/components/QuerySetupStoreProvider.tsx +0 -56
@@ -14,7 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { generatePath } from '@finos/legend-application';
17
+ import {
18
+ generateExtensionUrlPattern,
19
+ generatePath,
20
+ } from '@finos/legend-application';
21
+ import {
22
+ addQueryParamsStringToUrl,
23
+ stringifyQueryParams,
24
+ } from '@finos/legend-shared';
18
25
  import { generateGAVCoordinates } from '@finos/legend-storage';
19
26
 
20
27
  export enum LEGEND_QUERY_PATH_PARAM_TOKEN {
@@ -25,17 +32,77 @@ export enum LEGEND_QUERY_PATH_PARAM_TOKEN {
25
32
  SERVICE_PATH = 'servicePath',
26
33
  }
27
34
 
35
+ export enum LEGEND_QUERY_SETUP_QUERY_PARAM_TOKEN {
36
+ SHOW_ALL_GROUPS = 'showAllGroups',
37
+ SHOW_ADVANCED_ACTIONS = 'showAdvancedActions',
38
+ TAG = 'tag',
39
+ }
40
+
28
41
  export enum LEGEND_QUERY_QUERY_PARAM_TOKEN {
29
42
  SERVICE_EXECUTION_KEY = 'executionKey',
30
43
  }
31
44
 
32
45
  export const LEGEND_QUERY_ROUTE_PATTERN = Object.freeze({
33
46
  SETUP: '/setup',
47
+ EDIT_EXISTING_QUERY_SETUP: '/setup/existing-query',
48
+ CREATE_MAPPING_QUERY_SETUP: '/setup/manual',
49
+ CLONE_SERVICE_QUERY_SETUP: '/setup/clone-service-query',
50
+ QUERY_PRODUCTIONIZER_SETUP: '/setup/productionize-query',
51
+ UPDATE_EXISTING_SERVICE_QUERY_SETUP: '/setup/update-existing-service-query',
52
+ LOAD_PROJECT_SERVICE_QUERY_SETUP: '/setup/load-project-service-query',
34
53
  CREATE_FROM_MAPPING_QUERY: `/create/manual/:${LEGEND_QUERY_PATH_PARAM_TOKEN.GAV}/:${LEGEND_QUERY_PATH_PARAM_TOKEN.MAPPING_PATH}/:${LEGEND_QUERY_PATH_PARAM_TOKEN.RUNTIME_PATH}`,
35
54
  CREATE_FROM_SERVICE_QUERY: `/create-from-service/:${LEGEND_QUERY_PATH_PARAM_TOKEN.GAV}/:${LEGEND_QUERY_PATH_PARAM_TOKEN.SERVICE_PATH}`,
36
55
  EDIT_EXISTING_QUERY: `/edit/:${LEGEND_QUERY_PATH_PARAM_TOKEN.QUERY_ID}`,
37
56
  });
38
57
 
58
+ export interface QuerySetupQueryParams {
59
+ [LEGEND_QUERY_SETUP_QUERY_PARAM_TOKEN.SHOW_ALL_GROUPS]?: string;
60
+ [LEGEND_QUERY_SETUP_QUERY_PARAM_TOKEN.SHOW_ADVANCED_ACTIONS]?: string;
61
+ [LEGEND_QUERY_SETUP_QUERY_PARAM_TOKEN.TAG]?: string;
62
+ }
63
+
64
+ export const generateQuerySetupRoute = (
65
+ showAllGroups?: boolean | undefined,
66
+ showAdvancedActions?: boolean | undefined,
67
+ tag?: string | undefined,
68
+ ): string =>
69
+ addQueryParamsStringToUrl(
70
+ generatePath(LEGEND_QUERY_ROUTE_PATTERN.SETUP, {}),
71
+ stringifyQueryParams({
72
+ [LEGEND_QUERY_SETUP_QUERY_PARAM_TOKEN.SHOW_ALL_GROUPS]: showAllGroups,
73
+ [LEGEND_QUERY_SETUP_QUERY_PARAM_TOKEN.SHOW_ADVANCED_ACTIONS]:
74
+ showAdvancedActions,
75
+ [LEGEND_QUERY_SETUP_QUERY_PARAM_TOKEN.TAG]: tag,
76
+ }),
77
+ );
78
+
79
+ export const generateEditExistingQuerySetupRoute = (): string =>
80
+ generatePath(LEGEND_QUERY_ROUTE_PATTERN.EDIT_EXISTING_QUERY_SETUP, {});
81
+ export const generateCreateMappingQuerySetupRoute = (): string =>
82
+ generatePath(LEGEND_QUERY_ROUTE_PATTERN.CREATE_MAPPING_QUERY_SETUP, {});
83
+ export const generateCloneServiceQuerySetupRoute = (): string =>
84
+ generateExtensionUrlPattern(
85
+ generatePath(LEGEND_QUERY_ROUTE_PATTERN.CLONE_SERVICE_QUERY_SETUP, {}),
86
+ );
87
+ export const generateQueryProductionizerSetupRoute = (): string =>
88
+ generateExtensionUrlPattern(
89
+ generatePath(LEGEND_QUERY_ROUTE_PATTERN.QUERY_PRODUCTIONIZER_SETUP, {}),
90
+ );
91
+ export const generateUpdateExistingServiceQuerySetup = (): string =>
92
+ generateExtensionUrlPattern(
93
+ generatePath(
94
+ LEGEND_QUERY_ROUTE_PATTERN.UPDATE_EXISTING_SERVICE_QUERY_SETUP,
95
+ {},
96
+ ),
97
+ );
98
+ export const generateLoadProjectServiceQuerySetup = (): string =>
99
+ generateExtensionUrlPattern(
100
+ generatePath(
101
+ LEGEND_QUERY_ROUTE_PATTERN.LOAD_PROJECT_SERVICE_QUERY_SETUP,
102
+ {},
103
+ ),
104
+ );
105
+
39
106
  export const generateMappingQueryCreatorRoute = (
40
107
  groupId: string,
41
108
  artifactId: string,
@@ -64,18 +131,21 @@ export const generateServiceQueryCreatorRoute = (
64
131
  artifactId: string,
65
132
  versionId: string,
66
133
  servicePath: string,
67
- key?: string,
134
+ executionKey?: string | undefined,
68
135
  ): string =>
69
- `${generatePath(LEGEND_QUERY_ROUTE_PATTERN.CREATE_FROM_SERVICE_QUERY, {
70
- [LEGEND_QUERY_PATH_PARAM_TOKEN.GAV]: generateGAVCoordinates(
71
- groupId,
72
- artifactId,
73
- versionId,
74
- ),
75
- [LEGEND_QUERY_PATH_PARAM_TOKEN.SERVICE_PATH]: servicePath,
76
- })}${
77
- key ? `?${LEGEND_QUERY_QUERY_PARAM_TOKEN.SERVICE_EXECUTION_KEY}=${key}` : ''
78
- }`;
136
+ addQueryParamsStringToUrl(
137
+ generatePath(LEGEND_QUERY_ROUTE_PATTERN.CREATE_FROM_SERVICE_QUERY, {
138
+ [LEGEND_QUERY_PATH_PARAM_TOKEN.GAV]: generateGAVCoordinates(
139
+ groupId,
140
+ artifactId,
141
+ versionId,
142
+ ),
143
+ [LEGEND_QUERY_PATH_PARAM_TOKEN.SERVICE_PATH]: servicePath,
144
+ }),
145
+ stringifyQueryParams({
146
+ [LEGEND_QUERY_QUERY_PARAM_TOKEN.SERVICE_EXECUTION_KEY]: executionKey,
147
+ }),
148
+ );
79
149
 
80
150
  export interface ServiceQueryCreatorPathParams {
81
151
  [LEGEND_QUERY_PATH_PARAM_TOKEN.GAV]: string;
@@ -111,6 +181,19 @@ export const EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl = (
111
181
  versionId,
112
182
  )}${entityPath ? `/entity/${entityPath}` : ''}`;
113
183
 
184
+ /**
185
+ * @external_application_navigation This depends on Legend Studio routing and is hardcoded so it's potentially brittle
186
+ */
187
+ export const EXTERNAL_APPLICATION_NAVIGATION__generateStudioSDLCProjectViewUrl =
188
+ (
189
+ studioUrl: string,
190
+ projectId: string,
191
+ entityPath: string | undefined,
192
+ ): string =>
193
+ `${studioUrl}/view/${projectId}${
194
+ entityPath ? `/entity/${entityPath}` : ''
195
+ }`;
196
+
114
197
  /**
115
198
  * @external_application_navigation This depends on Legend Studio routing and is hardcoded so it's potentially brittle
116
199
  */
@@ -0,0 +1,87 @@
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 {
18
+ ProjectData,
19
+ type DepotServerClient,
20
+ } from '@finos/legend-server-depot';
21
+ import {
22
+ ActionState,
23
+ assertErrorThrown,
24
+ type PlainObject,
25
+ type GeneratorFn,
26
+ } from '@finos/legend-shared';
27
+ import { parseProjectIdentifier } from '@finos/legend-storage';
28
+ import { flow, makeObservable, observable } from 'mobx';
29
+ import type { LegendQueryApplicationStore } from './LegendQueryBaseStore.js';
30
+ import { EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateProjectServiceQueryUrl } from './LegendQueryRouter.js';
31
+ import { BaseQuerySetupStore } from './QuerySetupStore.js';
32
+
33
+ export class LoadProjectServiceQuerySetupStore extends BaseQuerySetupStore {
34
+ readonly loadProjectsState = ActionState.create();
35
+ projects: ProjectData[] = [];
36
+
37
+ constructor(
38
+ applicationStore: LegendQueryApplicationStore,
39
+ depotServerClient: DepotServerClient,
40
+ ) {
41
+ super(applicationStore, depotServerClient);
42
+
43
+ makeObservable(this, {
44
+ projects: observable,
45
+ loadProjects: flow,
46
+ });
47
+ }
48
+
49
+ *loadProjects(): GeneratorFn<void> {
50
+ this.loadProjectsState.inProgress();
51
+ try {
52
+ this.projects = (
53
+ (yield this.depotServerClient.getProjects()) as PlainObject<ProjectData>[]
54
+ ).map((v) => ProjectData.serialization.fromJson(v));
55
+ this.loadProjectsState.pass();
56
+ } catch (error) {
57
+ assertErrorThrown(error);
58
+ this.applicationStore.notifyError(error);
59
+ this.loadProjectsState.fail();
60
+ }
61
+ }
62
+
63
+ async loadProjectServiceUpdater(project: ProjectData): Promise<void> {
64
+ // find the matching SDLC instance
65
+ const projectIDPrefix = parseProjectIdentifier(project.projectId).prefix;
66
+ const matchingSDLCEntry = this.applicationStore.config.studioInstances.find(
67
+ (entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
68
+ );
69
+ if (matchingSDLCEntry) {
70
+ this.applicationStore.setBlockingAlert({
71
+ message: `Loading service project...`,
72
+ prompt: 'Please do not close the application',
73
+ showLoading: true,
74
+ });
75
+ this.applicationStore.navigator.goToAddress(
76
+ EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateProjectServiceQueryUrl(
77
+ matchingSDLCEntry.url,
78
+ project.projectId,
79
+ ),
80
+ );
81
+ } else {
82
+ this.applicationStore.notifyWarning(
83
+ `Can't find the corresponding SDLC instance to load project '${project.projectId}'`,
84
+ );
85
+ }
86
+ }
87
+ }
@@ -50,21 +50,27 @@ import {
50
50
  QuerySearchSpecification,
51
51
  Mapping,
52
52
  type Runtime,
53
+ type Service,
53
54
  } from '@finos/legend-graph';
54
55
  import {
56
+ EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl,
57
+ EXTERNAL_APPLICATION_NAVIGATION__generateStudioSDLCProjectViewUrl,
55
58
  generateExistingQueryEditorRoute,
56
59
  generateMappingQueryCreatorRoute,
57
60
  generateServiceQueryCreatorRoute,
58
61
  } from './LegendQueryRouter.js';
59
62
  import { LEGEND_QUERY_APP_EVENT } from '../LegendQueryAppEvent.js';
60
- import type { Entity, ProjectGAVCoordinates } from '@finos/legend-storage';
63
+ import {
64
+ type Entity,
65
+ type ProjectGAVCoordinates,
66
+ parseProjectIdentifier,
67
+ } from '@finos/legend-storage';
61
68
  import {
62
69
  type DepotServerClient,
63
70
  ProjectData,
64
71
  } from '@finos/legend-server-depot';
65
72
  import {
66
73
  TAB_SIZE,
67
- APPLICATION_EVENT,
68
74
  DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
69
75
  DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
70
76
  } from '@finos/legend-application';
@@ -79,6 +85,58 @@ import {
79
85
  ServiceQueryBuilderState,
80
86
  } from '@finos/legend-query-builder';
81
87
 
88
+ export const createViewProjectHandler =
89
+ (applicationStore: LegendQueryApplicationStore) =>
90
+ (
91
+ groupId: string,
92
+ artifactId: string,
93
+ versionId: string,
94
+ entityPath: string | undefined,
95
+ ): void =>
96
+ applicationStore.navigator.visitAddress(
97
+ EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl(
98
+ applicationStore.config.studioUrl,
99
+ groupId,
100
+ artifactId,
101
+ versionId,
102
+ entityPath,
103
+ ),
104
+ );
105
+
106
+ export const createViewSDLCProjectHandler =
107
+ (
108
+ applicationStore: LegendQueryApplicationStore,
109
+ depotServerClient: DepotServerClient,
110
+ ) =>
111
+ async (
112
+ groupId: string,
113
+ artifactId: string,
114
+ entityPath: string | undefined,
115
+ ): Promise<void> => {
116
+ // fetch project data
117
+ const project = ProjectData.serialization.fromJson(
118
+ await depotServerClient.getProject(groupId, artifactId),
119
+ );
120
+ // find the matching SDLC instance
121
+ const projectIDPrefix = parseProjectIdentifier(project.projectId).prefix;
122
+ const matchingSDLCEntry = applicationStore.config.studioInstances.find(
123
+ (entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
124
+ );
125
+ if (matchingSDLCEntry) {
126
+ applicationStore.navigator.visitAddress(
127
+ EXTERNAL_APPLICATION_NAVIGATION__generateStudioSDLCProjectViewUrl(
128
+ matchingSDLCEntry.url,
129
+ project.projectId,
130
+ entityPath,
131
+ ),
132
+ );
133
+ } else {
134
+ applicationStore.notifyWarning(
135
+ `Can't find the corresponding SDLC instance to view the SDLC project`,
136
+ );
137
+ }
138
+ };
139
+
82
140
  export interface QueryExportConfiguration {
83
141
  defaultName?: string | undefined;
84
142
  allowUpdate?: boolean | undefined;
@@ -131,6 +189,7 @@ export class QueryExportState {
131
189
 
132
190
  async persistQuery(createNew: boolean): Promise<void> {
133
191
  if (
192
+ this.editorStore.isSaveActionDisabled ||
134
193
  !this.queryBuilderState.mapping ||
135
194
  !(this.queryBuilderState.runtimeValue instanceof RuntimePointer)
136
195
  ) {
@@ -174,7 +233,7 @@ export class QueryExportState {
174
233
  LegendQueryEventService.create(
175
234
  this.editorStore.applicationStore.eventService,
176
235
  ).notify_QueryCreated({ queryId: newQuery.id });
177
- this.editorStore.applicationStore.navigator.reloadToLocation(
236
+ this.editorStore.applicationStore.navigator.goToLocation(
178
237
  generateExistingQueryEditorRoute(newQuery.id),
179
238
  );
180
239
  } else {
@@ -296,6 +355,14 @@ export abstract class QueryEditorStore {
296
355
  this.queryLoaderState = new QueryLoaderState(this);
297
356
  }
298
357
 
358
+ get isViewProjectActionDisabled(): boolean {
359
+ return false;
360
+ }
361
+
362
+ get isSaveActionDisabled(): boolean {
363
+ return false;
364
+ }
365
+
299
366
  setExportState(val: QueryExportState | undefined): void {
300
367
  this.exportState = val;
301
368
  }
@@ -304,9 +371,11 @@ export abstract class QueryEditorStore {
304
371
  /**
305
372
  * Set up the editor state before building the graph
306
373
  */
374
+
307
375
  protected async setUpEditorState(): Promise<void> {
308
376
  // do nothing
309
377
  }
378
+
310
379
  /**
311
380
  * Set up the query builder state after building the graph
312
381
  */
@@ -317,17 +386,6 @@ export abstract class QueryEditorStore {
317
386
 
318
387
  *initialize(): GeneratorFn<void> {
319
388
  if (!this.initState.isInInitialState) {
320
- // eslint-disable-next-line no-process-env
321
- if (process.env.NODE_ENV === 'development') {
322
- this.applicationStore.log.info(
323
- LogEvent.create(APPLICATION_EVENT.DEVELOPMENT_ISSUE),
324
- `Fast-refreshing the app - preventing initialize() recall...`,
325
- );
326
- return;
327
- }
328
- this.applicationStore.notifyIllegalState(
329
- `Query editor store is already initialized`,
330
- );
331
389
  return;
332
390
  }
333
391
 
@@ -351,8 +409,7 @@ export abstract class QueryEditorStore {
351
409
  );
352
410
 
353
411
  yield this.setUpEditorState();
354
- const { groupId, artifactId, versionId } = this.getProjectInfo();
355
- yield flowResult(this.buildGraph(groupId, artifactId, versionId));
412
+ yield flowResult(this.buildGraph());
356
413
  this.queryBuilderState =
357
414
  (yield this.initializeQueryBuilderState()) as QueryBuilderState;
358
415
 
@@ -368,13 +425,11 @@ export abstract class QueryEditorStore {
368
425
  }
369
426
  }
370
427
 
371
- *buildGraph(
372
- groupId: string,
373
- artifactId: string,
374
- versionId: string,
375
- ): GeneratorFn<void> {
428
+ *buildGraph(): GeneratorFn<void> {
376
429
  const stopWatch = new StopWatch();
377
430
 
431
+ const { groupId, artifactId, versionId } = this.getProjectInfo();
432
+
378
433
  // fetch project data
379
434
  const project = ProjectData.serialization.fromJson(
380
435
  (yield this.depotServerClient.getProject(
@@ -496,7 +551,7 @@ export class MappingQueryCreatorStore extends QueryEditorStore {
496
551
  this.applicationStore,
497
552
  this.graphManagerState,
498
553
  (val: Mapping) => {
499
- this.applicationStore.navigator.goToLocation(
554
+ this.applicationStore.navigator.updateCurrentLocation(
500
555
  generateMappingQueryCreatorRoute(
501
556
  this.groupId,
502
557
  this.artifactId,
@@ -508,7 +563,7 @@ export class MappingQueryCreatorStore extends QueryEditorStore {
508
563
  );
509
564
  },
510
565
  (val: Runtime) => {
511
- this.applicationStore.navigator.goToLocation(
566
+ this.applicationStore.navigator.updateCurrentLocation(
512
567
  generateMappingQueryCreatorRoute(
513
568
  this.groupId,
514
569
  this.artifactId,
@@ -590,9 +645,20 @@ export class ServiceQueryCreatorStore extends QueryEditorStore {
590
645
  this.applicationStore,
591
646
  this.graphManagerState,
592
647
  service,
648
+ this.graphManagerState.usableServices,
593
649
  this.executionKey,
594
- (val: ServiceExecutionContext): void => {
650
+ (val: Service): void => {
595
651
  this.applicationStore.navigator.goToLocation(
652
+ generateServiceQueryCreatorRoute(
653
+ this.groupId,
654
+ this.artifactId,
655
+ this.versionId,
656
+ val.path,
657
+ ),
658
+ );
659
+ },
660
+ (val: ServiceExecutionContext): void => {
661
+ this.applicationStore.navigator.updateCurrentLocation(
596
662
  generateServiceQueryCreatorRoute(
597
663
  this.groupId,
598
664
  this.artifactId,
@@ -30,6 +30,9 @@ const TEST_DATA__appConfig = {
30
30
  url: 'http://testStudioUrl',
31
31
  instances: [],
32
32
  },
33
+ taxonomy: {
34
+ url: 'http://testTaxonomyUrl',
35
+ },
33
36
  };
34
37
 
35
38
  export const TEST__getTestLegendQueryApplicationConfig = (
@@ -0,0 +1,143 @@
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 {
18
+ DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
19
+ DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
20
+ } from '@finos/legend-application';
21
+ import {
22
+ type LightQuery,
23
+ type QueryInfo,
24
+ QuerySearchSpecification,
25
+ } from '@finos/legend-graph';
26
+ import {
27
+ type DepotServerClient,
28
+ ProjectData,
29
+ } from '@finos/legend-server-depot';
30
+ import {
31
+ ActionState,
32
+ assertErrorThrown,
33
+ type GeneratorFn,
34
+ } from '@finos/legend-shared';
35
+ import { parseProjectIdentifier } from '@finos/legend-storage';
36
+ import { flow, makeObservable, observable } from 'mobx';
37
+ import type { LegendQueryApplicationStore } from './LegendQueryBaseStore.js';
38
+ import { EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl } from './LegendQueryRouter.js';
39
+ import { BaseQuerySetupStore } from './QuerySetupStore.js';
40
+
41
+ export class QueryProductionizerSetupStore extends BaseQuerySetupStore {
42
+ readonly loadQueriesState = ActionState.create();
43
+ readonly loadQueryState = ActionState.create();
44
+ queries: LightQuery[] = [];
45
+ currentQuery?: LightQuery | undefined;
46
+ currentQueryInfo?: QueryInfo | undefined;
47
+
48
+ constructor(
49
+ applicationStore: LegendQueryApplicationStore,
50
+ depotServerClient: DepotServerClient,
51
+ ) {
52
+ super(applicationStore, depotServerClient);
53
+
54
+ makeObservable(this, {
55
+ queries: observable,
56
+ currentQuery: observable,
57
+ currentQueryInfo: observable,
58
+ setCurrentQuery: flow,
59
+ loadQueries: flow,
60
+ });
61
+ }
62
+
63
+ async loadQueryProductionizer(): Promise<void> {
64
+ if (!this.currentQuery) {
65
+ return;
66
+ }
67
+
68
+ // fetch project data
69
+ const project = ProjectData.serialization.fromJson(
70
+ await this.depotServerClient.getProject(
71
+ this.currentQuery.groupId,
72
+ this.currentQuery.artifactId,
73
+ ),
74
+ );
75
+
76
+ // find the matching SDLC instance
77
+ const projectIDPrefix = parseProjectIdentifier(project.projectId).prefix;
78
+ const matchingSDLCEntry = this.applicationStore.config.studioInstances.find(
79
+ (entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
80
+ );
81
+ if (matchingSDLCEntry) {
82
+ this.applicationStore.setBlockingAlert({
83
+ message: `Loading query...`,
84
+ prompt: 'Please do not close the application',
85
+ showLoading: true,
86
+ });
87
+ this.applicationStore.navigator.goToAddress(
88
+ EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl(
89
+ matchingSDLCEntry.url,
90
+ this.currentQuery.id,
91
+ ),
92
+ );
93
+ } else {
94
+ this.applicationStore.notifyWarning(
95
+ `Can't find the corresponding SDLC instance to productionize the query`,
96
+ );
97
+ }
98
+ }
99
+
100
+ *setCurrentQuery(queryId: string | undefined): GeneratorFn<void> {
101
+ if (queryId) {
102
+ try {
103
+ this.loadQueryState.inProgress();
104
+ this.currentQuery =
105
+ (yield this.graphManagerState.graphManager.getLightQuery(
106
+ queryId,
107
+ )) as LightQuery;
108
+ this.currentQueryInfo =
109
+ (yield this.graphManagerState.graphManager.getQueryInfo(
110
+ queryId,
111
+ )) as QueryInfo;
112
+ } catch (error) {
113
+ assertErrorThrown(error);
114
+ this.applicationStore.notifyError(error);
115
+ } finally {
116
+ this.loadQueryState.reset();
117
+ }
118
+ } else {
119
+ this.currentQuery = undefined;
120
+ }
121
+ }
122
+
123
+ *loadQueries(searchText: string): GeneratorFn<void> {
124
+ const isValidSearchString =
125
+ searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
126
+ this.loadQueriesState.inProgress();
127
+ try {
128
+ const searchSpecification = new QuerySearchSpecification();
129
+ searchSpecification.searchTerm = isValidSearchString
130
+ ? searchText
131
+ : undefined;
132
+ searchSpecification.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
133
+ this.queries = (yield this.graphManagerState.graphManager.searchQueries(
134
+ searchSpecification,
135
+ )) as LightQuery[];
136
+ this.loadQueriesState.pass();
137
+ } catch (error) {
138
+ assertErrorThrown(error);
139
+ this.applicationStore.notifyError(error);
140
+ this.loadQueriesState.fail();
141
+ }
142
+ }
143
+ }