@finos/legend-extension-dsl-data-space 6.1.11 → 6.1.12

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 (70) hide show
  1. package/lib/DSLDataSpace_Const.d.ts +2 -0
  2. package/lib/DSLDataSpace_Const.d.ts.map +1 -1
  3. package/lib/DSLDataSpace_Const.js +2 -0
  4. package/lib/DSLDataSpace_Const.js.map +1 -1
  5. package/lib/components/DSLDataSpace_Icon.d.ts +18 -0
  6. package/lib/components/DSLDataSpace_Icon.d.ts.map +1 -0
  7. package/lib/components/DSLDataSpace_Icon.js +19 -0
  8. package/lib/components/DSLDataSpace_Icon.js.map +1 -0
  9. package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.d.ts +3 -2
  10. package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.d.ts.map +1 -1
  11. package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.js +99 -8
  12. package/lib/components/query/DSLDataSpace_LegendQueryApplicationPlugin.js.map +1 -1
  13. package/lib/components/query/DataSpaceQueryBuilder.d.ts +18 -0
  14. package/lib/components/query/DataSpaceQueryBuilder.d.ts.map +1 -0
  15. package/lib/components/query/DataSpaceQueryBuilder.js +126 -0
  16. package/lib/components/query/DataSpaceQueryBuilder.js.map +1 -0
  17. package/lib/components/query/{DataSpaceQueryEditor.d.ts → DataSpaceQueryCreator.d.ts} +2 -2
  18. package/lib/components/query/DataSpaceQueryCreator.d.ts.map +1 -0
  19. package/lib/components/query/{DataSpaceQueryEditor.js → DataSpaceQueryCreator.js} +11 -11
  20. package/lib/components/query/DataSpaceQueryCreator.js.map +1 -0
  21. package/lib/components/query/DataSpaceQuerySetup.d.ts.map +1 -1
  22. package/lib/components/query/DataSpaceQuerySetup.js +6 -8
  23. package/lib/components/query/DataSpaceQuerySetup.js.map +1 -1
  24. package/lib/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.d.ts.map +1 -1
  25. package/lib/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.js +2 -2
  26. package/lib/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.js.map +1 -1
  27. package/lib/index.css +2 -2
  28. package/lib/index.css.map +1 -1
  29. package/lib/package.json +6 -6
  30. package/lib/stores/query/DSLDataSpace_LegendQueryRouter.d.ts +11 -8
  31. package/lib/stores/query/DSLDataSpace_LegendQueryRouter.d.ts.map +1 -1
  32. package/lib/stores/query/DSLDataSpace_LegendQueryRouter.js +15 -11
  33. package/lib/stores/query/DSLDataSpace_LegendQueryRouter.js.map +1 -1
  34. package/lib/stores/query/DataSpaceInfo.d.ts +31 -0
  35. package/lib/stores/query/DataSpaceInfo.d.ts.map +1 -0
  36. package/lib/stores/query/DataSpaceInfo.js +34 -0
  37. package/lib/stores/query/DataSpaceInfo.js.map +1 -0
  38. package/lib/stores/query/DataSpaceQueryBuilderState.d.ts +52 -0
  39. package/lib/stores/query/DataSpaceQueryBuilderState.d.ts.map +1 -0
  40. package/lib/stores/query/DataSpaceQueryBuilderState.js +112 -0
  41. package/lib/stores/query/DataSpaceQueryBuilderState.js.map +1 -0
  42. package/lib/stores/query/{DataSpaceQueryEditorStore.d.ts → DataSpaceQueryCreatorStore.d.ts} +6 -4
  43. package/lib/stores/query/DataSpaceQueryCreatorStore.d.ts.map +1 -0
  44. package/lib/stores/query/DataSpaceQueryCreatorStore.js +113 -0
  45. package/lib/stores/query/DataSpaceQueryCreatorStore.js.map +1 -0
  46. package/lib/stores/query/DataSpaceQuerySetupState.d.ts +5 -12
  47. package/lib/stores/query/DataSpaceQuerySetupState.d.ts.map +1 -1
  48. package/lib/stores/query/DataSpaceQuerySetupState.js +9 -19
  49. package/lib/stores/query/DataSpaceQuerySetupState.js.map +1 -1
  50. package/package.json +16 -16
  51. package/src/DSLDataSpace_Const.ts +3 -0
  52. package/src/components/DSLDataSpace_Icon.tsx +23 -0
  53. package/src/components/query/DSLDataSpace_LegendQueryApplicationPlugin.tsx +170 -8
  54. package/src/components/query/DataSpaceQueryBuilder.tsx +344 -0
  55. package/src/components/query/{DataSpaceQueryEditor.tsx → DataSpaceQueryCreator.tsx} +13 -13
  56. package/src/components/query/DataSpaceQuerySetup.tsx +10 -14
  57. package/src/components/studio/DSLDataSpace_LegendStudioApplicationPlugin.tsx +2 -6
  58. package/src/stores/query/DSLDataSpace_LegendQueryRouter.ts +17 -15
  59. package/src/stores/query/DataSpaceInfo.ts +57 -0
  60. package/src/stores/query/DataSpaceQueryBuilderState.ts +178 -0
  61. package/src/stores/query/DataSpaceQueryCreatorStore.ts +241 -0
  62. package/src/stores/query/DataSpaceQuerySetupState.ts +18 -32
  63. package/tsconfig.json +7 -3
  64. package/tsconfig.package.json +1 -1
  65. package/lib/components/query/DataSpaceQueryEditor.d.ts.map +0 -1
  66. package/lib/components/query/DataSpaceQueryEditor.js.map +0 -1
  67. package/lib/stores/query/DataSpaceQueryEditorStore.d.ts.map +0 -1
  68. package/lib/stores/query/DataSpaceQueryEditorStore.js +0 -98
  69. package/lib/stores/query/DataSpaceQueryEditorStore.js.map +0 -1
  70. package/src/stores/query/DataSpaceQueryEditorStore.ts +0 -173
