@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-application-query",
3
- "version": "8.1.2",
3
+ "version": "9.0.0",
4
4
  "description": "Legend Query application core",
5
5
  "keywords": [
6
6
  "legend",
@@ -43,13 +43,13 @@
43
43
  "test:watch": "jest --watch"
44
44
  },
45
45
  "dependencies": {
46
- "@finos/legend-application": "9.0.0",
47
- "@finos/legend-art": "4.0.0",
48
- "@finos/legend-graph": "18.0.0",
49
- "@finos/legend-query-builder": "0.2.0",
50
- "@finos/legend-server-depot": "4.1.1",
51
- "@finos/legend-shared": "6.1.4",
52
- "@finos/legend-storage": "3.0.13",
46
+ "@finos/legend-application": "10.0.0",
47
+ "@finos/legend-art": "4.1.0",
48
+ "@finos/legend-graph": "19.0.0",
49
+ "@finos/legend-query-builder": "0.2.2",
50
+ "@finos/legend-server-depot": "4.1.2",
51
+ "@finos/legend-shared": "6.1.5",
52
+ "@finos/legend-storage": "3.0.14",
53
53
  "@testing-library/react": "13.4.0",
54
54
  "@types/react": "18.0.21",
55
55
  "@types/react-dom": "18.0.6",
@@ -57,15 +57,14 @@
57
57
  "mobx-react-lite": "3.4.0",
58
58
  "react": "18.2.0",
59
59
  "react-dom": "18.2.0",
60
- "react-hotkeys": "2.0.0",
61
- "serializr": "2.0.5"
60
+ "serializr": "3.0.1"
62
61
  },
63
62
  "devDependencies": {
64
- "@finos/legend-dev-utils": "2.0.20",
65
- "@jest/globals": "29.1.2",
63
+ "@finos/legend-dev-utils": "2.0.21",
64
+ "@jest/globals": "29.2.1",
66
65
  "cross-env": "7.0.3",
67
66
  "eslint": "8.25.0",
68
- "jest": "29.1.2",
67
+ "jest": "29.2.1",
69
68
  "npm-run-all": "4.1.5",
70
69
  "rimraf": "3.0.2",
71
70
  "sass": "1.55.0",
@@ -78,9 +77,7 @@
78
77
  "directory": "build/publishContent"
79
78
  },
80
79
  "extensions": {
81
- "graphManagerPreset": "@finos/legend-graph-manager-preset-query-builder",
82
- "pureProtocolProcessorPlugin": "@finos/legend-pure-protocol-processor-plugin-query-builder",
83
- "pureGraphManagerPlugin": "@finos/legend-pure-graph-manager-plugin-query-builder"
80
+ "applicationQueryPlugin": "@finos/legend-application-query-plugin-core"
84
81
  },
