@finos/legend-extension-dsl-data-space 8.0.1 → 9.0.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 (60) hide show
  1. package/lib/components/DataSpaceViewer.d.ts.map +1 -1
  2. package/lib/components/DataSpaceViewer.js +12 -5
  3. package/lib/components/DataSpaceViewer.js.map +1 -1
  4. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.d.ts +2 -4
  5. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.d.ts.map +1 -1
  6. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js +24 -35
  7. package/lib/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.js.map +1 -1
  8. package/lib/components/query/DataSpaceAdvancedSearchModal.d.ts +24 -0
  9. package/lib/components/query/DataSpaceAdvancedSearchModal.d.ts.map +1 -0
  10. package/lib/components/query/DataSpaceAdvancedSearchModal.js +82 -0
  11. package/lib/components/query/DataSpaceAdvancedSearchModal.js.map +1 -0
  12. package/lib/components/query/DataSpaceQueryBuilder.d.ts +7 -0
  13. package/lib/components/query/DataSpaceQueryBuilder.d.ts.map +1 -1
  14. package/lib/components/query/DataSpaceQueryBuilder.js +7 -5
  15. package/lib/components/query/DataSpaceQueryBuilder.js.map +1 -1
  16. package/lib/components/query/DataSpaceQuerySetup.d.ts +3 -4
  17. package/lib/components/query/DataSpaceQuerySetup.d.ts.map +1 -1
  18. package/lib/components/query/DataSpaceQuerySetup.js +45 -56
  19. package/lib/components/query/DataSpaceQuerySetup.js.map +1 -1
  20. package/lib/index.css +2 -2
  21. package/lib/index.css.map +1 -1
  22. package/lib/package.json +4 -4
  23. package/lib/stores/DataSpaceViewerState.d.ts +9 -5
  24. package/lib/stores/DataSpaceViewerState.d.ts.map +1 -1
  25. package/lib/stores/DataSpaceViewerState.js +8 -4
  26. package/lib/stores/DataSpaceViewerState.js.map +1 -1
  27. package/lib/stores/query/DSL_DataSpace_LegendQueryRouter.d.ts +5 -1
  28. package/lib/stores/query/DSL_DataSpace_LegendQueryRouter.d.ts.map +1 -1
  29. package/lib/stores/query/DSL_DataSpace_LegendQueryRouter.js +10 -5
  30. package/lib/stores/query/DSL_DataSpace_LegendQueryRouter.js.map +1 -1
  31. package/lib/stores/query/{DataSpaceQuerySetupState.d.ts → DataSpaceAdvancedSearchState.d.ts} +16 -7
  32. package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -0
  33. package/lib/stores/query/{DataSpaceQuerySetupState.js → DataSpaceAdvancedSearchState.js} +28 -16
  34. package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -0
  35. package/lib/stores/query/DataSpaceQueryBuilderState.d.ts +9 -2
  36. package/lib/stores/query/DataSpaceQueryBuilderState.d.ts.map +1 -1
  37. package/lib/stores/query/DataSpaceQueryBuilderState.js +32 -2
  38. package/lib/stores/query/DataSpaceQueryBuilderState.js.map +1 -1
  39. package/lib/stores/query/DataSpaceQueryCreatorStore.d.ts.map +1 -1
  40. package/lib/stores/query/DataSpaceQueryCreatorStore.js +6 -6
  41. package/lib/stores/query/DataSpaceQueryCreatorStore.js.map +1 -1
  42. package/lib/stores/query/DataSpaceQuerySetupStore.d.ts +50 -0
  43. package/lib/stores/query/DataSpaceQuerySetupStore.d.ts.map +1 -0
  44. package/lib/stores/query/DataSpaceQuerySetupStore.js +112 -0
  45. package/lib/stores/query/DataSpaceQuerySetupStore.js.map +1 -0
  46. package/package.json +15 -15
  47. package/src/components/DataSpaceViewer.tsx +53 -24
  48. package/src/components/query/DSL_DataSpace_LegendQueryApplicationPlugin.tsx +35 -69
  49. package/src/components/query/DataSpaceAdvancedSearchModal.tsx +248 -0
  50. package/src/components/query/DataSpaceQueryBuilder.tsx +57 -37
  51. package/src/components/query/DataSpaceQuerySetup.tsx +124 -186
  52. package/src/stores/DataSpaceViewerState.ts +28 -15
  53. package/src/stores/query/DSL_DataSpace_LegendQueryRouter.ts +34 -20
  54. package/src/stores/query/{DataSpaceQuerySetupState.ts → DataSpaceAdvancedSearchState.ts} +63 -37
  55. package/src/stores/query/DataSpaceQueryBuilderState.ts +61 -2
  56. package/src/stores/query/DataSpaceQueryCreatorStore.ts +11 -4
  57. package/src/stores/query/DataSpaceQuerySetupStore.ts +207 -0
  58. package/tsconfig.json +3 -1
  59. package/lib/stores/query/DataSpaceQuerySetupState.d.ts.map +0 -1
  60. package/lib/stores/query/DataSpaceQuerySetupState.js.map +0 -1
