@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.
Files changed (65) hide show
  1. package/lib/__lib__/LegendQueryEvent.d.ts +1 -0
  2. package/lib/__lib__/LegendQueryEvent.d.ts.map +1 -1
  3. package/lib/__lib__/LegendQueryEvent.js +1 -0
  4. package/lib/__lib__/LegendQueryEvent.js.map +1 -1
  5. package/lib/__lib__/LegendQueryTelemetryHelper.d.ts +7 -6
  6. package/lib/__lib__/LegendQueryTelemetryHelper.d.ts.map +1 -1
  7. package/lib/__lib__/LegendQueryTelemetryHelper.js +15 -12
  8. package/lib/__lib__/LegendQueryTelemetryHelper.js.map +1 -1
  9. package/lib/__lib__/LegendQueryUserDataHelper.d.ts +27 -0
  10. package/lib/__lib__/LegendQueryUserDataHelper.d.ts.map +1 -0
  11. package/lib/__lib__/LegendQueryUserDataHelper.js +63 -0
  12. package/lib/__lib__/LegendQueryUserDataHelper.js.map +1 -0
  13. package/lib/components/EditExistingQuerySetup.d.ts.map +1 -1
  14. package/lib/components/EditExistingQuerySetup.js +7 -71
  15. package/lib/components/EditExistingQuerySetup.js.map +1 -1
  16. package/lib/components/QueryEditor.d.ts.map +1 -1
  17. package/lib/components/QueryEditor.js +47 -97
  18. package/lib/components/QueryEditor.js.map +1 -1
  19. package/lib/components/QueryProductionizerSetup.d.ts.map +1 -1
  20. package/lib/components/QueryProductionizerSetup.js +6 -47
  21. package/lib/components/QueryProductionizerSetup.js.map +1 -1
  22. package/lib/components/QuerySetup.d.ts +3 -3
  23. package/lib/components/QuerySetup.d.ts.map +1 -1
  24. package/lib/components/QuerySetup.js +1 -1
  25. package/lib/components/QuerySetup.js.map +1 -1
  26. package/lib/index.css +2 -2
  27. package/lib/index.css.map +1 -1
  28. package/lib/index.d.ts +1 -1
  29. package/lib/index.d.ts.map +1 -1
  30. package/lib/index.js +1 -1
  31. package/lib/index.js.map +1 -1
  32. package/lib/package.json +1 -1
  33. package/lib/stores/EditExistingQuerySetupStore.d.ts +3 -12
  34. package/lib/stores/EditExistingQuerySetupStore.d.ts.map +1 -1
  35. package/lib/stores/EditExistingQuerySetupStore.js +27 -64
  36. package/lib/stores/EditExistingQuerySetupStore.js.map +1 -1
  37. package/lib/stores/LegendQueryApplicationPlugin.d.ts +4 -3
  38. package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
  39. package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
  40. package/lib/stores/QueryEditorStore.d.ts +25 -39
  41. package/lib/stores/QueryEditorStore.d.ts.map +1 -1
  42. package/lib/stores/QueryEditorStore.js +44 -81
  43. package/lib/stores/QueryEditorStore.js.map +1 -1
  44. package/lib/stores/QueryProductionizerSetupStore.d.ts +4 -10
  45. package/lib/stores/QueryProductionizerSetupStore.d.ts.map +1 -1
  46. package/lib/stores/QueryProductionizerSetupStore.js +29 -62
  47. package/lib/stores/QueryProductionizerSetupStore.js.map +1 -1
  48. package/lib/stores/QuerySetupStore.d.ts.map +1 -1
  49. package/lib/stores/QuerySetupStore.js +4 -1
  50. package/lib/stores/QuerySetupStore.js.map +1 -1
  51. package/package.json +10 -10
  52. package/src/__lib__/LegendQueryEvent.ts +1 -0
  53. package/src/__lib__/LegendQueryTelemetryHelper.ts +19 -26
  54. package/src/__lib__/LegendQueryUserDataHelper.ts +92 -0
  55. package/src/components/EditExistingQuerySetup.tsx +10 -204
  56. package/src/components/QueryEditor.tsx +87 -291
  57. package/src/components/QueryProductionizerSetup.tsx +9 -124
  58. package/src/components/QuerySetup.tsx +1 -1
  59. package/src/index.ts +4 -1
  60. package/src/stores/EditExistingQuerySetupStore.ts +54 -87
  61. package/src/stores/LegendQueryApplicationPlugin.ts +4 -3
  62. package/src/stores/QueryEditorStore.ts +91 -107
  63. package/src/stores/QueryProductionizerSetupStore.ts +55 -84
  64. package/src/stores/QuerySetupStore.ts +10 -1
  65. package/tsconfig.json +1 -0
