@finos/legend-query-builder 4.14.56 → 4.14.58
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/QueryBuilder.d.ts.map +1 -1
- package/lib/components/QueryBuilder.js +1 -1
- package/lib/components/QueryBuilder.js.map +1 -1
- package/lib/components/QueryChat.d.ts +1 -1
- package/lib/components/QueryChat.d.ts.map +1 -1
- package/lib/components/QueryChat.js +1 -3
- package/lib/components/QueryChat.js.map +1 -1
- package/lib/components/QueryLoader.d.ts.map +1 -1
- package/lib/components/QueryLoader.js +49 -9
- package/lib/components/QueryLoader.js.map +1 -1
- package/lib/components/result/tds/QueryBuilderTDSGridResult.js +2 -2
- package/lib/components/result/tds/QueryBuilderTDSGridResult.js.map +1 -1
- package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.d.ts.map +1 -1
- package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js +7 -6
- package/lib/components/result/tds/QueryBuilderTDSSimpleGridResult.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +7 -7
- package/lib/stores/QueryLoaderState.d.ts +11 -0
- package/lib/stores/QueryLoaderState.d.ts.map +1 -1
- package/lib/stores/QueryLoaderState.js +15 -3
- package/lib/stores/QueryLoaderState.js.map +1 -1
- package/package.json +15 -15
- package/src/components/QueryBuilder.tsx +8 -3
- package/src/components/QueryChat.tsx +1 -9
- package/src/components/QueryLoader.tsx +64 -4
- package/src/components/result/tds/QueryBuilderTDSGridResult.tsx +2 -2
- package/src/components/result/tds/QueryBuilderTDSSimpleGridResult.tsx +7 -5
- package/src/stores/QueryLoaderState.ts +24 -5
@@ -45,6 +45,14 @@ import type {
|
|
45
45
|
export const QUERY_LOADER_TYPEAHEAD_SEARCH_LIMIT = 50;
|
46
46
|
export const QUERY_LOADER_DEFAULT_QUERY_SEARCH_LIMIT = 10;
|
47
47
|
|
48
|
+
export enum SORT_BY_OPTIONS {
|
49
|
+
SORT_BY_CREATE = 'Last Created',
|
50
|
+
SORT_BY_VIEW = 'Last Viewed',
|
51
|
+
SORT_BY_UPDATE = 'Last Updated',
|
52
|
+
}
|
53
|
+
|
54
|
+
export type SortByOption = { label: string; value: string };
|
55
|
+
|
48
56
|
export class QueryLoaderState {
|
49
57
|
readonly applicationStore: GenericLegendApplicationStore;
|
50
58
|
readonly graphManagerState: BasicGraphManagerState;
|
@@ -84,6 +92,7 @@ export class QueryLoaderState {
|
|
84
92
|
showingDefaultQueries = true;
|
85
93
|
showPreviewViewer = false;
|
86
94
|
queryPreviewContent?: QueryInfo | { name: string; content: string };
|
95
|
+
sortBy = '';
|
87
96
|
|
88
97
|
constructor(
|
89
98
|
applicationStore: GenericLegendApplicationStore,
|
@@ -115,6 +124,8 @@ export class QueryLoaderState {
|
|
115
124
|
searchText: observable,
|
116
125
|
isCuratedTemplateToggled: observable,
|
117
126
|
curatedTemplateQuerySepcifications: observable,
|
127
|
+
sortBy: observable,
|
128
|
+
setSortBy: action,
|
118
129
|
setSearchText: action,
|
119
130
|
setQueryLoaderDialogOpen: action,
|
120
131
|
setQueries: action,
|
@@ -147,6 +158,10 @@ export class QueryLoaderState {
|
|
147
158
|
this.isCuratedTemplateToggled = val;
|
148
159
|
}
|
149
160
|
|
161
|
+
setSortBy(val: string): void {
|
162
|
+
this.sortBy = val;
|
163
|
+
}
|
164
|
+
|
150
165
|
setSearchText(val: string): void {
|
151
166
|
this.searchText = val;
|
152
167
|
}
|
@@ -156,7 +171,7 @@ export class QueryLoaderState {
|
|
156
171
|
}
|
157
172
|
|
158
173
|
setQueries(val: LightQuery[]): void {
|
159
|
-
this.queries = val;
|
174
|
+
this.queries = val.sort((a, b) => a.name.localeCompare(b.name));
|
160
175
|
}
|
161
176
|
|
162
177
|
setShowPreviewViewer(val: boolean): void {
|
@@ -225,7 +240,9 @@ export class QueryLoaderState {
|
|
225
240
|
if (!this.fetchDefaultQueries) {
|
226
241
|
return;
|
227
242
|
}
|
228
|
-
this.queries = (
|
243
|
+
this.queries = (
|
244
|
+
(yield this.fetchDefaultQueries()) as LightQuery[]
|
245
|
+
).sort((a, b) => a.name.localeCompare(b.name));
|
229
246
|
this.searchQueriesState.pass();
|
230
247
|
} catch (error) {
|
231
248
|
this.searchQueriesState.fail();
|
@@ -271,9 +288,11 @@ export class QueryLoaderState {
|
|
271
288
|
searchSpecification =
|
272
289
|
this.decorateSearchSpecification?.(searchSpecification) ??
|
273
290
|
searchSpecification;
|
274
|
-
this.queries = (
|
275
|
-
|
276
|
-
|
291
|
+
this.queries = (
|
292
|
+
(yield this.graphManagerState.graphManager.searchQueries(
|
293
|
+
searchSpecification,
|
294
|
+
)) as LightQuery[]
|
295
|
+
).sort((a, b) => a.name.localeCompare(b.name));
|
277
296
|
this.searchQueriesState.pass();
|
278
297
|
} catch (error) {
|
279
298
|
assertErrorThrown(error);
|