@@ -0,0 +1,113 @@
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
+ import { extractElementNameFromPath, QueryTaggedValue, RuntimePointer, PackageableElementExplicitReference, } from '@finos/legend-graph';
17
+ import { QueryEditorStore, } from '@finos/legend-application-query';
18
+ import { guaranteeNonNullable, guaranteeType, uuid, } from '@finos/legend-shared';
19
+ import { QUERY_PROFILE_PATH, QUERY_PROFILE_TAG_DATA_SPACE, } from '../../DSLDataSpace_Const.js';
20
+ import { getDataSpace } from '../../graphManager/DSLDataSpace_GraphManagerHelper.js';
21
+ import { DataSpaceQueryBuilderState } from './DataSpaceQueryBuilderState.js';
22
+ import { generateDataSpaceQueryCreatorRoute } from './DSLDataSpace_LegendQueryRouter.js';
23
+ export const createQueryDataSpaceTaggedValue = (dataSpacePath) => {
24
+ const taggedValue = new QueryTaggedValue();
25
+ taggedValue.profile = QUERY_PROFILE_PATH;
26
+ taggedValue.tag = QUERY_PROFILE_TAG_DATA_SPACE;
27
+ taggedValue.value = dataSpacePath;
28
+ return taggedValue;
29
+ };
30
+ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
31
+ groupId;
32
+ artifactId;
33
+ versionId;
34
+ dataSpacePath;
35
+ executionContext;
36
+ runtimePath;
37
+ classPath;
38
+ constructor(applicationStore, depotServerClient, pluginManager, groupId, artifactId, versionId, dataSpacePath, executionContext, runtimePath, executionKey) {
39
+ super(applicationStore, depotServerClient, pluginManager);
40
+ this.groupId = groupId;
41
+ this.artifactId = artifactId;
42
+ this.versionId = versionId;
43
+ this.dataSpacePath = dataSpacePath;
44
+ this.executionContext = executionContext;
45
+ this.runtimePath = runtimePath;
46
+ this.classPath = executionKey;
47
+ }
48
+ getProjectInfo() {
49
+ return {
50
+ groupId: this.groupId,
51
+ artifactId: this.artifactId,
52
+ versionId: this.versionId,
53
+ };
54
+ }
55
+ async initializeQueryBuilderState() {
56
+ const dataSpace = getDataSpace(this.dataSpacePath, this.graphManagerState.graph);
57
+ const executionContext = guaranteeNonNullable(dataSpace.executionContexts.find((context) => context.name === this.executionContext), `Can't find execution context '${this.executionContext}'`);
58
+ const queryBuilderState = new DataSpaceQueryBuilderState(this.applicationStore, this.graphManagerState, this.depotServerClient, dataSpace, executionContext, this.groupId, this.artifactId, this.versionId, (dataSpaceInfo) => {
59
+ if (dataSpaceInfo.defaultExecutionContext) {
60
+ this.applicationStore.navigator.jumpTo(generateDataSpaceQueryCreatorRoute(dataSpaceInfo.groupId, dataSpaceInfo.artifactId, dataSpaceInfo.versionId, dataSpaceInfo.path, dataSpaceInfo.defaultExecutionContext, undefined, undefined));
61
+ }
62
+ else {
63
+ this.applicationStore.notifyWarning(`Can't switch data space: default execution context not specified`);
64
+ }
65
+ }, (ec) => {
66
+ // runtime should already be set
67
+ const runtimePointer = guaranteeType(queryBuilderState.runtimeValue, RuntimePointer);
68
+ this.applicationStore.navigator.goTo(generateDataSpaceQueryCreatorRoute(this.groupId, this.artifactId, this.versionId, dataSpace.path, ec.name, runtimePointer.packageableRuntime.value ===
69
+ queryBuilderState.executionContext.defaultRuntime.value
70
+ ? undefined
71
+ : runtimePointer.packageableRuntime.value.path, queryBuilderState.class?.path));
72
+ }, (runtimeValue) => {
73
+ const runtimePointer = guaranteeType(runtimeValue, RuntimePointer);
74
+ queryBuilderState.applicationStore.navigator.goTo(generateDataSpaceQueryCreatorRoute(queryBuilderState.groupId, queryBuilderState.artifactId, queryBuilderState.versionId, queryBuilderState.dataSpace.path, queryBuilderState.executionContext.name, runtimePointer.packageableRuntime.value ===
75
+ queryBuilderState.executionContext.defaultRuntime.value
76
+ ? undefined
77
+ : runtimePointer.packageableRuntime.value.path, queryBuilderState.class?.path));
78
+ }, (_class) => {
79
+ // runtime should already be set
80
+ const runtimePointer = guaranteeType(queryBuilderState.runtimeValue, RuntimePointer);
81
+ queryBuilderState.applicationStore.navigator.goTo(generateDataSpaceQueryCreatorRoute(queryBuilderState.groupId, queryBuilderState.artifactId, queryBuilderState.versionId, queryBuilderState.dataSpace.path, queryBuilderState.executionContext.name, runtimePointer.packageableRuntime.value ===
82
+ queryBuilderState.executionContext.defaultRuntime.value
83
+ ? undefined
84
+ : runtimePointer.packageableRuntime.value.path, _class.path));
85
+ });
86
+ queryBuilderState.setExecutionContext(executionContext);
87
+ queryBuilderState.propagateExecutionContextChange(executionContext);
88
+ // set runtime if already chosen
89
+ if (this.runtimePath) {
90
+ queryBuilderState.changeRuntime(new RuntimePointer(PackageableElementExplicitReference.create(this.graphManagerState.graph.getRuntime(this.runtimePath))));
91
+ }
92
+ // set class if already chosen
93
+ if (this.classPath) {
94
+ queryBuilderState.changeClass(this.graphManagerState.graph.getClass(this.classPath));
95
+ }
96
+ return queryBuilderState;
97
+ }
98
+ async getExportConfiguration() {
99
+ return {
100
+ defaultName: `New Query for ${extractElementNameFromPath(this.dataSpacePath)}[${this.executionContext}]`,
101
+ decorator: (query) => {
102
+ query.id = uuid();
103
+ query.groupId = this.groupId;
104
+ query.artifactId = this.artifactId;
105
+ query.versionId = this.versionId;
106
+ query.taggedValues = [
107
+ createQueryDataSpaceTaggedValue(this.dataSpacePath),
108
+ ];
109
+ },
110
+ };
111
+ }
112
+ }
113
+ //# sourceMappingURL=DataSpaceQueryCreatorStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSpaceQueryCreatorStore.js","sourceRoot":"","sources":["../../../src/stores/query/DataSpaceQueryCreatorStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,0BAA0B,EAC1B,gBAAgB,EAChB,cAAc,EACd,mCAAmC,GAGpC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,gBAAgB,GAKjB,MAAM,iCAAiC,CAAC;AAKzC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,IAAI,GACL,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,kBAAkB,EAClB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,uDAAuD,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAE7E,OAAO,EAAE,kCAAkC,EAAE,MAAM,qCAAqC,CAAC;AAGzF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,aAAqB,EACH,EAAE;IACpB,MAAM,WAAW,GAAG,IAAI,gBAAgB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AC;QACJ,CAAC,CACF,CAAC;QACF,iBAAiB,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;QACxD,iBAAiB,CAAC,+BAA+B,CAAC,gBAAgB,CAAC,CAAC;QAEpE,gCAAgC;QAChC,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,iBAAiB,CAAC,aAAa,CAC7B,IAAI,cAAc,CAChB,mCAAmC,CAAC,MAAM,CACxC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAC1D,CACF,CACF,CAAC;SACH;QAED,8BAA8B;QAC9B,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,iBAAiB,CAAC,WAAW,CAC3B,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CACtD,CAAC;SACH;QAED,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,sBAAsB;QAC1B,OAAO;YACL,WAAW,EAAE,iBAAiB,0BAA0B,CACtD,IAAI,CAAC,aAAa,CACnB,IAAI,IAAI,CAAC,gBAAgB,GAAG;YAC7B,SAAS,EAAE,CAAC,KAAY,EAAQ,EAAE;gBAChC,KAAK,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC;gBAClB,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;gBAC7B,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC;gBACnC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;gBACjC,KAAK,CAAC,YAAY,GAAG;oBACnB,+BAA+B,CAAC,IAAI,CAAC,aAAa,CAAC;iBACpD,CAAC;YACJ,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -17,27 +17,20 @@ import type { Class } from '@finos/legend-graph';
17
17
  import { type QuerySetupStore, QuerySetupState } from '@finos/legend-application-query';
