@finos/legend-application-query 12.0.9 → 13.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.
- package/lib/__lib__/LegendQueryEvent.d.ts +1 -0
- 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__/LegendQueryTelemetryHelper.d.ts +7 -6
- package/lib/__lib__/LegendQueryTelemetryHelper.d.ts.map +1 -1
- package/lib/__lib__/LegendQueryTelemetryHelper.js +15 -12
- package/lib/__lib__/LegendQueryTelemetryHelper.js.map +1 -1
- package/lib/__lib__/LegendQueryUserDataHelper.d.ts +27 -0
- package/lib/__lib__/LegendQueryUserDataHelper.d.ts.map +1 -0
- package/lib/__lib__/LegendQueryUserDataHelper.js +63 -0
- package/lib/__lib__/LegendQueryUserDataHelper.js.map +1 -0
- package/lib/components/EditExistingQuerySetup.d.ts.map +1 -1
- package/lib/components/EditExistingQuerySetup.js +7 -71
- package/lib/components/EditExistingQuerySetup.js.map +1 -1
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +47 -97
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/QueryProductionizerSetup.d.ts.map +1 -1
- package/lib/components/QueryProductionizerSetup.js +6 -47
- package/lib/components/QueryProductionizerSetup.js.map +1 -1
- package/lib/components/QuerySetup.d.ts +3 -3
- package/lib/components/QuerySetup.d.ts.map +1 -1
- package/lib/components/QuerySetup.js +1 -1
- package/lib/components/QuerySetup.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/EditExistingQuerySetupStore.d.ts +3 -12
- package/lib/stores/EditExistingQuerySetupStore.d.ts.map +1 -1
- package/lib/stores/EditExistingQuerySetupStore.js +27 -64
- package/lib/stores/EditExistingQuerySetupStore.js.map +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.d.ts +4 -3
- package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/stores/QueryEditorStore.d.ts +25 -39
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +44 -81
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/QueryProductionizerSetupStore.d.ts +4 -10
- package/lib/stores/QueryProductionizerSetupStore.d.ts.map +1 -1
- package/lib/stores/QueryProductionizerSetupStore.js +29 -62
- package/lib/stores/QueryProductionizerSetupStore.js.map +1 -1
- package/lib/stores/QuerySetupStore.d.ts.map +1 -1
- package/lib/stores/QuerySetupStore.js +4 -1
- package/lib/stores/QuerySetupStore.js.map +1 -1
- package/package.json +10 -10
- package/src/__lib__/LegendQueryEvent.ts +1 -0
- package/src/__lib__/LegendQueryTelemetryHelper.ts +19 -26
- package/src/__lib__/LegendQueryUserDataHelper.ts +92 -0
- package/src/components/EditExistingQuerySetup.tsx +10 -204
- package/src/components/QueryEditor.tsx +87 -291
- package/src/components/QueryProductionizerSetup.tsx +9 -124
- package/src/components/QuerySetup.tsx +1 -1
- package/src/index.ts +4 -1
- package/src/stores/EditExistingQuerySetupStore.ts +54 -87
- package/src/stores/LegendQueryApplicationPlugin.ts +4 -3
- package/src/stores/QueryEditorStore.ts +91 -107
- package/src/stores/QueryProductionizerSetupStore.ts +55 -84
- package/src/stores/QuerySetupStore.ts +10 -1
- package/tsconfig.json +1 -0
@@ -13,36 +13,44 @@
|
|
13
13
|
* See the License for the specific language governing permissions and
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
|
-
import {
|
17
|
-
import { QuerySearchSpecification, } from '@finos/legend-graph';
|
16
|
+
import { QueryLoaderState } from '@finos/legend-query-builder';
|
18
17
|
import { StoreProjectData, } from '@finos/legend-server-depot';
|
19
|
-
import { ActionState, assertErrorThrown, } from '@finos/legend-shared';
|
20
18
|
import { parseProjectIdentifier } from '@finos/legend-storage';
|
21
|
-
import { flow, makeObservable, observable } from 'mobx';
|
22
19
|
import { EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl } from '../__lib__/LegendQueryNavigation.js';
|
23
20
|
import { BaseQuerySetupStore } from './QuerySetupStore.js';
|
21
|
+
import { LegendQueryUserDataHelper } from '../__lib__/LegendQueryUserDataHelper.js';
|
22
|
+
import { quantifyList } from '@finos/legend-shared';
|
23
|
+
import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
|
24
24
|
export class QueryProductionizerSetupStore extends BaseQuerySetupStore {
|
25
|
-
|
26
|
-
loadQueryState = ActionState.create();
|
27
|
-
queries = [];
|
28
|
-
currentQuery;
|
29
|
-
currentQueryInfo;
|
25
|
+
queryLoaderState;
|
30
26
|
constructor(applicationStore, depotServerClient) {
|
31
27
|
super(applicationStore, depotServerClient);
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
28
|
+
this.queryLoaderState = new QueryLoaderState(applicationStore, this.graphManagerState, {
|
29
|
+
loadQuery: (query) => {
|
30
|
+
this.queryLoaderState.setQueryLoaderDialogOpen(false);
|
31
|
+
this.loadQueryProductionizer(query).catch(applicationStore.alertUnhandledError);
|
32
|
+
},
|
33
|
+
fetchDefaultQueries: () => this.graphManagerState.graphManager.getQueries(LegendQueryUserDataHelper.getRecentlyViewedQueries(this.applicationStore.userDataService)),
|
34
|
+
generateDefaultQueriesSummaryText: (queries) => queries.length
|
35
|
+
? `Showing ${quantifyList(queries, 'recently viewed query', 'recently viewed queries')}`
|
36
|
+
: `No recently viewed queries`,
|
37
|
+
onQueryDeleted: (query) => LegendQueryUserDataHelper.removeRecentlyViewedQuery(this.applicationStore.userDataService, query.id),
|
38
|
+
onQueryRenamed: (query) => {
|
39
|
+
LegendQueryTelemetryHelper.logEvent_RenameQuerySucceeded(applicationStore.telemetryService, {
|
40
|
+
query: {
|
41
|
+
id: query.id,
|
42
|
+
name: query.name,
|
43
|
+
groupId: query.groupId,
|
44
|
+
artifactId: query.artifactId,
|
45
|
+
versionId: query.versionId,
|
46
|
+
},
|
47
|
+
});
|
48
|
+
},
|
38
49
|
});
|
39
50
|
}
|
40
|
-
async loadQueryProductionizer() {
|
41
|
-
if (!this.currentQuery) {
|
42
|
-
return;
|
43
|
-
}
|
51
|
+
async loadQueryProductionizer(selectedQuery) {
|
44
52
|
// fetch project data
|
45
|
-
const project = StoreProjectData.serialization.fromJson(await this.depotServerClient.getProject(
|
53
|
+
const project = StoreProjectData.serialization.fromJson(await this.depotServerClient.getProject(selectedQuery.groupId, selectedQuery.artifactId));
|
46
54
|
// find the matching SDLC instance
|
47
55
|
const projectIDPrefix = parseProjectIdentifier(project.projectId).prefix;
|
48
56
|
const matchingSDLCEntry = this.applicationStore.config.studioInstances.find((entry) => entry.sdlcProjectIDPrefix === projectIDPrefix);
|
@@ -52,52 +60,11 @@ export class QueryProductionizerSetupStore extends BaseQuerySetupStore {
|
|
52
60
|
prompt: 'Please do not close the application',
|
53
61
|
showLoading: true,
|
54
62
|
});
|
55
|
-
this.applicationStore.navigationService.navigator.goToAddress(EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl(matchingSDLCEntry.url,
|
63
|
+
this.applicationStore.navigationService.navigator.goToAddress(EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl(matchingSDLCEntry.url, selectedQuery.id));
|
56
64
|
}
|
57
65
|
else {
|
58
66
|
this.applicationStore.notificationService.notifyWarning(`Can't find the corresponding SDLC instance to productionize the query`);
|
59
67
|
}
|
60
68
|
}
|
61
|
-
*setCurrentQuery(queryId) {
|
62
|
-
if (queryId) {
|
63
|
-
try {
|
64
|
-
this.loadQueryState.inProgress();
|
65
|
-
this.currentQuery =
|
66
|
-
(yield this.graphManagerState.graphManager.getLightQuery(queryId));
|
67
|
-
const queryInfo = (yield this.graphManagerState.graphManager.getQueryInfo(queryId));
|
68
|
-
queryInfo.content =
|
69
|
-
(yield this.graphManagerState.graphManager.prettyLambdaContent(queryInfo.content));
|
70
|
-
this.currentQueryInfo = queryInfo;
|
71
|
-
}
|
72
|
-
catch (error) {
|
73
|
-
assertErrorThrown(error);
|
74
|
-
this.applicationStore.notificationService.notifyError(error);
|
75
|
-
}
|
76
|
-
finally {
|
77
|
-
this.loadQueryState.reset();
|
78
|
-
}
|
79
|
-
}
|
80
|
-
else {
|
81
|
-
this.currentQuery = undefined;
|
82
|
-
}
|
83
|
-
}
|
84
|
-
*loadQueries(searchText) {
|
85
|
-
const isValidSearchString = searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
|
86
|
-
this.loadQueriesState.inProgress();
|
87
|
-
try {
|
88
|
-
const searchSpecification = new QuerySearchSpecification();
|
89
|
-
searchSpecification.searchTerm = isValidSearchString
|
90
|
-
? searchText
|
91
|
-
: undefined;
|
92
|
-
searchSpecification.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
|
93
|
-
this.queries = (yield this.graphManagerState.graphManager.searchQueries(searchSpecification));
|
94
|
-
this.loadQueriesState.pass();
|
95
|
-
}
|
96
|
-
catch (error) {
|
97
|
-
assertErrorThrown(error);
|
98
|
-
this.applicationStore.notificationService.notifyError(error);
|
99
|
-
this.loadQueriesState.fail();
|
100
|
-
}
|
101
|
-
}
|
102
69
|
}
|
103
70
|
//# sourceMappingURL=QueryProductionizerSetupStore.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryProductionizerSetupStore.js","sourceRoot":"","sources":["../../src/stores/QueryProductionizerSetupStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
1
|
+
{"version":3,"file":"QueryProductionizerSetupStore.js","sourceRoot":"","sources":["../../src/stores/QueryProductionizerSetup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,CAAC;YACH,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,SAAS,CAAC,WAAW,CAC3D,oEAAoE,CAClE,iBAAiB,CAAC,GAAG,EACrB,aAAa,CAAC,EAAE,CACjB,CACF,CAAC;SACH;aAAM;YACL,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,aAAa,CACrD,uEAAuE,CACxE,CAAC;SACH;IACH,CAAC;CACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QuerySetupStore.d.ts","sourceRoot":"","sources":["../../src/stores/QuerySetupStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,KAAK,WAAW,EAChB,WAAW,EAKZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;
|
1
|
+
{"version":3,"file":"QuerySetupStore.d.ts","sourceRoot":"","sources":["../../src/stores/QuerySetupStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,KAAK,WAAW,EAChB,WAAW,EAKZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAMpE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAC3F,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAE7E,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,mCAAmC,CAAC;AAEvF,8BAAsB,mBAAmB;IACvC,QAAQ,CAAC,gBAAgB,EAAE,2BAA2B,CAAC;IACvD,QAAQ,CAAC,iBAAiB,EAAE,sBAAsB,CAAC;IACnD,QAAQ,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAC9C,QAAQ,CAAC,aAAa,EAAE,wBAAwB,CAAC;IAEjD,QAAQ,CAAC,SAAS,cAAwB;gBAGxC,gBAAgB,EAAE,2BAA2B,EAC7C,iBAAiB,EAAE,iBAAiB;IAerC,UAAU,IAAI,WAAW,CAAC,IAAI,CAAC;CAyCjC;AAED,qBAAa,0BAA0B;IACrC,QAAQ,CAAC,gBAAgB,EAAE,2BAA2B,CAAC;IACvD,QAAQ,CAAC,aAAa,EAAE,wBAAwB,CAAC;IAEjD,QAAQ,CAAC,SAAS,cAAwB;IAE1C,OAAO,EAAE,6BAA6B,EAAE,CAAM;IAC9C,IAAI,EAAE,MAAM,EAAE,CAAM;IACpB,aAAa,UAAS;IACtB,mBAAmB,UAAS;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;gBAEpB,gBAAgB,EAAE,2BAA2B;IAyBzD,IAAI,YAAY,IAAI,OAAO,CAI1B;IAED,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAKpC,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI;IAK1C,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAQ5C,WAAW,IAAI,IAAI;IAOnB,OAAO,CAAC,oBAAoB;IAU5B,UAAU,CACR,mBAAmB,EAAE,MAAM,GAAG,SAAS,EACvC,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,UAAU,EAAE,MAAM,GAAG,SAAS,GAC7B,IAAI;CAkBR"}
|
@@ -17,7 +17,7 @@ import { action, computed, flow, makeObservable, observable } from 'mobx';
|
|
17
17
|
import { ActionState, assertErrorThrown, LogEvent, uniq, isNonNullable, } from '@finos/legend-shared';
|
18
18
|
import { BasicGraphManagerState } from '@finos/legend-graph';
|
19
19
|
import { LEGEND_QUERY_APP_EVENT } from '../__lib__/LegendQueryEvent.js';
|
20
|
-
import { DEFAULT_TAB_SIZE } from '@finos/legend-application';
|
20
|
+
import { DEFAULT_TAB_SIZE, LEGEND_APPLICATION_COLOR_THEME, } from '@finos/legend-application';
|
21
21
|
import { generateQuerySetupRoute } from '../__lib__/LegendQueryNavigation.js';
|
22
22
|
export class BaseQuerySetupStore {
|
23
23
|
applicationStore;
|
@@ -38,6 +38,9 @@ export class BaseQuerySetupStore {
|
|
38
38
|
if (!this.initState.isInInitialState) {
|
39
39
|
return;
|
40
40
|
}
|
41
|
+
// TODO?: remove this when we properly support theme everywhere
|
42
|
+
// See https://github.com/finos/legend-studio/issues/264
|
43
|
+
this.applicationStore.layoutService.setColorTheme(LEGEND_APPLICATION_COLOR_THEME.DEFAULT_DARK);
|
41
44
|
try {
|
42
45
|
this.initState.inProgress();
|
43
46
|
yield this.graphManagerState.graphManager.initialize({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QuerySetupStore.js","sourceRoot":"","sources":["../../src/stores/QuerySetupStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAC1E,OAAO,EAEL,WAAW,EACX,iBAAiB,EACjB,QAAQ,EACR,IAAI,EACJ,aAAa,GACd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AACxE,OAAO,
|
1
|
+
{"version":3,"file":"QuerySetupStore.js","sourceRoot":"","sources":["../../src/stores/QuerySetupStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAC1E,OAAO,EAEL,WAAW,EACX,iBAAiB,EACjB,QAAQ,EACR,IAAI,EACJ,aAAa,GACd,MAAM,sBAAsB,CA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AI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED,WAAW;QACT,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC,CAAC;QACnC,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;QAC9B,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAEO,oBAAoB;QAC1B,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,SAAS,CAAC,qBAAqB,CACrE,uBAAuB,CACrB,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,mBAAmB,EACxB,IAAI,CAAC,UAAU,CAChB,CACF,CAAC;IACJ,CAAC;IAED,UAAU,CACR,mBAAuC,EACvC,aAAiC,EACjC,UAA8B;QAE9B,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,gBAAgB,EAAE;YACpC,OAAO;SACR;QAED,IAAI,mBAAmB,EAAE;YACvB,IAAI,CAAC,mBAAmB,GAAG,mBAAmB,KAAK,OAAO,CAAC;SAC5D;QACD,IAAI,aAAa,EAAE;YACjB,IAAI,CAAC,aAAa,GAAG,aAAa,KAAK,OAAO,CAAC;SAChD;QACD,IAAI,UAAU,EAAE;YACd,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;SAC3E;QACD,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAE5B,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IACxB,CAAC;CACF"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@finos/legend-application-query",
|
3
|
-
"version": "
|
3
|
+
"version": "13.0.1",
|
4
4
|
"description": "Legend Query application core",
|
5
5
|
"keywords": [
|
6
6
|
"legend",
|
@@ -43,14 +43,14 @@
|
|
43
43
|
"test:watch": "jest --watch"
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
|
-
"@finos/legend-application": "15.0.
|
47
|
-
"@finos/legend-art": "7.0.
|
48
|
-
"@finos/legend-graph": "28.1.
|
49
|
-
"@finos/legend-lego": "0.
|
50
|
-
"@finos/legend-query-builder": "3.1
|
51
|
-
"@finos/legend-server-depot": "6.0.
|
52
|
-
"@finos/legend-shared": "10.0.
|
53
|
-
"@finos/legend-storage": "3.0.
|
46
|
+
"@finos/legend-application": "15.0.8",
|
47
|
+
"@finos/legend-art": "7.0.9",
|
48
|
+
"@finos/legend-graph": "28.1.5",
|
49
|
+
"@finos/legend-lego": "1.0.0",
|
50
|
+
"@finos/legend-query-builder": "3.2.1",
|
51
|
+
"@finos/legend-server-depot": "6.0.5",
|
52
|
+
"@finos/legend-shared": "10.0.4",
|
53
|
+
"@finos/legend-storage": "3.0.54",
|
54
54
|
"@testing-library/react": "14.0.0",
|
55
55
|
"@types/react": "18.2.0",
|
56
56
|
"@types/react-dom": "18.2.1",
|
@@ -61,7 +61,7 @@
|
|
61
61
|
"serializr": "3.0.2"
|
62
62
|
},
|
63
63
|
"devDependencies": {
|
64
|
-
"@finos/legend-dev-utils": "2.0.
|
64
|
+
"@finos/legend-dev-utils": "2.0.58",
|
65
65
|
"@jest/globals": "29.5.0",
|
66
66
|
"cross-env": "7.0.3",
|
67
67
|
"eslint": "8.39.0",
|
@@ -21,6 +21,7 @@ export enum LEGEND_QUERY_APP_EVENT {
|
|
21
21
|
VIEW_QUERY__SUCCESS = 'query-editor.view-query.success',
|
22
22
|
CREATE_QUERY__SUCCESS = 'query-editor.create-query.success',
|
23
23
|
UPDATE_QUERY__SUCCESS = 'query-editor.update-query.success',
|
24
|
+
RENAME_QUERY__SUCCESS = 'query-editor.rename.query.success',
|
24
25
|
|
25
26
|
VIEW_PROJECT__LAUNCH = 'query-editor.view-project.launch',
|
26
27
|
VIEW_SDLC_PROJECT__LAUNCH = 'query-editor.view-sdlc-project.launch',
|
@@ -33,54 +33,47 @@ type Query_TelemetryData = {
|
|
33
33
|
|
34
34
|
export class LegendQueryTelemetryHelper {
|
35
35
|
static logEvent_ViewQuerySucceeded(
|
36
|
-
|
36
|
+
service: TelemetryService,
|
37
37
|
data: Query_TelemetryData,
|
38
38
|
): void {
|
39
|
-
|
39
|
+
service.logEvent(LEGEND_QUERY_APP_EVENT.VIEW_QUERY__SUCCESS, data);
|
40
40
|
}
|
41
41
|
|
42
42
|
static logEvent_CreateQuerySucceeded(
|
43
|
-
|
43
|
+
service: TelemetryService,
|
44
44
|
data: Query_TelemetryData,
|
45
45
|
): void {
|
46
|
-
|
47
|
-
LEGEND_QUERY_APP_EVENT.CREATE_QUERY__SUCCESS,
|
48
|
-
data,
|
49
|
-
);
|
46
|
+
service.logEvent(LEGEND_QUERY_APP_EVENT.CREATE_QUERY__SUCCESS, data);
|
50
47
|
}
|
51
48
|
|
52
49
|
static logEvent_UpdateQuerySucceeded(
|
53
|
-
|
50
|
+
service: TelemetryService,
|
54
51
|
data: Query_TelemetryData,
|
55
52
|
): void {
|
56
|
-
|
57
|
-
LEGEND_QUERY_APP_EVENT.UPDATE_QUERY__SUCCESS,
|
58
|
-
data,
|
59
|
-
);
|
53
|
+
service.logEvent(LEGEND_QUERY_APP_EVENT.UPDATE_QUERY__SUCCESS, data);
|
60
54
|
}
|
61
55
|
|
62
|
-
static logEvent_QueryViewProjectLaunched(
|
63
|
-
|
64
|
-
): void {
|
65
|
-
telemetryService.logEvent(LEGEND_QUERY_APP_EVENT.VIEW_PROJECT__LAUNCH, {});
|
56
|
+
static logEvent_QueryViewProjectLaunched(service: TelemetryService): void {
|
57
|
+
service.logEvent(LEGEND_QUERY_APP_EVENT.VIEW_PROJECT__LAUNCH, {});
|
66
58
|
}
|
67
59
|
|
68
60
|
static logEvent_QueryViewSdlcProjectLaunched(
|
69
|
-
|
61
|
+
service: TelemetryService,
|
70
62
|
): void {
|
71
|
-
|
72
|
-
LEGEND_QUERY_APP_EVENT.VIEW_SDLC_PROJECT__LAUNCH,
|
73
|
-
{},
|
74
|
-
);
|
63
|
+
service.logEvent(LEGEND_QUERY_APP_EVENT.VIEW_SDLC_PROJECT__LAUNCH, {});
|
75
64
|
}
|
76
65
|
|
77
66
|
static logEvent_GraphInitializationSucceeded(
|
78
|
-
|
67
|
+
service: TelemetryService,
|
79
68
|
data: GraphInitializationReport,
|
80
69
|
): void {
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
70
|
+
service.logEvent(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS, data);
|
71
|
+
}
|
72
|
+
|
73
|
+
static logEvent_RenameQuerySucceeded(
|
74
|
+
service: TelemetryService,
|
75
|
+
data: Query_TelemetryData,
|
76
|
+
): void {
|
77
|
+
service.logEvent(LEGEND_QUERY_APP_EVENT.RENAME_QUERY__SUCCESS, data);
|
85
78
|
}
|
86
79
|
}
|
@@ -0,0 +1,92 @@
|
|
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 type { UserDataService } from '@finos/legend-application';
|
18
|
+
import { returnUndefOnError } from '@finos/legend-shared';
|
19
|
+
import { createSimpleSchema, deserialize, list, primitive } from 'serializr';
|
20
|
+
|
21
|
+
export enum LEGEND_QUERY_USER_DATA_KEY {
|
22
|
+
RECENTLY_VIEWED_QUERIES = 'query-editor.recent-queries',
|
23
|
+
}
|
24
|
+
|
25
|
+
const USER_DATA_RECENTLY_VIEWED_QUERIES_LIMIT = 10;
|
26
|
+
type RecentlyViewedQueriesData = string[];
|
27
|
+
|
28
|
+
export class LegendQueryUserDataHelper {
|
29
|
+
static getRecentlyViewedQueries(
|
30
|
+
service: UserDataService,
|
31
|
+
): RecentlyViewedQueriesData {
|
32
|
+
const data = service.getObjectValue(
|
33
|
+
LEGEND_QUERY_USER_DATA_KEY.RECENTLY_VIEWED_QUERIES,
|
34
|
+
);
|
35
|
+
return (
|
36
|
+
// TODO: think of a better way to deserialize this data, maybe like settings, use JSON schema
|
37
|
+
// See https://github.com/finos/legend-studio/issues/407
|
38
|
+
returnUndefOnError(
|
39
|
+
() =>
|
40
|
+
(
|
41
|
+
deserialize(
|
42
|
+
createSimpleSchema({
|
43
|
+
data: list(primitive()),
|
44
|
+
}),
|
45
|
+
{
|
46
|
+
data,
|
47
|
+
},
|
48
|
+
) as { data: RecentlyViewedQueriesData }
|
49
|
+
).data,
|
50
|
+
) ?? []
|
51
|
+
);
|
52
|
+
}
|
53
|
+
|
54
|
+
static removeRecentlyViewedQuery(
|
55
|
+
service: UserDataService,
|
56
|
+
queryId: string,
|
57
|
+
): void {
|
58
|
+
const queries = LegendQueryUserDataHelper.getRecentlyViewedQueries(service);
|
59
|
+
const idx = queries.findIndex((query) => query === queryId);
|
60
|
+
if (idx !== -1) {
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
queries.splice(idx, 1);
|
64
|
+
service.persistValue(
|
65
|
+
LEGEND_QUERY_USER_DATA_KEY.RECENTLY_VIEWED_QUERIES,
|
66
|
+
queries,
|
67
|
+
);
|
68
|
+
}
|
69
|
+
|
70
|
+
static addRecentlyViewedQuery(
|
71
|
+
service: UserDataService,
|
72
|
+
queryId: string,
|
73
|
+
): void {
|
74
|
+
const queries = LegendQueryUserDataHelper.getRecentlyViewedQueries(service);
|
75
|
+
const idx = queries.findIndex((query) => query === queryId);
|
76
|
+
if (idx === -1) {
|
77
|
+
if (queries.length < USER_DATA_RECENTLY_VIEWED_QUERIES_LIMIT) {
|
78
|
+
queries.unshift(queryId);
|
79
|
+
} else {
|
80
|
+
queries.pop();
|
81
|
+
queries.unshift(queryId);
|
82
|
+
}
|
83
|
+
} else {
|
84
|
+
queries.splice(idx, 1);
|
85
|
+
queries.unshift(queryId);
|
86
|
+
}
|
87
|
+
service.persistValue(
|
88
|
+
LEGEND_QUERY_USER_DATA_KEY.RECENTLY_VIEWED_QUERIES,
|
89
|
+
queries,
|
90
|
+
);
|
91
|
+
}
|
92
|
+
}
|
@@ -14,40 +14,19 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import {
|
18
|
-
|
19
|
-
ArrowLeftIcon,
|
20
|
-
ArrowRightIcon,
|
21
|
-
BlankPanelContent,
|
22
|
-
clsx,
|
23
|
-
CustomSelectorInput,
|
24
|
-
PanelLoadingIndicator,
|
25
|
-
SearchIcon,
|
26
|
-
UserIcon,
|
27
|
-
} from '@finos/legend-art';
|
28
|
-
import { debounce, guaranteeType } from '@finos/legend-shared';
|
29
|
-
import { flowResult } from 'mobx';
|
17
|
+
import { ArrowLeftIcon } from '@finos/legend-art';
|
18
|
+
import { guaranteeType } from '@finos/legend-shared';
|
30
19
|
import { observer, useLocalObservable } from 'mobx-react-lite';
|
31
|
-
import { useContext
|
32
|
-
import {
|
33
|
-
generateExistingQueryEditorRoute,
|
34
|
-
generateQuerySetupRoute,
|
35
|
-
} from '../__lib__/LegendQueryNavigation.js';
|
20
|
+
import { useContext } from 'react';
|
21
|
+
import { generateQuerySetupRoute } from '../__lib__/LegendQueryNavigation.js';
|
36
22
|
import { useApplicationStore } from '@finos/legend-application';
|
37
|
-
import {
|
38
|
-
type QueryOption,
|
39
|
-
buildQueryOption,
|
40
|
-
} from '@finos/legend-query-builder';
|
41
23
|
import {
|
42
24
|
useLegendQueryApplicationStore,
|
43
25
|
useLegendQueryBaseStore,
|
44
26
|
} from './LegendQueryFrameworkProvider.js';
|
45
27
|
import { EditExistingQuerySetupStore } from '../stores/EditExistingQuerySetupStore.js';
|
46
28
|
import { BaseQuerySetup, BaseQuerySetupStoreContext } from './QuerySetup.js';
|
47
|
-
import {
|
48
|
-
CODE_EDITOR_LANGUAGE,
|
49
|
-
CodeEditor,
|
50
|
-
} from '@finos/legend-lego/code-editor';
|
29
|
+
import { QueryLoader } from '@finos/legend-query-builder';
|
51
30
|
|
52
31
|
const EditExistingQuerySetupStoreProvider: React.FC<{
|
53
32
|
children: React.ReactNode;
|
@@ -78,8 +57,6 @@ const useEditExistingQuerySetupStore = (): EditExistingQuerySetupStore =>
|
|
78
57
|
const EditExistingQuerySetupContent = observer(() => {
|
79
58
|
const setupStore = useEditExistingQuerySetupStore();
|
80
59
|
const applicationStore = useApplicationStore();
|
81
|
-
const querySearchRef = useRef<SelectComponent>(null);
|
82
|
-
const [searchText, setSearchText] = useState('');
|
83
60
|
|
84
61
|
// actions
|
85
62
|
const back = (): void => {
|
@@ -87,112 +64,6 @@ const EditExistingQuerySetupContent = observer(() => {
|
|
87
64
|
generateQuerySetupRoute(),
|
88
65
|
);
|
89
66
|
};
|
90
|
-
const next = (): void => {
|
91
|
-
if (setupStore.currentQuery) {
|
92
|
-
applicationStore.navigationService.navigator.goToLocation(
|
93
|
-
generateExistingQueryEditorRoute(setupStore.currentQuery.id),
|
94
|
-
);
|
95
|
-
}
|
96
|
-
};
|
97
|
-
const canProceed = setupStore.currentQuery;
|
98
|
-
|
99
|
-
// query
|
100
|
-
const queryOptions = setupStore.queries.map(buildQueryOption);
|
101
|
-
const selectedQueryOption = setupStore.currentQuery
|
102
|
-
? buildQueryOption(setupStore.currentQuery)
|
103
|
-
: null;
|
104
|
-
const onQueryOptionChange = (option: QueryOption | null): void => {
|
105
|
-
if (option?.value !== setupStore.currentQuery) {
|
106
|
-
setupStore.setCurrentQuery(option?.value.id);
|
107
|
-
}
|
108
|
-
};
|
109
|
-
const formatQueryOptionLabel = (option: QueryOption): React.ReactNode => {
|
110
|
-
const deleteQuery: React.MouseEventHandler<HTMLButtonElement> = (event) => {
|
111
|
-
event.preventDefault();
|
112
|
-
event.stopPropagation();
|
113
|
-
setupStore.graphManagerState.graphManager
|
114
|
-
.deleteQuery(option.value.id)
|
115
|
-
.then(() =>
|
116
|
-
flowResult(setupStore.loadQueries('')).catch(
|
117
|
-
applicationStore.alertUnhandledError,
|
118
|
-
),
|
119
|
-
)
|
120
|
-
.catch(applicationStore.alertUnhandledError);
|
121
|
-
};
|
122
|
-
if (option.value.id === setupStore.currentQuery?.id) {
|
123
|
-
return option.label;
|
124
|
-
}
|
125
|
-
return (
|
126
|
-
<div className="query-setup__existing-query__query-option">
|
127
|
-
<div
|
128
|
-
className="query-setup__existing-query__query-option__label"
|
129
|
-
title={option.label}
|
130
|
-
>
|
131
|
-
{option.label}
|
132
|
-
</div>
|
133
|
-
{setupStore.showCurrentUserQueriesOnly && (
|
134
|
-
<button
|
135
|
-
className="query-setup__existing-query__query-option__action"
|
136
|
-
tabIndex={-1}
|
137
|
-
onClick={deleteQuery}
|
138
|
-
>
|
139
|
-
Delete
|
140
|
-
</button>
|
141
|
-
)}
|
142
|
-
{!setupStore.showCurrentUserQueriesOnly &&
|
143
|
-
Boolean(option.value.owner) && (
|
144
|
-
<div
|
145
|
-
className={clsx(
|
146
|
-
'query-setup__existing-query__query-option__user',
|
147
|
-
{
|
148
|
-
'query-setup__existing-query__query-option__user--mine':
|
149
|
-
option.value.isCurrentUserQuery,
|
150
|
-
},
|
151
|
-
)}
|
152
|
-
>
|
153
|
-
{option.value.isCurrentUserQuery ? 'mine' : option.value.owner}
|
154
|
-
</div>
|
155
|
-
)}
|
156
|
-
</div>
|
157
|
-
);
|
158
|
-
};
|
159
|
-
|
160
|
-
// search text
|
161
|
-
const debouncedLoadQueries = useMemo(
|
162
|
-
() =>
|
163
|
-
debounce((input: string): void => {
|
164
|
-
flowResult(setupStore.loadQueries(input)).catch(
|
165
|
-
applicationStore.alertUnhandledError,
|
166
|
-
);
|
167
|
-
}, 500),
|
168
|
-
[applicationStore, setupStore],
|
169
|
-
);
|
170
|
-
const onSearchTextChange = (value: string): void => {
|
171
|
-
if (value !== searchText) {
|
172
|
-
setSearchText(value);
|
173
|
-
debouncedLoadQueries.cancel();
|
174
|
-
debouncedLoadQueries(value);
|
175
|
-
}
|
176
|
-
};
|
177
|
-
|
178
|
-
// show current user queries only
|
179
|
-
const toggleShowCurrentUserQueriesOnly = (): void => {
|
180
|
-
setupStore.setShowCurrentUserQueriesOnly(
|
181
|
-
!setupStore.showCurrentUserQueriesOnly,
|
182
|
-
);
|
183
|
-
debouncedLoadQueries.cancel();
|
184
|
-
debouncedLoadQueries(searchText);
|
185
|
-
};
|
186
|
-
|
187
|
-
useEffect(() => {
|
188
|
-
flowResult(setupStore.loadQueries('')).catch(
|
189
|
-
applicationStore.alertUnhandledError,
|
190
|
-
);
|
191
|
-
}, [setupStore, applicationStore]);
|
192
|
-
|
193
|
-
useEffect(() => {
|
194
|
-
querySearchRef.current?.focus();
|
195
|
-
}, []);
|
196
67
|
|
197
68
|
return (
|
198
69
|
<div className="query-setup__wizard query-setup__existing-query">
|
@@ -207,77 +78,12 @@ const EditExistingQuerySetupContent = observer(() => {
|
|
207
78
|
<div className="query-setup__wizard__header__title">
|
208
79
|
Loading an existing query...
|
209
80
|
</div>
|
210
|
-
<button
|
211
|
-
className={clsx('query-setup__wizard__header__btn', {
|
212
|
-
'query-setup__wizard__header__btn--ready': canProceed,
|
213
|
-
})}
|
214
|
-
onClick={next}
|
215
|
-
disabled={!canProceed}
|
216
|
-
title="Edit query"
|
217
|
-
>
|
218
|
-
<ArrowRightIcon />
|
219
|
-
</button>
|
220
81
|
</div>
|
221
|
-
<div className="query-
|
222
|
-
<
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
<div className="query-setup__existing-query__input">
|
227
|
-
<CustomSelectorInput
|
228
|
-
ref={querySearchRef}
|
229
|
-
className="query-setup__wizard__selector"
|
230
|
-
options={queryOptions}
|
231
|
-
isLoading={setupStore.loadQueriesState.isInProgress}
|
232
|
-
onInputChange={onSearchTextChange}
|
233
|
-
inputValue={searchText}
|
234
|
-
onChange={onQueryOptionChange}
|
235
|
-
value={selectedQueryOption}
|
236
|
-
placeholder="Search for query by name..."
|
237
|
-
isClearable={true}
|
238
|
-
escapeClearsValue={true}
|
239
|
-
darkMode={true}
|
240
|
-
formatOptionLabel={formatQueryOptionLabel}
|
241
|
-
/>
|
242
|
-
<button
|
243
|
-
className={clsx('query-setup__existing-query__btn', {
|
244
|
-
'query-setup__existing-query__btn--active':
|
245
|
-
setupStore.showCurrentUserQueriesOnly,
|
246
|
-
})}
|
247
|
-
tabIndex={-1}
|
248
|
-
title={`[${
|
249
|
-
setupStore.showCurrentUserQueriesOnly ? 'on' : 'off'
|
250
|
-
}] Toggle show only queries of current user`}
|
251
|
-
onClick={toggleShowCurrentUserQueriesOnly}
|
252
|
-
>
|
253
|
-
<UserIcon />
|
254
|
-
</button>
|
255
|
-
</div>
|
256
|
-
</div>
|
257
|
-
<div className="query-setup__existing-query__preview">
|
258
|
-
<PanelLoadingIndicator
|
259
|
-
isLoading={setupStore.loadQueryState.isInProgress}
|
260
|
-
/>
|
261
|
-
{setupStore.currentQuery && (
|
262
|
-
<>
|
263
|
-
{!setupStore.currentQueryInfo && (
|
264
|
-
<BlankPanelContent>{`Can't preview query`}</BlankPanelContent>
|
265
|
-
)}
|
266
|
-
{setupStore.currentQueryInfo && (
|
267
|
-
<CodeEditor
|
268
|
-
inputValue={setupStore.currentQueryInfo.content}
|
269
|
-
isReadOnly={true}
|
270
|
-
language={CODE_EDITOR_LANGUAGE.PURE}
|
271
|
-
showMiniMap={false}
|
272
|
-
hideGutter={true}
|
273
|
-
/>
|
274
|
-
)}
|
275
|
-
</>
|
276
|
-
)}
|
277
|
-
{!setupStore.currentQuery && (
|
278
|
-
<BlankPanelContent>No query to preview</BlankPanelContent>
|
279
|
-
)}
|
280
|
-
</div>
|
82
|
+
<div className="query-setup__existing-query__content">
|
83
|
+
<QueryLoader
|
84
|
+
queryLoaderState={setupStore.queryLoaderState}
|
85
|
+
loadActionLabel="load query"
|
86
|
+
/>
|
281
87
|
</div>
|
282
88
|
</div>
|
283
89
|
);
|