@@ -33,6 +33,7 @@ import {
33
33
  ActionState,
34
34
  StopWatch,
35
35
  guaranteeType,
36
+ quantifyList,
36
37
  } from '@finos/legend-shared';
37
38
  import {
38
39
  type LightQuery,
@@ -45,12 +46,12 @@ import {
45
46
  RuntimePointer,
46
47
  GRAPH_MANAGER_EVENT,
47
48
  extractElementNameFromPath,
48
- QuerySearchSpecification,
49
49
  Mapping,
50
50
  type Runtime,
51
51
  type Service,
52
52
  createGraphBuilderReport,
53
53
  LegendSDLC,
54
+ QuerySearchSpecification,
54
55
  } from '@finos/legend-graph';
55
56
  import {
56
57
  EXTERNAL_APPLICATION_NAVIGATION__generateStudioProjectViewUrl,
@@ -74,7 +75,6 @@ import {
74
75
  import {
75
76
  DEFAULT_TAB_SIZE,
76
77
  DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
77
- DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
78
78
  } from '@finos/legend-application';
79
79
  import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
80
80
  import { LegendQueryEventHelper } from '../__lib__/LegendQueryEventHelper.js';
@@ -85,7 +85,9 @@ import {
85
85
  ClassQueryBuilderState,
86
86
  MappingQueryBuilderState,
87
87
  ServiceQueryBuilderState,
88
+ QueryLoaderState,
88
89
  } from '@finos/legend-query-builder';
90
+ import { LegendQueryUserDataHelper } from '../__lib__/LegendQueryUserDataHelper.js';
89
91
  import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
90
92
 
91
93
  export const createViewProjectHandler =
@@ -148,14 +150,15 @@ export interface QueryPersistConfiguration {
148
150
  }
149
151
 
150
152
  export class QuerySaveAsState {
151
- editorStore: QueryEditorStore;
153
+ readonly editorStore: QueryEditorStore;
154
+ readonly queryBuilderState: QueryBuilderState;
155
+ readonly createQueryState = ActionState.create();
156
+
152
157
  lambda: RawLambda;
153
158
  queryName: string;
154
159
  allowUpdate = false;
155
160
  onQueryUpdate?: ((query: Query) => void) | undefined;
156
161
  decorator?: ((query: Query) => void) | undefined;
157
- queryBuilderState: QueryBuilderState;
158
- createQueryState = ActionState.create();
159
162
 
160
163
  constructor(
161
164
  editorStore: QueryEditorStore,
@@ -256,7 +259,6 @@ export class QuerySaveAsState {
256
259
  this.queryBuilderState.changeDetectionState.initialize(this.lambda);
257
260
  // turn off change detection at this point
258
261
  // TODO: to make performance better, refrain from refreshing like this
259
- this.editorStore.setTitle(query.name);
260
262
  this.editorStore.applicationStore.navigationService.navigator.goToLocation(
261
263
  generateExistingQueryEditorRoute(newQuery.id),
262
264
  );
@@ -266,7 +268,6 @@ export class QuerySaveAsState {
266
268
  query,
267
269
  this.editorStore.graphManagerState.graph,
268
270
  )) as Query;
269
- this.editorStore.setTitle(updatedQuery.name);
270
271
  this.editorStore.applicationStore.notificationService.notifySuccess(
271
272
  `Successfully updated query!`,
272
273
  );
@@ -301,14 +302,15 @@ export class QuerySaveAsState {
301
302
  }
302
303
 
303
304
  export class QuerySaveState {
304
- editorStore: QueryEditorStore;
305
+ readonly editorStore: QueryEditorStore;
306
+ readonly saveQueryState = ActionState.create();
307
+
308
+ queryBuilderState: QueryBuilderState;
305
309
  lambda: RawLambda;
306
310
  queryName: string;
307
311
  allowUpdate = false;
308
312
  onQueryUpdate?: ((query: Query) => void) | undefined;
309
313
  decorator?: ((query: Query) => void) | undefined;
310
- queryBuilderState: QueryBuilderState;
311
- saveQueryState = ActionState.create();
312
314
 
313
315
  constructor(
314
316
  editorStore: QueryEditorStore,
@@ -409,14 +411,16 @@ export class QuerySaveState {
409
411
  }
410
412
 
411
413
  export class QueryRenameState {
412
- editorStore: QueryEditorStore;
414
+ readonly editorStore: QueryEditorStore;
415
+ readonly queryBuilderState: QueryBuilderState;
416
+
417
+ readonly renameQueryState = ActionState.create();
418
+
413
419
  lambda: RawLambda;
414
420
  queryName: string;
415
421
  allowUpdate = false;
416
422
  onQueryUpdate?: ((query: Query) => void) | undefined;
417
423
  decorator?: ((query: Query) => void) | undefined;
418
- queryBuilderState: QueryBuilderState;
419
- saveQueryState = ActionState.create();
420
424
 
421
425
  constructor(
422
426
  editorStore: QueryEditorStore,
@@ -451,7 +455,7 @@ export class QueryRenameState {
451
455
  ) {
452
456
  return;
453
457
  }
454
- this.saveQueryState.inProgress();
458
+ this.renameQueryState.inProgress();
455
459
  const query = new Query();
456
460
  query.name = this.queryName;
457
461
  query.mapping = PackageableElementExplicitReference.create(
@@ -471,7 +475,7 @@ export class QueryRenameState {
471
475
  error,
472
476
  );
473
477
  this.editorStore.applicationStore.notificationService.notifyError(error);
474
- this.saveQueryState.reset();
478
+ this.renameQueryState.reset();
475
479
  return;
476
480
  }
477
481
 
@@ -481,7 +485,6 @@ export class QueryRenameState {
481
485
  query,
482
486
  this.editorStore.graphManagerState.graph,
483
487
  )) as Query;
484
- this.editorStore.setTitle(updatedQuery.name);
485
488
  this.editorStore.applicationStore.notificationService.notifySuccess(
486
489
  `Successfully renamed query!`,
487
490
  );
@@ -506,90 +509,25 @@ export class QueryRenameState {
506
509
  );
507
510
  this.editorStore.applicationStore.notificationService.notifyError(error);
508
511
  } finally {
509
- this.saveQueryState.reset();
512
+ this.renameQueryState.reset();
510
513
  this.editorStore.setRenameState(undefined);
511
514
  }
512
515
  }
513
516
  }
514
517
 
515
- export class QueryLoaderState {
516
- readonly editorStore: QueryEditorStore;
517
-
518
- readonly loadQueriesState = ActionState.create();
519
- queries: LightQuery[] = [];
520
- isQueryLoaderOpen = false;
521
- showCurrentUserQueriesOnly = false;
522
-
523
- constructor(editorStore: QueryEditorStore) {
524
- makeObservable(this, {
525
- isQueryLoaderOpen: observable,
526
- queries: observable,
527
- showCurrentUserQueriesOnly: observable,
528
- setIsQueryLoaderOpen: action,
529
- setQueries: action,
530
- setShowCurrentUserQueriesOnly: action,
531
- loadQueries: flow,
532
- });
533
- this.editorStore = editorStore;
534
- }
535
-
536
- setIsQueryLoaderOpen(val: boolean): void {
537
- this.isQueryLoaderOpen = val;
538
- }
539
-
540
- setQueries(val: LightQuery[]): void {
541
- this.queries = val;
542
- }
543
-
544
- setShowCurrentUserQueriesOnly(val: boolean): void {
545
- this.showCurrentUserQueriesOnly = val;
546
- }
547
-
548
- *loadQueries(searchText: string): GeneratorFn<void> {
549
- const isValidSearchString =
550
- searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
551
- this.loadQueriesState.inProgress();
552
- try {
553
- const searchSpecification = new QuerySearchSpecification();
554
- searchSpecification.searchTerm = isValidSearchString
555
- ? searchText
556
- : undefined;
557
- searchSpecification.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
558
- searchSpecification.showCurrentUserQueriesOnly =
559
- this.showCurrentUserQueriesOnly;
560
- this.queries =
561
- (yield this.editorStore.graphManagerState.graphManager.searchQueries(
562
- searchSpecification,
563
- )) as LightQuery[];
564
- this.loadQueriesState.pass();
565
- } catch (error) {
566
- this.loadQueriesState.fail();
567
- assertErrorThrown(error);
568
- this.editorStore.applicationStore.notificationService.notifyError(error);
569
- }
570
- }
571
-
572
- reset(): void {
573
- this.setShowCurrentUserQueriesOnly(false);
574
- }
575
- }
576
-
577
518
  export abstract class QueryEditorStore {
578
519
  readonly applicationStore: LegendQueryApplicationStore;
579
520
  readonly depotServerClient: DepotServerClient;
580
521
  readonly pluginManager: LegendQueryPluginManager;
581
522
  readonly graphManagerState: GraphManagerState;
523
+ readonly queryLoaderState: QueryLoaderState;
582
524
 
583
525
  readonly initState = ActionState.create();
526
+
584
527
  queryBuilderState?: QueryBuilderState | undefined;
585
528
  saveAsState?: QuerySaveAsState | undefined;
586
529
  saveState?: QuerySaveState | undefined;
587
530
  renameState?: QueryRenameState | undefined;
588
-
589
- // if the implementation of QueryEditorStore does not support save
590
- // saveState = undefined
591
-
592
- queryLoaderState: QueryLoaderState;
593
531
  title: string | undefined;
594
532
  existingQueryName: string | undefined;
595
533
 
@@ -608,7 +546,6 @@ export abstract class QueryEditorStore {
608
546
  setExistingQueryName: action,
609
547
  setSaveAsState: action,
610
548
  setSaveState: action,
611
- setTitle: action,
612
549
  initialize: flow,
613
550
  buildGraph: flow,
614
551
  searchExistingQueryName: flow,
@@ -621,7 +558,56 @@ export abstract class QueryEditorStore {
621
558
  applicationStore.pluginManager,
622
559
  applicationStore.logService,
623
560
  );
624
- this.queryLoaderState = new QueryLoaderState(this);
561
+ this.queryLoaderState = new QueryLoaderState(
562
+ applicationStore,
563
+ this.graphManagerState,
564
+ {
565
+ loadQuery: (query: LightQuery): void => {
566
+ this.queryBuilderState?.changeDetectionState.alertUnsavedChanges(
567
+ () => {
568
+ this.queryLoaderState.setQueryLoaderDialogOpen(false);
569
+ applicationStore.navigationService.navigator.goToLocation(
570
+ generateExistingQueryEditorRoute(query.id),
571
+ { ignoreBlocking: true },
572
+ );
573
+ },
574
+ );
575
+ },
576
+ fetchDefaultQueries: () =>
577
+ this.graphManagerState.graphManager.getQueries(
578
+ LegendQueryUserDataHelper.getRecentlyViewedQueries(
579
+ this.applicationStore.userDataService,
580
+ ),
581
+ ),
582
+ generateDefaultQueriesSummaryText: (queries) =>
583
+ queries.length
584
+ ? `Showing ${quantifyList(
585
+ queries,
586
+ 'recently viewed query',
587
+ 'recently viewed queries',
588
+ )}`
589
+ : `No recently viewed queries`,
590
+ onQueryDeleted: (query): void =>
591
+ LegendQueryUserDataHelper.removeRecentlyViewedQuery(
592
+ this.applicationStore.userDataService,
593
+ query.id,
594
+ ),
595
+ onQueryRenamed: (query): void => {
596
+ LegendQueryTelemetryHelper.logEvent_RenameQuerySucceeded(
597
+ applicationStore.telemetryService,
598
+ {
599
+ query: {
600
+ id: query.id,
601
+ name: query.name,
602
+ groupId: query.groupId,
603
+ artifactId: query.artifactId,
604
+ versionId: query.versionId,
605
+ },
606
+ },
607
+ );
608
+ },
609
+ },
610
+ );
625
611
  }
626
612
 
627
613
  get isViewProjectActionDisabled(): boolean {
@@ -632,11 +618,6 @@ export abstract class QueryEditorStore {
632
618
  return false;
633
619
  }
634
620
 
635
- setTitle(val: string | undefined): void {
636
- document.title = `${val} - Legend Query`;
637
- this.title = val;
638
- }
639
-
640
621
  setSaveAsState(val: QuerySaveAsState | undefined): void {
641
622
  this.saveAsState = val;
642
623
  }
@@ -667,7 +648,7 @@ export abstract class QueryEditorStore {
667
648
  */
668
649
  protected abstract initializeQueryBuilderState(): Promise<QueryBuilderState>;
669
650
 
670
- abstract getExportConfiguration(
651
+ abstract getPersistConfiguration(
671
652
  lambda: RawLambda,
672
653
  options?: { update?: boolean | undefined },
673
654
  ): Promise<QueryPersistConfiguration>;
@@ -703,7 +684,7 @@ export abstract class QueryEditorStore {
703
684
  yield flowResult(this.buildGraph());
704
685
  this.queryBuilderState =
705
686
  (yield this.initializeQueryBuilderState()) as QueryBuilderState;
706
-
687
+ this.queryLoaderState.initialize(this.queryBuilderState);
707
688
  this.initState.pass();
708
689
  } catch (error) {
709
690
  assertErrorThrown(error);
@@ -835,11 +816,11 @@ export abstract class QueryEditorStore {
835
816
  }
836
817
 
837
818
  export class MappingQueryCreatorStore extends QueryEditorStore {
838
- groupId: string;
839
- artifactId: string;
840
- versionId: string;
841
- mappingPath: string;
842
- runtimePath: string;
819
+ readonly groupId: string;
820
+ readonly artifactId: string;
821
+ readonly versionId: string;
822
+ readonly mappingPath: string;
823
+ readonly runtimePath: string;
843
824
 
844
825
  constructor(
845
826
  applicationStore: LegendQueryApplicationStore,
@@ -909,7 +890,7 @@ export class MappingQueryCreatorStore extends QueryEditorStore {
909
890
  return queryBuilderState;
910
891
  }
911
892
 
912
- async getExportConfiguration(): Promise<QueryPersistConfiguration> {
893
+ async getPersistConfiguration(): Promise<QueryPersistConfiguration> {
913
894
  return {
914
895
  decorator: (query: Query): void => {
915
896
  query.id = uuid();
@@ -922,11 +903,11 @@ export class MappingQueryCreatorStore extends QueryEditorStore {
922
903
  }
923
904
 
924
905
  export class ServiceQueryCreatorStore extends QueryEditorStore {
925
- groupId: string;
926
- artifactId: string;
927
- versionId: string;
928
- servicePath: string;
929
- executionKey: string | undefined;
906
+ readonly groupId: string;
907
+ readonly artifactId: string;
908
+ readonly versionId: string;
909
+ readonly servicePath: string;
910
+ readonly executionKey: string | undefined;
930
911
 
931
912
  constructor(
932
913
  applicationStore: LegendQueryApplicationStore,
@@ -997,7 +978,7 @@ export class ServiceQueryCreatorStore extends QueryEditorStore {
997
978
  return queryBuilderState;
998
979
  }
999
980
 
1000
- async getExportConfiguration(
981
+ async getPersistConfiguration(
1001
982
  lambda: RawLambda,
1002
983
  options?: { update?: boolean | undefined },
1003
984
  ): Promise<QueryPersistConfiguration> {
@@ -1064,6 +1045,10 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1064
1045
  this.queryId,
1065
1046
  this.graphManagerState.graph,
1066
1047
  );
1048
+ LegendQueryUserDataHelper.addRecentlyViewedQuery(
1049
+ this.applicationStore.userDataService,
1050
+ query.id,
1051
+ );
1067
1052
  let queryBuilderState: QueryBuilderState | undefined;
1068
1053
  const existingQueryEditorStateBuilders = this.applicationStore.pluginManager
1069
1054
  .getApplicationPlugins()
@@ -1107,11 +1092,10 @@ export class ExistingQueryEditorStore extends QueryEditorStore {
1107
1092
  },
1108
1093
  },
1109
1094
  );
1110
- this.setTitle(this.query.name);
1111
1095
  return queryBuilderState;
1112
1096
  }
1113
1097
 
1114
- async getExportConfiguration(
1098
+ async getPersistConfiguration(
1115
1099
  lambda: RawLambda,
1116
1100
  options?: { update?: boolean | undefined },
1117
1101
  ): Promise<QueryPersistConfiguration> {
@@ -14,36 +14,22 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import {
18
- DEFAULT_TYPEAHEAD_SEARCH_LIMIT,
19
- DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH,
20
- } from '@finos/legend-application';
21
- import {
22
- type LightQuery,
23
- type QueryInfo,
24
- QuerySearchSpecification,
25
- } from '@finos/legend-graph';
17
+ import type { LightQuery } from '@finos/legend-graph';
18
+ import { QueryLoaderState } from '@finos/legend-query-builder';
26
19
  import {
27
20
  type DepotServerClient,
28
21
  StoreProjectData,
29
22
  } from '@finos/legend-server-depot';
30
- import {
31
- ActionState,
32
- assertErrorThrown,
33
- type GeneratorFn,
34
- } from '@finos/legend-shared';
35
23
  import { parseProjectIdentifier } from '@finos/legend-storage';
36
- import { flow, makeObservable, observable } from 'mobx';
37
24
  import type { LegendQueryApplicationStore } from './LegendQueryBaseStore.js';
38
25
  import { EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl } from '../__lib__/LegendQueryNavigation.js';
39
26
  import { BaseQuerySetupStore } from './QuerySetupStore.js';
27
+ import { LegendQueryUserDataHelper } from '../__lib__/LegendQueryUserDataHelper.js';
28
+ import { quantifyList } from '@finos/legend-shared';
29
+ import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
40
30
 
41
31
  export class QueryProductionizerSetupStore extends BaseQuerySetupStore {
42
- readonly loadQueriesState = ActionState.create();
43
- readonly loadQueryState = ActionState.create();
44
- queries: LightQuery[] = [];
45
- currentQuery?: LightQuery | undefined;
46
- currentQueryInfo?: QueryInfo | undefined;
32
+ readonly queryLoaderState: QueryLoaderState;
47
33
 
48
34
  constructor(
49
35
  applicationStore: LegendQueryApplicationStore,
@@ -51,25 +37,59 @@ export class QueryProductionizerSetupStore extends BaseQuerySetupStore {
51
37
  ) {
52
38
  super(applicationStore, depotServerClient);
53
39
 
54
- makeObservable(this, {
55
- queries: observable,
56
- currentQuery: observable,
57
- currentQueryInfo: observable,
58
- setCurrentQuery: flow,
59
- loadQueries: flow,
60
- });
40
+ this.queryLoaderState = new QueryLoaderState(
41
+ applicationStore,
42
+ this.graphManagerState,
43
+ {
44
+ loadQuery: (query: LightQuery): void => {
45
+ this.queryLoaderState.setQueryLoaderDialogOpen(false);
46
+ this.loadQueryProductionizer(query).catch(
47
+ applicationStore.alertUnhandledError,
48
+ );
49
+ },
50
+ fetchDefaultQueries: () =>
51
+ this.graphManagerState.graphManager.getQueries(
52
+ LegendQueryUserDataHelper.getRecentlyViewedQueries(
53
+ this.applicationStore.userDataService,
54
+ ),
55
+ ),
56
+ generateDefaultQueriesSummaryText: (queries) =>
57
+ queries.length
58
+ ? `Showing ${quantifyList(
59
+ queries,
60
+ 'recently viewed query',
61
+ 'recently viewed queries',
62
+ )}`
63
+ : `No recently viewed queries`,
64
+ onQueryDeleted: (query): void =>
65
+ LegendQueryUserDataHelper.removeRecentlyViewedQuery(
66
+ this.applicationStore.userDataService,
67
+ query.id,
68
+ ),
69
+ onQueryRenamed: (query): void => {
70
+ LegendQueryTelemetryHelper.logEvent_RenameQuerySucceeded(
71
+ applicationStore.telemetryService,
72
+ {
73
+ query: {
74
+ id: query.id,
75
+ name: query.name,
76
+ groupId: query.groupId,
77
+ artifactId: query.artifactId,
78
+ versionId: query.versionId,
79
+ },
80
+ },
81
+ );
82
+ },
83
+ },
84
+ );
61
85
  }
62
86
 
63
- async loadQueryProductionizer(): Promise<void> {
64
- if (!this.currentQuery) {
65
- return;
66
- }
67
-
87
+ async loadQueryProductionizer(selectedQuery: LightQuery): Promise<void> {
68
88
  // fetch project data
69
89
  const project = StoreProjectData.serialization.fromJson(
70
90
  await this.depotServerClient.getProject(
71
- this.currentQuery.groupId,
72
- this.currentQuery.artifactId,
91
+ selectedQuery.groupId,
92
+ selectedQuery.artifactId,
73
93
  ),
74
94
  );
75
95
 
@@ -87,7 +107,7 @@ export class QueryProductionizerSetupStore extends BaseQuerySetupStore {
87
107
  this.applicationStore.navigationService.navigator.goToAddress(
88
108
  EXTERNAL_APPLICATION_NAVIGATION__generateStudioProductionizeQueryUrl(
89
109
  matchingSDLCEntry.url,
90
- this.currentQuery.id,
110
+ selectedQuery.id,
91
111
  ),
92
112
  );
93
113
  } else {
@@ -96,53 +116,4 @@ export class QueryProductionizerSetupStore extends BaseQuerySetupStore {
96
116
  );
97
117
  }
98
118
  }
99
-
100
- *setCurrentQuery(queryId: string | undefined): GeneratorFn<void> {
101
- if (queryId) {
102
- try {
103
- this.loadQueryState.inProgress();
104
- this.currentQuery =
105
- (yield this.graphManagerState.graphManager.getLightQuery(
106
- queryId,
107
- )) as LightQuery;
108
- const queryInfo =
109
- (yield this.graphManagerState.graphManager.getQueryInfo(
110
- queryId,
111
- )) as QueryInfo;
112
- queryInfo.content =
113
- (yield this.graphManagerState.graphManager.prettyLambdaContent(
114
- queryInfo.content,
115
- )) as string;
116
- this.currentQueryInfo = queryInfo;
117
- } catch (error) {
118
- assertErrorThrown(error);
119
- this.applicationStore.notificationService.notifyError(error);
120
- } finally {
121
- this.loadQueryState.reset();
122
- }
123
- } else {
124
- this.currentQuery = undefined;
125
- }
126
- }
127
-
128
- *loadQueries(searchText: string): GeneratorFn<void> {
129
- const isValidSearchString =
130
- searchText.length >= DEFAULT_TYPEAHEAD_SEARCH_MINIMUM_SEARCH_LENGTH;
131
- this.loadQueriesState.inProgress();
132
- try {
133
- const searchSpecification = new QuerySearchSpecification();
134
- searchSpecification.searchTerm = isValidSearchString
135
- ? searchText
136
- : undefined;
137
- searchSpecification.limit = DEFAULT_TYPEAHEAD_SEARCH_LIMIT;
138
- this.queries = (yield this.graphManagerState.graphManager.searchQueries(
139
- searchSpecification,
140
- )) as LightQuery[];
141
- this.loadQueriesState.pass();
142
- } catch (error) {
143
- assertErrorThrown(error);
144
- this.applicationStore.notificationService.notifyError(error);
145
- this.loadQueriesState.fail();
146
- }
147
- }
148
119
  }
@@ -26,7 +26,10 @@ import {
26
26
  import { BasicGraphManagerState } from '@finos/legend-graph';
27
27
  import type { DepotServerClient } from '@finos/legend-server-depot';
28
28
  import { LEGEND_QUERY_APP_EVENT } from '../__lib__/LegendQueryEvent.js';
29
- import { DEFAULT_TAB_SIZE } from '@finos/legend-application';
29
+ import {
30
+ DEFAULT_TAB_SIZE,
31
+ LEGEND_APPLICATION_COLOR_THEME,
32
+ } from '@finos/legend-application';
30
33
  import type { LegendQueryPluginManager } from '../application/LegendQueryPluginManager.js';
31
34
  import type { LegendQueryApplicationStore } from './LegendQueryBaseStore.js';
32
35
  import { generateQuerySetupRoute } from '../__lib__/LegendQueryNavigation.js';
@@ -62,6 +65,12 @@ export abstract class BaseQuerySetupStore {
62
65
  return;
63
66
  }
64
67
 
68
+ // TODO?: remove this when we properly support theme everywhere
69
+ // See https://github.com/finos/legend-studio/issues/264
70
+ this.applicationStore.layoutService.setColorTheme(
71
+ LEGEND_APPLICATION_COLOR_THEME.DEFAULT_DARK,
72
+ );
73
+
65
74
  try {
66
75
  this.initState.inProgress();
67
76
  yield this.graphManagerState.graphManager.initialize(
package/tsconfig.json CHANGED
@@ -38,6 +38,7 @@
38
38
  "./src/__lib__/LegendQueryEventHelper.ts",
39
39
  "./src/__lib__/LegendQueryNavigation.ts",
40
40
  "./src/__lib__/LegendQueryTelemetryHelper.ts",
41
+ "./src/__lib__/LegendQueryUserDataHelper.ts",
41
42
  "./src/application/LegendQueryApplicationConfig.ts",
42
43
  "./src/application/LegendQueryDocumentation.ts",
43
44
  "./src/application/LegendQueryPluginManager.ts",