@finos/legend-application-query 13.4.12 → 13.4.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts +3 -0
  2. package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
  3. package/lib/components/Core_LegendQueryApplicationPlugin.js +250 -5
  4. package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
  5. package/lib/components/QueryEditor.d.ts +8 -0
  6. package/lib/components/QueryEditor.d.ts.map +1 -1
  7. package/lib/components/QueryEditor.js +15 -136
  8. package/lib/components/QueryEditor.js.map +1 -1
  9. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts.map +1 -1
  10. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js +2 -0
  11. package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js.map +1 -1
  12. package/lib/components/data-space/DataSpaceQuerySetup.d.ts.map +1 -1
  13. package/lib/components/data-space/DataSpaceQuerySetup.js +7 -6
  14. package/lib/components/data-space/DataSpaceQuerySetup.js.map +1 -1
  15. package/lib/index.css +2 -2
  16. package/lib/index.css.map +1 -1
  17. package/lib/index.d.ts +1 -1
  18. package/lib/index.d.ts.map +1 -1
  19. package/lib/index.js +1 -1
  20. package/lib/index.js.map +1 -1
  21. package/lib/package.json +1 -1
  22. package/lib/stores/LegendQueryApplicationPlugin.d.ts +4 -4
  23. package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
  24. package/lib/stores/LegendQueryApplicationPlugin.js +1 -0
  25. package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
  26. package/lib/stores/QueryEditorStore.d.ts +5 -1
  27. package/lib/stores/QueryEditorStore.d.ts.map +1 -1
  28. package/lib/stores/QueryEditorStore.js +12 -4
  29. package/lib/stores/QueryEditorStore.js.map +1 -1
  30. package/lib/stores/__test-utils__/LegendQueryApplicationTestUtils.js +1 -1
  31. package/lib/stores/__test-utils__/LegendQueryApplicationTestUtils.js.map +1 -1
  32. package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts.map +1 -1
  33. package/lib/stores/data-space/DataSpaceQueryCreatorStore.js +2 -2
  34. package/lib/stores/data-space/DataSpaceQueryCreatorStore.js.map +1 -1
  35. package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts +2 -1
  36. package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts.map +1 -1
  37. package/lib/stores/data-space/DataSpaceQuerySetupState.js +6 -3
  38. package/lib/stores/data-space/DataSpaceQuerySetupState.js.map +1 -1
  39. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
  40. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +2 -2
  41. package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
  42. package/package.json +6 -6
  43. package/src/components/Core_LegendQueryApplicationPlugin.tsx +593 -1
  44. package/src/components/QueryEditor.tsx +30 -468
  45. package/src/components/__test-utils__/QueryEditorComponentTestUtils.tsx +2 -0
  46. package/src/components/data-space/DataSpaceQuerySetup.tsx +52 -53
  47. package/src/index.ts +2 -1
  48. package/src/stores/{LegendQueryApplicationPlugin.ts → LegendQueryApplicationPlugin.tsx} +11 -6
  49. package/src/stores/QueryEditorStore.ts +16 -0
  50. package/src/stores/__test-utils__/LegendQueryApplicationTestUtils.ts +1 -1
  51. package/src/stores/data-space/DataSpaceQueryCreatorStore.ts +2 -0
  52. package/src/stores/data-space/DataSpaceQuerySetupState.ts +8 -0
  53. package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +2 -0
  54. package/tsconfig.json +2 -2
@@ -23,10 +23,22 @@ import packageJson from '../../package.json' assert { type: 'json' };
23
23
  import type { QuerySetupLandingPageStore } from '../stores/QuerySetupStore.js';
24
24
  import {
25
25
  ArrowCircleUpIcon,
26
+ Button,
27
+ CaretDownIcon,
28
+ CheckIcon,
26
29
  DroidIcon,
30
+ DropdownMenu,
31
+ EmptyLightBulbIcon,
32
+ LightBulbIcon,
27
33
  ManageSearchIcon,
34
+ MenuContent,
35
+ MenuContentItem,
36
+ MenuContentItemIcon,
37
+ MenuContentItemLabel,
28
38
  PlusIcon,
29
39
  RobotIcon,
40
+ SaveAsIcon,
41
+ SaveCurrIcon,
30
42
  SquareIcon,
31
43
  } from '@finos/legend-art';
