@finos/legend-application-query 13.4.16 → 13.4.18
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/__lib__/LegendQueryEvent.d.ts +2 -1
- package/lib/__lib__/LegendQueryEvent.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryEvent.js +1 -0
- package/lib/__lib__/LegendQueryEvent.js.map +1 -1
- package/lib/__lib__/LegendQueryUserDataHelper.d.ts +23 -3
- package/lib/__lib__/LegendQueryUserDataHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryUserDataHelper.js +94 -14
- package/lib/__lib__/LegendQueryUserDataHelper.js.map +1 -1
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.d.ts +31 -0
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.d.ts.map +1 -0
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.js +54 -0
- package/lib/__lib__/LegendQueryUserDataSpaceHelper.js.map +1 -0
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.js +29 -11
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/LegendQueryAppInfo.d.ts +21 -0
- package/lib/components/LegendQueryAppInfo.d.ts.map +1 -0
- package/lib/components/LegendQueryAppInfo.js +46 -0
- package/lib/components/LegendQueryAppInfo.js.map +1 -0
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +8 -7
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.js +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +3 -3
- package/lib/stores/QueryEditorStore.d.ts +3 -0
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +13 -1
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts +2 -0
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js +21 -2
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts +10 -2
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.js +53 -3
- package/lib/stores/data-space/DataSpaceQuerySetupState.js.map +1 -1
- package/package.json +13 -13
- package/src/__lib__/LegendQueryEvent.ts +2 -0
- package/src/__lib__/LegendQueryUserDataHelper.ts +192 -18
- package/src/__lib__/LegendQueryUserDataSpaceHelper.ts +98 -0
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +35 -20
- package/src/components/LegendQueryAppInfo.tsx +153 -0
- package/src/components/QueryEditor.tsx +18 -9
- package/src/components/data-space/DataSpaceQuerySetup.tsx +1 -1
- package/src/stores/QueryEditorStore.ts +19 -0
- package/src/stores/data-space/DataSpaceQueryCreatorStore.ts +59 -0
- package/src/stores/data-space/DataSpaceQuerySetupState.ts +92 -4
- package/tsconfig.json +2 -0
@@ -15,12 +15,15 @@
|
|
15
15
|
*/
|
16
16
|
import { extractElementNameFromPath, RuntimePointer, PackageableElementExplicitReference, } from '@finos/legend-graph';
|
17
17
|
import { StoreProjectData, LATEST_VERSION_ALIAS, } from '@finos/legend-server-depot';
|
18
|
-
import { guaranteeNonNullable, guaranteeType, uuid, } from '@finos/legend-shared';
|
18
|
+
import { LogEvent, assertErrorThrown, guaranteeNonNullable, guaranteeType, returnUndefOnError, uuid, } from '@finos/legend-shared';
|
19
19
|
import { QueryBuilderDataBrowserWorkflow, } from '@finos/legend-query-builder';
|
20
20
|
import { DSL_DataSpace_getGraphManagerExtension, getDataSpace, retrieveAnalyticsResultCache, } from '@finos/legend-extension-dsl-data-space/graph';
|
21
21
|
import { QueryBuilderActionConfig_QueryApplication, QueryEditorStore, createViewProjectHandler, createViewSDLCProjectHandler, } from '../QueryEditorStore.js';
|
22
22
|
import { DataSpaceProjectInfo, DataSpaceQueryBuilderState, createQueryClassTaggedValue, } from '@finos/legend-extension-dsl-data-space/application';
|
23
23
|
import { generateDataSpaceQueryCreatorRoute } from '../../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
|
24
|
+
import { LegendQueryUserDataHelper } from '../../__lib__/LegendQueryUserDataHelper.js';
|
25
|
+
import { createVisitedDataSpaceId, hasDataSpaceInfoBeenVisited, createSimpleVisitedDataspace, } from '../../__lib__/LegendQueryUserDataSpaceHelper.js';
|
26
|
+
import { LEGEND_QUERY_APP_EVENT } from '../../__lib__/LegendQueryEvent.js';
|
24
27
|
export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
25
28
|
groupId;
|
26
29
|
artifactId;
|
@@ -64,6 +67,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
64
67
|
versionId: projectInfo.versionId,
|
65
68
|
dataSpace: dataSpace.path,
|
66
69
|
};
|
70
|
+
const visitedDataSpaces = LegendQueryUserDataHelper.getRecentlyVisitedDataSpaces(this.applicationStore.userDataService);
|
67
71
|
const queryBuilderState = new DataSpaceQueryBuilderState(this.applicationStore, this.graphManagerState, this.depotServerClient, QueryBuilderDataBrowserWorkflow.INSTANCE, new QueryBuilderActionConfig_QueryApplication(this), dataSpace, executionContext, (dataSpaceInfo) => {
|
68
72
|
if (dataSpaceInfo.defaultExecutionContext) {
|
69
73
|
this.applicationStore.navigationService.navigator.goToLocation(generateDataSpaceQueryCreatorRoute(guaranteeNonNullable(dataSpaceInfo.groupId), guaranteeNonNullable(dataSpaceInfo.artifactId), LATEST_VERSION_ALIAS, //always default to latest
|
@@ -79,6 +83,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
79
83
|
queryBuilderState.executionContext.defaultRuntime.value
|
80
84
|
? undefined
|
81
85
|
: runtimePointer.packageableRuntime.value.path, queryBuilderState.class?.path));
|
86
|
+
returnUndefOnError(() => LegendQueryUserDataHelper.updateVisitedDataSpaceExecContext(this.applicationStore.userDataService, this.groupId, this.artifactId, dataSpace.path, ec.name));
|
82
87
|
}, (runtimeValue) => {
|
83
88
|
const runtimePointer = guaranteeType(runtimeValue, RuntimePointer);
|
84
89
|
queryBuilderState.applicationStore.navigationService.navigator.updateCurrentLocation(generateDataSpaceQueryCreatorRoute(guaranteeNonNullable(queryBuilderState.projectInfo).groupId, guaranteeNonNullable(queryBuilderState.projectInfo).artifactId, guaranteeNonNullable(queryBuilderState.projectInfo).versionId, queryBuilderState.dataSpace.path, queryBuilderState.executionContext.name, runtimePointer.packageableRuntime.value ===
|
@@ -92,7 +97,7 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
92
97
|
queryBuilderState.executionContext.defaultRuntime.value
|
93
98
|
? undefined
|
94
99
|
: runtimePointer.packageableRuntime.value.path, _class.path));
|
95
|
-
}, projectInfo, this.applicationStore.config.options.queryBuilderConfig, sourceInfo);
|
100
|
+
}, projectInfo, this.applicationStore.config.options.queryBuilderConfig, sourceInfo, (dataSpaceInfo) => hasDataSpaceInfoBeenVisited(dataSpaceInfo, visitedDataSpaces));
|
96
101
|
queryBuilderState.setExecutionContext(executionContext);
|
97
102
|
queryBuilderState.propagateExecutionContextChange(executionContext);
|
98
103
|
// set runtime if already chosen
|
@@ -103,8 +108,19 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
103
108
|
if (this.classPath) {
|
104
109
|
queryBuilderState.changeClass(this.graphManagerState.graph.getClass(this.classPath));
|
105
110
|
}
|
111
|
+
// add to visited dataspaces
|
112
|
+
this.addVisitedDataSpace(executionContext.name);
|
106
113
|
return queryBuilderState;
|
107
114
|
}
|
115
|
+
addVisitedDataSpace(execName) {
|
116
|
+
try {
|
117
|
+
LegendQueryUserDataHelper.addVisitedDatspace(this.applicationStore.userDataService, createSimpleVisitedDataspace(this.groupId, this.artifactId, this.versionId, this.dataSpacePath, execName));
|
118
|
+
}
|
119
|
+
catch (error) {
|
120
|
+
assertErrorThrown(error);
|
121
|
+
this.applicationStore.logService.warn(LogEvent.create(LEGEND_QUERY_APP_EVENT.LOCAL_STORAGE_PERSIST_ERROR), error.message);
|
122
|
+
}
|
123
|
+
}
|
108
124
|
getPersistConfiguration(lambda, options) {
|
109
125
|
return {
|
110
126
|
defaultName: options?.update
|
@@ -123,5 +139,8 @@ export class DataSpaceQueryCreatorStore extends QueryEditorStore {
|
|
123
139
|
},
|
124
140
|
};
|
125
141
|
}
|
142
|
+
onInitializeFailure() {
|
143
|
+
LegendQueryUserDataHelper.removeRecentlyViewedDataSpace(this.applicationStore.userDataService, createVisitedDataSpaceId(this.groupId, this.artifactId, this.dataSpacePath));
|
144
|
+
}
|
126
145
|
}
|
127
146
|
//# sourceMappingURL=DataSpaceQueryCreatorStore.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DataSpaceQueryCreatorStore.js","sourceRoot":"","sources":["../../../src/stores/data-space/DataSpaceQueryCreatorStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,0BAA0B,EAC1B,cAAc,EACd,mCAAmC,GAIpC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,IAAI,GACL,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,+BAA+B,GAChC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAEL,sCAAsC,EACtC,YAAY,EACZ,4BAA4B,GAC7B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,yCAAyC,EACzC,gBAAgB,EAChB,wBAAwB,EACxB,4BAA4B,GAE7B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,2BAA2B,GAE5B,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,kCAAkC,EAAE,MAAM,sDAAsD,CAAC;
|
1
|
+
{"version":3,"file":"DataSpaceQueryCreatorStore.js","sourceRoot":"","sources":["../../../src/stores/data-space/DataSpaceQueryCreatorStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,0BAA0B,EAC1B,cAAc,EACd,mCAAmC,GAIpC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,QAAQ,EACR,iBAAiB,EACjB,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,IAAI,GACL,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,+BAA+B,GAChC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAEL,sCAAsC,EACtC,YAAY,EACZ,4BAA4B,GAC7B,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,yCAAyC,EACzC,gBAAgB,EAChB,wBAAwB,EACxB,4BAA4B,GAE7B,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,2BAA2B,GAE5B,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,kCAAkC,EAAE,MAAM,sDAAsD,CAAC;AAC1G,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AACvF,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,MAAM,OAAO,0BAA2B,SAAQ,gBAAgB;IACrD,OAAO,CAAS;IAChB,UAAU,CAAS;IACnB,SAAS,CAAS;IAClB,aAAa,CAAS;IACtB,gBAAgB,CAAS;IACzB,WAAW,CAAqB;IAChC,SAAS,CAAqB;IAEvC,YACE,gBAA6C,EAC7C,iBAAoC,EACpC,OAAe,EACf,UAAkB,EAClB,SA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EACnE,KAAK,CAAC,OAAO,CACd,CAAC;QACJ,CAAC;IACH,CAAC;IAED,uBAAuB,CACrB,MAAiB,EACjB,OAA0C;QAE1C,OAAO;YACL,WAAW,EAAE,OAAO,EAAE,MAAM;gBAC1B,CAAC,CAAC,GAAG,0BAA0B,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE;gBACrD,CAAC,CAAC,iBAAiB,0BAA0B,CAAC,IAAI,CAAC,aAAa,CAAC,IAC7D,IAAI,CAAC,gBACP,GAAG;YACP,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,IAAI,IAAI,CAAC,iBAAiB,EAAE,KAAK,EAAE,CAAC;oBAClC,KAAK,CAAC,YAAY,GAAG;wBACnB,2BAA2B,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC;qBAC/D,CAAC;gBACJ,CAAC;YACH,CAAC;SACF,CAAC;IACJ,CAAC;IAEQ,mBAAmB;QAC1B,yBAAyB,CAAC,6BAA6B,CACrD,IAAI,CAAC,gBAAgB,CAAC,eAAe,EACrC,wBAAwB,CACtB,IAAI,CAAC,OAAO,EACZ,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,aAAa,CACnB,CACF,CAAC;IACJ,CAAC;CACF"}
|
@@ -17,11 +17,16 @@ import { type DepotServerClient } from '@finos/legend-server-depot';
|
|
17
17
|
import type { GraphManagerState, RawLambda } from '@finos/legend-graph';
|
18
18
|
import { type GenericLegendApplicationStore } from '@finos/legend-application';
|
19
19
|
import { type QueryBuilderConfig, QueryBuilderState } from '@finos/legend-query-builder';
|
20
|
-
import type { ProjectGAVCoordinates } from '@finos/legend-storage';
|
20
|
+
import type { Entity, ProjectGAVCoordinates } from '@finos/legend-storage';
|
21
21
|
import { ActionState, type GeneratorFn } from '@finos/legend-shared';
|
22
22
|
import { type DataSpaceInfo } from '@finos/legend-extension-dsl-data-space/application';
|
23
23
|
import { QueryEditorStore, type QueryPersistConfiguration } from '../QueryEditorStore.js';
|
24
24
|
import { DataSpaceAdvancedSearchState } from '@finos/legend-extension-dsl-data-space/application-query';
|
25
|
+
import type { VisitedDataspace } from '../../__lib__/LegendQueryUserDataSpaceHelper.js';
|
26
|
+
type DataSpaceVisitedEntity = {
|
27
|
+
visited: VisitedDataspace;
|
28
|
+
entity: Entity;
|
29
|
+
};
|
25
30
|
export declare class DataSpaceQuerySetupState extends QueryBuilderState {
|
26
31
|
editorStore: QueryEditorStore;
|
27
32
|
readonly depotServerClient: DepotServerClient;
|
@@ -38,7 +43,9 @@ export declare class DataSpaceQuerySetupState extends QueryBuilderState {
|
|
38
43
|
get sideBarClassName(): string | undefined;
|
39
44
|
showAdvancedSearchPanel(): void;
|
40
45
|
hideAdvancedSearchPanel(): void;
|
41
|
-
|
46
|
+
initializeDataSpaceSetup(): GeneratorFn<void>;
|
47
|
+
redirectIfPossible(): GeneratorFn<DataSpaceVisitedEntity | undefined>;
|
48
|
+
hyrdateVisitedDataSpace(visited: VisitedDataspace): GeneratorFn<DataSpaceVisitedEntity | undefined>;
|
42
49
|
}
|
43
50
|
export declare class DataSpaceQuerySetupStore extends QueryEditorStore {
|
44
51
|
get isViewProjectActionDisabled(): boolean;
|
@@ -49,4 +56,5 @@ export declare class DataSpaceQuerySetupStore extends QueryEditorStore {
|
|
49
56
|
initializeQueryBuilderState(): Promise<QueryBuilderState>;
|
50
57
|
buildGraph(): GeneratorFn<void>;
|
51
58
|
}
|
59
|
+
export {};
|
52
60
|
//# sourceMappingURL=DataSpaceQuerySetupState.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DataSpaceQuerySetupState.d.ts","sourceRoot":"","sources":["../../../src/stores/data-space/DataSpaceQuerySetupState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,KAAK,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EACL,KAAK,kBAAkB,EACvB,iBAAiB,EAElB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;
|
1
|
+
{"version":3,"file":"DataSpaceQuerySetupState.d.ts","sourceRoot":"","sources":["../../../src/stores/data-space/DataSpaceQuerySetupState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,KAAK,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EACL,KAAK,kBAAkB,EACvB,iBAAiB,EAElB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EACL,WAAW,EAIX,KAAK,WAAW,EACjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,oDAAoD,CAAC;AAE5D,OAAO,EAEL,gBAAgB,EAGhB,KAAK,yBAAyB,EAC/B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AACxG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iDAAiD,CAAC;AAGxF,KAAK,sBAAsB,GAAG;IAC5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AAG,SAAS;IA6BxC,IAAa,mBAAmB,IAAI,OAAO,CAE1C;IAED,IAAa,gBAAgB,IAAI,MAAM,GAAG,SAAS,CAElD;IAED,uBAAuB,IAAI,IAAI;IAY/B,uBAAuB,IAAI,IAAI;IAI9B,wBAAwB,IAAI,WAAW,CAAC,IAAI,CAAC;IAuC7C,kBAAkB,IAAI,WAAW,CAAC,sBAAsB,GAAG,SAAS,CAAC;IAqBrE,uBAAuB,CACtB,OAAO,EAAE,gBAAgB,GACxB,WAAW,CAAC,sBAAsB,GAAG,SAAS,CAAC;CAoCnD;AAED,qBAAa,wBAAyB,SAAQ,gBAAgB;IAC5D,IAAa,2BAA2B,IAAI,OAAO,CAElD;IAED,cAAc,IAAI,qBAAqB;IAIvC,uBAAuB,CACrB,MAAM,EAAE,SAAS,EACjB,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE,GACzC,yBAAyB;IAItB,2BAA2B,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAoCrD,UAAU,IAAI,WAAW,CAAC,IAAI,CAAC;CAG1C"}
|
@@ -15,7 +15,7 @@
|
|
15
15
|
*/
|
16
16
|
import { DepotScope, LATEST_VERSION_ALIAS, } from '@finos/legend-server-depot';
|
17
17
|
import {} from '@finos/legend-application';
|
18
|
-
import { action, flow, makeObservable, observable } from 'mobx';
|
18
|
+
import { action, flow, flowResult, makeObservable, observable } from 'mobx';
|
19
19
|
import { QueryBuilderState, QueryBuilderDataBrowserWorkflow, } from '@finos/legend-query-builder';
|
20
20
|
import { ActionState, assertErrorThrown, guaranteeNonNullable, UnsupportedOperationError, } from '@finos/legend-shared';
|
21
21
|
import { extractDataSpaceInfo, } from '@finos/legend-extension-dsl-data-space/application';
|
@@ -24,6 +24,7 @@ import { QueryBuilderActionConfig_QueryApplication, QueryEditorStore, createView
|
|
24
24
|
import { generateDataSpaceQueryCreatorRoute } from '../../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
|
25
25
|
import { renderDataSpaceQuerySetupSetupPanelContent } from '../../components/data-space/DataSpaceQuerySetup.js';
|
26
26
|
import { DataSpaceAdvancedSearchState } from '@finos/legend-extension-dsl-data-space/application-query';
|
27
|
+
import { LegendQueryUserDataHelper } from '../../__lib__/LegendQueryUserDataHelper.js';
|
27
28
|
export class DataSpaceQuerySetupState extends QueryBuilderState {
|
28
29
|
editorStore;
|
29
30
|
depotServerClient;
|
@@ -42,7 +43,9 @@ export class DataSpaceQuerySetupState extends QueryBuilderState {
|
|
42
43
|
advancedSearchState: observable,
|
43
44
|
showAdvancedSearchPanel: action,
|
44
45
|
hideAdvancedSearchPanel: action,
|
45
|
-
|
46
|
+
initializeDataSpaceSetup: flow,
|
47
|
+
redirectIfPossible: flow,
|
48
|
+
hyrdateVisitedDataSpace: flow,
|
46
49
|
});
|
47
50
|
this.editorStore = editorStore;
|
48
51
|
this.workflowState.updateActionConfig(new QueryBuilderActionConfig_QueryApplication(editorStore));
|
@@ -66,9 +69,16 @@ export class DataSpaceQuerySetupState extends QueryBuilderState {
|
|
66
69
|
hideAdvancedSearchPanel() {
|
67
70
|
this.advancedSearchState = undefined;
|
68
71
|
}
|
69
|
-
*
|
72
|
+
*initializeDataSpaceSetup() {
|
70
73
|
this.loadDataSpacesState.inProgress();
|
71
74
|
try {
|
75
|
+
const hydrated = (yield flowResult(this.redirectIfPossible()));
|
76
|
+
if (hydrated) {
|
77
|
+
this.applicationStore.navigationService.navigator.goToLocation(generateDataSpaceQueryCreatorRoute(guaranteeNonNullable(hydrated.visited.groupId), guaranteeNonNullable(hydrated.visited.artifactId), hydrated.visited.versionId ?? LATEST_VERSION_ALIAS, hydrated.visited.path, hydrated.visited.execContext ??
|
78
|
+
hydrated.entity.content.defaultExecutionContext, undefined, undefined));
|
79
|
+
this.loadDataSpacesState.complete();
|
80
|
+
return;
|
81
|
+
}
|
72
82
|
this.dataSpaces = (yield this.depotServerClient.getEntitiesByClassifier(DATA_SPACE_ELEMENT_CLASSIFIER_PATH, {
|
73
83
|
scope: DepotScope.RELEASES,
|
74
84
|
})).map((storedEntity) => extractDataSpaceInfo(storedEntity, false));
|
@@ -80,6 +90,46 @@ export class DataSpaceQuerySetupState extends QueryBuilderState {
|
|
80
90
|
this.applicationStore.notificationService.notifyError(error);
|
81
91
|
}
|
82
92
|
}
|
93
|
+
*redirectIfPossible() {
|
94
|
+
const visitedQueries = LegendQueryUserDataHelper.getRecentlyVisitedDataSpaces(this.applicationStore.userDataService);
|
95
|
+
let redirect = undefined;
|
96
|
+
for (let i = 0; i < visitedQueries.length; i++) {
|
97
|
+
const visited = visitedQueries[i];
|
98
|
+
if (visited) {
|
99
|
+
const hydrated = (yield flowResult(this.hyrdateVisitedDataSpace(visited)));
|
100
|
+
if (hydrated) {
|
101
|
+
redirect = hydrated;
|
102
|
+
break;
|
103
|
+
}
|
104
|
+
}
|
105
|
+
}
|
106
|
+
return redirect;
|
107
|
+
}
|
108
|
+
*hyrdateVisitedDataSpace(visited) {
|
109
|
+
try {
|
110
|
+
const entity = (yield this.depotServerClient.getVersionEntity(visited.groupId, visited.artifactId, visited.versionId ?? LATEST_VERSION_ALIAS, visited.path));
|
111
|
+
const content = entity.content;
|
112
|
+
if (visited.execContext) {
|
113
|
+
const found = content.executionContexts.find((e) => e.name === visited.execContext);
|
114
|
+
if (!found) {
|
115
|
+
visited.execContext = undefined;
|
116
|
+
return {
|
117
|
+
visited,
|
118
|
+
entity,
|
119
|
+
};
|
120
|
+
}
|
121
|
+
}
|
122
|
+
return {
|
123
|
+
visited,
|
124
|
+
entity,
|
125
|
+
};
|
126
|
+
}
|
127
|
+
catch (error) {
|
128
|
+
assertErrorThrown(error);
|
129
|
+
LegendQueryUserDataHelper.removeRecentlyViewedDataSpace(this.applicationStore.userDataService, visited.id);
|
130
|
+
}
|
131
|
+
return undefined;
|
132
|
+
}
|
83
133
|
}
|
84
134
|
export class DataSpaceQuerySetupStore extends QueryEditorStore {
|
85
135
|
get isViewProjectActionDisabled() {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"DataSpaceQuerySetupState.js","sourceRoot":"","sources":["../../../src/stores/data-space/DataSpaceQuerySetupState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,UAAU,EACV,oBAAoB,GAGrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAsC,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;
|
1
|
+
{"version":3,"file":"DataSpaceQuerySetupState.js","sourceRoot":"","sources":["../../../src/stores/data-space/DataSpaceQuerySetupState.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,UAAU,EACV,oBAAoB,GAGrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAsC,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAC5E,OAAO,EAEL,iBAAiB,EACjB,+BAA+B,GAChC,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,yBAAyB,GAE1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,GAErB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,kCAAkC,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,EACL,yCAAyC,EACzC,gBAAgB,EAChB,wBAAwB,EACxB,4BAA4B,GAE7B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,kCAAkC,EAAE,MAAM,sDAAsD,CAAC;AAC1G,OAAO,EAAE,0CAA0C,EAAE,MAAM,oDAAoD,CAAC;AAChH,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AAExG,OAAO,EAAE,yBAAyB,EA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CAAC,OAAO,CAAC,EAC3C,oBAAoB,CAAC,aAAa,CAAC,UAAU,CAAC,EAC9C,oBAAoB,EAAE,0BAA0B;gBAChD,aAAa,CAAC,IAAI,EAClB,aAAa,CAAC,uBAAuB,EACrC,SAAS,EACT,SAAS,CACV,CACF,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,aAAa,CACrD,kEAAkE,CACnE,CAAC;YACJ,CAAC;QACH,CAAC,EACD,wBAAwB,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAC/C,4BAA4B,CAC1B,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,iBAAiB,CACvB,EACD,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,OAAO,CAAC,kBAAkB,CACxD,CAAC;QAEF,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IAEQ,CAAC,UAAU;QAClB,aAAa;IACf,CAAC;CACF"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@finos/legend-application-query",
|
3
|
-
"version": "13.4.
|
3
|
+
"version": "13.4.18",
|
4
4
|
"description": "Legend Query application core",
|
5
5
|
"keywords": [
|
6
6
|
"legend",
|
@@ -43,17 +43,17 @@
|
|
43
43
|
"test:watch": "jest --watch"
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
|
-
"@finos/legend-application": "15.1.
|
47
|
-
"@finos/legend-art": "7.1.
|
48
|
-
"@finos/legend-extension-dsl-data-space": "10.3.
|
49
|
-
"@finos/legend-graph": "31.10.
|
50
|
-
"@finos/legend-lego": "1.2.
|
51
|
-
"@finos/legend-query-builder": "4.14.
|
52
|
-
"@finos/legend-server-depot": "6.0.
|
53
|
-
"@finos/legend-shared": "10.0.
|
54
|
-
"@finos/legend-storage": "3.0.
|
46
|
+
"@finos/legend-application": "15.1.5",
|
47
|
+
"@finos/legend-art": "7.1.34",
|
48
|
+
"@finos/legend-extension-dsl-data-space": "10.3.17",
|
49
|
+
"@finos/legend-graph": "31.10.2",
|
50
|
+
"@finos/legend-lego": "1.2.35",
|
51
|
+
"@finos/legend-query-builder": "4.14.41",
|
52
|
+
"@finos/legend-server-depot": "6.0.43",
|
53
|
+
"@finos/legend-shared": "10.0.38",
|
54
|
+
"@finos/legend-storage": "3.0.88",
|
55
55
|
"@testing-library/react": "15.0.7",
|
56
|
-
"@types/react": "18.3.
|
56
|
+
"@types/react": "18.3.3",
|
57
57
|
"@types/react-dom": "18.3.0",
|
58
58
|
"mobx": "6.12.3",
|
59
59
|
"mobx-react-lite": "4.0.7",
|
@@ -62,14 +62,14 @@
|
|
62
62
|
"serializr": "3.0.2"
|
63
63
|
},
|
64
64
|
"devDependencies": {
|
65
|
-
"@finos/legend-dev-utils": "2.1.
|
65
|
+
"@finos/legend-dev-utils": "2.1.6",
|
66
66
|
"@jest/globals": "29.7.0",
|
67
67
|
"cross-env": "7.0.3",
|
68
68
|
"eslint": "8.57.0",
|
69
69
|
"jest": "29.7.0",
|
70
70
|
"npm-run-all": "4.1.5",
|
71
71
|
"rimraf": "5.0.7",
|
72
|
-
"sass": "1.77.
|
72
|
+
"sass": "1.77.3",
|
73
73
|
"typescript": "5.4.5"
|
74
74
|
},
|
75
75
|
"peerDependencies": {
|
@@ -16,22 +16,38 @@
|
|
16
16
|
|
17
17
|
import type { UserDataService } from '@finos/legend-application';
|
18
18
|
import { returnUndefOnError } from '@finos/legend-shared';
|
19
|
-
import {
|
19
|
+
import {
|
20
|
+
createSimpleSchema,
|
21
|
+
deserialize,
|
22
|
+
list,
|
23
|
+
primitive,
|
24
|
+
raw,
|
25
|
+
} from 'serializr';
|
26
|
+
import {
|
27
|
+
createVisitedDataspaceFromInfo,
|
28
|
+
createIdFromDataSpaceInfo,
|
29
|
+
createVisitedDataSpaceId,
|
30
|
+
type SavedVisitedDataSpaces,
|
31
|
+
type VisitedDataspace,
|
32
|
+
} from './LegendQueryUserDataSpaceHelper.js';
|
33
|
+
import type { DataSpaceInfo } from '@finos/legend-extension-dsl-data-space/application';
|
20
34
|
|
21
35
|
export enum LEGEND_QUERY_USER_DATA_KEY {
|
22
36
|
RECENTLY_VIEWED_QUERIES = 'query-editor.recent-queries',
|
37
|
+
RECENTLY_VIEWED_DATASPACES = 'query-editor.recent-dataSpaces',
|
23
38
|
}
|
24
39
|
|
25
|
-
const USER_DATA_RECENTLY_VIEWED_QUERIES_LIMIT = 10;
|
26
|
-
|
40
|
+
export const USER_DATA_RECENTLY_VIEWED_QUERIES_LIMIT = 10;
|
41
|
+
export const USER_DATA_QUERY_DATASPACE_LIMIT = 10;
|
42
|
+
|
43
|
+
type SavedData = string[];
|
27
44
|
|
28
45
|
export class LegendQueryUserDataHelper {
|
29
|
-
static
|
46
|
+
static getPersistedData(
|
30
47
|
service: UserDataService,
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
);
|
48
|
+
key: LEGEND_QUERY_USER_DATA_KEY,
|
49
|
+
): SavedData {
|
50
|
+
const data = service.getObjectValue(key);
|
35
51
|
return (
|
36
52
|
// TODO: think of a better way to deserialize this data, maybe like settings, use JSON schema
|
37
53
|
// See https://github.com/finos/legend-studio/issues/407
|
@@ -45,12 +61,41 @@ export class LegendQueryUserDataHelper {
|
|
45
61
|
{
|
46
62
|
data,
|
47
63
|
},
|
48
|
-
) as { data:
|
64
|
+
) as { data: SavedData }
|
49
65
|
).data,
|
50
66
|
) ?? []
|
51
67
|
);
|
52
68
|
}
|
53
69
|
|
70
|
+
static persistValue(
|
71
|
+
service: UserDataService,
|
72
|
+
value: string,
|
73
|
+
persistedData: SavedData,
|
74
|
+
opts: {
|
75
|
+
key: LEGEND_QUERY_USER_DATA_KEY;
|
76
|
+
limit: number;
|
77
|
+
},
|
78
|
+
): void {
|
79
|
+
const idx = persistedData.findIndex((data) => data === value);
|
80
|
+
if (idx === -1) {
|
81
|
+
if (persistedData.length >= opts.limit) {
|
82
|
+
persistedData.pop();
|
83
|
+
}
|
84
|
+
persistedData.unshift(value);
|
85
|
+
} else {
|
86
|
+
persistedData.splice(idx, 1);
|
87
|
+
persistedData.unshift(value);
|
88
|
+
}
|
89
|
+
service.persistValue(opts.key, persistedData);
|
90
|
+
}
|
91
|
+
|
92
|
+
static getRecentlyViewedQueries(service: UserDataService): SavedData {
|
93
|
+
return LegendQueryUserDataHelper.getPersistedData(
|
94
|
+
service,
|
95
|
+
LEGEND_QUERY_USER_DATA_KEY.RECENTLY_VIEWED_QUERIES,
|
96
|
+
);
|
97
|
+
}
|
98
|
+
|
54
99
|
static removeRecentlyViewedQueries(service: UserDataService): void {
|
55
100
|
service.persistValue(
|
56
101
|
LEGEND_QUERY_USER_DATA_KEY.RECENTLY_VIEWED_QUERIES,
|
@@ -79,21 +124,150 @@ export class LegendQueryUserDataHelper {
|
|
79
124
|
queryId: string,
|
80
125
|
): void {
|
81
126
|
const queries = LegendQueryUserDataHelper.getRecentlyViewedQueries(service);
|
82
|
-
|
127
|
+
LegendQueryUserDataHelper.persistValue(service, queryId, queries, {
|
128
|
+
limit: USER_DATA_RECENTLY_VIEWED_QUERIES_LIMIT,
|
129
|
+
key: LEGEND_QUERY_USER_DATA_KEY.RECENTLY_VIEWED_QUERIES,
|
130
|
+
});
|
131
|
+
}
|
132
|
+
// DataSpaces
|
133
|
+
static getRecentlyVisitedDataSpaces(
|
134
|
+
service: UserDataService,
|
135
|
+
): SavedVisitedDataSpaces {
|
136
|
+
const data = service.getObjectValue(
|
137
|
+
LEGEND_QUERY_USER_DATA_KEY.RECENTLY_VIEWED_DATASPACES,
|
138
|
+
);
|
139
|
+
return (
|
140
|
+
// TODO: think of a better way to deserialize this data, maybe like settings, use JSON schema
|
141
|
+
// See https://github.com/finos/legend-studio/issues/407
|
142
|
+
returnUndefOnError(
|
143
|
+
() =>
|
144
|
+
(
|
145
|
+
deserialize(
|
146
|
+
createSimpleSchema({
|
147
|
+
data: raw(),
|
148
|
+
}),
|
149
|
+
{
|
150
|
+
data,
|
151
|
+
},
|
152
|
+
) as { data: SavedVisitedDataSpaces }
|
153
|
+
).data,
|
154
|
+
) ?? []
|
155
|
+
);
|
156
|
+
}
|
157
|
+
|
158
|
+
static findRecentlyVisitedDataSpace(
|
159
|
+
service: UserDataService,
|
160
|
+
id: string,
|
161
|
+
): VisitedDataspace | undefined {
|
162
|
+
return LegendQueryUserDataHelper.getRecentlyVisitedDataSpaces(service).find(
|
163
|
+
(v) => v.id === id,
|
164
|
+
);
|
165
|
+
}
|
166
|
+
|
167
|
+
static getRecentlyVisitedDataSpace(
|
168
|
+
service: UserDataService,
|
169
|
+
): VisitedDataspace | undefined {
|
170
|
+
return LegendQueryUserDataHelper.getRecentlyVisitedDataSpaces(service)[0];
|
171
|
+
}
|
172
|
+
|
173
|
+
static persistVisitedDataspace(
|
174
|
+
service: UserDataService,
|
175
|
+
value: VisitedDataspace,
|
176
|
+
persistedData: SavedVisitedDataSpaces,
|
177
|
+
limit = USER_DATA_QUERY_DATASPACE_LIMIT,
|
178
|
+
): void {
|
179
|
+
const key = LEGEND_QUERY_USER_DATA_KEY.RECENTLY_VIEWED_DATASPACES;
|
180
|
+
const idx = persistedData.findIndex((data) => data.id === value.id);
|
83
181
|
if (idx === -1) {
|
84
|
-
if (
|
85
|
-
|
86
|
-
} else {
|
87
|
-
queries.pop();
|
88
|
-
queries.unshift(queryId);
|
182
|
+
if (persistedData.length >= limit) {
|
183
|
+
persistedData.pop();
|
89
184
|
}
|
185
|
+
persistedData.unshift(value);
|
90
186
|
} else {
|
91
|
-
|
92
|
-
|
187
|
+
persistedData.splice(idx, 1);
|
188
|
+
persistedData.unshift(value);
|
93
189
|
}
|
190
|
+
service.persistValue(key, persistedData);
|
191
|
+
}
|
192
|
+
|
193
|
+
static removeRecentlyViewedDataSpaces(service: UserDataService): void {
|
194
|
+
service.persistValue(
|
195
|
+
LEGEND_QUERY_USER_DATA_KEY.RECENTLY_VIEWED_DATASPACES,
|
196
|
+
[],
|
197
|
+
);
|
198
|
+
}
|
199
|
+
|
200
|
+
static removeRecentlyViewedDataSpace(
|
201
|
+
service: UserDataService,
|
202
|
+
id: string,
|
203
|
+
): void {
|
204
|
+
const dataSpaces =
|
205
|
+
LegendQueryUserDataHelper.getRecentlyVisitedDataSpaces(service);
|
206
|
+
const idx = dataSpaces.findIndex(
|
207
|
+
(visitedDataspace) => visitedDataspace.id === id,
|
208
|
+
);
|
209
|
+
if (idx === -1) {
|
210
|
+
return;
|
211
|
+
}
|
212
|
+
dataSpaces.splice(idx, 1);
|
94
213
|
service.persistValue(
|
95
214
|
LEGEND_QUERY_USER_DATA_KEY.RECENTLY_VIEWED_QUERIES,
|
96
|
-
|
215
|
+
dataSpaces,
|
97
216
|
);
|
98
217
|
}
|
218
|
+
|
219
|
+
static removeDataSpace(service: UserDataService, info: DataSpaceInfo): void {
|
220
|
+
const id = createIdFromDataSpaceInfo(info);
|
221
|
+
if (id) {
|
222
|
+
LegendQueryUserDataHelper.removeRecentlyViewedDataSpace(service, id);
|
223
|
+
}
|
224
|
+
}
|
225
|
+
|
226
|
+
static addRecentlyVistedDatspace(
|
227
|
+
service: UserDataService,
|
228
|
+
info: DataSpaceInfo,
|
229
|
+
execContext: string | undefined,
|
230
|
+
): void {
|
231
|
+
const visited = createVisitedDataspaceFromInfo(info, execContext);
|
232
|
+
if (visited) {
|
233
|
+
const dataspaces =
|
234
|
+
LegendQueryUserDataHelper.getRecentlyVisitedDataSpaces(service);
|
235
|
+
LegendQueryUserDataHelper.persistVisitedDataspace(
|
236
|
+
service,
|
237
|
+
visited,
|
238
|
+
dataspaces,
|
239
|
+
);
|
240
|
+
}
|
241
|
+
}
|
242
|
+
static addVisitedDatspace(
|
243
|
+
service: UserDataService,
|
244
|
+
visited: VisitedDataspace,
|
245
|
+
): void {
|
246
|
+
const dataspaces =
|
247
|
+
LegendQueryUserDataHelper.getRecentlyVisitedDataSpaces(service);
|
248
|
+
LegendQueryUserDataHelper.persistVisitedDataspace(
|
249
|
+
service,
|
250
|
+
visited,
|
251
|
+
dataspaces,
|
252
|
+
);
|
253
|
+
}
|
254
|
+
|
255
|
+
static updateVisitedDataSpaceExecContext(
|
256
|
+
service: UserDataService,
|
257
|
+
groupId: string,
|
258
|
+
artifactId: string,
|
259
|
+
dataspace: string,
|
260
|
+
exec: string,
|
261
|
+
): boolean {
|
262
|
+
const visited = LegendQueryUserDataHelper.findRecentlyVisitedDataSpace(
|
263
|
+
service,
|
264
|
+
createVisitedDataSpaceId(groupId, artifactId, dataspace),
|
265
|
+
);
|
266
|
+
if (visited) {
|
267
|
+
visited.execContext = exec;
|
268
|
+
LegendQueryUserDataHelper.addVisitedDatspace(service, visited);
|
269
|
+
return true;
|
270
|
+
}
|
271
|
+
return false;
|
272
|
+
}
|
99
273
|
}
|