@finos/legend-application-query 13.4.13 → 13.4.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. package/lib/__lib__/LegendQueryUserDataHelper.js +1 -1
  2. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts +3 -1
  3. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
  4. package/lib/components/Core_LegendQueryApplicationPlugin.js +71 -118
  5. package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
  6. package/lib/components/QueryEditor.d.ts.map +1 -1
  7. package/lib/components/QueryEditor.js +25 -14
  8. package/lib/components/QueryEditor.js.map +1 -1
  9. package/lib/components/data-space/DataSpaceQuerySetup.d.ts.map +1 -1
  10. package/lib/components/data-space/DataSpaceQuerySetup.js +2 -2
  11. package/lib/components/data-space/DataSpaceQuerySetup.js.map +1 -1
  12. package/lib/index.css +2 -2
  13. package/lib/index.css.map +1 -1
  14. package/lib/index.d.ts +0 -1
  15. package/lib/index.d.ts.map +1 -1
  16. package/lib/index.js +0 -1
  17. package/lib/index.js.map +1 -1
  18. package/lib/package.json +1 -1
  19. package/lib/stores/EditExistingQuerySetupStore.js +1 -1
  20. package/lib/stores/EditExistingQuerySetupStore.js.map +1 -1
  21. package/lib/stores/LegendQueryApplicationPlugin.d.ts +0 -8
  22. package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
  23. package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
  24. package/lib/stores/QueryEditorStore.d.ts +2 -0
  25. package/lib/stores/QueryEditorStore.d.ts.map +1 -1
  26. package/lib/stores/QueryEditorStore.js +8 -2
  27. package/lib/stores/QueryEditorStore.js.map +1 -1
  28. package/lib/stores/QueryProductionizerSetupStore.js +1 -1
  29. package/lib/stores/QueryProductionizerSetupStore.js.map +1 -1
  30. package/package.json +7 -7
  31. package/src/__lib__/LegendQueryUserDataHelper.ts +1 -1
  32. package/src/components/Core_LegendQueryApplicationPlugin.tsx +136 -324
  33. package/src/components/QueryEditor.tsx +114 -66
  34. package/src/components/data-space/DataSpaceQuerySetup.tsx +2 -1
  35. package/src/index.ts +0 -1
  36. package/src/stores/EditExistingQuerySetupStore.ts +2 -2
  37. package/src/stores/LegendQueryApplicationPlugin.tsx +0 -12
  38. package/src/stores/QueryEditorStore.ts +10 -3
  39. package/src/stores/QueryProductionizerSetupStore.ts +2 -2
  40. package/tsconfig.json +0 -2
  41. package/lib/__lib__/LegendQueryTesting.d.ts +0 -19
  42. package/lib/__lib__/LegendQueryTesting.d.ts.map +0 -1
  43. package/lib/__lib__/LegendQueryTesting.js +0 -20
  44. package/lib/__lib__/LegendQueryTesting.js.map +0 -1
  45. package/lib/application/LegendQueryDocumentation.d.ts +0 -19
  46. package/lib/application/LegendQueryDocumentation.d.ts.map +0 -1
  47. package/lib/application/LegendQueryDocumentation.js +0 -20
  48. package/lib/application/LegendQueryDocumentation.js.map +0 -1
  49. package/src/__lib__/LegendQueryTesting.ts +0 -19
  50. package/src/application/LegendQueryDocumentation.ts +0 -19