18
18
  import { type GeneratorFn, ActionState } from '@finos/legend-shared';
19
19
  import { DataSpaceViewerState } from '../DataSpaceViewerState.js';
20
- export interface DataSpaceContext {
21
- groupId: string;
22
- artifactId: string;
23
- versionId: string;
24
- title: string | undefined;
25
- name: string;
26
- path: string;
27
- }
20
+ import { type DataSpaceInfo } from './DataSpaceInfo.js';
28
21
  export declare class DataSpaceQuerySetupState extends QuerySetupState {
29
- dataSpaces: DataSpaceContext[];
22
+ dataSpaces: DataSpaceInfo[];
30
23
  loadDataSpacesState: ActionState;
31
24
  loadDataSpaceState: ActionState;
32
- currentDataSpace?: DataSpaceContext | undefined;
25
+ currentDataSpace?: DataSpaceInfo | undefined;
33
26
  dataSpaceViewerState?: DataSpaceViewerState | undefined;
34
27
  toGetSnapShot: boolean;
35
28
  constructor(setupStore: QuerySetupStore);
36
- setCurrentDataSpace(val: DataSpaceContext | undefined): void;
29
+ setCurrentDataSpace(val: DataSpaceInfo | undefined): void;
37
30
  setDataSpaceViewerState(val: DataSpaceViewerState | undefined): void;
38
31
  setToGetSnapShot(val: boolean): void;
39
32
  loadDataSpaces(searchText: string): GeneratorFn<void>;
40
- loadDataSpace(dataSpace: DataSpaceContext): GeneratorFn<void>;
33
+ loadDataSpace(dataSpace: DataSpaceInfo): GeneratorFn<void>;
41
34
  proceedToCreateQuery(_class?: Class): GeneratorFn<void>;
42
35
  }