@@ -14,229 +14,167 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ import { observer, useLocalObservable } from 'mobx-react-lite';
18
+ import { debounce } from '@finos/legend-shared';
17
19
  import { useApplicationStore } from '@finos/legend-application';
20
+ import { useDepotServerClient } from '@finos/legend-server-depot';
21
+ import {
22
+ QueryEditor,
23
+ QueryEditorStoreContext,
24
+ useLegendQueryApplicationStore,
25
+ } from '@finos/legend-application-query';
26
+ import { useEffect, useMemo, useRef, useState } from 'react';
27
+ import { flowResult } from 'mobx';
28
+ import { QueryBuilderClassSelector } from '@finos/legend-query-builder';
18
29
  import {
19
- type SelectComponent,
20
- BoltIcon,
21
- ArrowRightIcon,
22
- clsx,
23
- BlankPanelContent,
24
- TimesCircleIcon,
25
- PanelLoadingIndicator,
26
- ArrowLeftIcon,
27
30
  CustomSelectorInput,
28
31
  SearchIcon,
32
+ type SelectComponent,
29
33
  } from '@finos/legend-art';
30
- import { useQuerySetupStore } from '@finos/legend-application-query';
31
- import { generateGAVCoordinates } from '@finos/legend-storage';
32
- import { debounce } from '@finos/legend-shared';
33
- import { flowResult } from 'mobx';
34
- import { observer } from 'mobx-react-lite';
35
- import { useEffect, useMemo, useRef, useState } from 'react';
36
- import type { DataSpaceQuerySetupState } from '../../stores/query/DataSpaceQuerySetupState.js';
37
- import { DataSpaceViewer } from '../DataSpaceViewer.js';
38
- import type { DataSpaceInfo } from '../../stores/query/DataSpaceInfo.js';
34
+ import { DataSpaceIcon } from '../DSL_DataSpace_Icon.js';
35
+ import {
36
+ type DataSpaceQuerySetupState,
37
+ DataSpaceQuerySetupStore,
38
+ } from '../../stores/query/DataSpaceQuerySetupStore.js';
39
+ import {
40
+ buildDataSpaceOption,
41
+ formatDataSpaceOptionLabel,
42
+ type DataSpaceOption,
43
+ } from './DataSpaceQueryBuilder.js';
44
+ import { DataSpaceAdvancedSearchModal } from './DataSpaceAdvancedSearchModal.js';
45
+
46
+ const DataSpaceQuerySetupStoreProvider: React.FC<{
47
+ children: React.ReactNode;
48
+ }> = ({ children }) => {
49
+ const applicationStore = useLegendQueryApplicationStore();
50
+ const depotServerClient = useDepotServerClient();
51
+ const store = useLocalObservable(
52
+ () => new DataSpaceQuerySetupStore(applicationStore, depotServerClient),
53
+ );
54
+ return (
55
+ <QueryEditorStoreContext.Provider value={store}>
56
+ {children}
57
+ </QueryEditorStoreContext.Provider>
58
+ );
59
+ };
39
60
 
