@finos/legend-application-query 13.4.13 → 13.4.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts +3 -1
  2. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
  3. package/lib/components/Core_LegendQueryApplicationPlugin.js +69 -117
  4. package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
  5. package/lib/components/QueryEditor.d.ts.map +1 -1
  6. package/lib/components/QueryEditor.js +17 -11
  7. package/lib/components/QueryEditor.js.map +1 -1
  8. package/lib/index.css +2 -2
  9. package/lib/index.css.map +1 -1
  10. package/lib/index.d.ts +0 -1
  11. package/lib/index.d.ts.map +1 -1
  12. package/lib/index.js +0 -1
  13. package/lib/index.js.map +1 -1
  14. package/lib/package.json +1 -1
  15. package/lib/stores/LegendQueryApplicationPlugin.d.ts +0 -8
  16. package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
  17. package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
  18. package/lib/stores/QueryEditorStore.d.ts +2 -0
  19. package/lib/stores/QueryEditorStore.d.ts.map +1 -1
  20. package/lib/stores/QueryEditorStore.js +6 -0
  21. package/lib/stores/QueryEditorStore.js.map +1 -1
  22. package/package.json +6 -6
  23. package/src/components/Core_LegendQueryApplicationPlugin.tsx +135 -322
  24. package/src/components/QueryEditor.tsx +104 -62
  25. package/src/index.ts +0 -1
  26. package/src/stores/LegendQueryApplicationPlugin.tsx +0 -12
  27. package/src/stores/QueryEditorStore.ts +7 -0
  28. package/tsconfig.json +0 -2
  29. package/lib/__lib__/LegendQueryTesting.d.ts +0 -19
  30. package/lib/__lib__/LegendQueryTesting.d.ts.map +0 -1
  31. package/lib/__lib__/LegendQueryTesting.js +0 -20
  32. package/lib/__lib__/LegendQueryTesting.js.map +0 -1
  33. package/lib/application/LegendQueryDocumentation.d.ts +0 -19
  34. package/lib/application/LegendQueryDocumentation.d.ts.map +0 -1
  35. package/lib/application/LegendQueryDocumentation.js +0 -20
  36. package/lib/application/LegendQueryDocumentation.js.map +0 -1
  37. package/src/__lib__/LegendQueryTesting.ts +0 -19
  38. 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,
329
353
  );
330
354
  }
331
- return undefined;
332
355
  },
356
+ icon: <InfoCircleIcon />,
333
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,
378
+ );
379
+ }
380
+ },
381
+ icon: <InfoCircleIcon />,
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 (
@@ -449,40 +503,6 @@ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlu
449
503
  editorStore.updateState.showSaveModal();
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,50 @@ 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
+ !isExistingQuery ||
519
+ editorStore.isPerformingBlockingAction ||
520
+ !queryBuilderState.canBuildQuery
521
+ }
522
+ onClick={openSaveQueryModal}
523
+ title="Save query"
594
524
  >
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 && (
525
+ <SaveCurrIcon />
526
+ <div className="query-editor__header__action__label">
527
+ Save
528
+ </div>
529
+ </Button>
530
+ <DropdownMenu
531
+ className="query-editor__header__action-combo__dropdown-btn"
532
+ disabled={editorStore.isViewProjectActionDisabled}
533
+ title="query__editor__save-dropdown"
534
+ content={
535
+ <MenuContent>
709
536
  <MenuContentItem
710
- className="query-editor__header__action__options"
711
- onClick={showQueryInfo}
712
- disabled={!isExistingQuery}
537
+ className="btn__dropdown-combo__option"
538
+ onClick={handleQuerySaveAs}
539
+ title="query__editor__save-dropdown__save-as"
540
+ disabled={
541
+ editorStore.isPerformingBlockingAction ||
542
+ !queryBuilderState.canBuildQuery
543
+ }
713
544
  >
714
- Get Query Info
545
+ <MenuContentItemIcon>
546
+ <SaveAsIcon />
547
+ </MenuContentItemIcon>
548
+ <MenuContentItemLabel>
549
+ Save As New Query
550
+ </MenuContentItemLabel>
715
551
  </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"
552
+ </MenuContent>
553
+ }
737
554
  >
738
- More Actions...
739
- </div>
740
- <CaretDownIcon className="query-editor__header__action__dropdown-trigger" />
741
- </DropdownMenu>
555
+ <CaretDownIcon />
556
+ </DropdownMenu>
557
+ </div>
742
558
  );
743
559
  }
744
560
  return undefined;
@@ -783,10 +599,7 @@ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlu
783
599
  return undefined;
784
600
  };
785
601
  return (
786
- <div
787
- className="query-editor__header__content"
788
- data-testid={QUERY_EDITOR_TEST_ID.QUERY_EDITOR_ACTIONS}
789
- >
602
+ <div className="query-editor__header__content">
790
603
  {renderQueryTitle()}
791
604
  </div>
792
605
  );