@finos/legend-application-query 8.0.0 → 8.1.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/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/components/LegendQueryApplication.d.ts +1 -0
- package/lib/components/LegendQueryApplication.d.ts.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 +16 -6
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/QuerySetup.d.ts.map +1 -1
- package/lib/components/QuerySetup.js +66 -24
- 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 +6 -6
- 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/LegendQueryRouter.d.ts +4 -0
- package/lib/stores/LegendQueryRouter.d.ts.map +1 -1
- package/lib/stores/LegendQueryRouter.js +4 -0
- package/lib/stores/LegendQueryRouter.js.map +1 -1
- package/lib/stores/QueryEditorStore.d.ts +5 -5
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +6 -8
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/QuerySetupStore.d.ts +18 -6
- package/lib/stores/QuerySetupStore.d.ts.map +1 -1
- package/lib/stores/QuerySetupStore.js +92 -12
- package/lib/stores/QuerySetupStore.js.map +1 -1
- package/package.json +14 -14
- package/src/LegendQueryAppEvent.ts +1 -1
- package/src/components/QueryEditor.tsx +30 -20
- package/src/components/QuerySetup.tsx +190 -26
- package/src/index.ts +1 -0
- package/src/stores/LegendQueryApplicationPlugin.ts +18 -2
- package/src/stores/LegendQueryRouter.ts +7 -0
- package/src/stores/QueryEditorStore.ts +16 -14
- package/src/stores/QuerySetupStore.ts +130 -15
@@ -62,7 +62,12 @@ import {
|
|
62
62
|
type DepotServerClient,
|
63
63
|
ProjectData,
|
64
64
|
} from '@finos/legend-server-depot';
|
65
|
-
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';
|
66
71
|
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
67
72
|
import { LegendQueryEventService } from './LegendQueryEventService.js';
|
68
73
|
import type { LegendQueryApplicationStore } from './LegendQueryBaseStore.js';
|
@@ -74,9 +79,6 @@ import {
|
|
74
79
|
ServiceQueryBuilderState,
|
75
80
|
} from '@finos/legend-query-builder';
|
76
81
|
|
77
|
-
const QUERY_BUILDER_SEARCH_TEXT_MIN_LENGTH = 3;
|
78
|
-
const QUERY_BUILDER_QUERY_LOAD_MAX_AMOUNT = 10;
|
79
|
-
|
80
82
|
export interface QueryExportConfiguration {
|
81
83
|
defaultName?: string | undefined;
|
82
84
|
allowUpdate?: boolean | undefined;
|
@@ -150,7 +152,7 @@ export class QueryExportState {
|
|
150
152
|
} catch (error) {
|
151
153
|
assertErrorThrown(error);
|
152
154
|
this.editorStore.applicationStore.log.error(
|
153
|
-
LogEvent.create(LEGEND_QUERY_APP_EVENT.
|
155
|
+
LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
|
154
156
|
error,
|
155
157
|
);
|
156
158
|
this.editorStore.applicationStore.notifyError(error);
|
@@ -191,7 +193,7 @@ export class QueryExportState {
|
|
191
193
|
} catch (error) {
|
192
194
|
assertErrorThrown(error);
|
193
195
|
this.editorStore.applicationStore.log.error(
|
194
|
-
LogEvent.create(LEGEND_QUERY_APP_EVENT.
|
196
|
+
LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
|
195
197
|
error,
|
196
198
|
);
|
197
199
|
this.editorStore.applicationStore.notifyError(error);
|
@@ -236,14 +238,14 @@ export class QueryLoaderState {
|
|
236
238
|
|
237
239
|
*loadQueries(searchText: string): GeneratorFn<void> {
|
238
240
|
const isValidSearchString =
|
239
|
-
searchText.length >=
|
241
|
+
searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
|
240
242
|
this.loadQueriesState.inProgress();
|
241
243
|
try {
|
242
244
|
const searchSpecification = new QuerySearchSpecification();
|
243
245
|
searchSpecification.searchTerm = isValidSearchString
|
244
246
|
? searchText
|
245
247
|
: undefined;
|
246
|
-
searchSpecification.limit =
|
248
|
+
searchSpecification.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
|
247
249
|
searchSpecification.showCurrentUserQueriesOnly =
|
248
250
|
this.showCurrentUserQueriesOnly;
|
249
251
|
this.queries =
|
@@ -260,12 +262,12 @@ export class QueryLoaderState {
|
|
260
262
|
}
|
261
263
|
|
262
264
|
export abstract class QueryEditorStore {
|
263
|
-
applicationStore: LegendQueryApplicationStore;
|
264
|
-
depotServerClient: DepotServerClient;
|
265
|
-
pluginManager: LegendQueryPluginManager;
|
266
|
-
graphManagerState: GraphManagerState;
|
265
|
+
readonly applicationStore: LegendQueryApplicationStore;
|
266
|
+
readonly depotServerClient: DepotServerClient;
|
267
|
+
readonly pluginManager: LegendQueryPluginManager;
|
268
|
+
readonly graphManagerState: GraphManagerState;
|
267
269
|
|
268
|
-
initState = ActionState.create();
|
270
|
+
readonly initState = ActionState.create();
|
269
271
|
queryBuilderState?: QueryBuilderState | undefined;
|
270
272
|
exportState?: QueryExportState | undefined;
|
271
273
|
queryLoaderState: QueryLoaderState;
|
@@ -356,7 +358,7 @@ export abstract class QueryEditorStore {
|
|
356
358
|
} catch (error) {
|
357
359
|
assertErrorThrown(error);
|
358
360
|
this.applicationStore.log.error(
|
359
|
-
LogEvent.create(LEGEND_QUERY_APP_EVENT.
|
361
|
+
LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
|
360
362
|
error,
|
361
363
|
);
|
362
364
|
this.applicationStore.notifyError(error);
|
@@ -34,6 +34,7 @@ import {
|
|
34
34
|
type Mapping,
|
35
35
|
type PackageableRuntime,
|
36
36
|
type Service,
|
37
|
+
type QueryInfo,
|
37
38
|
QuerySearchSpecification,
|
38
39
|
BasicGraphManagerState,
|
39
40
|
CORE_PURE_PATH,
|
@@ -46,7 +47,12 @@ import {
|
|
46
47
|
} from '@finos/legend-server-depot';
|
47
48
|
import { type Entity, parseProjectIdentifier } from '@finos/legend-storage';
|
48
49
|
import { LEGEND_QUERY_APP_EVENT } from '../LegendQueryAppEvent.js';
|
49
|
-
import {
|
50
|
+
import {
|
51
|
+
APPLICATION_EVENT,
|
52
|
+
DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
|
53
|
+
DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
|
54
|
+
TAB_SIZE,
|
55
|
+
} from '@finos/legend-application';
|
50
56
|
import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
|
51
57
|
import type { LegendQueryApplicationStore } from './LegendQueryBaseStore.js';
|
52
58
|
import {
|
@@ -57,6 +63,7 @@ import {
|
|
57
63
|
extractServiceInfo,
|
58
64
|
} from '@finos/legend-query-builder';
|
59
65
|
import {
|
66
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl,
|
60
67
|
EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateExistingServiceQueryUrl,
|
61
68
|
EXTERNAL_APPLICATION_NAVIGATION__generateStudioUpdateProjectServiceQueryUrl,
|
62
69
|
} from './LegendQueryRouter.js';
|
@@ -74,6 +81,7 @@ export class EditExistingQuerySetupState extends QuerySetupState {
|
|
74
81
|
loadQueriesState = ActionState.create();
|
75
82
|
loadQueryState = ActionState.create();
|
76
83
|
currentQuery?: LightQuery | undefined;
|
84
|
+
currentQueryInfo?: QueryInfo | undefined;
|
77
85
|
showCurrentUserQueriesOnly = false;
|
78
86
|
|
79
87
|
constructor(setupStore: QuerySetupStore) {
|
@@ -82,6 +90,7 @@ export class EditExistingQuerySetupState extends QuerySetupState {
|
|
82
90
|
makeObservable(this, {
|
83
91
|
queries: observable,
|
84
92
|
currentQuery: observable,
|
93
|
+
currentQueryInfo: observable,
|
85
94
|
showCurrentUserQueriesOnly: observable,
|
86
95
|
setShowCurrentUserQueriesOnly: action,
|
87
96
|
setCurrentQuery: flow,
|
@@ -101,6 +110,10 @@ export class EditExistingQuerySetupState extends QuerySetupState {
|
|
101
110
|
(yield this.setupStore.graphManagerState.graphManager.getLightQuery(
|
102
111
|
queryId,
|
103
112
|
)) as LightQuery;
|
113
|
+
this.currentQueryInfo =
|
114
|
+
(yield this.setupStore.graphManagerState.graphManager.getQueryInfo(
|
115
|
+
queryId,
|
116
|
+
)) as QueryInfo;
|
104
117
|
} catch (error) {
|
105
118
|
assertErrorThrown(error);
|
106
119
|
this.setupStore.applicationStore.notifyError(error);
|
@@ -113,14 +126,15 @@ export class EditExistingQuerySetupState extends QuerySetupState {
|
|
113
126
|
}
|
114
127
|
|
115
128
|
*loadQueries(searchText: string): GeneratorFn<void> {
|
116
|
-
const isValidSearchString =
|
129
|
+
const isValidSearchString =
|
130
|
+
searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
|
117
131
|
this.loadQueriesState.inProgress();
|
118
132
|
try {
|
119
133
|
const searchSpecification = new QuerySearchSpecification();
|
120
134
|
searchSpecification.searchTerm = isValidSearchString
|
121
135
|
? searchText
|
122
136
|
: undefined;
|
123
|
-
searchSpecification.limit =
|
137
|
+
searchSpecification.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
|
124
138
|
searchSpecification.showCurrentUserQueriesOnly =
|
125
139
|
this.showCurrentUserQueriesOnly;
|
126
140
|
this.queries =
|
@@ -136,8 +150,108 @@ export class EditExistingQuerySetupState extends QuerySetupState {
|
|
136
150
|
}
|
137
151
|
}
|
138
152
|
|
139
|
-
|
140
|
-
|
153
|
+
export class QueryProductionizationSetupState extends QuerySetupState {
|
154
|
+
queries: LightQuery[] = [];
|
155
|
+
loadQueriesState = ActionState.create();
|
156
|
+
loadQueryState = ActionState.create();
|
157
|
+
currentQuery?: LightQuery | undefined;
|
158
|
+
currentQueryInfo?: QueryInfo | undefined;
|
159
|
+
|
160
|
+
constructor(setupStore: QuerySetupStore) {
|
161
|
+
super(setupStore);
|
162
|
+
|
163
|
+
makeObservable(this, {
|
164
|
+
queries: observable,
|
165
|
+
currentQuery: observable,
|
166
|
+
currentQueryInfo: observable,
|
167
|
+
setCurrentQuery: flow,
|
168
|
+
loadQueries: flow,
|
169
|
+
});
|
170
|
+
}
|
171
|
+
|
172
|
+
async loadQueryProductionizer(): Promise<void> {
|
173
|
+
if (!this.currentQuery) {
|
174
|
+
return;
|
175
|
+
}
|
176
|
+
|
177
|
+
// fetch project data
|
178
|
+
const project = ProjectData.serialization.fromJson(
|
179
|
+
await this.setupStore.depotServerClient.getProject(
|
180
|
+
this.currentQuery.groupId,
|
181
|
+
this.currentQuery.artifactId,
|
182
|
+
),
|
183
|
+
);
|
184
|
+
|
185
|
+
// find the matching SDLC instance
|
186
|
+
const projectIDPrefix = parseProjectIdentifier(project.projectId).prefix;
|
187
|
+
const matchingSDLCEntry =
|
188
|
+
this.setupStore.applicationStore.config.studioInstances.find(
|
189
|
+
(entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
|
190
|
+
);
|
191
|
+
if (matchingSDLCEntry) {
|
192
|
+
this.setupStore.applicationStore.setBlockingAlert({
|
193
|
+
message: `Loading query...`,
|
194
|
+
prompt: 'Please do not close the application',
|
195
|
+
showLoading: true,
|
196
|
+
});
|
197
|
+
this.setupStore.applicationStore.navigator.jumpTo(
|
198
|
+
EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl(
|
199
|
+
matchingSDLCEntry.url,
|
200
|
+
this.currentQuery.id,
|
201
|
+
),
|
202
|
+
);
|
203
|
+
} else {
|
204
|
+
this.setupStore.applicationStore.notifyWarning(
|
205
|
+
`Can't find the corresponding SDLC instance to productionize the query`,
|
206
|
+
);
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
*setCurrentQuery(queryId: string | undefined): GeneratorFn<void> {
|
211
|
+
if (queryId) {
|
212
|
+
try {
|
213
|
+
this.loadQueryState.inProgress();
|
214
|
+
this.currentQuery =
|
215
|
+
(yield this.setupStore.graphManagerState.graphManager.getLightQuery(
|
216
|
+
queryId,
|
217
|
+
)) as LightQuery;
|
218
|
+
this.currentQueryInfo =
|
219
|
+
(yield this.setupStore.graphManagerState.graphManager.getQueryInfo(
|
220
|
+
queryId,
|
221
|
+
)) as QueryInfo;
|
222
|
+
} catch (error) {
|
223
|
+
assertErrorThrown(error);
|
224
|
+
this.setupStore.applicationStore.notifyError(error);
|
225
|
+
} finally {
|
226
|
+
this.loadQueryState.reset();
|
227
|
+
}
|
228
|
+
} else {
|
229
|
+
this.currentQuery = undefined;
|
230
|
+
}
|
231
|
+
}
|
232
|
+
|
233
|
+
*loadQueries(searchText: string): GeneratorFn<void> {
|
234
|
+
const isValidSearchString =
|
235
|
+
searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
|
236
|
+
this.loadQueriesState.inProgress();
|
237
|
+
try {
|
238
|
+
const searchSpecification = new QuerySearchSpecification();
|
239
|
+
searchSpecification.searchTerm = isValidSearchString
|
240
|
+
? searchText
|
241
|
+
: undefined;
|
242
|
+
searchSpecification.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
|
243
|
+
this.queries =
|
244
|
+
(yield this.setupStore.graphManagerState.graphManager.searchQueries(
|
245
|
+
searchSpecification,
|
246
|
+
)) as LightQuery[];
|
247
|
+
this.loadQueriesState.pass();
|
248
|
+
} catch (error) {
|
249
|
+
assertErrorThrown(error);
|
250
|
+
this.setupStore.applicationStore.notifyError(error);
|
251
|
+
this.loadQueriesState.fail();
|
252
|
+
}
|
253
|
+
}
|
254
|
+
}
|
141
255
|
|
142
256
|
export class UpdateExistingServiceQuerySetupState extends QuerySetupState {
|
143
257
|
services: ServiceInfo[] = [];
|
@@ -190,7 +304,7 @@ export class UpdateExistingServiceQuerySetupState extends QuerySetupState {
|
|
190
304
|
|
191
305
|
*loadServices(searchText: string): GeneratorFn<void> {
|
192
306
|
const isValidSearchString =
|
193
|
-
searchText.length >=
|
307
|
+
searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
|
194
308
|
this.loadServicesState.inProgress();
|
195
309
|
try {
|
196
310
|
this.services = (
|
@@ -201,7 +315,7 @@ export class UpdateExistingServiceQuerySetupState extends QuerySetupState {
|
|
201
315
|
// NOTE: since this mode is meant for contribution, we want to load services
|
202
316
|
// on the snapshot version (i.e. merged to the default branch on the projects)
|
203
317
|
scope: DepotScope.SNAPSHOT,
|
204
|
-
limit:
|
318
|
+
limit: DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
|
205
319
|
},
|
206
320
|
)) as StoredEntity[]
|
207
321
|
).map((storedEntity) => extractServiceInfo(storedEntity));
|
@@ -315,7 +429,7 @@ export class CreateMappingQuerySetupState extends QuerySetupState {
|
|
315
429
|
} catch (error) {
|
316
430
|
assertErrorThrown(error);
|
317
431
|
this.setupStore.applicationStore.log.error(
|
318
|
-
LogEvent.create(LEGEND_QUERY_APP_EVENT.
|
432
|
+
LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
|
319
433
|
error,
|
320
434
|
);
|
321
435
|
this.setupStore.applicationStore.notifyError(error);
|
@@ -483,7 +597,7 @@ export class CloneServiceQuerySetupState extends QuerySetupState {
|
|
483
597
|
} catch (error) {
|
484
598
|
assertErrorThrown(error);
|
485
599
|
this.setupStore.applicationStore.log.error(
|
486
|
-
LogEvent.create(LEGEND_QUERY_APP_EVENT.
|
600
|
+
LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
|
487
601
|
error,
|
488
602
|
);
|
489
603
|
this.setupStore.applicationStore.notifyError(error);
|
@@ -493,12 +607,13 @@ export class CloneServiceQuerySetupState extends QuerySetupState {
|
|
493
607
|
}
|
494
608
|
|
495
609
|
export class QuerySetupStore {
|
496
|
-
applicationStore: LegendQueryApplicationStore;
|
497
|
-
graphManagerState: BasicGraphManagerState;
|
498
|
-
depotServerClient: DepotServerClient;
|
499
|
-
pluginManager: LegendQueryPluginManager;
|
610
|
+
readonly applicationStore: LegendQueryApplicationStore;
|
611
|
+
readonly graphManagerState: BasicGraphManagerState;
|
612
|
+
readonly depotServerClient: DepotServerClient;
|
613
|
+
readonly pluginManager: LegendQueryPluginManager;
|
614
|
+
|
615
|
+
readonly initState = ActionState.create();
|
500
616
|
querySetupState?: QuerySetupState | undefined;
|
501
|
-
initState = ActionState.create();
|
502
617
|
|
503
618
|
constructor(
|
504
619
|
applicationStore: LegendQueryApplicationStore,
|
@@ -560,7 +675,7 @@ export class QuerySetupStore {
|
|
560
675
|
} catch (error) {
|
561
676
|
assertErrorThrown(error);
|
562
677
|
this.applicationStore.log.error(
|
563
|
-
LogEvent.create(LEGEND_QUERY_APP_EVENT.
|
678
|
+
LogEvent.create(LEGEND_QUERY_APP_EVENT.GENERIC_FAILURE),
|
564
679
|
error,
|
565
680
|
);
|
566
681
|
this.applicationStore.setBlockingAlert({
|