@@ -25,11 +25,9 @@ import {
25
25
  ArrowCircleUpIcon,
26
26
  Button,
27
27
  CaretDownIcon,
28
- CheckIcon,
29
28
  DroidIcon,
30
29
  DropdownMenu,
31
- EmptyLightBulbIcon,
32
- LightBulbIcon,
30
+ InfoCircleIcon,
33
31
  ManageSearchIcon,
34
32
  MenuContent,
35
33
  MenuContentItem,
@@ -52,7 +50,6 @@ import {
52
50
  LEGEND_QUERY_ROUTE_PATTERN,
53
51
  } from '../__lib__/LegendQueryNavigation.js';
54
52
  import {
55
- LEGEND_APPLICATION_COLOR_THEME,
56
53
  type ApplicationPageEntry,
57
54
  type LegendApplicationSetup,
58
55
  } from '@finos/legend-application';
@@ -68,7 +65,10 @@ import {
68
65
  generateDataSpaceQueryCreatorRoute,
69
66
  generateDataSpaceQuerySetupRoute,
70
67
  } from '../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
71
- import type { QueryBuilderHeaderActionConfiguration } from '@finos/legend-query-builder';
68
+ import type {
69
+ QueryBuilderHeaderActionConfiguration,
70
+ QueryBuilderMenuActionConfiguration,
71
+ } from '@finos/legend-query-builder';
72
72
  import {
73
73
  ExistingQueryEditorStore,
74
74
  QueryBuilderActionConfig_QueryApplication,
@@ -80,12 +80,10 @@ import {
80
80
  generateDataSpaceTemplateQueryPromotionRoute,
81
81
  } from '@finos/legend-extension-dsl-data-space/application';
82
82
  import { RuntimePointer } from '@finos/legend-graph';
83
- import { QUERY_DOCUMENTATION_KEY } from '../application/LegendQueryDocumentation.js';
84
83
  import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
85
84
  import { StoreProjectData } from '@finos/legend-server-depot';
86
85
  import { buildUrl } from '@finos/legend-shared';
87
86
  import { parseProjectIdentifier } from '@finos/legend-storage';
88
- import { QUERY_EDITOR_TEST_ID } from '../__lib__/LegendQueryTesting.js';
89
87
  import { QueryEditorExistingQueryHeader } from './QueryEditor.js';
90
88
  import { DataSpaceTemplateQueryCreatorStore } from '../stores/data-space/DataSpaceTemplateQueryCreatorStore.js';
91
89
 
@@ -240,13 +238,13 @@ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlu
240
238
  },
241
239
  ];
242
240
  }