43
36
  //# sourceMappingURL=DataSpaceQuerySetupState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DataSpaceQuerySetupState.d.ts","sourceRoot":"","sources":["../../../src/stores/query/DataSpaceQuerySetupState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EACL,KAAK,eAAe,EACpB,eAAe,EAEhB,MAAM,iCAAiC,CAAC;AAOzC,OAAO,EACL,KAAK,WAAW,EAEhB,WAAW,EAGZ,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,oBAAo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,EAEZ,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,KAAK,aAAa,EAAwB,MAAM,oBAAoB,CAAC;AAM9E,qBAAa,wBAAyB,SAAQ,eAAe;IAC3D,UAAU,EAAE,aAAa,EAAE,CAAM;IACjC,mBAAmB,cAAwB;IAC3C,kBAAkB,cAAwB;IAC1C,gBAAgB,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;IAC7C,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,SAAS,CAAC;IACxD,aAAa,UAAS;gBAEV,UAAU,EAAE,eAAe;IAiBvC,mBAAmB,CAAC,GAAG,EAAE,aAAa,GAAG,SAAS,GAAG,IAAI;IAIzD,uBAAuB,CAAC,GAAG,EAAE,oBAAoB,GAAG,SAAS,GAAG,IAAI;IAIpE,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAInC,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC;IA2BrD,aAAa,CAAC,SAAS,EAAE,aAAa,GAAG,WAAW,CAAC,IAAI,CAAC;IA8E1D,oBAAoB,CAAC,MAAM,CAAC,EAAE,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC;CAmBzD"}
@@ -13,15 +13,16 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { extractEntityNameFromPath } from '@finos/legend-storage';
17
16
  import { QuerySetupState, generateStudioProjectViewUrl, } from '@finos/legend-application-query';
18
- import { DepotScope, ProjectData, SNAPSHOT_VERSION_ALIAS, } from '@finos/legend-server-depot';
19
- import { ActionState, assertErrorThrown, isString, } from '@finos/legend-shared';
17
+ import { DepotScope, ProjectData, } from '@finos/legend-server-depot';
18
+ import { ActionState, assertErrorThrown, } from '@finos/legend-shared';
20
19
  import { action, flow, flowResult, makeObservable, observable } from 'mobx';