40
- type DataSpaceOption = { label: string; value: DataSpaceInfo };
41
- const buildDataSpaceOption = (value: DataSpaceInfo): DataSpaceOption => ({
42
- label: value.title ?? value.name,
43
- value,
44
- });
61
+ export const DataSpaceQuerySetup = observer(() => (
62
+ <DataSpaceQuerySetupStoreProvider>
63
+ <QueryEditor />
64
+ </DataSpaceQuerySetupStoreProvider>
65
+ ));
45
66
 
46
- export const DataspaceQuerySetup = observer(
47
- (props: { querySetupState: DataSpaceQuerySetupState }) => {
48
- const { querySetupState } = props;
67
+ /**
68
+ * This setup panel supports cascading in order: Data-space -> Execution context (-> Runtime) -> Class
69
+ *
70
+ * In other words, we will only show:
71
+ * - For runtime selector: the list of compatible runtimes with the selected execution context mapping
72
+ * - For class selector: the list of compatible class with the selected execution context mapping
73
+ *
74
+ * See details on propagation/cascading in {@link DataSpaceQuerySetupState}
75
+ */
76
+ const DataSpaceQuerySetupSetupPanelContent = observer(
77
+ (props: { queryBuilderState: DataSpaceQuerySetupState }) => {
78
+ const { queryBuilderState } = props;
49
79
  const applicationStore = useApplicationStore();
50
- const setupStore = useQuerySetupStore();
51
80
  const dataSpaceSearchRef = useRef<SelectComponent>(null);
52
- const [searchText, setSearchText] = useState('');
53
-
54
- const toggleGetSnapshot = (): void => {
55
- querySetupState.setToGetSnapShot(!querySetupState.toGetSnapShot);
56
- flowResult(querySetupState.loadDataSpaces(searchText)).catch(
57
- applicationStore.alertUnhandledError,
58
- );
59
- };
60
-
61
- const next = (): void => {
62
- if (querySetupState.dataSpaceViewerState) {
63
- flowResult(querySetupState.proceedToCreateQuery()).catch(
64
- applicationStore.alertUnhandledError,
65
- );
66
- }
67
- };
68
- const canProceed = querySetupState.dataSpaceViewerState;
69
-
70
- const back = (): void => {
71
- setupStore.setSetupState(undefined);
72
- };
81
+ const [dataSpaceSearchText, setDataSpaceSearchText] = useState('');
73
82
 
74
83
  // data space
75
84
  const dataSpaceOptions =
76
- querySetupState.dataSpaces.map(buildDataSpaceOption);
77
- const selectedDataSpaceOption = querySetupState.currentDataSpace
78
- ? buildDataSpaceOption(querySetupState.currentDataSpace)
79
- : null;
80
- const onDataSpaceOptionChange = (option: DataSpaceOption | null): void => {
81
- querySetupState.setCurrentDataSpace(option?.value);
82
- querySetupState.setDataSpaceViewerState(undefined);
85
+ queryBuilderState.dataSpaces.map(buildDataSpaceOption);
86
+ const selectedDataSpaceOption = null;
87
+ const onDataSpaceOptionChange = (option: DataSpaceOption): void => {
88
+ queryBuilderState.onDataSpaceChange(option.value);
83
89
  };
84
- const formatDataSpaceOptionLabel = (
85
- option: DataSpaceOption,
86
- ): React.ReactNode => (
87
- <div
88
- className="query-setup__data-space__option"
89
- title={`${option.label} - ${
90
- option.value.path
91
- } - ${generateGAVCoordinates(
92
- option.value.groupId,
93
- option.value.artifactId,
94
- option.value.versionId,
95
- )}`}
96
- >
97
- <div className="query-setup__data-space__option__label">
98
- {option.label}
99
- </div>
100
- <div className="query-setup__data-space__option__path">
101
- {option.value.path}
102
- </div>
103
- <div className="query-setup__data-space__option__gav">
104
- {generateGAVCoordinates(
105
- option.value.groupId,
106
- option.value.artifactId,
107
- option.value.versionId,
108
- )}
109
- </div>
110
- </div>
111
- );
112
90
 
113
- // search text
91
+ // data space search text
114
92
  const debouncedLoadDataSpaces = useMemo(
115
93
  () =>
116
94
  debounce((input: string): void => {
117
- flowResult(querySetupState.loadDataSpaces(input)).catch(
95
+ flowResult(queryBuilderState.loadDataSpaces(input)).catch(
118
96
  applicationStore.alertUnhandledError,
119
97
  );
120
98
  }, 500),
121
- [applicationStore, querySetupState],
99
+ [applicationStore, queryBuilderState],
122
100
  );
123
- const onSearchTextChange = (value: string): void => {
124
- if (value !== searchText) {
125
- setSearchText(value);
101
+ const onDataSpaceSearchTextChange = (value: string): void => {
102
+ if (value !== dataSpaceSearchText) {
103
+ setDataSpaceSearchText(value);
126
104
  debouncedLoadDataSpaces.cancel();
127
105
  debouncedLoadDataSpaces(value);
128
106
  }
129
107
  };
108
+ const openDataSpaceAdvancedSearch = (): void =>
109
+ queryBuilderState.showAdvancedSearchPanel();
130
110
 
131
111
  useEffect(() => {
132
- flowResult(querySetupState.loadDataSpaces('')).catch(
112
+ flowResult(queryBuilderState.loadDataSpaces('')).catch(
133
113
  applicationStore.alertUnhandledError,
134
114
  );
135
- }, [querySetupState, applicationStore]);
115
+ }, [queryBuilderState, applicationStore]);
136
116
 
137
- useEffect(() => {
138
- if (querySetupState.currentDataSpace) {
139
- flowResult(
140
- querySetupState.loadDataSpace(querySetupState.currentDataSpace),
141
- ).catch(applicationStore.alertUnhandledError);
142
- }
143
- }, [querySetupState, applicationStore, querySetupState.currentDataSpace]);
144
-
145
- useEffect(() => {
146
- dataSpaceSearchRef.current?.focus();
147
- }, []);
117
+ useEffect(() => dataSpaceSearchRef.current?.focus());
148
118
 
149
119
  return (
150
- <div className="query-setup__wizard query-setup__data-space">
151
- <div className="query-setup__wizard__header query-setup__data-space__header">
152
- <button
153
- className="query-setup__wizard__header__btn"
154
- onClick={back}
155
- title="Back to Main Menu"
156
- >
157
- <ArrowLeftIcon />
158
- </button>
159
- <div className="query-setup__wizard__header__title">
160
- Creating query from data space...
161
- </div>
162
- <button
163
- className={clsx('query-setup__wizard__header__btn', {
164
- 'query-setup__wizard__header__btn--ready': canProceed,
165
- })}
166
- onClick={next}
167
- disabled={!canProceed}
168
- title="Create a new query"
169
- >
170
- <ArrowRightIcon />
171
- </button>
172
- </div>
173
- <div className="query-setup__wizard__content">
174
- <div className="query-setup__wizard__group query-setup__wizard__group--inline query-setup__data-space__input-group">
175
- <div className="query-setup__wizard__group__title">
176
- <SearchIcon />
120
+ <>
121
+ <div className="query-builder__setup__config-group">
122
+ <div className="query-builder__setup__config-group__header">
123
+ <div className="query-builder__setup__config-group__header__title">
124
+ data space execution context
177
125
  </div>
178
- <CustomSelectorInput
179
- ref={dataSpaceSearchRef}
180
- className="query-setup__wizard__selector"
181
- options={dataSpaceOptions}
182
- isLoading={querySetupState.loadDataSpacesState.isInProgress}
183
- onInputChange={onSearchTextChange}
184
- inputValue={searchText}
185
- onChange={onDataSpaceOptionChange}
186
- value={selectedDataSpaceOption}
187
- placeholder="Search for data space..."
188
- isClearable={true}
189
- escapeClearsValue={true}
190
- darkMode={true}
191
- formatOptionLabel={formatDataSpaceOptionLabel}
192
- />
193
- <button
194
- className={clsx('query-setup__data-space__use-snapshot-btn', {
195
- 'query-setup__data-space__use-snapshot-btn--active':
196
- querySetupState.toGetSnapShot,
197
- })}
198
- tabIndex={-1}
199
- title={`[${
200
- querySetupState.toGetSnapShot ? 'on' : 'off'
201
- }] Toggle show data spaces from snapshot releases instead of latest releases`}
202
- onClick={toggleGetSnapshot}
203
- >
204
- <BoltIcon />
205
- </button>
206
126
  </div>
207
- <div className="query-setup__data-space__view">
208
- <PanelLoadingIndicator
209
- isLoading={querySetupState.loadDataSpaceState.isInProgress}
210
- />
211
- {querySetupState.dataSpaceViewerState && (
212
- <DataSpaceViewer
213
- dataSpaceViewerState={querySetupState.dataSpaceViewerState}
127
+ <div className="query-builder__setup__config-group__content">
128
+ <div className="query-builder__setup__config-group__item">
129
+ <div
130
+ className="btn--sm query-builder__setup__config-group__item__label"
131
+ title="data space"
132
+ >
133
+ <DataSpaceIcon />
134
+ </div>
135
+ <CustomSelectorInput
136
+ ref={dataSpaceSearchRef}
137
+ className="panel__content__form__section__dropdown query-builder__setup__config-group__item__selector"
138
+ options={dataSpaceOptions}
139
+ isLoading={queryBuilderState.loadDataSpacesState.isInProgress}
140
+ onInputChange={onDataSpaceSearchTextChange}
141
+ inputValue={dataSpaceSearchText}
142
+ onChange={onDataSpaceOptionChange}
143
+ value={selectedDataSpaceOption}
144
+ placeholder="Search for data space..."
145
+ escapeClearsValue={true}
146
+ darkMode={!applicationStore.TEMPORARY__isLightThemeEnabled}
147
+ formatOptionLabel={formatDataSpaceOptionLabel}
214
148
  />
215
- )}
216
- {!querySetupState.dataSpaceViewerState && (
217
- <>
218
- {querySetupState.loadDataSpaceState.isInProgress && (
219
- <BlankPanelContent>
220
- {querySetupState.loadDataSpaceState.message}
221
- </BlankPanelContent>
222
- )}
223
- {querySetupState.loadDataSpaceState.hasFailed && (
224
- <BlankPanelContent>
225
- <div className="query-setup__data-space__view--failed">
226
- <div className="query-setup__data-space__view--failed__icon">
227
- <TimesCircleIcon />
228
- </div>
229
- <div className="query-setup__data-space__view--failed__text">
230
- Can&apos;t load data space
231
- </div>
232
- </div>
233
- </BlankPanelContent>
234
- )}
235
- </>
236
- )}
149
+ <button
150
+ tabIndex={-1}
151
+ className="query-builder__setup__data-space-searcher__btn btn--dark"
152
+ onClick={openDataSpaceAdvancedSearch}
153
+ title="Open advanced search for data space..."
154
+ >
155
+ <SearchIcon />
156
+ </button>
157
+ {queryBuilderState.advancedSearchState && (
158
+ <DataSpaceAdvancedSearchModal
159
+ searchState={queryBuilderState.advancedSearchState}
160
+ onClose={() => queryBuilderState.hideAdvancedSearchPanel()}
161
+ />
162
+ )}
163
+ </div>
237
164
  </div>
238
165
  </div>
239
- </div>
166
+ <QueryBuilderClassSelector
167
+ queryBuilderState={queryBuilderState}
168
+ classes={[]}
169
+ noMatchMessage="No compatible class found"
170
+ />
171
+ </>
240
172
  );
241
173
  },
242
174
  );
175
+
176
+ export const renderDataSpaceQuerySetupSetupPanelContent = (
177
+ queryBuilderState: DataSpaceQuerySetupState,
178
+ ): React.ReactNode => (
179
+ <DataSpaceQuerySetupSetupPanelContent queryBuilderState={queryBuilderState} />
180
+ );
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ import type { GenericLegendApplicationStore } from '@finos/legend-application';
17
18
  import {
18
19
  type ClassView,
19
20
  type DiagramRenderer,
@@ -42,6 +43,7 @@ export enum DATA_SPACE_VIEWER_ACTIVITY_MODE {
42
43
  }
43
44
 
44
45
  export class DataSpaceViewerState {
46
+ readonly applicationStore: GenericLegendApplicationStore;
45
47
  groupId: string;
46
48
  artifactId: string;
47
49
  versionId: string;
@@ -51,29 +53,38 @@ export class DataSpaceViewerState {
51
53
  currentActivity = DATA_SPACE_VIEWER_ACTIVITY_MODE.MODELS_OVERVIEW;
52
54
  currentExecutionContext: DataSpaceExecutionContextAnalysisResult;
53
55
  currentRuntime: PackageableRuntime;
54
- viewProject?:
55
- | ((
56
- groupId: string,
57
- artifactId: string,
58
- versionId: string,
59
- entityPath: string | undefined,
60
- ) => void)
61
- | undefined;
62
- onDiagramClassDoubleClick?: ((classView: ClassView) => void) | undefined;
56
+ viewProject: (
57
+ groupId: string,
58
+ artifactId: string,
59
+ versionId: string,
60
+ entityPath: string | undefined,
61
+ ) => void;
62
+ viewSDLCProject: (
63
+ groupId: string,
64
+ artifactId: string,
65
+ entityPath: string | undefined,
66
+ ) => Promise<void>;
67
+ onDiagramClassDoubleClick: (classView: ClassView) => void;
63
68
 
64
69
  constructor(
70
+ applicationStore: GenericLegendApplicationStore,
65
71
  groupId: string,
66
72
  artifactId: string,
67
73
  versionId: string,
68
74
  dataSpaceAnalysisResult: DataSpaceAnalysisResult,
69
- options?: {
70
- viewProject?: (
75
+ actions: {
76
+ viewProject: (
71
77
  groupId: string,
72
78
  artifactId: string,
73
79
  versionId: string,
74
80
  entityPath: string | undefined,
75
81
  ) => void;
76
- onDiagramClassDoubleClick?: (classView: ClassView) => void;
82
+ viewSDLCProject: (
83
+ groupId: string,
84
+ artifactId: string,
85
+ entityPath: string | undefined,
86
+ ) => Promise<void>;
87
+ onDiagramClassDoubleClick: (classView: ClassView) => void;
77
88
  },
78
89
  ) {
79
90
  makeObservable(this, {
@@ -90,6 +101,7 @@ export class DataSpaceViewerState {
90
101
  setCurrentRuntime: action,
91
102
  });
92
103
 
104
+ this.applicationStore = applicationStore;
93
105
  this.dataSpaceAnalysisResult = dataSpaceAnalysisResult;
94
106
  this.groupId = groupId;
95
107
  this.artifactId = artifactId;
@@ -100,8 +112,9 @@ export class DataSpaceViewerState {
100
112
  this.currentDiagram = getNullableFirstElement(
101
113
  this.dataSpaceAnalysisResult.featuredDiagrams,
102
114
  );
103
- this.viewProject = options?.viewProject;
104
- this.onDiagramClassDoubleClick = options?.onDiagramClassDoubleClick;
115
+ this.viewProject = actions.viewProject;
116
+ this.viewSDLCProject = actions.viewSDLCProject;
117
+ this.onDiagramClassDoubleClick = actions.onDiagramClassDoubleClick;
105
118
  }
106
119
 
107
120
  get renderer(): DiagramRenderer {
@@ -164,6 +177,6 @@ export class DataSpaceViewerState {
164
177
  setupRenderer(): void {
165
178
  this.renderer.setIsReadOnly(true);
166
179
  this.renderer.onClassViewDoubleClick = (classView: ClassView): void =>
167
- this.onDiagramClassDoubleClick?.(classView);
180
+ this.onDiagramClassDoubleClick(classView);
168
181
  }
169
182
  }
@@ -19,6 +19,10 @@ import {
19
19
  generatePath,
20
20
  } from '@finos/legend-application';
21
21
  import { LEGEND_QUERY_PATH_PARAM_TOKEN } from '@finos/legend-application-query';
22
+ import {
23
+ addQueryParamsStringToUrl,
24
+ stringifyQueryParams,
25
+ } from '@finos/legend-shared';
22
26
  import { generateGAVCoordinates } from '@finos/legend-storage';
23
27
 
24
28
  export enum DATA_SPACE_QUERY_CREATOR_PATH_PARAM_TOKEN {
@@ -41,7 +45,16 @@ export interface DataSpaceQueryEditorQueryParams {
41
45
  [DATA_SPACE_QUERY_CREATOR_QUERY_PARAM_TOKEN.CLASS_PATH]?: string;
42
46
  }
43
47
 
44
- export const CREATE_QUERY_FROM_DATA_SPACE_ROUTE_PATTERN = `/create-from-dataspace/:${LEGEND_QUERY_PATH_PARAM_TOKEN.GAV}/:${DATA_SPACE_QUERY_CREATOR_PATH_PARAM_TOKEN.DATA_SPACE_PATH}/:${DATA_SPACE_QUERY_CREATOR_PATH_PARAM_TOKEN.EXECUTION_CONTEXT}/:${LEGEND_QUERY_PATH_PARAM_TOKEN.RUNTIME_PATH}?`;
48
+ export const DATA_SPACE_QUERY_ROUTE_PATTERN = Object.freeze({
49
+ SETUP: `/dataspace`,
50
+ CREATE: `/dataspace/:${LEGEND_QUERY_PATH_PARAM_TOKEN.GAV}/:${DATA_SPACE_QUERY_CREATOR_PATH_PARAM_TOKEN.DATA_SPACE_PATH}/:${DATA_SPACE_QUERY_CREATOR_PATH_PARAM_TOKEN.EXECUTION_CONTEXT}/:${LEGEND_QUERY_PATH_PARAM_TOKEN.RUNTIME_PATH}?`,
51
+ });
52
+
53
+ export const generateDataSpaceQuerySetupRoute = (): string =>
54
+ generatePath(
55
+ generateExtensionUrlPattern(DATA_SPACE_QUERY_ROUTE_PATTERN.SETUP),
56
+ {},
57
+ );
45
58
 
46
59
  export const generateDataSpaceQueryCreatorRoute = (
47
60
  groupId: string,
@@ -52,22 +65,23 @@ export const generateDataSpaceQueryCreatorRoute = (
52
65
  runtimePath?: string | undefined,
53
66
  classPath?: string | undefined,
54
67
  ): string =>
55
- `${generatePath(
56
- generateExtensionUrlPattern(CREATE_QUERY_FROM_DATA_SPACE_ROUTE_PATTERN),
57
- {
58
- [LEGEND_QUERY_PATH_PARAM_TOKEN.GAV]: generateGAVCoordinates(
59
- groupId,
60
- artifactId,
61
- versionId,
62
- ),
63
- [DATA_SPACE_QUERY_CREATOR_PATH_PARAM_TOKEN.DATA_SPACE_PATH]:
64
- dataSpacePath,
65
- [DATA_SPACE_QUERY_CREATOR_PATH_PARAM_TOKEN.EXECUTION_CONTEXT]:
66
- executionContextKey,
67
- [LEGEND_QUERY_PATH_PARAM_TOKEN.RUNTIME_PATH]: runtimePath,
68
- },
69
- )}${
70
- classPath
71
- ? `?${DATA_SPACE_QUERY_CREATOR_QUERY_PARAM_TOKEN.CLASS_PATH}=${classPath}`
72
- : ''
73
- }`;
68
+ addQueryParamsStringToUrl(
69
+ generatePath(
70
+ generateExtensionUrlPattern(DATA_SPACE_QUERY_ROUTE_PATTERN.CREATE),
71
+ {
72
+ [LEGEND_QUERY_PATH_PARAM_TOKEN.GAV]: generateGAVCoordinates(
73
+ groupId,
74
+ artifactId,
75
+ versionId,
76
+ ),
77
+ [DATA_SPACE_QUERY_CREATOR_PATH_PARAM_TOKEN.DATA_SPACE_PATH]:
78
+ dataSpacePath,
79
+ [DATA_SPACE_QUERY_CREATOR_PATH_PARAM_TOKEN.EXECUTION_CONTEXT]:
80
+ executionContextKey,
81
+ [LEGEND_QUERY_PATH_PARAM_TOKEN.RUNTIME_PATH]: runtimePath,
82
+ },
83
+ ),
84
+ stringifyQueryParams({
85
+ [DATA_SPACE_QUERY_CREATOR_QUERY_PARAM_TOKEN.CLASS_PATH]: classPath,
86
+ }),
87
+ );