85
82
  "typedoc": {
86
83
  "entryPoint": "./src/index.ts",
@@ -24,7 +24,6 @@ import {
24
24
  type LegendApplicationConfigurationInput,
25
25
  BrowserRouter,
26
26
  } from '@finos/legend-application';
27
- import { configure as configureReactHotkeys } from 'react-hotkeys';
28
27
  import { LegendQueryApplication } from '../components/LegendQueryApplication.js';
29
28
  import { LegendQueryPluginManager } from './LegendQueryPluginManager.js';
30
29
  import { getRootElement } from '@finos/legend-art';
@@ -35,17 +34,13 @@ import {
35
34
  } from './LegendQueryApplicationConfig.js';
36
35
  import {
37
36
  QueryBuilder_GraphManagerPreset,
37
+ QueryBuilder_LegendApplicationPlugin,
38
38
  setupQueryBuilderUILibrary,
39
39
  } from '@finos/legend-query-builder';
40
+ import { Core_LegendQueryApplicationPlugin } from '../components/Core_LegendQueryApplicationPlugin.js';
40
41
 
41
42
  export const setupLegendQueryUILibrary = async (): Promise<void> => {
42
43
  await setupQueryBuilderUILibrary();
43
- configureReactHotkeys({
44
- // By default, `react-hotkeys` will avoid capturing keys from input tags like <input>, <textarea>, <select>
45
- // We want to listen to hotkey from every where in the app so we disable that
46
- // See https://github.com/greena13/react-hotkeys#ignoring-events
47
- ignoreTags: [],
48
- });
49
44
  };
50
45
 
51
46
  export class LegendQuery extends LegendApplication {
@@ -54,8 +49,12 @@ export class LegendQuery extends LegendApplication {
54
49
 
55
50
  static create(): LegendQuery {
56
51
  const application = new LegendQuery(LegendQueryPluginManager.create());
57
- application.withBasePlugins([new Core_PureGraphManagerPlugin()]);
58
52
  application.withBasePresets([new QueryBuilder_GraphManagerPreset()]);
53
+ application.withBasePlugins([
54
+ new Core_PureGraphManagerPlugin(),
55
+ new Core_LegendQueryApplicationPlugin(),
56
+ new QueryBuilder_LegendApplicationPlugin(),
57
+ ]);
59
58
  return application;
60
59
  }
61
60
 
@@ -70,6 +70,9 @@ export interface LegendQueryApplicationConfigurationData
70
70
  url: string;
71
71
  instances: LegendStudioApplicationInstanceConfigurationData[];
72
72
  };
73
+ taxonomy: {
74
+ url: string;
75
+ };
73
76
  }
74
77
 
75
78
  export class LegendQueryApplicationConfig extends LegendApplicationConfig {
@@ -81,6 +84,7 @@ export class LegendQueryApplicationConfig extends LegendApplicationConfig {
81
84
  readonly studioUrl: string;
82
85
  readonly studioInstances: LegendStudioApplicationInstanceConfigurationData[] =
83
86
  [];
87
+ readonly taxonomyUrl: string;
84
88
 
85
89
  constructor(
86
90
  input: LegendApplicationConfigurationInput<LegendQueryApplicationConfigurationData>,
@@ -122,6 +126,16 @@ export class LegendQueryApplicationConfig extends LegendApplicationConfig {
122
126
  `Can't configure application: 'studio.instances' field is missing`,
123
127
  );
124
128
 
129
+ // taxonomy
130
+ assertNonNullable(
131
+ input.configData.taxonomy,
132
+ `Can't configure application: 'taxonomy' field is missing`,
133
+ );
134
+ this.taxonomyUrl = guaranteeNonEmptyString(
135
+ input.configData.taxonomy.url,
136
+ `Can't configure application: 'taxonomy.url' field is missing or empty`,
137
+ );
138
+
125
139
  // options
126
140
  this.options = LegendQueryApplicationCoreOptions.create(
127
141
  (input.configData.extensions?.core ??
@@ -0,0 +1,312 @@
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
+ ArrowLeftIcon,
19
+ ArrowRightIcon,
20
+ BlankPanelContent,
21
+ clsx,
22
+ CustomSelectorInput,
23
+ PanelLoadingIndicator,
24
+ } from '@finos/legend-art';
25
+ import { guaranteeType } from '@finos/legend-shared';
26
+ import { flowResult } from 'mobx';
27
+ import { observer, useLocalObservable } from 'mobx-react-lite';
28
+ import { useContext, useEffect } from 'react';
29
+ import {
30
+ generateQuerySetupRoute,
31
+ generateServiceQueryCreatorRoute,
32
+ } from '../stores/LegendQueryRouter.js';
33
+ import {
34
+ LATEST_VERSION_ALIAS,
35
+ SNAPSHOT_VERSION_ALIAS,
36
+ useDepotServerClient,
37
+ } from '@finos/legend-server-depot';
38
+ import { useApplicationStore } from '@finos/legend-application';
39
+ import { useLegendQueryApplicationStore } from './LegendQueryBaseStoreProvider.js';
40
+ import {
41
+ CloneServiceQuerySetupStore,
42
+ type ServiceExecutionOption,
43
+ } from '../stores/CloneServiceQuerySetupStore.js';
44
+ import {
45
+ BaseQuerySetup,
46
+ BaseQuerySetupStoreContext,
47
+ buildProjectOption,
48
+ buildVersionOption,
49
+ type ProjectOption,
50
+ type VersionOption,
51
+ } from './QuerySetup.js';
52
+ import { compareSemVerVersions } from '@finos/legend-storage';
53
+
54
+ const CloneServiceQuerySetupStoreProvider: React.FC<{
55
+ children: React.ReactNode;
56
+ }> = ({ children }) => {
57
+ const applicationStore = useLegendQueryApplicationStore();
58
+ const depotServerClient = useDepotServerClient();
59
+ const store = useLocalObservable(
60
+ () => new CloneServiceQuerySetupStore(applicationStore, depotServerClient),
61
+ );
62
+ return (
63
+ <BaseQuerySetupStoreContext.Provider value={store}>
64
+ {children}
65
+ </BaseQuerySetupStoreContext.Provider>
66
+ );
67
+ };
68
+
69
+ const useCloneServiceQuerySetupStore = (): CloneServiceQuerySetupStore =>
70
+ guaranteeType(
71
+ useContext(BaseQuerySetupStoreContext),
72
+ CloneServiceQuerySetupStore,
73
+ `Can't find query setup store in context`,
74
+ );
75
+
76
+ const CloneQueryServiceSetupContent = observer(() => {
77
+ const applicationStore = useApplicationStore();
78
+ const querySetupState = useCloneServiceQuerySetupStore();
79
+
80
+ // actions
81
+ const back = (): void => {
82
+ applicationStore.navigator.goToLocation(generateQuerySetupRoute());
83
+ };
84
+ const next = (): void => {
85
+ if (
86
+ querySetupState.currentProject &&
87
+ querySetupState.currentVersionId &&
88
+ querySetupState.currentServiceExecutionOption
89
+ ) {
90
+ applicationStore.navigator.goToLocation(
91
+ generateServiceQueryCreatorRoute(
92
+ querySetupState.currentProject.groupId,
93
+ querySetupState.currentProject.artifactId,
94
+ querySetupState.currentVersionId,
95
+ querySetupState.currentServiceExecutionOption.service.path,
96
+ querySetupState.currentServiceExecutionOption.key,
97
+ ),
98
+ );
99
+ }
100
+ };
101
+ const canProceed =
102
+ querySetupState.currentProject &&
103
+ querySetupState.currentVersionId &&
104
+ querySetupState.currentServiceExecutionOption;
105
+
106
+ // project
107
+ const projectOptions = querySetupState.projects.map(buildProjectOption);
108
+ const selectedProjectOption = querySetupState.currentProject
109
+ ? buildProjectOption(querySetupState.currentProject)
110
+ : null;
111
+ const projectSelectorPlaceholder = querySetupState.loadProjectsState
112
+ .isInProgress
113
+ ? 'Loading projects'
114
+ : querySetupState.loadProjectsState.hasFailed
115
+ ? 'Error fetching projects'
116
+ : querySetupState.projects.length
117
+ ? 'Choose a project'
118
+ : 'You have no projects, please create or acquire access for at least one';
119
+ const onProjectOptionChange = (option: ProjectOption | null): void => {
120
+ if (option?.value !== querySetupState.currentProject) {
121
+ querySetupState.setCurrentProject(option?.value);
122
+ // cascade
123
+ querySetupState.setCurrentVersionId(undefined);
124
+ querySetupState.setCurrentServiceExecutionOption(undefined);
125
+ }
126
+ };
127
+
128
+ // version
129
+ const versionOptions = [
130
+ LATEST_VERSION_ALIAS,
131
+ SNAPSHOT_VERSION_ALIAS,
132
+ ...(querySetupState.currentProject?.versions ?? []),
133
+ ]
134
+ .slice()
135
+ .sort((v1, v2) => compareSemVerVersions(v2, v1))
136
+ .map(buildVersionOption);
137
+ const selectedVersionOption = querySetupState.currentVersionId
138
+ ? buildVersionOption(querySetupState.currentVersionId)
139
+ : null;
140
+ const versionSelectorPlaceholder = !querySetupState.currentProject
141
+ ? 'No project selected'
142
+ : 'Choose a version';
143
+ const onVersionOptionChange = async (
144
+ option: VersionOption | null,
145
+ ): Promise<void> => {
146
+ if (option?.value !== querySetupState.currentVersionId) {
147
+ querySetupState.setCurrentVersionId(option?.value);
148
+ // cascade
149
+ querySetupState.setCurrentServiceExecutionOption(undefined);
150
+ if (querySetupState.currentProject && querySetupState.currentVersionId) {
151
+ await flowResult(
152
+ querySetupState.loadServiceExecutionOptions(
153
+ querySetupState.currentProject,
154
+ querySetupState.currentVersionId,
155
+ ),
156
+ ).catch(applicationStore.alertUnhandledError);
157
+ }
158
+ }
159
+ };
160
+
161
+ // service and key
162
+ const serviceExecutionOptions = querySetupState.serviceExecutionOptions.map(
163
+ (option) => ({
164
+ label: `${option.service.name}${option.key ? ` [${option.key}]` : ''}`,
165
+ value: option,
166
+ }),
167
+ );
168
+ const selectedServiceExecutionOption =
169
+ querySetupState.currentServiceExecutionOption
170
+ ? {
171
+ label: `${
172
+ querySetupState.currentServiceExecutionOption.service.name
173
+ }${
174
+ querySetupState.currentServiceExecutionOption.key
175
+ ? ` [${querySetupState.currentServiceExecutionOption.key}]`
176
+ : ''
177
+ }`,
178
+ value: querySetupState.currentServiceExecutionOption,
179
+ }
180
+ : null;
181
+ const serviceExecutionSelectorPlaceholder = serviceExecutionOptions.length
182
+ ? 'Choose a service'
183
+ : 'No service available';
184
+ const onServiceExecutionOptionChange = (
185
+ option: { value: ServiceExecutionOption } | null,
186
+ ): void => {
187
+ querySetupState.setCurrentServiceExecutionOption(
188
+ option?.value ?? undefined,
189
+ );
190
+ };
191
+
192
+ useEffect(() => {
193
+ flowResult(querySetupState.loadProjects()).catch(
194
+ applicationStore.alertUnhandledError,
195
+ );
196
+ }, [querySetupState, applicationStore]);
197
+
198
+ return (
199
+ <div className="query-setup__wizard query-setup__service-query">
200
+ <div className="query-setup__wizard__header query-setup__service-query__header">
201
+ <button
202
+ className="query-setup__wizard__header__btn"
203
+ onClick={back}
204
+ title="Back to Main Menu"
205
+ >
206
+ <ArrowLeftIcon />
207
+ </button>
208
+ <div className="query-setup__wizard__header__title">
209
+ Clone an existing service query...
210
+ </div>
211
+ <button
212
+ className={clsx('query-setup__wizard__header__btn', {
213
+ 'query-setup__wizard__header__btn--ready': canProceed,
214
+ })}
215
+ onClick={next}
216
+ disabled={!canProceed}
217
+ title="Create a new query"
218
+ >
219
+ <ArrowRightIcon />
220
+ </button>
221
+ </div>
222
+ <div className="query-setup__wizard__content">
223
+ <div className="query-setup__service-query__project">
224
+ <div className="query-setup__wizard__group">
225
+ <div className="query-setup__wizard__group__title">Project</div>
226
+ <CustomSelectorInput
227
+ className="query-setup__wizard__selector"
228
+ options={projectOptions}
229
+ disabled={
230
+ querySetupState.loadProjectsState.isInProgress ||
231
+ !projectOptions.length
232
+ }
233
+ isLoading={querySetupState.loadProjectsState.isInProgress}
234
+ onChange={onProjectOptionChange}
235
+ value={selectedProjectOption}
236
+ placeholder={projectSelectorPlaceholder}
237
+ isClearable={true}
238
+ escapeClearsValue={true}
239
+ darkMode={true}
240
+ />
241
+ </div>
242
+ <div className="query-setup__wizard__group">
243
+ <div className="query-setup__wizard__group__title">Version</div>
244
+ <CustomSelectorInput
245
+ className="query-setup__wizard__selector"
246
+ options={versionOptions}
247
+ disabled={!querySetupState.currentProject}
248
+ onChange={onVersionOptionChange}
249
+ value={selectedVersionOption}
250
+ placeholder={versionSelectorPlaceholder}
251
+ isClearable={true}
252
+ escapeClearsValue={true}
253
+ darkMode={true}
254
+ />
255
+ </div>
256
+ </div>
257
+ <div className="query-setup__service-query__graph">
258
+ {(!querySetupState.currentProject ||
259
+ !querySetupState.currentVersionId ||
260
+ !querySetupState.loadServiceExecutionsState.hasSucceeded) && (
261
+ <div className="query-setup__service-query__graph__loader">
262
+ <PanelLoadingIndicator
263
+ isLoading={
264
+ Boolean(querySetupState.currentProject) &&
265
+ Boolean(querySetupState.currentVersionId) &&
266
+ !querySetupState.loadServiceExecutionsState.isInProgress
267
+ }
268
+ />
269
+ <BlankPanelContent>
270
+ {querySetupState.loadServiceExecutionsState.isInProgress
271
+ ? `Surveying service executions...`
272
+ : querySetupState.loadServiceExecutionsState.hasFailed
273
+ ? `Can't load service executions`
274
+ : 'Project and version must be specified'}
275
+ </BlankPanelContent>
276
+ </div>
277
+ )}
278
+ {querySetupState.currentProject &&
279
+ querySetupState.currentVersionId &&
280
+ querySetupState.loadServiceExecutionsState.hasSucceeded && (
281
+ <>
282
+ <div className="query-setup__wizard__group">
283
+ <div className="query-setup__wizard__group__title">
284
+ Service
285
+ </div>
286
+ <CustomSelectorInput
287
+ className="query-setup__wizard__selector"
288
+ options={serviceExecutionOptions}
289
+ disabled={!serviceExecutionOptions.length}
290
+ onChange={onServiceExecutionOptionChange}
291
+ value={selectedServiceExecutionOption}
292
+ placeholder={serviceExecutionSelectorPlaceholder}
293
+ isClearable={true}
294
+ escapeClearsValue={true}
295
+ darkMode={true}
296
+ />
297
+ </div>
298
+ </>
299
+ )}
300
+ </div>
301
+ </div>
302
+ </div>
303
+ );
304
+ });
305
+
306
+ export const CloneQueryServiceSetup: React.FC = () => (
307
+ <CloneServiceQuerySetupStoreProvider>
308
+ <BaseQuerySetup>
309
+ <CloneQueryServiceSetupContent />
310
+ </BaseQuerySetup>
311
+ </CloneServiceQuerySetupStoreProvider>
312
+ );
@@ -0,0 +1,184 @@
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
+ LegendQueryApplicationPlugin,
19
+ QuerySetupActionTag,
20
+ type QuerySetupActionConfiguration,
21
+ } from '../stores/LegendQueryApplicationPlugin.js';
22
+ import packageJson from '../../package.json';
23
+ import type { QuerySetupLandingPageStore } from '../stores/QuerySetupStore.js';
24
+ import {
25
+ ArrowCirceUpIcon,
26
+ BrainIcon,
27
+ DroidIcon,
28
+ ManageSearchIcon,
29
+ PlusIcon,
30
+ RobotIcon,
31
+ } from '@finos/legend-art';
32
+ import {
33
+ generateCloneServiceQuerySetupRoute,
34
+ generateCreateMappingQuerySetupRoute,
35
+ generateEditExistingQuerySetupRoute,
36
+ generateLoadProjectServiceQuerySetup,
37
+ generateQueryProductionizerSetupRoute,
38
+ generateUpdateExistingServiceQuerySetup,
39
+ LEGEND_QUERY_ROUTE_PATTERN,
40
+ } from '../stores/LegendQueryRouter.js';
41
+ import type { ApplicationPageEntry } from '@finos/legend-application';
42
+ import { CloneQueryServiceSetup } from './CloneQueryServiceSetup.js';
43
+ import { QueryProductionizerSetup } from './QueryProductionizerSetup.js';
44
+ import { UpdateExistingServiceQuerySetup } from './UpdateExistingServiceQuerySetup.js';
45
+ import { LoadProjectServiceQuerySetup } from './LoadProjectServiceQuerySetup.js';
46
+
47
+ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlugin {
48
+ static NAME = packageJson.extensions.applicationQueryPlugin;
49
+
50
+ constructor() {
51
+ super(Core_LegendQueryApplicationPlugin.NAME, packageJson.version);
52
+ }
53
+
54
+ override getExtraApplicationPageEntries(): ApplicationPageEntry[] {
55
+ return [
56
+ {
57
+ key: 'clone-service-query-setup-application-page',
58
+ urlPatterns: [LEGEND_QUERY_ROUTE_PATTERN.CLONE_SERVICE_QUERY_SETUP],
59
+ renderer: CloneQueryServiceSetup,
60
+ },
61
+ {
62
+ key: 'query-productionizer-setup-application-page',
63
+ urlPatterns: [LEGEND_QUERY_ROUTE_PATTERN.QUERY_PRODUCTIONIZER_SETUP],
64
+ renderer: QueryProductionizerSetup,
65
+ },
66
+ {
67
+ key: 'update-existing-service-query-setup-application-page',
68
+ urlPatterns: [
69
+ LEGEND_QUERY_ROUTE_PATTERN.UPDATE_EXISTING_SERVICE_QUERY_SETUP,
70
+ ],
71
+ renderer: UpdateExistingServiceQuerySetup,
72
+ },
73
+ {
74
+ key: 'load-project-service-query-setup-application-page',
75
+ urlPatterns: [
76
+ LEGEND_QUERY_ROUTE_PATTERN.LOAD_PROJECT_SERVICE_QUERY_SETUP,
77
+ ],
78
+ renderer: LoadProjectServiceQuerySetup,
79
+ },
80
+ ];
81
+ }
82
+
83
+ override getExtraQuerySetupActionConfigurations(): QuerySetupActionConfiguration[] {
84
+ return [
85
+ {
86
+ key: 'open-existing-query',
87
+ isAdvanced: false,
88
+ isCreateAction: false,
89
+ action: async (setupStore: QuerySetupLandingPageStore) => {
90
+ setupStore.applicationStore.navigator.goToLocation(
91
+ generateEditExistingQuerySetupRoute(),
92
+ );
93
+ },
94
+ label: 'Open an existing query',
95
+ className: 'query-setup__landing-page__action--existing-query',
96
+ icon: (
97
+ <ManageSearchIcon className="query-setup__landing-page__icon--search" />
98
+ ),
99
+ },
100
+ {
101
+ key: 'create-query-from-taxonomy',
102
+ isAdvanced: false,
103
+ isCreateAction: true,
104
+ action: async (setupStore: QuerySetupLandingPageStore) => {
105
+ setupStore.applicationStore.navigator.goToAddress(
106
+ setupStore.applicationStore.config.taxonomyUrl,
107
+ );
108
+ },
109
+ label: 'Create query from taxonomy',
110
+ className: 'query-setup__landing-page__action--taxonomy-query',
111
+ icon: <BrainIcon />,
112
+ },
113
+ {
114
+ key: 'create-mapping-query',
115
+ isAdvanced: true,
116
+ isCreateAction: true,
117
+ action: async (setupStore: QuerySetupLandingPageStore) => {
118
+ setupStore.applicationStore.navigator.goToLocation(
119
+ generateCreateMappingQuerySetupRoute(),
120
+ );
121
+ },
122
+ label: 'Create new query on a mapping',
123
+ className: 'query-setup__landing-page__action--create-mapping-query',
124
+ icon: <PlusIcon />,
125
+ },
126
+ {
127
+ key: 'clone-service-query',
128
+ isAdvanced: true,
129
+ isCreateAction: true,
130
+ action: async (setupStore: QuerySetupLandingPageStore) => {
131
+ setupStore.applicationStore.navigator.goToLocation(
132
+ generateCloneServiceQuerySetupRoute(),
133
+ );
134
+ },
135
+ label: 'Clone an existing service query',
136
+ className: 'query-setup__landing-page__action--service-query',
137
+ icon: <RobotIcon />,
138
+ },
139
+ // sdlc
140
+ {
141
+ key: 'update-existing-service-query',
142
+ isAdvanced: false,
143
+ isCreateAction: false,
144
+ tag: QuerySetupActionTag.PRODUCTIONIZATION,
145
+ action: async (setupStore: QuerySetupLandingPageStore) => {
146
+ setupStore.applicationStore.navigator.goToLocation(
147
+ generateUpdateExistingServiceQuerySetup(),
148
+ );
149
+ },
150
+ label: 'Update an existing service query',
151
+ className: 'query-setup__landing-page__action--service-query',
152
+ icon: <DroidIcon />,
153
+ },
154
+ {
155
+ key: 'open-project-service-query',
156
+ isAdvanced: true,
157
+ isCreateAction: false,
158
+ tag: QuerySetupActionTag.PRODUCTIONIZATION,
159
+ action: async (setupStore: QuerySetupLandingPageStore) => {
160
+ setupStore.applicationStore.navigator.goToLocation(
161
+ generateLoadProjectServiceQuerySetup(),
162
+ );
163
+ },
164
+ label: 'Open service query from a project',
165
+ className: 'query-setup__landing-page__action--service-query',
166
+ icon: <DroidIcon />,
167
+ },
168
+ {
169
+ key: 'productionize-query',
170
+ isAdvanced: false,
171
+ isCreateAction: true,
172
+ tag: QuerySetupActionTag.PRODUCTIONIZATION,
173
+ action: async (setupStore: QuerySetupLandingPageStore) => {
174
+ setupStore.applicationStore.navigator.goToLocation(
175
+ generateQueryProductionizerSetupRoute(),
176
+ );
177
+ },
178
+ label: 'Productionize an existing query',
179
+ className: 'query-setup__landing-page__action--productionize-query',
180
+ icon: <ArrowCirceUpIcon />,
181
+ },
182
+ ];
183
+ }
184
+ }