@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
@@ -18,6 +18,7 @@ export declare enum LEGEND_QUERY_APP_EVENT {
|
|
18
18
|
VIEW_QUERY__SUCCESS = "query-editor.view-query.success",
|
19
19
|
CREATE_QUERY__SUCCESS = "query-editor.create-query.success",
|
20
20
|
UPDATE_QUERY__SUCCESS = "query-editor.update-query.success",
|
21
|
+
RENAME_QUERY__SUCCESS = "query-editor.rename.query.success",
|
21
22
|
VIEW_PROJECT__LAUNCH = "query-editor.view-project.launch",
|
22
23
|
VIEW_SDLC_PROJECT__LAUNCH = "query-editor.view-sdlc-project.launch"
|
23
24
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LegendQueryEvent.d.ts","sourceRoot":"","sources":["../../src/__lib__/LegendQueryEvent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,oBAAY,sBAAsB;IAEhC,eAAe,gCAAgC;IAE/C,mBAAmB,oCAAoC;IACvD,qBAAqB,sCAAsC;IAC3D,qBAAqB,sCAAsC;IAE3D,oBAAoB,qCAAqC;IACzD,yBAAyB,0CAA0C;CACpE"}
|
1
|
+
{"version":3,"file":"LegendQueryEvent.d.ts","sourceRoot":"","sources":["../../src/__lib__/LegendQueryEvent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,oBAAY,sBAAsB;IAEhC,eAAe,gCAAgC;IAE/C,mBAAmB,oCAAoC;IACvD,qBAAqB,sCAAsC;IAC3D,qBAAqB,sCAAsC;IAC3D,qBAAqB,sCAAsC;IAE3D,oBAAoB,qCAAqC;IACzD,yBAAyB,0CAA0C;CACpE"}
|
@@ -20,6 +20,7 @@ export var LEGEND_QUERY_APP_EVENT;
|
|
20
20
|
LEGEND_QUERY_APP_EVENT["VIEW_QUERY__SUCCESS"] = "query-editor.view-query.success";
|
21
21
|
LEGEND_QUERY_APP_EVENT["CREATE_QUERY__SUCCESS"] = "query-editor.create-query.success";
|
22
22
|
LEGEND_QUERY_APP_EVENT["UPDATE_QUERY__SUCCESS"] = "query-editor.update-query.success";
|
23
|
+
LEGEND_QUERY_APP_EVENT["RENAME_QUERY__SUCCESS"] = "query-editor.rename.query.success";
|
23
24
|
LEGEND_QUERY_APP_EVENT["VIEW_PROJECT__LAUNCH"] = "query-editor.view-project.launch";
|
24
25
|
LEGEND_QUERY_APP_EVENT["VIEW_SDLC_PROJECT__LAUNCH"] = "query-editor.view-sdlc-project.launch";
|
25
26
|
})(LEGEND_QUERY_APP_EVENT = LEGEND_QUERY_APP_EVENT || (LEGEND_QUERY_APP_EVENT = {}));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LegendQueryEvent.js","sourceRoot":"","sources":["../../src/__lib__/LegendQueryEvent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAN,IAAY,
|
1
|
+
{"version":3,"file":"LegendQueryEvent.js","sourceRoot":"","sources":["../../src/__lib__/LegendQueryEvent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAN,IAAY,sBAWX;AAXD,WAAY,sBAAsB;IAChC,wCAAwC;IACxC,yEAA+C,CAAA;IAE/C,iFAAuD,CAAA;IACvD,qFAA2D,CAAA;IAC3D,qFAA2D,CAAA;IAC3D,qFAA2D,CAAA;IAE3D,mFAAyD,CAAA;IACzD,6FAAmE,CAAA;AACrE,CAAC,EAXW,sBAAsB,GAAtB,sBAAsB,KAAtB,sBAAsB,QAWjC"}
|
@@ -25,12 +25,13 @@ type Query_TelemetryData = {
|
|
25
25
|
};
|
26
26
|
};
|
27
27
|
export declare class LegendQueryTelemetryHelper {
|
28
|
-
static logEvent_ViewQuerySucceeded(
|
29
|
-
static logEvent_CreateQuerySucceeded(
|
30
|
-
static logEvent_UpdateQuerySucceeded(
|
31
|
-
static logEvent_QueryViewProjectLaunched(
|
32
|
-
static logEvent_QueryViewSdlcProjectLaunched(
|
33
|
-
static logEvent_GraphInitializationSucceeded(
|
28
|
+
static logEvent_ViewQuerySucceeded(service: TelemetryService, data: Query_TelemetryData): void;
|
29
|
+
static logEvent_CreateQuerySucceeded(service: TelemetryService, data: Query_TelemetryData): void;
|
30
|
+
static logEvent_UpdateQuerySucceeded(service: TelemetryService, data: Query_TelemetryData): void;
|
31
|
+
static logEvent_QueryViewProjectLaunched(service: TelemetryService): void;
|
32
|
+
static logEvent_QueryViewSdlcProjectLaunched(service: TelemetryService): void;
|
33
|
+
static logEvent_GraphInitializationSucceeded(service: TelemetryService, data: GraphInitializationReport): void;
|
34
|
+
static logEvent_RenameQuerySucceeded(service: TelemetryService, data: Query_TelemetryData): void;
|
34
35
|
}
|
35
36
|
export {};
|
36
37
|
//# sourceMappingURL=LegendQueryTelemetryHelper.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LegendQueryTelemetryHelper.d.ts","sourceRoot":"","sources":["../../src/__lib__/LegendQueryTelemetryHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAC;AAE7B,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,qBAAa,0BAA0B;IACrC,MAAM,CAAC,2BAA2B,CAChC,
|
1
|
+
{"version":3,"file":"LegendQueryTelemetryHelper.d.ts","sourceRoot":"","sources":["../../src/__lib__/LegendQueryTelemetryHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,qBAAqB,CAAC;AAE7B,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;QACX,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,qBAAa,0BAA0B;IACrC,MAAM,CAAC,2BAA2B,CAChC,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,mBAAmB,GACxB,IAAI;IAIP,MAAM,CAAC,6BAA6B,CAClC,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,mBAAmB,GACxB,IAAI;IAIP,MAAM,CAAC,6BAA6B,CAClC,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,mBAAmB,GACxB,IAAI;IAIP,MAAM,CAAC,iCAAiC,CAAC,OAAO,EAAE,gBAAgB,GAAG,IAAI;IAIzE,MAAM,CAAC,qCAAqC,CAC1C,OAAO,EAAE,gBAAgB,GACxB,IAAI;IAIP,MAAM,CAAC,qCAAqC,CAC1C,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,yBAAyB,GAC9B,IAAI;IAIP,MAAM,CAAC,6BAA6B,CAClC,OAAO,EAAE,gBAAgB,EACzB,IAAI,EAAE,mBAAmB,GACxB,IAAI;CAGR"}
|
@@ -16,23 +16,26 @@
|
|
16
16
|
import { LEGEND_QUERY_APP_EVENT } from './LegendQueryEvent.js';
|
17
17
|
import { GRAPH_MANAGER_EVENT, } from '@finos/legend-graph';
|
18
18
|
export class LegendQueryTelemetryHelper {
|
19
|
-
static logEvent_ViewQuerySucceeded(
|
20
|
-
|
19
|
+
static logEvent_ViewQuerySucceeded(service, data) {
|
20
|
+
service.logEvent(LEGEND_QUERY_APP_EVENT.VIEW_QUERY__SUCCESS, data);
|
21
21
|
}
|
22
|
-
static logEvent_CreateQuerySucceeded(
|
23
|
-
|
22
|
+
static logEvent_CreateQuerySucceeded(service, data) {
|
23
|
+
service.logEvent(LEGEND_QUERY_APP_EVENT.CREATE_QUERY__SUCCESS, data);
|
24
24
|
}
|
25
|
-
static logEvent_UpdateQuerySucceeded(
|
26
|
-
|
25
|
+
static logEvent_UpdateQuerySucceeded(service, data) {
|
26
|
+
service.logEvent(LEGEND_QUERY_APP_EVENT.UPDATE_QUERY__SUCCESS, data);
|
27
27
|
}
|
28
|
-
static logEvent_QueryViewProjectLaunched(
|
29
|
-
|
28
|
+
static logEvent_QueryViewProjectLaunched(service) {
|
29
|
+
service.logEvent(LEGEND_QUERY_APP_EVENT.VIEW_PROJECT__LAUNCH, {});
|
30
30
|
}
|
31
|
-
static logEvent_QueryViewSdlcProjectLaunched(
|
32
|
-
|
31
|
+
static logEvent_QueryViewSdlcProjectLaunched(service) {
|
32
|
+
service.logEvent(LEGEND_QUERY_APP_EVENT.VIEW_SDLC_PROJECT__LAUNCH, {});
|
33
33
|
}
|
34
|
-
static logEvent_GraphInitializationSucceeded(
|
35
|
-
|
34
|
+
static logEvent_GraphInitializationSucceeded(service, data) {
|
35
|
+
service.logEvent(GRAPH_MANAGER_EVENT.INITIALIZE_GRAPH__SUCCESS, data);
|
36
|
+
}
|
37
|
+
static logEvent_RenameQuerySucceeded(service, data) {
|
38
|
+
service.logEvent(LEGEND_QUERY_APP_EVENT.RENAME_QUERY__SUCCESS, data);
|
36
39
|
}
|
37
40
|
}
|
38
41
|
//# sourceMappingURL=LegendQueryTelemetryHelper.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"LegendQueryTelemetryHelper.js","sourceRoot":"","sources":["../../src/__lib__/LegendQueryTelemetryHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EACL,mBAAmB,GAEpB,MAAM,qBAAqB,CAAC;AAY7B,MAAM,OAAO,0BAA0B;IACrC,MAAM,CAAC,2BAA2B,CAChC,
|
1
|
+
{"version":3,"file":"LegendQueryTelemetryHelper.js","sourceRoot":"","sources":["../../src/__lib__/LegendQueryTelemetryHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EACL,mBAAmB,GAEpB,MAAM,qBAAqB,CAAC;AAY7B,MAAM,OAAO,0BAA0B;IACrC,MAAM,CAAC,2BAA2B,CAChC,OAAyB,EACzB,IAAyB;QAEzB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,CAAC,6BAA6B,CAClC,OAAyB,EACzB,IAAyB;QAEzB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,CAAC,6BAA6B,CAClC,OAAyB,EACzB,IAAyB;QAEzB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,CAAC,iCAAiC,CAAC,OAAyB;QAChE,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,CAAC,qCAAqC,CAC1C,OAAyB;QAEzB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC;IACzE,CAAC;IAED,MAAM,CAAC,qCAAqC,CAC1C,OAAyB,EACzB,IAA+B;QAE/B,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,yBAAyB,EAAE,IAAI,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,CAAC,6BAA6B,CAClC,OAAyB,EACzB,IAAyB;QAEzB,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAC,qBAAqB,EAAE,IAAI,CAAC,CAAC;IACvE,CAAC;CACF"}
|
@@ -0,0 +1,27 @@
|
|
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 type { UserDataService } from '@finos/legend-application';
|
17
|
+
export declare enum LEGEND_QUERY_USER_DATA_KEY {
|
18
|
+
RECENTLY_VIEWED_QUERIES = "query-editor.recent-queries"
|
19
|
+
}
|
20
|
+
type RecentlyViewedQueriesData = string[];
|
21
|
+
export declare class LegendQueryUserDataHelper {
|
22
|
+
static getRecentlyViewedQueries(service: UserDataService): RecentlyViewedQueriesData;
|
23
|
+
static removeRecentlyViewedQuery(service: UserDataService, queryId: string): void;
|
24
|
+
static addRecentlyViewedQuery(service: UserDataService, queryId: string): void;
|
25
|
+
}
|
26
|
+
export {};
|
27
|
+
//# sourceMappingURL=LegendQueryUserDataHelper.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"LegendQueryUserDataHelper.d.ts","sourceRoot":"","sources":["../../src/__lib__/LegendQueryUserDataHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAIjE,oBAAY,0BAA0B;IACpC,uBAAuB,gCAAgC;CACxD;AAGD,KAAK,yBAAyB,GAAG,MAAM,EAAE,CAAC;AAE1C,qBAAa,yBAAyB;IACpC,MAAM,CAAC,wBAAwB,CAC7B,OAAO,EAAE,eAAe,GACvB,yBAAyB;IAuB5B,MAAM,CAAC,yBAAyB,CAC9B,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,MAAM,GACd,IAAI;IAaP,MAAM,CAAC,sBAAsB,CAC3B,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,MAAM,GACd,IAAI;CAmBR"}
|
@@ -0,0 +1,63 @@
|
|
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 { returnUndefOnError } from '@finos/legend-shared';
|
17
|
+
import { createSimpleSchema, deserialize, list, primitive } from 'serializr';
|
18
|
+
export var LEGEND_QUERY_USER_DATA_KEY;
|
19
|
+
(function (LEGEND_QUERY_USER_DATA_KEY) {
|
20
|
+
LEGEND_QUERY_USER_DATA_KEY["RECENTLY_VIEWED_QUERIES"] = "query-editor.recent-queries";
|
21
|
+
})(LEGEND_QUERY_USER_DATA_KEY = LEGEND_QUERY_USER_DATA_KEY || (LEGEND_QUERY_USER_DATA_KEY = {}));
|
22
|
+
const USER_DATA_RECENTLY_VIEWED_QUERIES_LIMIT = 10;
|
23
|
+
export class LegendQueryUserDataHelper {
|
24
|
+
static getRecentlyViewedQueries(service) {
|
25
|
+
const data = service.getObjectValue(LEGEND_QUERY_USER_DATA_KEY.RECENTLY_VIEWED_QUERIES);
|
26
|
+
return (
|
27
|
+
// TODO: think of a better way to deserialize this data, maybe like settings, use JSON schema
|
28
|
+
// See https://github.com/finos/legend-studio/issues/407
|
29
|
+
returnUndefOnError(() => deserialize(createSimpleSchema({
|
30
|
+
data: list(primitive()),
|
31
|
+
}), {
|
32
|
+
data,
|
33
|
+
}).data) ?? []);
|
34
|
+
}
|
35
|
+
static removeRecentlyViewedQuery(service, queryId) {
|
36
|
+
const queries = LegendQueryUserDataHelper.getRecentlyViewedQueries(service);
|
37
|
+
const idx = queries.findIndex((query) => query === queryId);
|
38
|
+
if (idx !== -1) {
|
39
|
+
return;
|
40
|
+
}
|
41
|
+
queries.splice(idx, 1);
|
42
|
+
service.persistValue(LEGEND_QUERY_USER_DATA_KEY.RECENTLY_VIEWED_QUERIES, queries);
|
43
|
+
}
|
44
|
+
static addRecentlyViewedQuery(service, queryId) {
|
45
|
+
const queries = LegendQueryUserDataHelper.getRecentlyViewedQueries(service);
|
46
|
+
const idx = queries.findIndex((query) => query === queryId);
|
47
|
+
if (idx === -1) {
|
48
|
+
if (queries.length < USER_DATA_RECENTLY_VIEWED_QUERIES_LIMIT) {
|
49
|
+
queries.unshift(queryId);
|
50
|
+
}
|
51
|
+
else {
|
52
|
+
queries.pop();
|
53
|
+
queries.unshift(queryId);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
queries.splice(idx, 1);
|
58
|
+
queries.unshift(queryId);
|
59
|
+
}
|
60
|
+
service.persistValue(LEGEND_QUERY_USER_DATA_KEY.RECENTLY_VIEWED_QUERIES, queries);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
//# sourceMappingURL=LegendQueryUserDataHelper.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"LegendQueryUserDataHelper.js","sourceRoot":"","sources":["../../src/__lib__/LegendQueryUserDataHelper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE7E,MAAM,CAAN,IAAY,0BAEX;AAFD,WAAY,0BAA0B;IACpC,qFAAuD,CAAA;AACzD,CAAC,EAFW,0BAA0B,GAA1B,0BAA0B,KAA1B,0BAA0B,QAErC;AAED,MAAM,uCAAuC,GAAG,EAAE,CAAC;AAGnD,MAAM,OAAO,yBAAyB;IACpC,MAAM,CAAC,wBAAwB,CAC7B,OAAwB;QAExB,MAAM,IAAI,GAAG,OAAO,CAAC,cAAc,CACjC,0BAA0B,CAAC,uBAAuB,CACnD,CAAC;QACF,OAAO;QACL,6FAA6F;QAC7F,wDAAwD;QACxD,kBAAkB,CAChB,GAAG,EAAE,CAED,WAAW,CACT,kBAAkB,CAAC;YACjB,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC;SACxB,CAAC,EACF;YACE,IAAI;SACL,CAEJ,CAAC,IAAI,CACT,IAAI,EAAE,CACR,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,yBAAyB,CAC9B,OAAwB,EACxB,OAAe;QAEf,MAAM,OAAO,GAAG,yBAAyB,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAC5E,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC;QAC5D,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE;YACd,OAAO;SACR;QACD,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACvB,OAAO,CAAC,YAAY,CAClB,0BAA0B,CAAC,uBAAuB,EAClD,OAAO,CACR,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,sBAAsB,CAC3B,OAAwB,EACxB,OAAe;QAEf,MAAM,OAAO,GAAG,yBAAyB,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC;QAC5E,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC;QAC5D,IAAI,GAAG,KAAK,CAAC,CAAC,EAAE;YACd,IAAI,OAAO,CAAC,MAAM,GAAG,uCAAuC,EAAE;gBAC5D,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aAC1B;iBAAM;gBACL,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;aAC1B;SACF;aAAM;YACL,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YACvB,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;SAC1B;QACD,OAAO,CAAC,YAAY,CAClB,0BAA0B,CAAC,uBAAuB,EAClD,OAAO,CACR,CAAC;IACJ,CAAC;CACF"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EditExistingQuerySetup.d.ts","sourceRoot":"","sources":["../../src/components/EditExistingQuerySetup.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;
|
1
|
+
{"version":3,"file":"EditExistingQuerySetup.d.ts","sourceRoot":"","sources":["../../src/components/EditExistingQuerySetup.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;;AA6EH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAM1C,CAAC"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
/**
|
3
3
|
* Copyright (c) 2020-present, Goldman Sachs
|
4
4
|
*
|
@@ -14,18 +14,16 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
14
14
|
* See the License for the specific language governing permissions and
|
15
15
|
* limitations under the License.
|
16
16
|
*/
|
17
|
-
import { ArrowLeftIcon
|
18
|
-
import {
|
19
|
-
import { flowResult } from 'mobx';
|
17
|
+
import { ArrowLeftIcon } from '@finos/legend-art';
|
18
|
+
import { guaranteeType } from '@finos/legend-shared';
|
20
19
|
import { observer, useLocalObservable } from 'mobx-react-lite';
|
21
|
-
import { useContext
|
22
|
-
import {
|
20
|
+
import { useContext } from 'react';
|
21
|
+
import { generateQuerySetupRoute } from '../__lib__/LegendQueryNavigation.js';
|
23
22
|
import { useApplicationStore } from '@finos/legend-application';
|
24
|
-
import { buildQueryOption, } from '@finos/legend-query-builder';
|
25
23
|
import { useLegendQueryApplicationStore, useLegendQueryBaseStore, } from './LegendQueryFrameworkProvider.js';
|
26
24
|
import { EditExistingQuerySetupStore } from '../stores/EditExistingQuerySetupStore.js';
|
27
25
|
import { BaseQuerySetup, BaseQuerySetupStoreContext } from './QuerySetup.js';
|
28
|
-
import {
|
26
|
+
import { QueryLoader } from '@finos/legend-query-builder';
|
29
27
|
const EditExistingQuerySetupStoreProvider = ({ children }) => {
|
30
28
|
const applicationStore = useLegendQueryApplicationStore();
|
31
29
|
const baseStore = useLegendQueryBaseStore();
|
@@ -36,73 +34,11 @@ const useEditExistingQuerySetupStore = () => guaranteeType(useContext(BaseQueryS
|
|
36
34
|
const EditExistingQuerySetupContent = observer(() => {
|
37
35
|
const setupStore = useEditExistingQuerySetupStore();
|
38
36
|
const applicationStore = useApplicationStore();
|
39
|
-
const querySearchRef = useRef(null);
|
40
|
-
const [searchText, setSearchText] = useState('');
|
41
37
|
// actions
|
42
38
|
const back = () => {
|
43
39
|
applicationStore.navigationService.navigator.goToLocation(generateQuerySetupRoute());
|
44
40
|
};
|
45
|
-
|
46
|
-
if (setupStore.currentQuery) {
|
47
|
-
applicationStore.navigationService.navigator.goToLocation(generateExistingQueryEditorRoute(setupStore.currentQuery.id));
|
48
|
-
}
|
49
|
-
};
|
50
|
-
const canProceed = setupStore.currentQuery;
|
51
|
-
// query
|
52
|
-
const queryOptions = setupStore.queries.map(buildQueryOption);
|
53
|
-
const selectedQueryOption = setupStore.currentQuery
|
54
|
-
? buildQueryOption(setupStore.currentQuery)
|
55
|
-
: null;
|
56
|
-
const onQueryOptionChange = (option) => {
|
57
|
-
if (option?.value !== setupStore.currentQuery) {
|
58
|
-
setupStore.setCurrentQuery(option?.value.id);
|
59
|
-
}
|
60
|
-
};
|
61
|
-
const formatQueryOptionLabel = (option) => {
|
62
|
-
const deleteQuery = (event) => {
|
63
|
-
event.preventDefault();
|
64
|
-
event.stopPropagation();
|
65
|
-
setupStore.graphManagerState.graphManager
|
66
|
-
.deleteQuery(option.value.id)
|
67
|
-
.then(() => flowResult(setupStore.loadQueries('')).catch(applicationStore.alertUnhandledError))
|
68
|
-
.catch(applicationStore.alertUnhandledError);
|
69
|
-
};
|
70
|
-
if (option.value.id === setupStore.currentQuery?.id) {
|
71
|
-
return option.label;
|
72
|
-
}
|
73
|
-
return (_jsxs("div", { className: "query-setup__existing-query__query-option", children: [_jsx("div", { className: "query-setup__existing-query__query-option__label", title: option.label, children: option.label }), setupStore.showCurrentUserQueriesOnly && (_jsx("button", { className: "query-setup__existing-query__query-option__action", tabIndex: -1, onClick: deleteQuery, children: "Delete" })), !setupStore.showCurrentUserQueriesOnly &&
|
74
|
-
Boolean(option.value.owner) && (_jsx("div", { className: clsx('query-setup__existing-query__query-option__user', {
|
75
|
-
'query-setup__existing-query__query-option__user--mine': option.value.isCurrentUserQuery,
|
76
|
-
}), children: option.value.isCurrentUserQuery ? 'mine' : option.value.owner }))] }));
|
77
|
-
};
|
78
|
-
// search text
|
79
|
-
const debouncedLoadQueries = useMemo(() => debounce((input) => {
|
80
|
-
flowResult(setupStore.loadQueries(input)).catch(applicationStore.alertUnhandledError);
|
81
|
-
}, 500), [applicationStore, setupStore]);
|
82
|
-
const onSearchTextChange = (value) => {
|
83
|
-
if (value !== searchText) {
|
84
|
-
setSearchText(value);
|
85
|
-
debouncedLoadQueries.cancel();
|
86
|
-
debouncedLoadQueries(value);
|
87
|
-
}
|
88
|
-
};
|
89
|
-
// show current user queries only
|
90
|
-
const toggleShowCurrentUserQueriesOnly = () => {
|
91
|
-
setupStore.setShowCurrentUserQueriesOnly(!setupStore.showCurrentUserQueriesOnly);
|
92
|
-
debouncedLoadQueries.cancel();
|
93
|
-
debouncedLoadQueries(searchText);
|
94
|
-
};
|
95
|
-
useEffect(() => {
|
96
|
-
flowResult(setupStore.loadQueries('')).catch(applicationStore.alertUnhandledError);
|
97
|
-
}, [setupStore, applicationStore]);
|
98
|
-
useEffect(() => {
|
99
|
-
querySearchRef.current?.focus();
|
100
|
-
}, []);
|
101
|
-
return (_jsxs("div", { className: "query-setup__wizard query-setup__existing-query", children: [_jsxs("div", { className: "query-setup__wizard__header query-setup__existing-query__header", children: [_jsx("button", { className: "query-setup__wizard__header__btn", onClick: back, title: "Back to Main Menu", children: _jsx(ArrowLeftIcon, {}) }), _jsx("div", { className: "query-setup__wizard__header__title", children: "Loading an existing query..." }), _jsx("button", { className: clsx('query-setup__wizard__header__btn', {
|
102
|
-
'query-setup__wizard__header__btn--ready': canProceed,
|
103
|
-
}), onClick: next, disabled: !canProceed, title: "Edit query", children: _jsx(ArrowRightIcon, {}) })] }), _jsxs("div", { className: "query-setup__wizard__content", children: [_jsxs("div", { className: "query-setup__wizard__group query-setup__wizard__group--inline", children: [_jsx("div", { className: "query-setup__wizard__group__title", children: _jsx(SearchIcon, {}) }), _jsxs("div", { className: "query-setup__existing-query__input", children: [_jsx(CustomSelectorInput, { ref: querySearchRef, className: "query-setup__wizard__selector", options: queryOptions, isLoading: setupStore.loadQueriesState.isInProgress, onInputChange: onSearchTextChange, inputValue: searchText, onChange: onQueryOptionChange, value: selectedQueryOption, placeholder: "Search for query by name...", isClearable: true, escapeClearsValue: true, darkMode: true, formatOptionLabel: formatQueryOptionLabel }), _jsx("button", { className: clsx('query-setup__existing-query__btn', {
|
104
|
-
'query-setup__existing-query__btn--active': setupStore.showCurrentUserQueriesOnly,
|
105
|
-
}), tabIndex: -1, title: `[${setupStore.showCurrentUserQueriesOnly ? 'on' : 'off'}] Toggle show only queries of current user`, onClick: toggleShowCurrentUserQueriesOnly, children: _jsx(UserIcon, {}) })] })] }), _jsxs("div", { className: "query-setup__existing-query__preview", children: [_jsx(PanelLoadingIndicator, { isLoading: setupStore.loadQueryState.isInProgress }), setupStore.currentQuery && (_jsxs(_Fragment, { children: [!setupStore.currentQueryInfo && (_jsx(BlankPanelContent, { children: `Can't preview query` })), setupStore.currentQueryInfo && (_jsx(CodeEditor, { inputValue: setupStore.currentQueryInfo.content, isReadOnly: true, language: CODE_EDITOR_LANGUAGE.PURE, showMiniMap: false, hideGutter: true }))] })), !setupStore.currentQuery && (_jsx(BlankPanelContent, { children: "No query to preview" }))] })] })] }));
|
41
|
+
return (_jsxs("div", { className: "query-setup__wizard query-setup__existing-query", children: [_jsxs("div", { className: "query-setup__wizard__header query-setup__existing-query__header", children: [_jsx("button", { className: "query-setup__wizard__header__btn", onClick: back, title: "Back to Main Menu", children: _jsx(ArrowLeftIcon, {}) }), _jsx("div", { className: "query-setup__wizard__header__title", children: "Loading an existing query..." })] }), _jsx("div", { className: "query-setup__existing-query__content", children: _jsx(QueryLoader, { queryLoaderState: setupStore.queryLoaderState, loadActionLabel: "load query" }) })] }));
|
106
42
|
});
|
107
43
|
export const EditExistingQuerySetup = () => (_jsx(EditExistingQuerySetupStoreProvider, { children: _jsx(BaseQuerySetup, { children: _jsx(EditExistingQuerySetupContent, {}) }) }));
|
108
44
|
//# sourceMappingURL=EditExistingQuerySetup.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EditExistingQuerySetup.js","sourceRoot":"","sources":["../../src/components/EditExistingQuerySetup.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,
|
1
|
+
{"version":3,"file":"EditExistingQuerySetup.js","sourceRoot":"","sources":["../../src/components/EditExistingQuerySetup.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,8BAA8B,EAC9B,uBAAuB,GACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE1D,MAAM,mCAAmC,GAEpC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE;IACpB,MAAM,gBAAgB,GAAG,8BAA8B,EAAE,CAAC;IAC1D,MAAM,SAAS,GAAG,uBAAuB,EAAE,CAAC;IAC5C,MAAM,KAAK,GAAG,kBAAkB,CAC9B,GAAG,EAAE,CACH,IAAI,2BAA2B,CAC7B,gBAAgB,EAChB,SAAS,CAAC,iBAAiB,CAC5B,CACJ,CAAC;IACF,OAAO,CACL,KAAC,0BAA0B,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAC9C,QAAQ,GAC2B,CACvC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,8BAA8B,GAAG,GAAgC,EAAE,CACvE,aAAa,CACX,UAAU,CAAC,0BAA0B,CAAC,EACtC,2BAA2B,EAC3B,yCAAyC,CAC1C,CAAC;AAEJ,MAAM,6BAA6B,GAAG,QAAQ,CAAC,GAAG,EAAE;IAClD,MAAM,UAAU,GAAG,8BAA8B,EAAE,CAAC;IACpD,MAAM,gBAAgB,GAAG,mBAAmB,EAAE,CAAC;IAE/C,UAAU;IACV,MAAM,IAAI,GAAG,GAAS,EAAE;QACtB,gBAAgB,CAAC,iBAAiB,CAAC,SAAS,CAAC,YAAY,CACvD,uBAAuB,EAAE,CAC1B,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAC,iDAAiD,aAC9D,eAAK,SAAS,EAAC,iEAAiE,aAC9E,iBACE,SAAS,EAAC,kCAAkC,EAC5C,OAAO,EAAE,IAAI,EACb,KAAK,EAAC,mBAAmB,YAEzB,KAAC,aAAa,KAAG,GACV,EACT,cAAK,SAAS,EAAC,oCAAoC,6CAE7C,IACF,EACN,cAAK,SAAS,EAAC,sCAAsC,YACnD,KAAC,WAAW,IACV,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,EAC7C,eAAe,EAAC,YAAY,GAC5B,GACE,IACF,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAa,GAAG,EAAE,CAAC,CACpD,KAAC,mCAAmC,cAClC,KAAC,cAAc,cACb,KAAC,6BAA6B,KAAG,GAClB,GACmB,CACvC,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"QueryEditor.d.ts","sourceRoot":"","sources":["../../src/components/QueryEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
1
|
+
{"version":3,"file":"QueryEditor.d.ts","sourceRoot":"","sources":["../../src/components/QueryEditor.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA0jBH,eAAO,MAAM,WAAW;;CAwGtB,CAAC;AAEH,eAAO,MAAM,mBAAmB;;CAS9B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;CAmB9B,CAAC;AAEH,eAAO,MAAM,mBAAmB;;CAe9B,CAAC"}
|
@@ -14,19 +14,19 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
14
14
|
* See the License for the specific language governing permissions and
|
15
15
|
* limitations under the License.
|
16
16
|
*/
|
17
|
-
import { Dialog, PanelLoadingIndicator, BlankPanelContent,
|
18
|
-
import { debounce } from '@finos/legend-shared';
|
17
|
+
import { Dialog, PanelLoadingIndicator, BlankPanelContent, DropdownMenu, MenuContent, MenuContentItem, CaretDownIcon, MenuIcon, MenuContentDivider, MenuContentItemIcon, CheckIcon, MenuContentItemLabel, Modal, ModalHeader, ModalBody, ModalFooter, ModalFooterButton, ManageSearchIcon, LightBulbIcon, EmptyLightBulbIcon, SaveCurrIcon, SaveAsIcon, ExclamationTriangleIcon, PanelListItem, Button, clsx, } from '@finos/legend-art';
|
19
18
|
import { observer } from 'mobx-react-lite';
|
20
|
-
import
|
21
|
-
import { LEGEND_QUERY_QUERY_PARAM_TOKEN, LEGEND_QUERY_ROUTE_PATTERN_TOKEN,
|
19
|
+
import { Fragment, useEffect, useMemo, useRef } from 'react';
|
20
|
+
import { LEGEND_QUERY_QUERY_PARAM_TOKEN, LEGEND_QUERY_ROUTE_PATTERN_TOKEN, generateQuerySetupRoute, } from '../__lib__/LegendQueryNavigation.js';
|
22
21
|
import { QuerySaveAsState, createViewProjectHandler, createViewSDLCProjectHandler, QuerySaveState, QueryRenameState, } from '../stores/QueryEditorStore.js';
|
23
22
|
import { LEGEND_APPLICATION_COLOR_THEME, useApplicationStore, } from '@finos/legend-application';
|
24
23
|
import { useParams } from '@finos/legend-application/browser';
|
25
24
|
import { MappingQueryCreatorStoreProvider, ExistingQueryEditorStoreProvider, ServiceQueryCreatorStoreProvider, useQueryEditorStore, } from './QueryEditorStoreProvider.js';
|
26
25
|
import { flowResult } from 'mobx';
|
27
26
|
import { useLegendQueryApplicationStore } from './LegendQueryFrameworkProvider.js';
|
28
|
-
import { QueryBuilder, QueryBuilderNavigationBlocker, } from '@finos/legend-query-builder';
|
27
|
+
import { QueryBuilder, QueryBuilderNavigationBlocker, QueryLoaderDialog, } from '@finos/legend-query-builder';
|
29
28
|
import { QUERY_DOCUMENTATION_KEY } from '../application/LegendQueryDocumentation.js';
|
29
|
+
import { debounce } from '@finos/legend-shared';
|
30
30
|
import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
|
31
31
|
const QuerySaveAsDialogContent = observer((props) => {
|
32
32
|
const { saveAsState } = props;
|
@@ -69,67 +69,8 @@ const QuerySaveDialog = observer(() => {
|
|
69
69
|
root: 'editor-modal__root-container',
|
70
70
|
container: 'editor-modal__container',
|
71
71
|
paper: 'editor-modal__content',
|
72
|
-
}, children: _jsxs(Modal, { darkMode: true, className: "query-export", children: [_jsx(ModalHeader, { title:
|
72
|
+
}, children: _jsxs(Modal, { darkMode: true, className: "query-export", children: [_jsx(ModalHeader, { title: "Create New Query" }), saveAsState && _jsx(QuerySaveAsDialogContent, { saveAsState: saveAsState })] }) }));
|
73
73
|
});
|
74
|
-
const QueryLoader = observer((props) => {
|
75
|
-
const { editorStore, queryBuilderState } = props;
|
76
|
-
const applicationStore = useApplicationStore();
|
77
|
-
const queryFinderRef = useRef(null);
|
78
|
-
const searchInputRef = useRef(null);
|
79
|
-
const [selectedQueryID, setSelectedQueryID] = useState('');
|
80
|
-
const [isMineOnly, setIsMineOnly] = useState(false);
|
81
|
-
const [searchText, setSearchText] = useState('');
|
82
|
-
// search text
|
83
|
-
const debouncedLoadQueries = useMemo(() => debounce((input) => {
|
84
|
-
flowResult(editorStore.queryLoaderState.loadQueries(input)).catch(applicationStore.alertUnhandledError);
|
85
|
-
}, 500), [applicationStore, editorStore.queryLoaderState]);
|
86
|
-
const onSearchTextChange = (event) => {
|
87
|
-
if (event.target.value !== searchText) {
|
88
|
-
setSearchText(event.target.value);
|
89
|
-
debouncedLoadQueries.cancel();
|
90
|
-
debouncedLoadQueries(event.target.value);
|
91
|
-
}
|
92
|
-
};
|
93
|
-
const clearQuerySearching = () => {
|
94
|
-
setSearchText('');
|
95
|
-
debouncedLoadQueries.cancel();
|
96
|
-
debouncedLoadQueries('');
|
97
|
-
};
|
98
|
-
const toggleShowCurrentUserQueriesOnly = () => {
|
99
|
-
editorStore.queryLoaderState.setShowCurrentUserQueriesOnly(!editorStore.queryLoaderState.showCurrentUserQueriesOnly);
|
100
|
-
setIsMineOnly(!isMineOnly);
|
101
|
-
debouncedLoadQueries.cancel();
|
102
|
-
debouncedLoadQueries(searchText);
|
103
|
-
};
|
104
|
-
useEffect(() => {
|
105
|
-
flowResult(editorStore.queryLoaderState.loadQueries('')).catch(applicationStore.alertUnhandledError);
|
106
|
-
}, [applicationStore, editorStore.queryLoaderState]);
|
107
|
-
// actions
|
108
|
-
const loadQuery = () => {
|
109
|
-
if (selectedQueryID) {
|
110
|
-
queryBuilderState.changeDetectionState.alertUnsavedChanges(() => {
|
111
|
-
editorStore.queryLoaderState.setIsQueryLoaderOpen(false);
|
112
|
-
applicationStore.navigationService.navigator.goToLocation(generateExistingQueryEditorRoute(selectedQueryID), { ignoreBlocking: true });
|
113
|
-
});
|
114
|
-
}
|
115
|
-
};
|
116
|
-
// life-cycle
|
117
|
-
const close = () => {
|
118
|
-
editorStore.queryLoaderState.setIsQueryLoaderOpen(false);
|
119
|
-
editorStore.queryLoaderState.reset();
|
120
|
-
};
|
121
|
-
const onEnter = () => queryFinderRef.current?.focus();
|
122
|
-
return (_jsx(Dialog, { open: editorStore.queryLoaderState.isQueryLoaderOpen, onClose: close, TransitionProps: {
|
123
|
-
onEnter,
|
124
|
-
}, classes: { container: 'search-modal__container' }, PaperProps: { classes: { root: 'search-modal__inner-container' } }, children: _jsxs(Modal, { darkMode: true, className: "search-modal", children: [_jsx(ModalTitle, { title: "Load Query" }), _jsx("div", { className: "query-editor__query-loader__filter-section", children: _jsxs("div", { className: "query-editor__query-loader__filter-section__section__toggler", children: [_jsx("button", { className: clsx('query-editor__query-loader__filter-section__section__toggler__btn', {
|
125
|
-
'query-editor__query-loader__filter-section__section__toggler__btn--toggled': isMineOnly,
|
126
|
-
}), onClick: toggleShowCurrentUserQueriesOnly, tabIndex: -1, children: isMineOnly ? _jsx(CheckSquareIcon, {}) : _jsx(SquareIcon, {}) }), _jsx("div", { className: "query-editor__query-loader__filter-section__section__toggler__prompt", onClick: toggleShowCurrentUserQueriesOnly, children: "Mine Only" })] }) }), _jsx("div", { className: "query-editor__query-loader__search-section", children: _jsxs("div", { className: "query-editor__query-loader__search-section__input__container", children: [_jsx("input", { ref: searchInputRef, className: clsx('query-editor__query-loader__search-section__input input--dark', {
|
127
|
-
'query-editor__query-loader__search-section__input--searching': searchText,
|
128
|
-
}), onChange: onSearchTextChange, value: searchText, placeholder: "Search a query by name" }), !searchText ? (_jsx("div", { className: "query-editor__query-loader__search-section__input__search__icon", children: _jsx(SearchIcon, {}) })) : (_jsx(_Fragment, { children: _jsx("button", { className: "query-editor__query-loader__search-section__input__clear-btn", tabIndex: -1, onClick: clearQuerySearching, title: "Clear", children: _jsx(TimesIcon, {}) }) }))] }) }), _jsxs("div", { className: "query-editor__query-loader__body", children: [editorStore.queryLoaderState.loadQueriesState.hasCompleted && (_jsxs(_Fragment, { children: [editorStore.queryLoaderState.queries.length > 0 && (_jsx(_Fragment, { children: _jsxs("table", { className: "table", children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { className: "table__cell--left", children: "Name" }), _jsx("th", { className: "table__cell--left", children: "Author" }), _jsx("th", { className: "table__cell--left", children: "Version" })] }) }), _jsx("tbody", { children: editorStore.queryLoaderState.queries.map((query) => (_jsxs("tr", { className: clsx('query-editor__query-loader__body__table__row', {
|
129
|
-
'query-editor__query-loader__body__table__row--selected': selectedQueryID === query.id,
|
130
|
-
}), onClick: (event) => setSelectedQueryID(query.id), children: [_jsx("td", { className: "table__cell--left", children: query.name }), _jsx("td", { className: "table__cell--left", children: query.owner ?? 'anonymous' }), _jsx("td", { className: "table__cell--left", children: query.versionId })] }, query.id))) })] }) })), editorStore.queryLoaderState.queries.length === 0 && (_jsx(BlankPanelContent, { children: "No query available" }))] })), !editorStore.queryLoaderState.loadQueriesState.hasCompleted && (_jsxs(_Fragment, { children: [_jsx(PanelLoadingIndicator, { isLoading: !editorStore.queryLoaderState.loadQueriesState.hasCompleted }), _jsx(BlankPanelContent, { children: "Loading queries..." })] }))] }), _jsxs("div", { className: "search-modal__actions", children: [_jsx("button", { className: "btn btn--dark", onClick: loadQuery, disabled: selectedQueryID === '', children: "Load Query" }), _jsx("button", { className: "btn btn--dark", onClick: close, children: "Close" })] })] }) }));
|
131
|
-
});
|
132
|
-
const HelpMenuContentItemRenderer = (props) => (_jsxs(MenuContentItem, { title: props.title ?? '', onClick: props.onClick, children: [props.icon && _jsx(MenuContentItemIcon, { children: props.icon }), _jsx(MenuContentItemLabel, { className: "query-builder__sub-header__menu-content", children: props.label })] }));
|
133
74
|
const QueryEditorHeaderContent = observer((props) => {
|
134
75
|
const { queryBuilderState } = props;
|
135
76
|
const editorStore = useQueryEditorStore();
|
@@ -137,7 +78,7 @@ const QueryEditorHeaderContent = observer((props) => {
|
|
137
78
|
const applicationStore = useLegendQueryApplicationStore();
|
138
79
|
// actions
|
139
80
|
const openQueryLoader = () => {
|
140
|
-
editorStore.queryLoaderState.
|
81
|
+
editorStore.queryLoaderState.setQueryLoaderDialogOpen(true);
|
141
82
|
};
|
142
83
|
const viewProject = () => {
|
143
84
|
LegendQueryTelemetryHelper.logEvent_QueryViewProjectLaunched(editorStore.applicationStore.telemetryService);
|
@@ -155,38 +96,41 @@ const QueryEditorHeaderContent = observer((props) => {
|
|
155
96
|
: LEGEND_APPLICATION_COLOR_THEME.LEGACY_LIGHT, { persist: true });
|
156
97
|
};
|
157
98
|
const renameRef = useRef(null);
|
158
|
-
const updateQuery = () => {
|
159
|
-
|
160
|
-
|
161
|
-
editorStore.setRenameState(new QueryRenameState(editorStore, queryBuilderState, lambda, await editorStore.
|
99
|
+
const updateQuery = applicationStore.guardUnhandledError(async () => {
|
100
|
+
try {
|
101
|
+
const lambda = queryBuilderState.buildQuery();
|
102
|
+
editorStore.setRenameState(new QueryRenameState(editorStore, queryBuilderState, lambda, await editorStore.getPersistConfiguration(lambda, {
|
162
103
|
update: true,
|
163
104
|
})));
|
164
|
-
})
|
165
|
-
.then(() => {
|
166
105
|
renameRef.current?.select();
|
167
|
-
}
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
await renameState?.renameQuery();
|
106
|
+
}
|
107
|
+
catch {
|
108
|
+
// do nothing
|
109
|
+
}
|
172
110
|
});
|
173
|
-
const saveQuery = () => {
|
174
|
-
|
175
|
-
|
176
|
-
editorStore.setSaveState(new QuerySaveState(editorStore, queryBuilderState, lambda, await editorStore.
|
111
|
+
const saveQuery = applicationStore.guardUnhandledError(async () => {
|
112
|
+
try {
|
113
|
+
const lambda = queryBuilderState.buildQuery();
|
114
|
+
editorStore.setSaveState(new QuerySaveState(editorStore, queryBuilderState, lambda, await editorStore.getPersistConfiguration(lambda, {
|
177
115
|
update: true,
|
178
116
|
})));
|
179
|
-
flowResult(editorStore.saveState?.saveQuery()).catch(applicationStore.alertUnhandledError);
|
180
|
-
}
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
.
|
189
|
-
|
117
|
+
await flowResult(editorStore.saveState?.saveQuery()).catch(applicationStore.alertUnhandledError);
|
118
|
+
}
|
119
|
+
catch {
|
120
|
+
// do nothing
|
121
|
+
}
|
122
|
+
});
|
123
|
+
const saveAsQuery = applicationStore.guardUnhandledError(async () => {
|
124
|
+
try {
|
125
|
+
const lambda = queryBuilderState.buildQuery();
|
126
|
+
editorStore.setSaveAsState(new QuerySaveAsState(editorStore, queryBuilderState, lambda, await editorStore.getPersistConfiguration(lambda, {
|
127
|
+
update: true,
|
128
|
+
})));
|
129
|
+
}
|
130
|
+
catch {
|
131
|
+
// do nothing
|
132
|
+
}
|
133
|
+
});
|
190
134
|
const toggleAssistant = () => applicationStore.assistantService.toggleAssistant();
|
191
135
|
const queryDocEntry = applicationStore.documentationService.getDocEntry(QUERY_DOCUMENTATION_KEY.TUTORIAL_QUERY_BUILDER);
|
192
136
|
const openQueryTutorial = () => {
|
@@ -194,6 +138,11 @@ const QueryEditorHeaderContent = observer((props) => {
|
|
194
138
|
applicationStore.navigationService.navigator.visitAddress(queryDocEntry.url);
|
195
139
|
}
|
196
140
|
};
|
141
|
+
const renameQuery = () => {
|
142
|
+
if (renameState) {
|
143
|
+
flowResult(renameState.renameQuery()).catch(applicationStore.alertUnhandledError);
|
144
|
+
}
|
145
|
+
};
|
197
146
|
const changeQueryName = (event) => renameState?.setQueryName(event.target.value);
|
198
147
|
const onEnter = (event) => {
|
199
148
|
if (event.code === 'Enter') {
|
@@ -218,11 +167,11 @@ const QueryEditorHeaderContent = observer((props) => {
|
|
218
167
|
const isExistingQueryName = renameState?.editorStore.existingQueryName;
|
219
168
|
const extraHelpMenuContentItems = applicationStore.pluginManager
|
220
169
|
.getApplicationPlugins()
|
221
|
-
.flatMap((plugin) => plugin.
|
222
|
-
.map((item) => _jsx(
|
170
|
+
.flatMap((plugin) => plugin.getExtraQueryEditorHelpMenuActionConfigurations?.() ?? [])
|
171
|
+
.map((item) => (_jsxs(MenuContentItem, { title: item.title ?? '', onClick: item.onClick, children: [item.icon && _jsx(MenuContentItemIcon, { children: item.icon }), _jsx(MenuContentItemLabel, { children: item.label })] }, item.key)));
|
223
172
|
return (_jsxs("div", { className: "query-editor__header__content", children: [renameState ? (_jsx("div", { className: "query-editor__header__content__main query-editor__header__content__title", children: _jsxs(PanelListItem, { children: [_jsxs("div", { className: "input--with-validation", children: [_jsx("input", { title: "Query title rename", ref: renameRef, className: clsx('input input--dark', {
|
224
173
|
'input--caution': isExistingQueryName,
|
225
|
-
}), onChange: changeQueryName, onKeyDown: onEnter, value: renameState.queryName, placeholder: "Search" }), isExistingQueryName && (_jsx("div", { className: "input--with-validation__caution", title: `Query
|
174
|
+
}), onChange: changeQueryName, onKeyDown: onEnter, value: renameState.queryName, placeholder: "Search" }), isExistingQueryName && (_jsx("div", { className: "input--with-validation__caution", title: `Query with name '${isExistingQueryName}' already exists`, children: _jsx(ExclamationTriangleIcon, { className: "input--with-validation__caution__indicator" }) }))] }), _jsx("button", { className: clsx('input__btn', {
|
226
175
|
'btn--icon__caution': isExistingQueryName,
|
227
176
|
}), onClick: renameQuery, title: "Rename Query", children: _jsx(CheckIcon, {}) })] }) })) : (_jsx("div", { className: "query-editor__header__content__main query-editor__header__content__title", title: "Query title", children: editorStore.title })), _jsxs("div", { className: "query-editor__header__actions", children: [applicationStore.pluginManager
|
228
177
|
.getApplicationPlugins()
|
@@ -230,8 +179,9 @@ const QueryEditorHeaderContent = observer((props) => {
|
|
230
179
|
[])
|
231
180
|
.map((actionConfig) => (_jsx(Fragment, { children: actionConfig.renderer(editorStore, queryBuilderState) }, actionConfig.key))), _jsxs(Button, { className: "query-editor__header__action btn--dark", onClick: openQueryLoader, title: "Load query...", children: [_jsx(ManageSearchIcon, { className: "query-editor__header__action__icon--load" }), _jsx("div", { className: "query-editor__header__action__label", children: "Load Query" })] }), _jsxs(Button, { className: "query-editor__header__action btn--dark", disabled: editorStore.isSaveActionDisabled ||
|
232
181
|
!editorStore.title ||
|
233
|
-
|
234
|
-
.
|
182
|
+
Boolean(editorStore.saveState?.saveQueryState.isInProgress), onClick: saveQuery, title: "Save query", children: [_jsx(SaveCurrIcon, {}), _jsx("div", { className: "query-editor__header__action__label", children: "Save" })] }), _jsxs(Button, { className: "query-editor__header__action btn--dark", disabled: editorStore.isSaveActionDisabled ||
|
183
|
+
Boolean(editorStore.saveAsState?.createQueryState.isInProgress), onClick: saveAsQuery, title: "Save as new query", children: [_jsx(SaveAsIcon, {}), _jsx("div", { className: "query-editor__header__action__label", children: "Save As..." })] }), _jsxs(DropdownMenu, { className: "query-editor__header__action btn--dark", disabled: editorStore.isViewProjectActionDisabled, content: _jsxs(MenuContent, { children: [extraHelpMenuContentItems, queryDocEntry && (_jsxs(MenuContentItem, { onClick: openQueryTutorial, children: [_jsx(MenuContentItemIcon, { children: null }), _jsx(MenuContentItemLabel, { children: "Open Documentation" })] })), _jsxs(MenuContentItem, { onClick: toggleAssistant, children: [_jsx(MenuContentItemIcon, { children: !applicationStore.assistantService.isHidden ? (_jsx(CheckIcon, {})) : null }), _jsx(MenuContentItemLabel, { children: "Show Virtual Assistant" })] })] }), children: [_jsx("div", { className: "query-editor__header__action__label", title: "See more options", children: "Help..." }), _jsx(CaretDownIcon, { className: "query-editor__header__action__dropdown-trigger" })] }), editorStore.queryLoaderState.isQueryLoaderDialogOpen && (_jsx(QueryLoaderDialog, { queryLoaderState: editorStore.queryLoaderState, title: "Load query" })), _jsx("button", { title: "Toggle light/dark mode", onClick: TEMPORARY__toggleLightDarkMode, className: "query-editor__header__action query-editor__header__action__theme-toggler", children: applicationStore.layoutService
|
184
|
+
.TEMPORARY__isLightColorThemeEnabled ? (_jsx(_Fragment, { children: _jsx(LightBulbIcon, { className: "query-editor__header__action__icon--bulb--light" }) })) : (_jsx(_Fragment, { children: _jsx(EmptyLightBulbIcon, { className: "query-editor__header__action__icon--bulb--dark" }) })) }), _jsxs(DropdownMenu, { className: "query-editor__header__action btn--medium", disabled: editorStore.isViewProjectActionDisabled, content: _jsxs(MenuContent, { children: [_jsx(MenuContentItem, { className: "query-editor__header__action__options", onClick: updateQuery, disabled: !editorStore.title, children: "Rename Query" }), _jsx(MenuContentItem, { className: "query-editor__header__action__options", disabled: editorStore.isViewProjectActionDisabled, onClick: viewProject, children: "Go to Project" }), _jsx(MenuContentItem, { className: "query-editor__header__action__options", disabled: editorStore.isViewProjectActionDisabled, onClick: viewSDLCProject, children: "Go to SDLC project" })] }), children: [_jsx("div", { className: "query-editor__header__action__label", title: "See more options", children: "More Actions..." }), _jsx(CaretDownIcon, { className: "query-editor__header__action__dropdown-trigger" })] }), editorStore.saveAsState && _jsx(QuerySaveDialog, {})] })] }));
|
235
185
|
});
|
236
186
|
export const QueryEditor = observer(() => {
|
237
187
|
const applicationStore = useApplicationStore();
|