243
-
244
- getExtraQueryBuilderHeaderActionConfigurations?(): QueryBuilderHeaderActionConfiguration[] {
241
+ getExtraQueryBuilderExportMenuActionConfigurations?(): QueryBuilderMenuActionConfiguration[] {
245
242
  return [
246
243
  {
247
244
  key: 'promote-as-template-query',
248
- category: 0,
249
- renderer: (queryBuilderState): React.ReactNode => {
245
+ title: 'Promote Curated Template query...',
246
+ label: 'Curated Template Query',
247
+ onClick: (queryBuilderState): void => {
250
248
  if (
251
249
  queryBuilderState.workflowState.actionConfig instanceof
252
250
  QueryBuilderActionConfig_QueryApplication
@@ -298,39 +296,95 @@ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlu
298
296
  );
299
297
  }
300
298
  };
301
- const proceedTemplate = (): void => {
302
- queryBuilderState.changeDetectionState.alertUnsavedChanges(() => {
303
- proceedCuratedTemplateQueryPromotion().catch(
304
- editorStore.applicationStore.alertUnhandledError,
305
- );
306
- });
307
- };
308
- return (
309
- <>
310
- {editorStore instanceof ExistingQueryEditorStore &&
311
- queryBuilderState instanceof DataSpaceQueryBuilderState && (
312
- <button
313
- className="query-editor__header__action btn--dark"
314
- tabIndex={-1}
315
- onClick={proceedTemplate}
316
- title={
317
- !(editorStore instanceof ExistingQueryEditorStore)
318
- ? 'Please save your query first before promoting'
319
- : 'Promote Curated Template query...'
320
- }
321
- >
322
- <ArrowCircleUpIcon className="query-editor__header__action__icon--productionize" />
323
- <div className="query-editor__header__action__label">
324
- Promote as Template Query
325
- </div>
326
- </button>
327
- )}
328
- </>
299
+
300
+ queryBuilderState.changeDetectionState.alertUnsavedChanges(() => {
301
+ proceedCuratedTemplateQueryPromotion().catch(
302
+ editorStore.applicationStore.alertUnhandledError,
303
+ );
304
+ });
305
+ }
306
+ },
307
+ icon: <ArrowCircleUpIcon />,
308
+ },
309
+ ];
310
+ }
311
+
312
+ getExtraQueryBuilderHelpMenuActionConfigurations?(): QueryBuilderMenuActionConfiguration[] {
313
+ return [
314
+ {
315
+ key: 'about-query-info',
316
+ title: 'Get Query Info',
317
+ label: 'About Query Info',
318
+ onClick: (queryBuilderState): void => {
319
+ if (
320
+ queryBuilderState.workflowState.actionConfig instanceof
321
+ QueryBuilderActionConfig_QueryApplication
322
+ ) {
323
+ const editorStore =
324
+ queryBuilderState.workflowState.actionConfig.editorStore;
325
+ if (editorStore instanceof ExistingQueryEditorStore) {
326
+ editorStore.updateState.setShowQueryInfo(true);
327
+ }
328
+ }
329
+ },
330
+ icon: <InfoCircleIcon />,
331
+ },
332
+ {
333
+ key: 'about-query-project',
334
+ title: 'Go to Project',
335
+ label: 'Go to Project',
336
+ onClick: (queryBuilderState): void => {
337
+ if (
338
+ queryBuilderState.workflowState.actionConfig instanceof
339
+ QueryBuilderActionConfig_QueryApplication
340
+ ) {
341
+ const editorStore =
342
+ queryBuilderState.workflowState.actionConfig.editorStore;
343
+ LegendQueryTelemetryHelper.logEvent_QueryViewProjectLaunched(
344
+ editorStore.applicationStore.telemetryService,
345
+ );
346
+ const { groupId, artifactId, versionId } =
347
+ editorStore.getProjectInfo();
348
+ createViewProjectHandler(editorStore.applicationStore)(
349
+ groupId,
350
+ artifactId,
351
+ versionId,
352
+ undefined,
353
+ );
354
+ }
355
+ },
356
+ icon: <InfoCircleIcon />,
357
+ },
358
+ {
359
+ key: 'about-query-sdlc-project',
360
+ title: 'Go to SDLC Project',
361
+ label: 'Go to SDLC Project',
362
+ onClick: (queryBuilderState): void => {
363
+ if (
364
+ queryBuilderState.workflowState.actionConfig instanceof
365
+ QueryBuilderActionConfig_QueryApplication
366
+ ) {
367
+ const editorStore =
368
+ queryBuilderState.workflowState.actionConfig.editorStore;
369
+ LegendQueryTelemetryHelper.logEvent_QueryViewSdlcProjectLaunched(
370
+ editorStore.applicationStore.telemetryService,
371
+ );
372
+ const { groupId, artifactId } = editorStore.getProjectInfo();
373
+ createViewSDLCProjectHandler(
374
+ editorStore.applicationStore,
375
+ editorStore.depotServerClient,
376
+ )(groupId, artifactId, undefined).catch(
377
+ editorStore.applicationStore.alertUnhandledError,
329
378
  );
330
379
  }
331
- return undefined;
332
380
  },
381
+ icon: <InfoCircleIcon />,
333
382
  },
383
+ ];
384
+ }
385
+
386
+ getExtraQueryBuilderHeaderActionConfigurations?(): QueryBuilderHeaderActionConfiguration[] {
387
+ return [
334
388
  {
335
389
  key: 'load-query',
336
390
  category: 0,
@@ -433,7 +487,7 @@ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlu
433
487
  },
434
488
  },
435
489
  {
436
- key: 'save-query',
490
+ key: 'save-combo',
437
491
  category: 0,
438
492
  renderer: (queryBuilderState): React.ReactNode => {
439
493
  if (
@@ -442,47 +496,13 @@ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlu
442
496
  ) {
443
497
  const editorStore =
444
498
  queryBuilderState.workflowState.actionConfig.editorStore;
445
- const isExistingQuery =
446
- editorStore instanceof ExistingQueryEditorStore;
447
499
  const openSaveQueryModal = (): void => {
448
500
  if (editorStore instanceof ExistingQueryEditorStore) {
449
501
  editorStore.updateState.showSaveModal();
502
+ } else {
503
+ editorStore.queryCreatorState.open(undefined);
450
504
  }
451
505
  };
452
-
453
- return (
454
- <Button
455
- className="query-editor__header__action btn--dark"
456
- disabled={
457
- !isExistingQuery ||
458
- editorStore.isPerformingBlockingAction ||
459
- !queryBuilderState.canBuildQuery
460
- }
461
- onClick={openSaveQueryModal}
462
- title={
463
- !queryBuilderState.canBuildQuery
464
- ? 'Please fix query errors before saving'
465
- : 'Save query'
466
- }
467
- >
468
- <SaveCurrIcon />
469
- <div className="query-editor__header__action__label">Save</div>
470
- </Button>
471
- );
472
- }
473
- return undefined;
474
- },
475
- },
476
- {
477
- key: 'save-as',
478
- category: 0,
479
- renderer: (queryBuilderState): React.ReactNode => {
480
- if (
481
- queryBuilderState.workflowState.actionConfig instanceof
482
- QueryBuilderActionConfig_QueryApplication
483
- ) {
484
- const editorStore =
485
- queryBuilderState.workflowState.actionConfig.editorStore;
486
506
  const handleQuerySaveAs = (): void => {
487
507
  editorStore.queryCreatorState.open(
488
508
  editorStore instanceof ExistingQueryEditorStore
@@ -491,254 +511,49 @@ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlu
491
511
  );
492
512
  };
493
513
  return (
494
- <Button
495
- className="query-editor__header__action btn--dark"
496
- disabled={
497
- editorStore.isPerformingBlockingAction ||
498
- !queryBuilderState.canBuildQuery
499
- }
500
- onClick={handleQuerySaveAs}
501
- title={
502
- !queryBuilderState.canBuildQuery
503
- ? 'Please fix query errors before saving'
504
- : 'Save as new query'
505
- }
506
- >
507
- <SaveAsIcon />
508
- <div className="query-editor__header__action__label">
509
- Save As...
510
- </div>
511
- </Button>
512
- );
513
- }
514
- return undefined;
515
- },
516
- },
517
- {
518
- key: 'help',
519
- category: 0,
520
- renderer: (queryBuilderState): React.ReactNode => {
521
- if (
522
- queryBuilderState.workflowState.actionConfig instanceof
523
- QueryBuilderActionConfig_QueryApplication
524
- ) {
525
- const editorStore =
526
- queryBuilderState.workflowState.actionConfig.editorStore;
527
- const queryDocEntry =
528
- editorStore.applicationStore.documentationService.getDocEntry(
529
- QUERY_DOCUMENTATION_KEY.TUTORIAL_QUERY_BUILDER,
530
- );
531
- const toggleAssistant = (): void =>
532
- editorStore.applicationStore.assistantService.toggleAssistant();
533
-
534
- const openQueryTutorial = (): void => {
535
- if (queryDocEntry?.url) {
536
- editorStore.applicationStore.navigationService.navigator.visitAddress(
537
- queryDocEntry.url,
538
- );
539
- }
540
- };
541
- const extraHelpMenuContentItems =
542
- editorStore.applicationStore.pluginManager
543
- .getApplicationPlugins()
544
- .flatMap(
545
- (plugin) =>
546
- plugin.getExtraQueryEditorHelpMenuActionConfigurations?.() ??
547
- [],
548
- )
549
- .map((item) => (
550
- <MenuContentItem
551
- key={item.key}
552
- title={item.title ?? ''}
553
- onClick={() => item.onClick(editorStore)}
554
- >
555
- {item.icon && (
556
- <MenuContentItemIcon>{item.icon}</MenuContentItemIcon>
557
- )}
558
- <MenuContentItemLabel>{item.label}</MenuContentItemLabel>
559
- </MenuContentItem>
560
- ));
561
- return (
562
- <DropdownMenu
563
- className="query-editor__header__action btn--dark"
564
- disabled={editorStore.isViewProjectActionDisabled}
565
- content={
566
- <MenuContent>
567
- {extraHelpMenuContentItems}
568
- {queryDocEntry && (
569
- <MenuContentItem onClick={openQueryTutorial}>
570
- <MenuContentItemIcon>{null}</MenuContentItemIcon>
571
- <MenuContentItemLabel>
572
- Open Documentation
573
- </MenuContentItemLabel>
574
- </MenuContentItem>
575
- )}
576
-
577
- <MenuContentItem onClick={toggleAssistant}>
578
- <MenuContentItemIcon>
579
- {!editorStore.applicationStore.assistantService
580
- .isHidden ? (
581
- <CheckIcon />
582
- ) : null}
583
- </MenuContentItemIcon>
584
- <MenuContentItemLabel>
585
- Show Virtual Assistant
586
- </MenuContentItemLabel>
587
- </MenuContentItem>
588
- </MenuContent>
589
- }
590
- >
591
- <div
592
- className="query-editor__header__action__label"
593
- title="See more options"
514
+ <div className="query-editor__header__action-combo btn__dropdown-combo">
515
+ <Button
516
+ className="query-editor__header__action query-editor__header__action-combo__main-btn btn--dak"
517
+ disabled={
518
+ editorStore.isPerformingBlockingAction ||
519
+ !queryBuilderState.canBuildQuery
520
+ }
521
+ onClick={openSaveQueryModal}
522
+ title="Save query"
594
523
  >
595
- Help...
596
- </div>
597
- <CaretDownIcon className="query-editor__header__action__dropdown-trigger" />
598
- </DropdownMenu>
599
- );
600
- }
601
- return undefined;
602
- },
603
- },
604
- {
605
- key: 'toggle-theme',
606
- category: 0,
607
- renderer: (queryBuilderState): React.ReactNode => {
608
- if (
609
- queryBuilderState.workflowState.actionConfig instanceof
610
- QueryBuilderActionConfig_QueryApplication
611
- ) {
612
- const editorStore =
613
- queryBuilderState.workflowState.actionConfig.editorStore;
614
- const applicationStore = editorStore.applicationStore;
615
- const TEMPORARY__toggleLightDarkMode = (): void => {
616
- applicationStore.layoutService.setColorTheme(
617
- applicationStore.layoutService
618
- .TEMPORARY__isLightColorThemeEnabled
619
- ? LEGEND_APPLICATION_COLOR_THEME.DEFAULT_DARK
620
- : LEGEND_APPLICATION_COLOR_THEME.LEGACY_LIGHT,
621
- { persist: true },
622
- );
623
- };
624
- return (
625
- <button
626
- title="Toggle light/dark mode"
627
- onClick={TEMPORARY__toggleLightDarkMode}
628
- className="query-editor__header__action query-editor__header__action__theme-toggler"
629
- >
630
- {applicationStore.layoutService
631
- .TEMPORARY__isLightColorThemeEnabled ? (
632
- <>
633
- <LightBulbIcon className="query-editor__header__action__icon--bulb--light" />
634
- </>
635
- ) : (
636
- <>
637
- <EmptyLightBulbIcon className="query-editor__header__action__icon--bulb--dark" />
638
- </>
639
- )}
640
- </button>
641
- );
642
- }
643
- return undefined;
644
- },
645
- },
646
- {
647
- key: 'more-actions',
648
- category: 0,
649
- renderer: (queryBuilderState): React.ReactNode => {
650
- if (
651
- queryBuilderState.workflowState.actionConfig instanceof
652
- QueryBuilderActionConfig_QueryApplication
653
- ) {
654
- const editorStore =
655
- queryBuilderState.workflowState.actionConfig.editorStore;
656
- const isExistingQuery =
657
- editorStore instanceof ExistingQueryEditorStore;
658
- const renameQuery = (): void => {
659
- if (editorStore instanceof ExistingQueryEditorStore) {
660
- editorStore.updateState.setQueryRenamer(true);
661
- }
662
- };
663
- const showQueryInfo = (): void => {
664
- if (editorStore instanceof ExistingQueryEditorStore) {
665
- editorStore.updateState.setShowQueryInfo(true);
666
- }
667
- };
668
- const viewProject = (): void => {
669
- LegendQueryTelemetryHelper.logEvent_QueryViewProjectLaunched(
670
- editorStore.applicationStore.telemetryService,
671
- );
672
- const { groupId, artifactId, versionId } =
673
- editorStore.getProjectInfo();
674
- createViewProjectHandler(editorStore.applicationStore)(
675
- groupId,
676
- artifactId,
677
- versionId,
678
- undefined,
679
- );
680
- };
681
- const viewSDLCProject = (): void => {
682
- LegendQueryTelemetryHelper.logEvent_QueryViewSdlcProjectLaunched(
683
- editorStore.applicationStore.telemetryService,
684
- );
685
- const { groupId, artifactId } = editorStore.getProjectInfo();
686
- createViewSDLCProjectHandler(
687
- editorStore.applicationStore,
688
- editorStore.depotServerClient,
689
- )(groupId, artifactId, undefined).catch(
690
- editorStore.applicationStore.alertUnhandledError,
691
- );
692
- };
693
- return (
694
- <DropdownMenu
695
- className="query-editor__header__action btn--medium"
696
- disabled={editorStore.isViewProjectActionDisabled}
697
- content={
698
- <MenuContent>
699
- {isExistingQuery && (
700
- <MenuContentItem
701
- className="query-editor__header__action__options"
702
- onClick={renameQuery}
703
- disabled={!isExistingQuery}
704
- >
705
- Rename Query
706
- </MenuContentItem>
707
- )}
708
- {isExistingQuery && (
524
+ <SaveCurrIcon />
525
+ <div className="query-editor__header__action__label">
526
+ Save
527
+ </div>
528
+ </Button>
529
+ <DropdownMenu
530
+ className="query-editor__header__action-combo__dropdown-btn"
531
+ disabled={editorStore.isViewProjectActionDisabled}
532
+ title="query__editor__save-dropdown"
533
+ content={
534
+ <MenuContent>
709
535
  <MenuContentItem
710
- className="query-editor__header__action__options"
711
- onClick={showQueryInfo}
712
- disabled={!isExistingQuery}
536
+ className="btn__dropdown-combo__option"
537
+ onClick={handleQuerySaveAs}
538
+ title="query__editor__save-dropdown__save-as"
539
+ disabled={
540
+ editorStore.isPerformingBlockingAction ||
541
+ !queryBuilderState.canBuildQuery
542
+ }
713
543
  >
714
- Get Query Info
544
+ <MenuContentItemIcon>
545
+ <SaveAsIcon />
546
+ </MenuContentItemIcon>
547
+ <MenuContentItemLabel>
548
+ Save As New Query
549
+ </MenuContentItemLabel>
715
550
  </MenuContentItem>
716
- )}
717
- <MenuContentItem
718
- className="query-editor__header__action__options"
719
- disabled={editorStore.isViewProjectActionDisabled}
720
- onClick={viewProject}
721
- >
722
- Go to Project
723
- </MenuContentItem>
724
- <MenuContentItem
725
- className="query-editor__header__action__options"
726
- disabled={editorStore.isViewProjectActionDisabled}
727
- onClick={viewSDLCProject}
728
- >
729
- Go to SDLC project
730
- </MenuContentItem>
731
- </MenuContent>
732
- }
733
- >
734
- <div
735
- className="query-editor__header__action__label"
736
- title="See more options"
551
+ </MenuContent>
552
+ }
737
553
  >
738
- More Actions...
739
- </div>
740
- <CaretDownIcon className="query-editor__header__action__dropdown-trigger" />
741
- </DropdownMenu>
554
+ <CaretDownIcon />
555
+ </DropdownMenu>
556
+ </div>
742
557
  );
743
558
  }
744
559
  return undefined;
@@ -783,10 +598,7 @@ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlu
783
598
  return undefined;
784
599
  };
785
600
  return (
786
- <div
787
- className="query-editor__header__content"
788
- data-testid={QUERY_EDITOR_TEST_ID.QUERY_EDITOR_ACTIONS}
789
- >
601
+ <div className="query-editor__header__content">
790
602
  {renderQueryTitle()}
791
603
  </div>
792
604
  );