21
20
  import { getDSLDataSpaceGraphManagerExtension } from '../../graphManager/protocol/pure/DSLDataSpace_PureGraphManagerExtension.js';
22
21
  import { DATA_SPACE_ELEMENT_CLASSIFIER_PATH } from '../../graphManager/protocol/pure/DSLDataSpace_PureProtocolProcessorPlugin.js';
23
22
  import { DataSpaceViewerState } from '../DataSpaceViewerState.js';
24
- import { generateDataSpaceQueryEditorRoute } from './DSLDataSpace_LegendQueryRouter.js';
23
+ import { generateDataSpaceQueryCreatorRoute } from './DSLDataSpace_LegendQueryRouter.js';
24
+ import { extractDataSpaceInfo } from './DataSpaceInfo.js';
25
+ import { DEFAULT_DATA_SPACE_LOADER_LIMIT, MINIMUM_DATA_SPACE_LOADER_SEARCH_LENGTH, } from '../../DSLDataSpace_Const.js';
25
26
  export class DataSpaceQuerySetupState extends QuerySetupState {
26
27
  dataSpaces = [];
27
28
  loadDataSpacesState = ActionState.create();
@@ -54,7 +55,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
54
55
  this.toGetSnapShot = val;
55
56
  }
56
57
  *loadDataSpaces(searchText) {
57
- const isValidSearchString = searchText.length >= 3;
58
+ const isValidSearchString = searchText.length >= MINIMUM_DATA_SPACE_LOADER_SEARCH_LENGTH;
58
59
  this.loadDataSpacesState.inProgress();
59
60
  try {
60
61
  this.dataSpaces = (yield this.setupStore.depotServerClient.getEntitiesByClassifierPath(DATA_SPACE_ELEMENT_CLASSIFIER_PATH, {
@@ -62,19 +63,8 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
62
63
  scope: this.toGetSnapShot
63
64
  ? DepotScope.SNAPSHOT
64
65
  : DepotScope.RELEASES,
65
- limit: 10,
66
- })).map((storedEntity) => ({
67
- groupId: storedEntity.groupId,
68
- artifactId: storedEntity.artifactId,
69
- versionId: this.toGetSnapShot
70
- ? SNAPSHOT_VERSION_ALIAS
71
- : storedEntity.versionId,
72
- path: storedEntity.entity.path,
73
- name: extractEntityNameFromPath(storedEntity.entity.path),
74
- title: isString(storedEntity.entity.content.title)
75
- ? storedEntity.entity.content.title
76
- : undefined,
77
- }));
66
+ limit: DEFAULT_DATA_SPACE_LOADER_LIMIT,
67
+ })).map((storedEntity) => extractDataSpaceInfo(storedEntity, this.toGetSnapShot));
78
68
  this.loadDataSpacesState.pass();
79
69
  }
