@finos/legend-application-query 13.4.12 → 13.4.14
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts +5 -0
- package/lib/components/Core_LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/components/Core_LegendQueryApplicationPlugin.js +201 -4
- package/lib/components/Core_LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/components/QueryEditor.d.ts +8 -0
- package/lib/components/QueryEditor.d.ts.map +1 -1
- package/lib/components/QueryEditor.js +25 -140
- package/lib/components/QueryEditor.js.map +1 -1
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.d.ts.map +1 -1
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js +2 -0
- package/lib/components/__test-utils__/QueryEditorComponentTestUtils.js.map +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.d.ts.map +1 -1
- package/lib/components/data-space/DataSpaceQuerySetup.js +7 -6
- package/lib/components/data-space/DataSpaceQuerySetup.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +1 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -2
- package/lib/index.js.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.d.ts +4 -12
- package/lib/stores/LegendQueryApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendQueryApplicationPlugin.js +1 -0
- package/lib/stores/LegendQueryApplicationPlugin.js.map +1 -1
- package/lib/stores/QueryEditorStore.d.ts +7 -1
- package/lib/stores/QueryEditorStore.d.ts.map +1 -1
- package/lib/stores/QueryEditorStore.js +18 -4
- package/lib/stores/QueryEditorStore.js.map +1 -1
- package/lib/stores/__test-utils__/LegendQueryApplicationTestUtils.js +1 -1
- package/lib/stores/__test-utils__/LegendQueryApplicationTestUtils.js.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js +2 -2
- package/lib/stores/data-space/DataSpaceQueryCreatorStore.js.map +1 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts +2 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceQuerySetupState.js +6 -3
- package/lib/stores/data-space/DataSpaceQuerySetupState.js.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.d.ts.map +1 -1
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js +2 -2
- package/lib/stores/data-space/DataSpaceTemplateQueryCreatorStore.js.map +1 -1
- package/package.json +6 -6
- package/src/components/Core_LegendQueryApplicationPlugin.tsx +406 -1
- package/src/components/QueryEditor.tsx +111 -507
- package/src/components/__test-utils__/QueryEditorComponentTestUtils.tsx +2 -0
- package/src/components/data-space/DataSpaceQuerySetup.tsx +52 -53
- package/src/index.ts +2 -2
- package/src/stores/{LegendQueryApplicationPlugin.ts → LegendQueryApplicationPlugin.tsx} +11 -18
- package/src/stores/QueryEditorStore.ts +23 -0
- package/src/stores/__test-utils__/LegendQueryApplicationTestUtils.ts +1 -1
- package/src/stores/data-space/DataSpaceQueryCreatorStore.ts +2 -0
- package/src/stores/data-space/DataSpaceQuerySetupState.ts +8 -0
- package/src/stores/data-space/DataSpaceTemplateQueryCreatorStore.ts +2 -0
- package/tsconfig.json +2 -4
- package/lib/__lib__/LegendQueryTesting.d.ts +0 -19
- package/lib/__lib__/LegendQueryTesting.d.ts.map +0 -1
- package/lib/__lib__/LegendQueryTesting.js +0 -20
- package/lib/__lib__/LegendQueryTesting.js.map +0 -1
- package/lib/application/LegendQueryDocumentation.d.ts +0 -19
- package/lib/application/LegendQueryDocumentation.d.ts.map +0 -1
- package/lib/application/LegendQueryDocumentation.js +0 -20
- package/lib/application/LegendQueryDocumentation.js.map +0 -1
- package/src/__lib__/LegendQueryTesting.ts +0 -19
- package/src/application/LegendQueryDocumentation.ts +0 -19
@@ -21,7 +21,6 @@ import {
|
|
21
21
|
DropdownMenu,
|
22
22
|
MenuContent,
|
23
23
|
MenuContentItem,
|
24
|
-
CaretDownIcon,
|
25
24
|
MenuIcon,
|
26
25
|
MenuContentDivider,
|
27
26
|
MenuContentItemIcon,
|
@@ -33,21 +32,17 @@ import {
|
|
33
32
|
ModalFooter,
|
34
33
|
ModalTitle,
|
35
34
|
ModalFooterButton,
|
36
|
-
ManageSearchIcon,
|
37
|
-
LightBulbIcon,
|
38
|
-
EmptyLightBulbIcon,
|
39
|
-
SaveCurrIcon,
|
40
|
-
SaveAsIcon,
|
41
35
|
ExclamationTriangleIcon,
|
42
36
|
PanelListItem,
|
43
|
-
Button,
|
44
37
|
clsx,
|
45
38
|
ModalHeaderActions,
|
46
39
|
TimesIcon,
|
47
40
|
Panel,
|
48
41
|
PanelFullContent,
|
49
42
|
CustomSelectorInput,
|
50
|
-
|
43
|
+
PencilIcon,
|
44
|
+
MoonIcon,
|
45
|
+
SunIcon,
|
51
46
|
} from '@finos/legend-art';
|
52
47
|
import { observer } from 'mobx-react-lite';
|
53
48
|
import { Fragment, useEffect, useMemo, useRef, useState } from 'react';
|
@@ -59,13 +54,8 @@ import {
|
|
59
54
|
LEGEND_QUERY_ROUTE_PATTERN_TOKEN,
|
60
55
|
generateQuerySetupRoute,
|
61
56
|
generateExistingQueryEditorRoute,
|
62
|
-
generateMappingQueryCreatorRoute,
|
63
57
|
} from '../__lib__/LegendQueryNavigation.js';
|
64
|
-
import {
|
65
|
-
createViewProjectHandler,
|
66
|
-
createViewSDLCProjectHandler,
|
67
|
-
ExistingQueryEditorStore,
|
68
|
-
} from '../stores/QueryEditorStore.js';
|
58
|
+
import { ExistingQueryEditorStore } from '../stores/QueryEditorStore.js';
|
69
59
|
import {
|
70
60
|
LEGEND_APPLICATION_COLOR_THEME,
|
71
61
|
useApplicationStore,
|
@@ -78,7 +68,6 @@ import {
|
|
78
68
|
useQueryEditorStore,
|
79
69
|
} from './QueryEditorStoreProvider.js';
|
80
70
|
import { flowResult } from 'mobx';
|
81
|
-
import { useLegendQueryApplicationStore } from './LegendQueryFrameworkProvider.js';
|
82
71
|
import {
|
83
72
|
QueryBuilder,
|
84
73
|
QueryBuilderNavigationBlocker,
|
@@ -86,33 +75,20 @@ import {
|
|
86
75
|
QueryBuilderDiffViewPanel,
|
87
76
|
type QueryBuilderState,
|
88
77
|
} from '@finos/legend-query-builder';
|
89
|
-
|
90
|
-
import { buildUrl, debounce } from '@finos/legend-shared';
|
91
|
-
import { LegendQueryTelemetryHelper } from '../__lib__/LegendQueryTelemetryHelper.js';
|
92
|
-
import { QUERY_EDITOR_TEST_ID } from '../__lib__/LegendQueryTesting.js';
|
78
|
+
|
93
79
|
import {
|
94
80
|
compareSemVerVersions,
|
95
81
|
generateGAVCoordinates,
|
96
|
-
parseProjectIdentifier,
|
97
82
|
} from '@finos/legend-storage';
|
98
83
|
import {
|
84
|
+
type Query,
|
99
85
|
QueryDataSpaceExecutionContext,
|
100
86
|
QueryExplicitExecutionContext,
|
101
|
-
RuntimePointer,
|
102
|
-
type Query,
|
103
87
|
} from '@finos/legend-graph';
|
104
|
-
import {
|
105
|
-
LATEST_VERSION_ALIAS,
|
106
|
-
StoreProjectData,
|
107
|
-
} from '@finos/legend-server-depot';
|
88
|
+
import { LATEST_VERSION_ALIAS } from '@finos/legend-server-depot';
|
108
89
|
import { buildVersionOption, type VersionOption } from './QuerySetup.js';
|
109
90
|
import { QueryEditorExistingQueryVersionRevertModal } from './QueryEdtiorExistingQueryVersionRevertModal.js';
|
110
|
-
import {
|
111
|
-
DataSpaceQueryBuilderState,
|
112
|
-
generateDataSpaceTemplateQueryPromotionRoute,
|
113
|
-
} from '@finos/legend-extension-dsl-data-space/application';
|
114
|
-
import { generateDataSpaceQueryCreatorRoute } from '../__lib__/DSL_DataSpace_LegendQueryNavigation.js';
|
115
|
-
import { DataSpaceTemplateQueryCreatorStore } from '../stores/data-space/DataSpaceTemplateQueryCreatorStore.js';
|
91
|
+
import { debounce } from '@finos/legend-shared';
|
116
92
|
|
117
93
|
const CreateQueryDialog = observer(() => {
|
118
94
|
const editorStore = useQueryEditorStore();
|
@@ -281,7 +257,7 @@ const SaveQueryDialog = observer(
|
|
281
257
|
},
|
282
258
|
);
|
283
259
|
|
284
|
-
const QueryEditorExistingQueryHeader = observer(
|
260
|
+
export const QueryEditorExistingQueryHeader = observer(
|
285
261
|
(props: {
|
286
262
|
queryBuilderState: QueryBuilderState;
|
287
263
|
existingEditorStore: ExistingQueryEditorStore;
|
@@ -386,6 +362,12 @@ const QueryEditorExistingQueryHeader = observer(
|
|
386
362
|
title="Double-click to rename query"
|
387
363
|
>
|
388
364
|
{existingEditorStore.lightQuery.name}
|
365
|
+
<button
|
366
|
+
className="panel__content__form__section__list__item__edit-btn"
|
367
|
+
onClick={enableRename}
|
368
|
+
>
|
369
|
+
<PencilIcon />
|
370
|
+
</button>
|
389
371
|
</div>
|
390
372
|
)}
|
391
373
|
{existingEditorStore.updateState.saveModal && (
|
@@ -576,435 +558,11 @@ const QueryEditorExistingQueryInfoModal = observer(
|
|
576
558
|
},
|
577
559
|
);
|
578
560
|
|
579
|
-
const QueryEditorHeaderContent = observer(
|
580
|
-
(props: { queryBuilderState: QueryBuilderState }) => {
|
581
|
-
const { queryBuilderState } = props;
|
582
|
-
const editorStore = useQueryEditorStore();
|
583
|
-
const applicationStore = useLegendQueryApplicationStore();
|
584
|
-
const isExistingQuery = editorStore instanceof ExistingQueryEditorStore;
|
585
|
-
const renameQuery = (): void => {
|
586
|
-
if (editorStore instanceof ExistingQueryEditorStore) {
|
587
|
-
editorStore.updateState.setQueryRenamer(true);
|
588
|
-
}
|
589
|
-
};
|
590
|
-
const showQueryInfo = (): void => {
|
591
|
-
if (editorStore instanceof ExistingQueryEditorStore) {
|
592
|
-
editorStore.updateState.setShowQueryInfo(true);
|
593
|
-
}
|
594
|
-
};
|
595
|
-
// actions
|
596
|
-
const openQueryLoader = (): void => {
|
597
|
-
editorStore.queryLoaderState.setQueryLoaderDialogOpen(true);
|
598
|
-
};
|
599
|
-
const viewProject = (): void => {
|
600
|
-
LegendQueryTelemetryHelper.logEvent_QueryViewProjectLaunched(
|
601
|
-
editorStore.applicationStore.telemetryService,
|
602
|
-
);
|
603
|
-
const { groupId, artifactId, versionId } = editorStore.getProjectInfo();
|
604
|
-
createViewProjectHandler(applicationStore)(
|
605
|
-
groupId,
|
606
|
-
artifactId,
|
607
|
-
versionId,
|
608
|
-
undefined,
|
609
|
-
);
|
610
|
-
};
|
611
|
-
const viewSDLCProject = (): void => {
|
612
|
-
LegendQueryTelemetryHelper.logEvent_QueryViewSdlcProjectLaunched(
|
613
|
-
editorStore.applicationStore.telemetryService,
|
614
|
-
);
|
615
|
-
const { groupId, artifactId } = editorStore.getProjectInfo();
|
616
|
-
createViewSDLCProjectHandler(
|
617
|
-
applicationStore,
|
618
|
-
editorStore.depotServerClient,
|
619
|
-
)(groupId, artifactId, undefined).catch(
|
620
|
-
applicationStore.alertUnhandledError,
|
621
|
-
);
|
622
|
-
};
|
623
|
-
const TEMPORARY__toggleLightDarkMode = (): void => {
|
624
|
-
applicationStore.layoutService.setColorTheme(
|
625
|
-
applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
|
626
|
-
? LEGEND_APPLICATION_COLOR_THEME.DEFAULT_DARK
|
627
|
-
: LEGEND_APPLICATION_COLOR_THEME.LEGACY_LIGHT,
|
628
|
-
{ persist: true },
|
629
|
-
);
|
630
|
-
};
|
631
|
-
|
632
|
-
const openSaveQueryModal = (): void => {
|
633
|
-
if (editorStore instanceof ExistingQueryEditorStore) {
|
634
|
-
editorStore.updateState.showSaveModal();
|
635
|
-
}
|
636
|
-
};
|
637
|
-
|
638
|
-
const handleNewQuery = (): void => {
|
639
|
-
if (editorStore instanceof ExistingQueryEditorStore) {
|
640
|
-
const query = editorStore.query;
|
641
|
-
if (query) {
|
642
|
-
if (queryBuilderState instanceof DataSpaceQueryBuilderState) {
|
643
|
-
editorStore.applicationStore.navigationService.navigator.goToLocation(
|
644
|
-
generateDataSpaceQueryCreatorRoute(
|
645
|
-
query.groupId,
|
646
|
-
query.artifactId,
|
647
|
-
query.versionId,
|
648
|
-
queryBuilderState.dataSpace.path,
|
649
|
-
queryBuilderState.executionContext.name,
|
650
|
-
undefined,
|
651
|
-
undefined,
|
652
|
-
),
|
653
|
-
);
|
654
|
-
} else {
|
655
|
-
const mapping =
|
656
|
-
editorStore.queryBuilderState?.executionContextState.mapping;
|
657
|
-
const runtime =
|
658
|
-
editorStore.queryBuilderState?.executionContextState.runtimeValue;
|
659
|
-
if (mapping && runtime instanceof RuntimePointer) {
|
660
|
-
editorStore.applicationStore.navigationService.navigator.goToLocation(
|
661
|
-
generateMappingQueryCreatorRoute(
|
662
|
-
query.groupId,
|
663
|
-
query.artifactId,
|
664
|
-
query.versionId,
|
665
|
-
mapping.path,
|
666
|
-
runtime.packageableRuntime.value.path,
|
667
|
-
),
|
668
|
-
);
|
669
|
-
}
|
670
|
-
}
|
671
|
-
}
|
672
|
-
}
|
673
|
-
};
|
674
|
-
|
675
|
-
const toggleAssistant = (): void =>
|
676
|
-
applicationStore.assistantService.toggleAssistant();
|
677
|
-
|
678
|
-
const queryDocEntry = applicationStore.documentationService.getDocEntry(
|
679
|
-
QUERY_DOCUMENTATION_KEY.TUTORIAL_QUERY_BUILDER,
|
680
|
-
);
|
681
|
-
|
682
|
-
const openQueryTutorial = (): void => {
|
683
|
-
if (queryDocEntry?.url) {
|
684
|
-
applicationStore.navigationService.navigator.visitAddress(
|
685
|
-
queryDocEntry.url,
|
686
|
-
);
|
687
|
-
}
|
688
|
-
};
|
689
|
-
|
690
|
-
const handleQuerySaveAs = (): void => {
|
691
|
-
editorStore.queryCreatorState.open(
|
692
|
-
editorStore instanceof ExistingQueryEditorStore
|
693
|
-
? editorStore.query
|
694
|
-
: undefined,
|
695
|
-
);
|
696
|
-
};
|
697
|
-
|
698
|
-
const renderQueryTitle = (): React.ReactNode => {
|
699
|
-
if (editorStore instanceof ExistingQueryEditorStore) {
|
700
|
-
return (
|
701
|
-
<QueryEditorExistingQueryHeader
|
702
|
-
queryBuilderState={queryBuilderState}
|
703
|
-
existingEditorStore={editorStore}
|
704
|
-
/>
|
705
|
-
);
|
706
|
-
} else if (editorStore instanceof DataSpaceTemplateQueryCreatorStore) {
|
707
|
-
return (
|
708
|
-
<div className="query-editor__dataspace__header">
|
709
|
-
<div className="query-editor__header__content__main query-editor__header__content__title__text query-editor__dataspace__header__title__text">
|
710
|
-
{editorStore.templateQueryTitle}
|
711
|
-
</div>
|
712
|
-
<div className="query-editor__dataspace__header__title__tag">
|
713
|
-
template
|
714
|
-
</div>
|
715
|
-
</div>
|
716
|
-
);
|
717
|
-
}
|
718
|
-
|
719
|
-
return (
|
720
|
-
<div className="query-editor__header__content__main query-editor__header__content__title" />
|
721
|
-
);
|
722
|
-
};
|
723
|
-
|
724
|
-
const extraHelpMenuContentItems = applicationStore.pluginManager
|
725
|
-
.getApplicationPlugins()
|
726
|
-
.flatMap(
|
727
|
-
(plugin) =>
|
728
|
-
plugin.getExtraQueryEditorHelpMenuActionConfigurations?.() ?? [],
|
729
|
-
)
|
730
|
-
.map((item) => (
|
731
|
-
<MenuContentItem
|
732
|
-
key={item.key}
|
733
|
-
title={item.title ?? ''}
|
734
|
-
onClick={() => item.onClick(editorStore)}
|
735
|
-
>
|
736
|
-
{item.icon && <MenuContentItemIcon>{item.icon}</MenuContentItemIcon>}
|
737
|
-
<MenuContentItemLabel>{item.label}</MenuContentItemLabel>
|
738
|
-
</MenuContentItem>
|
739
|
-
));
|
740
|
-
|
741
|
-
const proceedCuratedTemplateQueryPromotion = async (): Promise<void> => {
|
742
|
-
if (
|
743
|
-
!(
|
744
|
-
editorStore instanceof ExistingQueryEditorStore &&
|
745
|
-
queryBuilderState instanceof DataSpaceQueryBuilderState
|
746
|
-
)
|
747
|
-
) {
|
748
|
-
return;
|
749
|
-
}
|
750
|
-
// fetch project data
|
751
|
-
const project = StoreProjectData.serialization.fromJson(
|
752
|
-
await editorStore.depotServerClient.getProject(
|
753
|
-
editorStore.lightQuery.groupId,
|
754
|
-
editorStore.lightQuery.artifactId,
|
755
|
-
),
|
756
|
-
);
|
757
|
-
|
758
|
-
// find the matching SDLC instance
|
759
|
-
const projectIDPrefix = parseProjectIdentifier(project.projectId).prefix;
|
760
|
-
const matchingSDLCEntry =
|
761
|
-
editorStore.applicationStore.config.studioInstances.find(
|
762
|
-
(entry) => entry.sdlcProjectIDPrefix === projectIDPrefix,
|
763
|
-
);
|
764
|
-
if (matchingSDLCEntry) {
|
765
|
-
editorStore.applicationStore.navigationService.navigator.visitAddress(
|
766
|
-
buildUrl([
|
767
|
-
editorStore.applicationStore.config.studioApplicationUrl,
|
768
|
-
generateDataSpaceTemplateQueryPromotionRoute(
|
769
|
-
editorStore.lightQuery.groupId,
|
770
|
-
editorStore.lightQuery.artifactId,
|
771
|
-
editorStore.lightQuery.versionId,
|
772
|
-
queryBuilderState.dataSpace.path,
|
773
|
-
editorStore.lightQuery.id,
|
774
|
-
),
|
775
|
-
]),
|
776
|
-
);
|
777
|
-
} else {
|
778
|
-
editorStore.applicationStore.notificationService.notifyWarning(
|
779
|
-
`Can't find the corresponding SDLC instance to productionize the query`,
|
780
|
-
);
|
781
|
-
}
|
782
|
-
};
|
783
|
-
|
784
|
-
const proceedTemplate = (): void => {
|
785
|
-
queryBuilderState.changeDetectionState.alertUnsavedChanges(() => {
|
786
|
-
proceedCuratedTemplateQueryPromotion().catch(
|
787
|
-
editorStore.applicationStore.alertUnhandledError,
|
788
|
-
);
|
789
|
-
});
|
790
|
-
};
|
791
|
-
|
792
|
-
return (
|
793
|
-
<div
|
794
|
-
className="query-editor__header__content"
|
795
|
-
data-testid={QUERY_EDITOR_TEST_ID.QUERY_EDITOR_ACTIONS}
|
796
|
-
>
|
797
|
-
{renderQueryTitle()}
|
798
|
-
|
799
|
-
<div className="query-editor__header__actions">
|
800
|
-
{applicationStore.pluginManager
|
801
|
-
.getApplicationPlugins()
|
802
|
-
.flatMap(
|
803
|
-
(plugin) =>
|
804
|
-
plugin.getExtraQueryEditorActionConfigurations?.(editorStore) ??
|
805
|
-
[],
|
806
|
-
)
|
807
|
-
.map((actionConfig) => (
|
808
|
-
<Fragment key={actionConfig.key}>
|
809
|
-
{actionConfig.renderer(editorStore, queryBuilderState)}
|
810
|
-
</Fragment>
|
811
|
-
))}
|
812
|
-
<>
|
813
|
-
{editorStore instanceof ExistingQueryEditorStore &&
|
814
|
-
queryBuilderState instanceof DataSpaceQueryBuilderState && (
|
815
|
-
<button
|
816
|
-
className="query-editor__header__action btn--dark"
|
817
|
-
tabIndex={-1}
|
818
|
-
onClick={proceedTemplate}
|
819
|
-
title={
|
820
|
-
!(editorStore instanceof ExistingQueryEditorStore)
|
821
|
-
? 'Please save your query first before promoting'
|
822
|
-
: 'Promote Curated Template query...'
|
823
|
-
}
|
824
|
-
>
|
825
|
-
<ArrowCircleUpIcon className="query-editor__header__action__icon--productionize" />
|
826
|
-
<div className="query-editor__header__action__label">
|
827
|
-
Promote as Template Query
|
828
|
-
</div>
|
829
|
-
</button>
|
830
|
-
)}
|
831
|
-
</>
|
832
|
-
<Button
|
833
|
-
className="query-editor__header__action btn--dark"
|
834
|
-
disabled={editorStore.isPerformingBlockingAction}
|
835
|
-
onClick={openQueryLoader}
|
836
|
-
title="Load query..."
|
837
|
-
>
|
838
|
-
<ManageSearchIcon className="query-editor__header__action__icon--load" />
|
839
|
-
<div className="query-editor__header__action__label">
|
840
|
-
Load Query
|
841
|
-
</div>
|
842
|
-
</Button>
|
843
|
-
|
844
|
-
{isExistingQuery && (
|
845
|
-
<Button
|
846
|
-
className="query-editor__header__action btn--dark"
|
847
|
-
disabled={editorStore.isPerformingBlockingAction}
|
848
|
-
onClick={handleNewQuery}
|
849
|
-
title="New query"
|
850
|
-
>
|
851
|
-
<SaveCurrIcon />
|
852
|
-
<div className="query-editor__header__action__label">
|
853
|
-
New Query
|
854
|
-
</div>
|
855
|
-
</Button>
|
856
|
-
)}
|
857
|
-
<Button
|
858
|
-
className="query-editor__header__action btn--dark"
|
859
|
-
disabled={
|
860
|
-
!isExistingQuery || editorStore.isPerformingBlockingAction
|
861
|
-
}
|
862
|
-
onClick={openSaveQueryModal}
|
863
|
-
title="Save query"
|
864
|
-
>
|
865
|
-
<SaveCurrIcon />
|
866
|
-
<div className="query-editor__header__action__label">Save</div>
|
867
|
-
</Button>
|
868
|
-
<Button
|
869
|
-
className="query-editor__header__action btn--dark"
|
870
|
-
disabled={editorStore.isPerformingBlockingAction}
|
871
|
-
onClick={handleQuerySaveAs}
|
872
|
-
title="Save as new query"
|
873
|
-
>
|
874
|
-
<SaveAsIcon />
|
875
|
-
<div className="query-editor__header__action__label">
|
876
|
-
Save As...
|
877
|
-
</div>
|
878
|
-
</Button>
|
879
|
-
<DropdownMenu
|
880
|
-
className="query-editor__header__action btn--dark"
|
881
|
-
disabled={editorStore.isViewProjectActionDisabled}
|
882
|
-
content={
|
883
|
-
<MenuContent>
|
884
|
-
{extraHelpMenuContentItems}
|
885
|
-
{queryDocEntry && (
|
886
|
-
<MenuContentItem onClick={openQueryTutorial}>
|
887
|
-
<MenuContentItemIcon>{null}</MenuContentItemIcon>
|
888
|
-
<MenuContentItemLabel>
|
889
|
-
Open Documentation
|
890
|
-
</MenuContentItemLabel>
|
891
|
-
</MenuContentItem>
|
892
|
-
)}
|
893
|
-
|
894
|
-
<MenuContentItem onClick={toggleAssistant}>
|
895
|
-
<MenuContentItemIcon>
|
896
|
-
{!applicationStore.assistantService.isHidden ? (
|
897
|
-
<CheckIcon />
|
898
|
-
) : null}
|
899
|
-
</MenuContentItemIcon>
|
900
|
-
<MenuContentItemLabel>
|
901
|
-
Show Virtual Assistant
|
902
|
-
</MenuContentItemLabel>
|
903
|
-
</MenuContentItem>
|
904
|
-
</MenuContent>
|
905
|
-
}
|
906
|
-
>
|
907
|
-
<div
|
908
|
-
className="query-editor__header__action__label"
|
909
|
-
title="See more options"
|
910
|
-
>
|
911
|
-
Help...
|
912
|
-
</div>
|
913
|
-
<CaretDownIcon className="query-editor__header__action__dropdown-trigger" />
|
914
|
-
</DropdownMenu>
|
915
|
-
{editorStore.queryLoaderState.isQueryLoaderDialogOpen && (
|
916
|
-
<QueryLoaderDialog
|
917
|
-
queryLoaderState={editorStore.queryLoaderState}
|
918
|
-
title="Load query"
|
919
|
-
/>
|
920
|
-
)}
|
921
|
-
<button
|
922
|
-
title="Toggle light/dark mode"
|
923
|
-
onClick={TEMPORARY__toggleLightDarkMode}
|
924
|
-
className="query-editor__header__action query-editor__header__action__theme-toggler"
|
925
|
-
>
|
926
|
-
{applicationStore.layoutService
|
927
|
-
.TEMPORARY__isLightColorThemeEnabled ? (
|
928
|
-
<>
|
929
|
-
<LightBulbIcon className="query-editor__header__action__icon--bulb--light" />
|
930
|
-
</>
|
931
|
-
) : (
|
932
|
-
<>
|
933
|
-
<EmptyLightBulbIcon className="query-editor__header__action__icon--bulb--dark" />
|
934
|
-
</>
|
935
|
-
)}
|
936
|
-
</button>
|
937
|
-
|
938
|
-
<DropdownMenu
|
939
|
-
className="query-editor__header__action btn--medium"
|
940
|
-
disabled={editorStore.isViewProjectActionDisabled}
|
941
|
-
content={
|
942
|
-
<MenuContent>
|
943
|
-
{isExistingQuery && (
|
944
|
-
<MenuContentItem
|
945
|
-
className="query-editor__header__action__options"
|
946
|
-
onClick={renameQuery}
|
947
|
-
disabled={!isExistingQuery}
|
948
|
-
>
|
949
|
-
Rename Query
|
950
|
-
</MenuContentItem>
|
951
|
-
)}
|
952
|
-
{isExistingQuery && (
|
953
|
-
<MenuContentItem
|
954
|
-
className="query-editor__header__action__options"
|
955
|
-
onClick={showQueryInfo}
|
956
|
-
disabled={!isExistingQuery}
|
957
|
-
>
|
958
|
-
Get Query Info
|
959
|
-
</MenuContentItem>
|
960
|
-
)}
|
961
|
-
<MenuContentItem
|
962
|
-
className="query-editor__header__action__options"
|
963
|
-
disabled={editorStore.isViewProjectActionDisabled}
|
964
|
-
onClick={viewProject}
|
965
|
-
>
|
966
|
-
Go to Project
|
967
|
-
</MenuContentItem>
|
968
|
-
<MenuContentItem
|
969
|
-
className="query-editor__header__action__options"
|
970
|
-
disabled={editorStore.isViewProjectActionDisabled}
|
971
|
-
onClick={viewSDLCProject}
|
972
|
-
>
|
973
|
-
Go to SDLC project
|
974
|
-
</MenuContentItem>
|
975
|
-
</MenuContent>
|
976
|
-
}
|
977
|
-
>
|
978
|
-
<div
|
979
|
-
className="query-editor__header__action__label"
|
980
|
-
title="See more options"
|
981
|
-
>
|
982
|
-
More Actions...
|
983
|
-
</div>
|
984
|
-
<CaretDownIcon className="query-editor__header__action__dropdown-trigger" />
|
985
|
-
</DropdownMenu>
|
986
|
-
|
987
|
-
{editorStore.queryCreatorState.showCreateModal && (
|
988
|
-
<CreateQueryDialog />
|
989
|
-
)}
|
990
|
-
{isExistingQuery &&
|
991
|
-
editorStore.updateState.showQueryInfo &&
|
992
|
-
editorStore.query && (
|
993
|
-
<QueryEditorExistingQueryInfoModal
|
994
|
-
existingEditorStore={editorStore}
|
995
|
-
query={editorStore.query}
|
996
|
-
/>
|
997
|
-
)}
|
998
|
-
</div>
|
999
|
-
</div>
|
1000
|
-
);
|
1001
|
-
},
|
1002
|
-
);
|
1003
|
-
|
1004
561
|
export const QueryEditor = observer(() => {
|
1005
562
|
const applicationStore = useApplicationStore();
|
1006
563
|
const editorStore = useQueryEditorStore();
|
1007
564
|
const isLoadingEditor = !editorStore.initState.hasCompleted;
|
565
|
+
const isExistingQuery = editorStore instanceof ExistingQueryEditorStore;
|
1008
566
|
|
1009
567
|
// documentation
|
1010
568
|
const appDocUrl = applicationStore.documentationService.url;
|
@@ -1024,6 +582,8 @@ export const QueryEditor = observer(() => {
|
|
1024
582
|
generateQuerySetupRoute(),
|
1025
583
|
),
|
1026
584
|
);
|
585
|
+
const goToReleaseLog = (): void =>
|
586
|
+
applicationStore.releaseNotesService.setReleaseLog(true);
|
1027
587
|
// settings
|
1028
588
|
// NOTE: this is temporary until we find a better home for these settings in query builder
|
1029
589
|
const engineConfig =
|
@@ -1033,6 +593,15 @@ export const QueryEditor = observer(() => {
|
|
1033
593
|
!engineConfig.useClientRequestPayloadCompression,
|
1034
594
|
);
|
1035
595
|
|
596
|
+
const TEMPORARY__toggleLightDarkMode = (): void => {
|
597
|
+
applicationStore.layoutService.setColorTheme(
|
598
|
+
applicationStore.layoutService.TEMPORARY__isLightColorThemeEnabled
|
599
|
+
? LEGEND_APPLICATION_COLOR_THEME.DEFAULT_DARK
|
600
|
+
: LEGEND_APPLICATION_COLOR_THEME.LEGACY_LIGHT,
|
601
|
+
{ persist: true },
|
602
|
+
);
|
603
|
+
};
|
604
|
+
|
1036
605
|
useEffect(() => {
|
1037
606
|
flowResult(editorStore.initialize()).catch(
|
1038
607
|
applicationStore.alertUnhandledError,
|
@@ -1041,60 +610,80 @@ export const QueryEditor = observer(() => {
|
|
1041
610
|
|
1042
611
|
return (
|
1043
612
|
<div className="query-editor">
|
1044
|
-
<div className="query-
|
1045
|
-
<div className="query-
|
1046
|
-
<
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
<
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
Documentation
|
1063
|
-
</MenuContentItem>
|
1064
|
-
{docLinks?.map((entry) => (
|
613
|
+
<div className="query-editor__logo-header">
|
614
|
+
<div className="query-editor__logo-header__combo">
|
615
|
+
<div className="query-editor__logo-header__combo__menu">
|
616
|
+
<DropdownMenu
|
617
|
+
className="query-editor__logo-header__combo__menu-item"
|
618
|
+
menuProps={{
|
619
|
+
anchorOrigin: { vertical: 'top', horizontal: 'right' },
|
620
|
+
transformOrigin: { vertical: 'top', horizontal: 'left' },
|
621
|
+
elevation: 7,
|
622
|
+
}}
|
623
|
+
content={
|
624
|
+
<MenuContent>
|
625
|
+
<MenuContentItem onClick={goToQuerySetup}>
|
626
|
+
Back to query setup
|
627
|
+
</MenuContentItem>
|
628
|
+
<MenuContentItem onClick={goToReleaseLog}>
|
629
|
+
Legend Query Release Log
|
630
|
+
</MenuContentItem>
|
1065
631
|
<MenuContentItem
|
1066
|
-
|
1067
|
-
onClick={
|
632
|
+
disabled={!appDocUrl}
|
633
|
+
onClick={goToDocumentation}
|
1068
634
|
>
|
1069
|
-
|
635
|
+
Documentation
|
1070
636
|
</MenuContentItem>
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
637
|
+
{docLinks?.map((entry) => (
|
638
|
+
<MenuContentItem
|
639
|
+
key={entry.key}
|
640
|
+
onClick={(): void => goToDocLink(entry.url)}
|
641
|
+
>
|
642
|
+
{entry.label}
|
643
|
+
</MenuContentItem>
|
644
|
+
))}
|
645
|
+
<MenuContentDivider />
|
646
|
+
<MenuContentItem disabled={true}>Settings</MenuContentItem>
|
647
|
+
<MenuContentItem
|
648
|
+
onClick={toggleEngineClientRequestPayloadCompression}
|
649
|
+
>
|
650
|
+
<MenuContentItemIcon>
|
651
|
+
{engineConfig.useClientRequestPayloadCompression ? (
|
652
|
+
<CheckIcon />
|
653
|
+
) : null}
|
654
|
+
</MenuContentItemIcon>
|
655
|
+
<MenuContentItemLabel>
|
656
|
+
Compress request payload
|
657
|
+
</MenuContentItemLabel>
|
658
|
+
</MenuContentItem>
|
659
|
+
</MenuContent>
|
660
|
+
}
|
661
|
+
>
|
662
|
+
<MenuIcon />
|
663
|
+
</DropdownMenu>
|
664
|
+
</div>
|
665
|
+
<div className="query-editor__logo-header__combo__name">
|
666
|
+
Legend Query
|
667
|
+
</div>
|
1091
668
|
</div>
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
669
|
+
<button
|
670
|
+
title="Toggle light/dark mode"
|
671
|
+
onClick={TEMPORARY__toggleLightDarkMode}
|
672
|
+
className="query-editor__header__action query-editor__header__action__theme-toggler"
|
673
|
+
>
|
674
|
+
{applicationStore.layoutService
|
675
|
+
.TEMPORARY__isLightColorThemeEnabled ? (
|
676
|
+
<>
|
677
|
+
<SunIcon className="query-editor__header__action__icon--bulb--light" />
|
678
|
+
</>
|
679
|
+
) : (
|
680
|
+
<>
|
681
|
+
<MoonIcon className="query-editor__header__action__icon--bulb--dark" />
|
682
|
+
</>
|
683
|
+
)}
|
684
|
+
</button>
|
1097
685
|
</div>
|
686
|
+
|
1098
687
|
<div className="query-editor__content">
|
1099
688
|
<PanelLoadingIndicator isLoading={isLoadingEditor} />
|
1100
689
|
{!isLoadingEditor && editorStore.queryBuilderState && (
|
@@ -1122,6 +711,21 @@ export const QueryEditor = observer(() => {
|
|
1122
711
|
/>
|
1123
712
|
)}
|
1124
713
|
</div>
|
714
|
+
{editorStore.queryLoaderState.isQueryLoaderDialogOpen && (
|
715
|
+
<QueryLoaderDialog
|
716
|
+
queryLoaderState={editorStore.queryLoaderState}
|
717
|
+
title="Load query"
|
718
|
+
/>
|
719
|
+
)}
|
720
|
+
{editorStore.queryCreatorState.showCreateModal && <CreateQueryDialog />}
|
721
|
+
{isExistingQuery &&
|
722
|
+
editorStore.updateState.showQueryInfo &&
|
723
|
+
editorStore.query && (
|
724
|
+
<QueryEditorExistingQueryInfoModal
|
725
|
+
existingEditorStore={editorStore}
|
726
|
+
query={editorStore.query}
|
727
|
+
/>
|
728
|
+
)}
|
1125
729
|
</div>
|
1126
730
|
);
|
1127
731
|
});
|