32
44
  import {
@@ -34,11 +46,13 @@ import {
34
46
  generateCreateMappingQuerySetupRoute,
35
47
  generateEditExistingQuerySetupRoute,
36
48
  generateLoadProjectServiceQuerySetup,
49
+ generateMappingQueryCreatorRoute,
37
50
  generateQueryProductionizerSetupRoute,
38
51
  generateUpdateExistingServiceQuerySetup,
39
52
  LEGEND_QUERY_ROUTE_PATTERN,
40
53
  } from '../__lib__/LegendQueryNavigation.js';
41
54
  import {
55
+ LEGEND_APPLICATION_COLOR_THEME,
42
56
  type ApplicationPageEntry,
43
57
  type LegendApplicationSetup,
44
58
  } from '@finos/legend-application';
@@ -50,7 +64,30 @@ import {
50
64
  configureCodeEditorComponent,
51
65
  setupPureLanguageService,
52
66
  } from '@finos/legend-lego/code-editor';
53
- import { generateDataSpaceQuerySetupRoute } from '../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
67
+ import {
68
+ generateDataSpaceQueryCreatorRoute,
69
+ generateDataSpaceQuerySetupRoute,
70
+ } from '../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
71
+ import type { QueryBuilderHeaderActionConfiguration } from '@finos/legend-query-builder';
72
+ import {
73
+ ExistingQueryEditorStore,
74
+ QueryBuilderActionConfig_QueryApplication,
75
+ createViewProjectHandler,
76
+ createViewSDLCProjectHandler,
77
+ } from '../stores/QueryEditorStore.js';
78
+ import {
79
+ DataSpaceQueryBuilderState,
80
+ generateDataSpaceTemplateQueryPromotionRoute,
81
+ } from '@finos/legend-extension-dsl-data-space/application';
82
+ import { RuntimePointer } from '@finos/legend-graph';
83
+ import { QUERY_DOCUMENTATION_KEY } from '../application/LegendQueryDocumentation.js';
84
+ import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
85
+ import { StoreProjectData } from '@finos/legend-server-depot';
86
+ import { buildUrl } from '@finos/legend-shared';
87
+ import { parseProjectIdentifier } from '@finos/legend-storage';
88
+ import { QUERY_EDITOR_TEST_ID } from '../__lib__/LegendQueryTesting.js';
89
+ import { QueryEditorExistingQueryHeader } from './QueryEditor.js';
90
+ import { DataSpaceTemplateQueryCreatorStore } from '../stores/data-space/DataSpaceTemplateQueryCreatorStore.js';
54
91
 
55
92
  export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlugin {
56
93
  static NAME = packageJson.extensions.applicationQueryPlugin;
@@ -203,4 +240,559 @@ export class Core_LegendQueryApplicationPlugin extends LegendQueryApplicationPlu
203
240
  },
204
241
  ];
205
242
  }