80
70
  catch (error) {
@@ -118,7 +108,7 @@ export class DataSpaceQuerySetupState extends QuerySetupState {
118
108
  }
119
109
  *proceedToCreateQuery(_class) {
120
110
  if (this.dataSpaceViewerState) {
121
- this.setupStore.applicationStore.navigator.goTo(generateDataSpaceQueryEditorRoute(this.dataSpaceViewerState.groupId, this.dataSpaceViewerState.artifactId, this.dataSpaceViewerState.versionId, this.dataSpaceViewerState.dataSpaceAnalysisResult.path, this.dataSpaceViewerState.currentExecutionContext.name, this.dataSpaceViewerState.currentRuntime ===
111
+ this.setupStore.applicationStore.navigator.goTo(generateDataSpaceQueryCreatorRoute(this.dataSpaceViewerState.groupId, this.dataSpaceViewerState.artifactId, this.dataSpaceViewerState.versionId, this.dataSpaceViewerState.dataSpaceAnalysisResult.path, this.dataSpaceViewerState.currentExecutionContext.name, this.dataSpaceViewerState.currentRuntime ===
122
112
  this.dataSpaceViewerState.currentExecutionContext.defaultRuntime
123
113
  ? undefined
124
114
  : this.dataSpaceViewerState.currentRuntime.path, _class?.path));
@@ -1 +1 @@
1
- {"version":3,"file":"DataSpaceQuerySetupState.js","sourceRoot":"","sources":["../../../src/stores/query/DataSpaceQuerySetupState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAe,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAEL,eAAe,EACf,4BAA4B,GAC7B,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAEL,UAAU,EACV,WAAW,EACX,sBAAsB,GACvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAGL,WAAW,EACX,iBAAiB,EACjB,QAAQ,GACT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE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AU,CAAC,gBAAgB,CAAC,SAAS,CAAC,IAAI,CAC7C,kCAAkC,CAChC,IAAI,CAAC,oBAAoB,CAAC,OAAO,EACjC,IAAI,CAAC,oBAAoB,CAAC,UAAU,EACpC,IAAI,CAAC,oBAAoB,CAAC,SAAS,EACnC,IAAI,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,IAAI,EACtD,IAAI,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,IAAI,EACtD,IAAI,CAAC,oBAAoB,CAAC,cAAc;gBACtC,IAAI,CAAC,oBAAoB,CAAC,uBAAuB,CAAC,cAAc;gBAChE,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC,IAAI,EACjD,MAAM,EAAE,IAAI,CACb,CACF,CAAC;YACF,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;SAC1C;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finos/legend-extension-dsl-data-space",
3
- "version": "6.1.11",
3
+ "version": "6.1.12",
4
4
  "description": "Legend extension for Data Space DSL",
5
5
  "keywords": [
6
6
  "legend",
@@ -43,16 +43,16 @@
43
43
  "test:watch": "jest --watch"
44
44
  },
45
45
  "dependencies": {
46
- "@finos/legend-application": "7.1.6",
47
- "@finos/legend-application-query": "5.2.8",
48
- "@finos/legend-application-studio": "15.1.0",
49
- "@finos/legend-art": "3.0.4",
50
- "@finos/legend-extension-dsl-diagram": "5.0.10",
51
- "@finos/legend-graph": "14.0.6",
52
- "@finos/legend-server-depot": "3.0.9",
53
- "@finos/legend-shared": "6.0.4",
54
- "@finos/legend-storage": "3.0.8",
55
- "@types/react": "18.0.18",
46
+ "@finos/legend-application": "7.1.7",
47
+ "@finos/legend-application-query": "6.0.0",
48
+ "@finos/legend-application-studio": "15.2.0",
49
+ "@finos/legend-art": "3.1.0",
50
+ "@finos/legend-extension-dsl-diagram": "5.0.11",
51
+ "@finos/legend-graph": "14.1.0",
52
+ "@finos/legend-server-depot": "3.0.10",
53
+ "@finos/legend-shared": "6.1.0",
54
+ "@finos/legend-storage": "3.0.9",
55
+ "@types/react": "18.0.19",
56
56
  "mobx": "6.6.2",
57
57
  "mobx-react-lite": "3.4.0",
58
58
  "react": "18.2.0",
@@ -62,15 +62,15 @@
62
62
  "serializr": "2.0.5"
63
63
  },
64
64
  "devDependencies": {
65
- "@finos/legend-dev-utils": "2.0.14",
66
- "@jest/globals": "29.0.2",
65
+ "@finos/legend-dev-utils": "2.0.15",
66
+ "@jest/globals": "29.0.3",
67
67
  "cross-env": "7.0.3",
68
68
  "eslint": "8.23.0",
69
- "jest": "29.0.2",
69
+ "jest": "29.0.3",
70
70
  "npm-run-all": "4.1.5",
71
71
  "rimraf": "3.0.2",
72
- "sass": "1.54.8",
73
- "typescript": "4.8.2"
72
+ "sass": "1.54.9",
73
+ "typescript": "4.8.3"
74
74
  },
75
75
  "peerDependencies": {
76
76
  "react": "^18.0.0"
@@ -18,3 +18,6 @@
18
18
  // so that it records the dataSpace it is created from
19
19
  export const QUERY_PROFILE_PATH = 'meta::pure::profiles::query';
20
20
  export const QUERY_PROFILE_TAG_DATA_SPACE = 'dataSpace';
21
+
22
+ export const DEFAULT_DATA_SPACE_LOADER_LIMIT = 10;
23
+ export const MINIMUM_DATA_SPACE_LOADER_SEARCH_LENGTH = 3;
@@ -0,0 +1,23 @@
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 { SquareIcon } from '@finos/legend-art';
18
+
19
+ export const DataSpaceIcon: React.FC = () => (
20
+ <div className="icon icon--data-space">
21
+ <SquareIcon />
22
+ </div>
23
+ );
@@ -22,16 +22,40 @@ import {
22
22
  type QuerySetupRenderer,
23
23
  type QuerySetupState,
24
24
  type QuerySetupStore,
25
+ type ExistingQueryEditorStateBuilder,
26
+ type QueryBuilderState,
25
27
  LegendQueryApplicationPlugin,
28
+ generateExistingQueryEditorRoute,
29
+ LegendQueryEventService,
30
+ LEGEND_QUERY_APP_EVENT,
26
31
  } from '@finos/legend-application-query';
27
32
  import { SquareIcon } from '@finos/legend-art';
28
33
  import { DataSpaceQuerySetupState } from '../../stores/query/DataSpaceQuerySetupState.js';
29
34
  import { DataspaceQuerySetup } from './DataSpaceQuerySetup.js';
30
- import type { ApplicationPageEntry } from '@finos/legend-application';
31
- import { DATA_SPACE_QUERY_EDITOR_ROUTE_PATTERN } from '../../stores/query/DSLDataSpace_LegendQueryRouter.js';
32
- import { DataSpaceQueryEditor } from './DataSpaceQueryEditor.js';
33
- import { DataSpaceQueryEditorStore } from '../../stores/query/DataSpaceQueryEditorStore.js';
34
- import { extractElementNameFromPath } from '@finos/legend-graph';
35
+ import {
36
+ ActionAlertActionType,
37
+ ActionAlertType,
38
+ type ApplicationPageEntry,
39
+ } from '@finos/legend-application';
40
+ import { CREATE_QUERY_FROM_DATA_SPACE_ROUTE_PATTERN } from '../../stores/query/DSLDataSpace_LegendQueryRouter.js';
41
+ import { DataSpaceQueryCreator } from './DataSpaceQueryCreator.js';
42
+ import {
43
+ createQueryDataSpaceTaggedValue,
44
+ DataSpaceQueryCreatorStore,
45
+ } from '../../stores/query/DataSpaceQueryCreatorStore.js';
46
+ import {
47
+ Query,
48
+ extractElementNameFromPath,
49
+ isValidFullPath,
50
+ } from '@finos/legend-graph';
51
+ import {
52
+ QUERY_PROFILE_PATH,
53
+ QUERY_PROFILE_TAG_DATA_SPACE,
54
+ } from '../../DSLDataSpace_Const.js';
55
+ import { DataSpaceQueryBuilderState } from '../../stores/query/DataSpaceQueryBuilderState.js';
56
+ import type { DataSpaceInfo } from '../../stores/query/DataSpaceInfo.js';
57
+ import { getOwnDataSpace } from '../../graphManager/DSLDataSpace_GraphManagerHelper.js';
58
+ import { assertErrorThrown, LogEvent, uuid } from '@finos/legend-shared';
35
59
 
36
60
  export class DSLDataSpace_LegendQueryApplicationPlugin extends LegendQueryApplicationPlugin {
37
61
  constructor() {
@@ -43,8 +67,8 @@ export class DSLDataSpace_LegendQueryApplicationPlugin extends LegendQueryApplic
43
67
  // data space query editor
44
68
  {
45
69
  key: 'data-space-query-editor-application-page',
46
- urlPatterns: [DATA_SPACE_QUERY_EDITOR_ROUTE_PATTERN],
47
- renderer: DataSpaceQueryEditor,
70
+ urlPatterns: [CREATE_QUERY_FROM_DATA_SPACE_ROUTE_PATTERN],
71
+ renderer: DataSpaceQueryCreator,
48
72
  },
49
73
  ];
50
74
  }
@@ -90,7 +114,7 @@ export class DSLDataSpace_LegendQueryApplicationPlugin extends LegendQueryApplic
90
114
  override getExtraQueryEditorHeaderLabelers(): QueryEditorHeaderLabeler[] {
91
115
  return [
92
116
  (editorStore: QueryEditorStore): React.ReactNode | undefined => {
93
- if (editorStore instanceof DataSpaceQueryEditorStore) {
117
+ if (editorStore instanceof DataSpaceQueryCreatorStore) {
94
118
  return (
95
119
  <div className="query-editor__header__label">
96
120
  <SquareIcon className="query-editor__header__label__icon icon--data-space" />
@@ -105,4 +129,142 @@ export class DSLDataSpace_LegendQueryApplicationPlugin extends LegendQueryApplic
105
129
  },
106
130
  ];
107
131
  }
132
+
133
+ override getExtraExistingQueryEditorStateBuilders(): ExistingQueryEditorStateBuilder[] {
134
+ return [
135
+ (
136
+ query: Query,
137
+ editorStore: QueryEditorStore,
138
+ ): QueryBuilderState | undefined => {
139
+ const dataSpaceTaggedValue = query.taggedValues?.find(
140
+ (taggedValue) =>
141
+ taggedValue.profile === QUERY_PROFILE_PATH &&
142
+ taggedValue.tag === QUERY_PROFILE_TAG_DATA_SPACE &&
143
+ isValidFullPath(taggedValue.value),
144
+ );
145
+
146
+ if (dataSpaceTaggedValue) {
147
+ const dataSpacePath = dataSpaceTaggedValue.value;
148
+ const dataSpace = getOwnDataSpace(
149
+ dataSpacePath,
150
+ editorStore.graphManagerState.graph,
151
+ );
152
+ const mapping = query.mapping.value;
153
+ const matchingExecutionContext = dataSpace.executionContexts.find(
154
+ (ec) => ec.mapping.value === mapping,
155
+ );
156
+ if (!matchingExecutionContext) {
157
+ // if a matching execution context is not found, it means this query is not
158
+ // properly created from a data space, therefore, we cannot support this case
159
+ return undefined;
160
+ }
161
+ return new DataSpaceQueryBuilderState(
162
+ editorStore.applicationStore,
163
+ editorStore.graphManagerState,
164
+ editorStore.depotServerClient,
165
+ dataSpace,
166
+ matchingExecutionContext,
167
+ query.groupId,
168
+ query.artifactId,
169
+ query.versionId,
170
+ (dataSpaceInfo: DataSpaceInfo) => {
171
+ if (dataSpaceInfo.defaultExecutionContext) {
172
+ const persistQuery = async (): Promise<void> => {
173
+ // prepare the new query to save
174
+ const _query = new Query();
175
+ _query.name = query.name;
176
+ _query.id = query.id;
177
+ _query.groupId = query.groupId;
178
+ _query.artifactId = query.artifactId;
179
+ _query.versionId = query.versionId;
180
+ _query.mapping = query.mapping;
181
+ _query.runtime = query.runtime;
182
+ _query.taggedValues = [
183
+ createQueryDataSpaceTaggedValue(dataSpaceInfo.path),
184
+ ].concat(
185
+ (query.taggedValues ?? []).filter(
186
+ (taggedValue) => taggedValue !== dataSpaceTaggedValue,
187
+ ),
188
+ );
189
+ _query.stereotypes = query.stereotypes;
190
+ _query.content = query.content;
191
+ _query.owner = query.owner;
192
+
193
+ try {
194
+ if (!query.isCurrentUserQuery) {
195
+ _query.id = uuid();
196
+ const newQuery =
197
+ await editorStore.graphManagerState.graphManager.createQuery(
198
+ _query,
199
+ editorStore.graphManagerState.graph,
200
+ );
201
+ editorStore.applicationStore.notifySuccess(
202
+ `Successfully created query!`,
203
+ );
204
+ LegendQueryEventService.create(
205
+ editorStore.applicationStore.eventService,
206
+ ).notify_QueryCreated({ queryId: newQuery.id });
207
+ editorStore.applicationStore.navigator.jumpTo(
208
+ editorStore.applicationStore.navigator.generateLocation(
209
+ generateExistingQueryEditorRoute(newQuery.id),
210
+ ),
211
+ );
212
+ } else {
213
+ await editorStore.graphManagerState.graphManager.updateQuery(
214
+ _query,
215
+ editorStore.graphManagerState.graph,
216
+ );
217
+ editorStore.applicationStore.notifySuccess(
218
+ `Successfully updated query!`,
219
+ );
220
+ editorStore.applicationStore.navigator.reload();
221
+ }
222
+ } catch (error) {
223
+ assertErrorThrown(error);
224
+ editorStore.applicationStore.log.error(
225
+ LogEvent.create(LEGEND_QUERY_APP_EVENT.QUERY_PROBLEM),
226
+ error,
227
+ );
228
+ editorStore.applicationStore.notifyError(error);
229
+ }
230
+ };
231
+
232
+ editorStore.applicationStore.setActionAlertInfo({
233
+ message: `To change the data space associated with this query, you need to ${
234
+ query.isCurrentUserQuery
235
+ ? 'update the query'
236
+ : 'create a new query'
237
+ } to proceed`,
238
+ type: ActionAlertType.CAUTION,
239
+ actions: [
240
+ {
241
+ label: query.isCurrentUserQuery
242
+ ? 'Update query'
243
+ : 'Create new query',
244
+ type: ActionAlertActionType.PROCEED_WITH_CAUTION,
245
+ handler: () => {
246
+ persistQuery().catch(
247
+ editorStore.applicationStore.alertUnhandledError,
248
+ );
249
+ },
250
+ },
251
+ {
252
+ label: 'Abort',
253
+ type: ActionAlertActionType.PROCEED,
254
+ default: true,
255
+ },
256
+ ],
257
+ });
258
+ } else {
259
+ editorStore.applicationStore.notifyWarning(
260
+ `Can't switch data space: default execution context not specified`,
261
+ );
262
+ }
263
+ },
264
+ );
265
+ }
266
+ return undefined;
267
+ },
268
+ ];
269
+ }
108
270
  }