@finos/legend-application-query 7.0.1 → 8.1.0
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/LegendQueryAppEvent.d.ts +1 -1
- package/lib/LegendQueryAppEvent.d.ts.map +1 -1
- package/lib/LegendQueryAppEvent.js +1 -1
- package/lib/LegendQueryAppEvent.js.map +1 -1
- package/lib/application/LegendQuery.d.ts.map +1 -1
- package/lib/application/LegendQuery.js +1 -1
- package/lib/application/LegendQuery.js.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.d.ts +6 -7
- package/lib/application/LegendQueryApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendQueryApplicationConfig.js +9 -4
- package/lib/application/LegendQueryApplicationConfig.js.map +1 -1
- package/lib/components/LegendQueryApplication.d.ts +1 -2
- package/lib/components/LegendQueryApplication.d.ts.map +1 -1
- package/lib/components/LegendQueryApplication.js +2 -3
- package/lib/components/LegendQueryApplication.js.map +1 -1
- package/lib/components/LegendQueryBaseStoreProvider.d.ts +1 -3
- package/lib/components/LegendQueryBaseStoreProvider.d.ts.map +1 -1
- package/lib/components/LegendQueryBaseStoreProvider.js +2 -2
- package/lib/components/LegendQueryBaseStoreProvider.js.map +1 -1
- package/lib/components/QueryEditor.d.ts +1 -0
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +42 -28
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/QueryEditorComponentTestUtils.d.ts.map +1 -1
- package/lib/components/QueryEditorComponentTestUtils.js +2 -2
- package/lib/components/QueryEditorComponentTestUtils.js.map +1 -1
- package/lib/components/QueryEditorStoreProvider.d.ts.map +1 -1
- package/lib/components/QueryEditorStoreProvider.js +6 -8
- package/lib/components/QueryEditorStoreProvider.js.map +1 -1
- package/lib/components/QuerySetup.d.ts +6 -0
- package/lib/components/QuerySetup.d.ts.map +1 -1
- package/lib/components/QuerySetup.js +152 -34
- package/lib/components/QuerySetup.js.map +1 -1
- package/lib/components/QuerySetupStoreProvider.d.ts.map +1 -1
- package/lib/components/QuerySetupStoreProvider.js +2 -3
- package/lib/components/QuerySetupStoreProvider.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 +9 -9
- package/lib/stores/LegendQueryApplicationPlugin.d.ts +10 -2
- package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/stores/LegendQueryBaseStore.d.ts +2 -3
- package/lib/stores/LegendQueryBaseStore.d.ts.map +1 -1
- package/lib/stores/LegendQueryBaseStore.js +2 -2
- package/lib/stores/LegendQueryBaseStore.js.map +1 -1
- package/lib/stores/LegendQueryRouter.d.ts +16 -1
- package/lib/stores/LegendQueryRouter.d.ts.map +1 -1
- package/lib/stores/LegendQueryRouter.js +17 -2
- package/lib/stores/LegendQueryRouter.js.map +1 -1
- package/lib/stores/QueryEditorStore.d.ts +15 -12
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +24 -19
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/QueryEditorStoreTestUtils.d.ts.map +1 -1
- package/lib/stores/QueryEditorStoreTestUtils.js +1 -0
- package/lib/stores/QueryEditorStoreTestUtils.js.map +1 -1
- package/lib/stores/QuerySetupStore.d.ts +35 -9
- package/lib/stores/QuerySetupStore.d.ts.map +1 -1
- package/lib/stores/QuerySetupStore.js +188 -17
- package/lib/stores/QuerySetupStore.js.map +1 -1
- package/package.json +17 -17
- package/src/LegendQueryAppEvent.ts +1 -1
- package/src/application/LegendQuery.tsx +1 -4
- package/src/application/LegendQueryApplicationConfig.ts +30 -10
- package/src/components/LegendQueryApplication.tsx +3 -9
- package/src/components/LegendQueryBaseStoreProvider.tsx +4 -14
- package/src/components/QueryEditor.tsx +77 -61
- package/src/components/QueryEditorComponentTestUtils.tsx +1 -6
- package/src/components/QueryEditorStoreProvider.tsx +3 -14
- package/src/components/QuerySetup.tsx +411 -50
- package/src/components/QuerySetupStoreProvider.tsx +2 -11
- package/src/index.ts +1 -0
- package/src/stores/LegendQueryApplicationPlugin.ts +18 -2
- package/src/stores/LegendQueryBaseStore.ts +2 -4
- package/src/stores/LegendQueryRouter.ts +35 -2
- package/src/stores/QueryEditorStore.ts +34 -30
- package/src/stores/QueryEditorStoreTestUtils.ts +1 -0
- package/src/stores/QuerySetupStore.ts +275 -20
@@ -19,7 +19,10 @@ import type { Query } from '@finos/legend-graph';
|
|
19
19
|
import type { QueryBuilderState } from '@finos/legend-query-builder';
|
20
20
|
import type React from 'react';
|
21
21
|
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
22
|
-
import type {
|
22
|
+
import type {
|
23
|
+
ExistingQueryEditorStore,
|
24
|
+
QueryEditorStore,
|
25
|
+
} from './QueryEditorStore.js';
|
23
26
|
import type { QuerySetupState, QuerySetupStore } from './QuerySetupStore.js';
|
24
27
|
|
25
28
|
export type QuerySetupOptionRendererConfiguration = {
|
@@ -37,9 +40,17 @@ export type QueryEditorHeaderLabeler = (
|
|
37
40
|
|
38
41
|
export type ExistingQueryEditorStateBuilder = (
|
39
42
|
query: Query,
|
40
|
-
editorStore:
|
43
|
+
editorStore: ExistingQueryEditorStore,
|
41
44
|
) => QueryBuilderState | undefined;
|
42
45
|
|
46
|
+
export type ExistingQueryEditorActionRendererConfiguration = {
|
47
|
+
key: string;
|
48
|
+
renderer: (
|
49
|
+
editorStore: ExistingQueryEditorStore,
|
50
|
+
queryBuilderState: QueryBuilderState,
|
51
|
+
) => React.ReactNode | undefined;
|
52
|
+
};
|
53
|
+
|
43
54
|
export abstract class LegendQueryApplicationPlugin extends LegendApplicationPlugin {
|
44
55
|
/**
|
45
56
|
* This helps to better type-check for this empty abtract type
|
@@ -70,4 +81,9 @@ export abstract class LegendQueryApplicationPlugin extends LegendApplicationPlug
|
|
70
81
|
* Get the list of existing query editor state builders.
|
71
82
|
*/
|
72
83
|
getExtraExistingQueryEditorStateBuilders?(): ExistingQueryEditorStateBuilder[];
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Get the list of renderer configurations for existing query editor actions.
|
87
|
+
*/
|
88
|
+
getExtraExistingQueryActionRendererConfiguration?(): ExistingQueryEditorActionRendererConfiguration[];
|
73
89
|
}
|
@@ -18,11 +18,10 @@ import type { DepotServerClient } from '@finos/legend-server-depot';
|
|
18
18
|
import type { ApplicationStore } from '@finos/legend-application';
|
19
19
|
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
20
20
|
import type { LegendQueryApplicationConfig } from '../application/LegendQueryApplicationConfig.js';
|
21
|
-
import type { LegendQueryApplicationPlugin } from './LegendQueryApplicationPlugin.js';
|
22
21
|
|
23
22
|
export type LegendQueryApplicationStore = ApplicationStore<
|
24
23
|
LegendQueryApplicationConfig,
|
25
|
-
|
24
|
+
LegendQueryPluginManager
|
26
25
|
>;
|
27
26
|
|
28
27
|
export class LegendQueryBaseStore {
|
@@ -33,11 +32,10 @@ export class LegendQueryBaseStore {
|
|
33
32
|
constructor(
|
34
33
|
applicationStore: LegendQueryApplicationStore,
|
35
34
|
depotServerClient: DepotServerClient,
|
36
|
-
pluginManager: LegendQueryPluginManager,
|
37
35
|
) {
|
38
36
|
this.applicationStore = applicationStore;
|
39
37
|
this.depotServerClient = depotServerClient;
|
40
|
-
this.pluginManager = pluginManager;
|
38
|
+
this.pluginManager = applicationStore.pluginManager;
|
41
39
|
|
42
40
|
// Register plugins
|
43
41
|
this.depotServerClient.setTracerService(
|
@@ -14,7 +14,7 @@
|
|
14
14
|
* limitations under the License.
|
15
15
|
*/
|
16
16
|
|
17
|
-
import { generateGAVCoordinates } from '@finos/legend-
|
17
|
+
import { generateGAVCoordinates } from '@finos/legend-storage';
|
18
18
|
import { generatePath } from 'react-router';
|
19
19
|
|
20
20
|
export enum LEGEND_QUERY_PATH_PARAM_TOKEN {
|
@@ -95,7 +95,10 @@ export interface ExistingQueryEditorPathParams {
|
|
95
95
|
[LEGEND_QUERY_PATH_PARAM_TOKEN.QUERY_ID]: string;
|
96
96
|
}
|
97
97
|
|
98
|
-
|
98
|
+
/**
|
99
|
+
* @external_application_navigation This depends on Legend Studio routing and is hardcoded so it's potentially brittle
|
100
|
+
*/
|
101
|
+
export const EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl = (
|
99
102
|
studioUrl: string,
|
100
103
|
groupId: string,
|
101
104
|
artifactId: string,
|
@@ -107,3 +110,33 @@ export const generateStudioProjectViewUrl = (
|
|
107
110
|
artifactId,
|
108
111
|
versionId,
|
109
112
|
)}${entityPath ? `/entity/${entityPath}` : ''}`;
|
113
|
+
|
114
|
+
/**
|
115
|
+
* @external_application_navigation This depends on Legend Studio routing and is hardcoded so it's potentially brittle
|
116
|
+
*/
|
117
|
+
export const EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateExistingServiceQueryUrl =
|
118
|
+
(
|
119
|
+
studioUrl: string,
|
120
|
+
groupId: string,
|
121
|
+
artifactId: string,
|
122
|
+
servicePath: string,
|
123
|
+
): string =>
|
124
|
+
`${studioUrl}/extensions/update-service-query/${servicePath}@${generateGAVCoordinates(
|
125
|
+
groupId,
|
126
|
+
artifactId,
|
127
|
+
undefined,
|
128
|
+
)}`;
|
129
|
+
|
130
|
+
/**
|
131
|
+
* @external_application_navigation This depends on Legend Studio routing and is hardcoded so it's potentially brittle
|
132
|
+
*/
|
133
|
+
export const EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateProjectServiceQueryUrl =
|
134
|
+
(studioUrl: string, projectId: string): string =>
|
135
|
+
`${studioUrl}/extensions/update-project-service-query/${projectId}`;
|
136
|
+
|
137
|
+
/**
|
138
|
+
* @external_application_navigation This depends on Legend Studio routing and is hardcoded so it's potentially brittle
|
139
|
+
*/
|
140
|
+
export const EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl =
|
141
|
+
(studioUrl: string, queryId: string): string =>
|
142
|
+
`${studioUrl}/extensions/productionize-query/${queryId}`;
|
@@ -57,13 +57,17 @@ import {
|
|
57
57
|
generateServiceQueryCreatorRoute,
|
58
58
|
} from './LegendQueryRouter.js';
|
59
59
|
import { LEGEND_QUERY_APP_EVENT } from '../LegendQueryAppEvent.js';
|
60
|
-
import type { Entity } from '@finos/legend-storage';
|
60
|
+
import type { Entity, ProjectGAVCoordinates } from '@finos/legend-storage';
|
61
61
|
import {
|
62
62
|
type DepotServerClient,
|
63
|
-
type ProjectGAVCoordinates,
|
64
63
|
ProjectData,
|
65
64
|
} from '@finos/legend-server-depot';
|
66
|
-
import {
|
65
|
+
import {
|
66
|
+
TAB_SIZE,
|
67
|
+
APPLICATION_EVENT,
|
68
|
+
DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
|
69
|
+
DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
|
70
|
+
} from '@finos/legend-application';
|
67
71
|
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
68
72
|
import { LegendQueryEventService } from './LegendQueryEventService.js';
|
69
73
|
import type { LegendQueryApplicationStore } from './LegendQueryBaseStore.js';
|
@@ -75,9 +79,6 @@ import {
|
|
75
79
|
ServiceQueryBuilderState,
|
76
80
|
} from '@finos/legend-query-builder';
|
77
81
|
|
78
|
-
const QUERY_BUILDER_SEARCH_TEXT_MIN_LENGTH = 3;
|
79
|
-
const QUERY_BUILDER_QUERY_LOAD_MAX_AMOUNT = 10;
|
80
|
-
|
81
82
|
export interface QueryExportConfiguration {
|
82
83
|
defaultName?: string | undefined;
|
83
84
|
allowUpdate?: boolean | undefined;
|
@@ -151,7 +152,7 @@ export class QueryExportState {
|
|
151
152
|
} catch (error) {
|
152
153
|
assertErrorThrown(error);
|
153
154
|
this.editorStore.applicationStore.log.error(
|
154
|
-
LogEvent.create(LEGEND_QUERY_APP_EVENT.
|
155
|
+
LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
|
155
156
|
error,
|
156
157
|
);
|
157
158
|
this.editorStore.applicationStore.notifyError(error);
|
@@ -192,7 +193,7 @@ export class QueryExportState {
|
|
192
193
|
} catch (error) {
|
193
194
|
assertErrorThrown(error);
|
194
195
|
this.editorStore.applicationStore.log.error(
|
195
|
-
LogEvent.create(LEGEND_QUERY_APP_EVENT.
|
196
|
+
LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
|
196
197
|
error,
|
197
198
|
);
|
198
199
|
this.editorStore.applicationStore.notifyError(error);
|
@@ -204,18 +205,20 @@ export class QueryExportState {
|
|
204
205
|
}
|
205
206
|
|
206
207
|
export class QueryLoaderState {
|
207
|
-
editorStore: QueryEditorStore;
|
208
|
-
isQueryLoaderOpen = false;
|
208
|
+
readonly editorStore: QueryEditorStore;
|
209
209
|
loadQueriesState = ActionState.create();
|
210
210
|
queries: LightQuery[] = [];
|
211
|
+
isQueryLoaderOpen = false;
|
212
|
+
showCurrentUserQueriesOnly = false;
|
211
213
|
|
212
214
|
constructor(editorStore: QueryEditorStore) {
|
213
215
|
makeObservable(this, {
|
214
216
|
isQueryLoaderOpen: observable,
|
215
217
|
queries: observable,
|
216
|
-
|
218
|
+
showCurrentUserQueriesOnly: observable,
|
217
219
|
setIsQueryLoaderOpen: action,
|
218
220
|
setQueries: action,
|
221
|
+
setShowCurrentUserQueriesOnly: action,
|
219
222
|
loadQueries: flow,
|
220
223
|
});
|
221
224
|
this.editorStore = editorStore;
|
@@ -229,16 +232,22 @@ export class QueryLoaderState {
|
|
229
232
|
this.queries = val;
|
230
233
|
}
|
231
234
|
|
235
|
+
setShowCurrentUserQueriesOnly(val: boolean): void {
|
236
|
+
this.showCurrentUserQueriesOnly = val;
|
237
|
+
}
|
238
|
+
|
232
239
|
*loadQueries(searchText: string): GeneratorFn<void> {
|
233
240
|
const isValidSearchString =
|
234
|
-
searchText.length >=
|
241
|
+
searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
|
235
242
|
this.loadQueriesState.inProgress();
|
236
243
|
try {
|
237
244
|
const searchSpecification = new QuerySearchSpecification();
|
238
245
|
searchSpecification.searchTerm = isValidSearchString
|
239
246
|
? searchText
|
240
247
|
: undefined;
|
241
|
-
searchSpecification.limit =
|
248
|
+
searchSpecification.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
|
249
|
+
searchSpecification.showCurrentUserQueriesOnly =
|
250
|
+
this.showCurrentUserQueriesOnly;
|
242
251
|
this.queries =
|
243
252
|
(yield this.editorStore.graphManagerState.graphManager.searchQueries(
|
244
253
|
searchSpecification,
|
@@ -253,12 +262,12 @@ export class QueryLoaderState {
|
|
253
262
|
}
|
254
263
|
|
255
264
|
export abstract class QueryEditorStore {
|
256
|
-
applicationStore: LegendQueryApplicationStore;
|
257
|
-
depotServerClient: DepotServerClient;
|
258
|
-
pluginManager: LegendQueryPluginManager;
|
259
|
-
graphManagerState: GraphManagerState;
|
265
|
+
readonly applicationStore: LegendQueryApplicationStore;
|
266
|
+
readonly depotServerClient: DepotServerClient;
|
267
|
+
readonly pluginManager: LegendQueryPluginManager;
|
268
|
+
readonly graphManagerState: GraphManagerState;
|
260
269
|
|
261
|
-
initState = ActionState.create();
|
270
|
+
readonly initState = ActionState.create();
|
262
271
|
queryBuilderState?: QueryBuilderState | undefined;
|
263
272
|
exportState?: QueryExportState | undefined;
|
264
273
|
queryLoaderState: QueryLoaderState;
|
@@ -266,7 +275,6 @@ export abstract class QueryEditorStore {
|
|
266
275
|
constructor(
|
267
276
|
applicationStore: LegendQueryApplicationStore,
|
268
277
|
depotServerClient: DepotServerClient,
|
269
|
-
pluginManager: LegendQueryPluginManager,
|
270
278
|
) {
|
271
279
|
makeObservable(this, {
|
272
280
|
exportState: observable,
|
@@ -278,10 +286,10 @@ export abstract class QueryEditorStore {
|
|
278
286
|
|
279
287
|
this.applicationStore = applicationStore;
|
280
288
|
this.depotServerClient = depotServerClient;
|
281
|
-
this.pluginManager = pluginManager;
|
289
|
+
this.pluginManager = applicationStore.pluginManager;
|
282
290
|
this.graphManagerState = new GraphManagerState(
|
283
|
-
|
284
|
-
|
291
|
+
applicationStore.pluginManager,
|
292
|
+
applicationStore.log,
|
285
293
|
);
|
286
294
|
this.queryLoaderState = new QueryLoaderState(this);
|
287
295
|
}
|
@@ -350,7 +358,7 @@ export abstract class QueryEditorStore {
|
|
350
358
|
} catch (error) {
|
351
359
|
assertErrorThrown(error);
|
352
360
|
this.applicationStore.log.error(
|
353
|
-
LogEvent.create(LEGEND_QUERY_APP_EVENT.
|
361
|
+
LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
|
354
362
|
error,
|
355
363
|
);
|
356
364
|
this.applicationStore.notifyError(error);
|
@@ -458,14 +466,13 @@ export class MappingQueryCreatorStore extends QueryEditorStore {
|
|
458
466
|
constructor(
|
459
467
|
applicationStore: LegendQueryApplicationStore,
|
460
468
|
depotServerClient: DepotServerClient,
|
461
|
-
pluginManager: LegendQueryPluginManager,
|
462
469
|
groupId: string,
|
463
470
|
artifactId: string,
|
464
471
|
versionId: string,
|
465
472
|
mappingPath: string,
|
466
473
|
runtimePath: string,
|
467
474
|
) {
|
468
|
-
super(applicationStore, depotServerClient
|
475
|
+
super(applicationStore, depotServerClient);
|
469
476
|
|
470
477
|
this.groupId = groupId;
|
471
478
|
this.artifactId = artifactId;
|
@@ -521,7 +528,6 @@ export class MappingQueryCreatorStore extends QueryEditorStore {
|
|
521
528
|
),
|
522
529
|
),
|
523
530
|
);
|
524
|
-
|
525
531
|
return queryBuilderState;
|
526
532
|
}
|
527
533
|
|
@@ -547,14 +553,13 @@ export class ServiceQueryCreatorStore extends QueryEditorStore {
|
|
547
553
|
constructor(
|
548
554
|
applicationStore: LegendQueryApplicationStore,
|
549
555
|
depotServerClient: DepotServerClient,
|
550
|
-
pluginManager: LegendQueryPluginManager,
|
551
556
|
groupId: string,
|
552
557
|
artifactId: string,
|
553
558
|
versionId: string,
|
554
559
|
servicePath: string,
|
555
560
|
executionKey: string | undefined,
|
556
561
|
) {
|
557
|
-
super(applicationStore, depotServerClient
|
562
|
+
super(applicationStore, depotServerClient);
|
558
563
|
|
559
564
|
this.groupId = groupId;
|
560
565
|
this.artifactId = artifactId;
|
@@ -625,10 +630,9 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
|
|
625
630
|
constructor(
|
626
631
|
applicationStore: LegendQueryApplicationStore,
|
627
632
|
depotServerClient: DepotServerClient,
|
628
|
-
pluginManager: LegendQueryPluginManager,
|
629
633
|
queryId: string,
|
630
634
|
) {
|
631
|
-
super(applicationStore, depotServerClient
|
635
|
+
super(applicationStore, depotServerClient);
|
632
636
|
|
633
637
|
makeObservable<ExistingQueryEditorStore, '_query'>(this, {
|
634
638
|
_query: observable,
|