243
+
244
+ getExtraQueryBuilderHeaderActionConfigurations?(): QueryBuilderHeaderActionConfiguration[] {
245
+ return [
246
+ {
247
+ key: 'promote-as-template-query',
248
+ category: 0,
249
+ renderer: (queryBuilderState): React.ReactNode => {
250
+ if (
251
+ queryBuilderState.workflowState.actionConfig instanceof
252
+ QueryBuilderActionConfig_QueryApplication
253
+ ) {
254
+ const editorStore =
255
+ queryBuilderState.workflowState.actionConfig.editorStore;
256
+ const proceedCuratedTemplateQueryPromotion =
257
+ async (): Promise<void> => {
258
+ if (
259
+ !(
260
+ editorStore instanceof ExistingQueryEditorStore &&
261
+ queryBuilderState instanceof DataSpaceQueryBuilderState
262
+ )
263
+ ) {
264
+ return;
265
+ }
266
+ // fetch project data
267
+ const project = StoreProjectData.serialization.fromJson(
268
+ await editorStore.depotServerClient.getProject(
269
+ editorStore.lightQuery.groupId,
270
+ editorStore.lightQuery.artifactId,
271
+ ),
272
+ );
273
+
274
+ // find the matching SDLC instance
275
+ const projectIDPrefix = parseProjectIdentifier(
276
+ project.projectId,
277
+ ).prefix;
278
+ const matchingSDLCEntry =
279
+ editorStore.applicationStore.config.studioInstances.find(
280
+ (entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
281
+ );
282
+ if (matchingSDLCEntry) {
283
+ editorStore.applicationStore.navigationService.navigator.visitAddress(
284
+ buildUrl([
285
+ editorStore.applicationStore.config.studioApplicationUrl,
286
+ generateDataSpaceTemplateQueryPromotionRoute(
287
+ editorStore.lightQuery.groupId,
288
+ editorStore.lightQuery.artifactId,
289
+ editorStore.lightQuery.versionId,
290
+ queryBuilderState.dataSpace.path,
291
+ editorStore.lightQuery.id,
292
+ ),
293
+ ]),
294
+ );
295
+ } else {
296
+ editorStore.applicationStore.notificationService.notifyWarning(
297
+ `Can't find the corresponding SDLC instance to productionize the query`,
298
+ );
299
+ }
300
+ };
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
+ </>
329
+ );
330
+ }
331
+ return undefined;
332
+ },
333
+ },
334
+ {
335
+ key: 'load-query',
336
+ category: 0,
337
+ renderer: (queryBuilderState): React.ReactNode => {
338
+ if (
339
+ queryBuilderState.workflowState.actionConfig instanceof
340
+ QueryBuilderActionConfig_QueryApplication
341
+ ) {
342
+ const editorStore =
343
+ queryBuilderState.workflowState.actionConfig.editorStore;
344
+ const openQueryLoader = (): void => {
345
+ editorStore.queryLoaderState.setQueryLoaderDialogOpen(true);
346
+ };
347
+ return (
348
+ <Button
349
+ className="query-editor__header__action btn--dark"
350
+ disabled={editorStore.isPerformingBlockingAction}
351
+ onClick={openQueryLoader}
352
+ title="Load query..."
353
+ >
354
+ <ManageSearchIcon className="query-editor__header__action__icon--load" />
355
+ <div className="query-editor__header__action__label">
356
+ Load Query
357
+ </div>
358
+ </Button>
359
+ );
360
+ }
361
+ return undefined;
362
+ },
363
+ },
364
+ {
365
+ key: 'new-query',
366
+ category: 0,
367
+ renderer: (queryBuilderState): React.ReactNode => {
368
+ if (
369
+ queryBuilderState.workflowState.actionConfig instanceof
370
+ QueryBuilderActionConfig_QueryApplication
371
+ ) {
372
+ const editorStore =
373
+ queryBuilderState.workflowState.actionConfig.editorStore;
374
+ const isExistingQuery =
375
+ editorStore instanceof ExistingQueryEditorStore;
376
+ const handleNewQuery = (): void => {
377
+ if (editorStore instanceof ExistingQueryEditorStore) {
378
+ const query = editorStore.query;
379
+ if (query) {
380
+ if (queryBuilderState instanceof DataSpaceQueryBuilderState) {
381
+ editorStore.applicationStore.navigationService.navigator.goToLocation(
382
+ generateDataSpaceQueryCreatorRoute(
383
+ query.groupId,
384
+ query.artifactId,
385
+ query.versionId,
386
+ queryBuilderState.dataSpace.path,
387
+ queryBuilderState.executionContext.name,
388
+ undefined,
389
+ undefined,
390
+ ),
391
+ );
392
+ } else {
393
+ const mapping =
394
+ editorStore.queryBuilderState?.executionContextState
395
+ .mapping;
396
+ const runtime =
397
+ editorStore.queryBuilderState?.executionContextState
398
+ .runtimeValue;
399
+ if (mapping && runtime instanceof RuntimePointer) {
400
+ editorStore.applicationStore.navigationService.navigator.goToLocation(
401
+ generateMappingQueryCreatorRoute(
402
+ query.groupId,
403
+ query.artifactId,
404
+ query.versionId,
405
+ mapping.path,
406
+ runtime.packageableRuntime.value.path,
407
+ ),
408
+ );
409
+ }
410
+ }
411
+ }
412
+ }
413
+ };
414
+ return (
415
+ <>
416
+ {isExistingQuery && (
417
+ <Button
418
+ className="query-editor__header__action btn--dark"
419
+ disabled={editorStore.isPerformingBlockingAction}
420
+ onClick={handleNewQuery}
421
+ title="New query"
422
+ >
423
+ <SaveCurrIcon />
424
+ <div className="query-editor__header__action__label">
425
+ New Query
426
+ </div>
427
+ </Button>
428
+ )}
429
+ </>
430
+ );
431
+ }
432
+ return undefined;
433
+ },
434
+ },
435
+ {
436
+ key: 'save-query',
437
+ category: 0,
438
+ renderer: (queryBuilderState): React.ReactNode => {
439
+ if (
440
+ queryBuilderState.workflowState.actionConfig instanceof
441
+ QueryBuilderActionConfig_QueryApplication
442
+ ) {
443
+ const editorStore =
444
+ queryBuilderState.workflowState.actionConfig.editorStore;
445
+ const isExistingQuery =
446
+ editorStore instanceof ExistingQueryEditorStore;
447
+ const openSaveQueryModal = (): void => {
448
+ if (editorStore instanceof ExistingQueryEditorStore) {
449
+ editorStore.updateState.showSaveModal();
450
+ }
451
+ };
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
+ const handleQuerySaveAs = (): void => {
487
+ editorStore.queryCreatorState.open(
488
+ editorStore instanceof ExistingQueryEditorStore
489
+ ? editorStore.query
490
+ : undefined,
491
+ );
492
+ };
493
+ 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"
594
+ >
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 && (
709
+ <MenuContentItem
710
+ className="query-editor__header__action__options"
711
+ onClick={showQueryInfo}
712
+ disabled={!isExistingQuery}
713
+ >
714
+ Get Query Info
715
+ </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"
737
+ >
738
+ More Actions...
739
+ </div>
740
+ <CaretDownIcon className="query-editor__header__action__dropdown-trigger" />
741
+ </DropdownMenu>
742
+ );
743
+ }
744
+ return undefined;
745
+ },
746
+ },
747
+ ];
748
+ }
749
+
750
+ getExtraQueryBuilderHeaderTitleConfigurations?(): QueryBuilderHeaderActionConfiguration {
751
+ return {
752
+ key: 'query-title',
753
+ category: 0,
754
+ renderer: (queryBuilderState): React.ReactNode => {
755
+ if (
756
+ queryBuilderState.workflowState.actionConfig instanceof
757
+ QueryBuilderActionConfig_QueryApplication
758
+ ) {
759
+ const editorStore =
760
+ queryBuilderState.workflowState.actionConfig.editorStore;
761
+ const renderQueryTitle = (): React.ReactNode => {
762
+ if (editorStore instanceof ExistingQueryEditorStore) {
763
+ return (
764
+ <QueryEditorExistingQueryHeader
765
+ queryBuilderState={queryBuilderState}
766
+ existingEditorStore={editorStore}
767
+ />
768
+ );
769
+ } else if (
770
+ editorStore instanceof DataSpaceTemplateQueryCreatorStore
771
+ ) {
772
+ return (
773
+ <div className="query-editor__dataspace__header">
774
+ <div className="query-editor__header__content__main query-editor__header__content__title__text query-editor__dataspace__header__title__text">
775
+ {editorStore.templateQueryTitle}
776
+ </div>
777
+ <div className="query-editor__dataspace__header__title__tag">
778
+ template
779
+ </div>
780
+ </div>
781
+ );
782
+ }
783
+ return undefined;
784
+ };
785
+ return (
786
+ <div
787
+ className="query-editor__header__content"
788
+ data-testid={QUERY_EDITOR_TEST_ID.QUERY_EDITOR_ACTIONS}
789
+ >
790
+ {renderQueryTitle()}
791
+ </div>
792
+ );
793
+ }
794
+ return undefined;
795
+ },
796
+ };
797
+ }
206
798
  }