@finos/legend-application-studio 28.13.2 → 28.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/__lib__/LegendStudioApplicationNavigationContext.d.ts +1 -0
- package/lib/__lib__/LegendStudioApplicationNavigationContext.d.ts.map +1 -1
- package/lib/__lib__/LegendStudioApplicationNavigationContext.js +1 -0
- package/lib/__lib__/LegendStudioApplicationNavigationContext.js.map +1 -1
- package/lib/application/LegendStudioApplicationConfig.d.ts +5 -9
- package/lib/application/LegendStudioApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendStudioApplicationConfig.js +6 -10
- package/lib/application/LegendStudioApplicationConfig.js.map +1 -1
- package/lib/components/editor/ActivityBar.d.ts.map +1 -1
- package/lib/components/editor/ActivityBar.js +3 -3
- package/lib/components/editor/ActivityBar.js.map +1 -1
- package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js +15 -15
- package/lib/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.js.map +1 -1
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts +1 -1
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.js +55 -104
- package/lib/components/editor/editor-group/function-activator/FunctionEditor.js.map +1 -1
- package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.d.ts.map +1 -1
- package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js +3 -3
- package/lib/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.js.map +1 -1
- package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.d.ts +22 -0
- package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.d.ts.map +1 -0
- package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.js +267 -0
- package/lib/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.js.map +1 -0
- package/lib/components/editor/side-bar/Explorer.d.ts.map +1 -1
- package/lib/components/editor/side-bar/Explorer.js +1 -25
- package/lib/components/editor/side-bar/Explorer.js.map +1 -1
- package/lib/index.css +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/{FunctionActivatorPromoteState.d.ts → FunctionActivatorState.d.ts} +9 -9
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/{FunctionActivatorPromoteState.js → FunctionActivatorState.js} +24 -24
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorState.js.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts +6 -5
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js +6 -5
- package/lib/stores/editor/editor-state/element-editor-state/FunctionEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/{FunctionActivatorBuilderState.d.ts → ToDelete_FunctionActivatorBuilderState.d.ts} +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ToDelete_FunctionActivatorBuilderState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/{FunctionActivatorBuilderState.js → ToDelete_FunctionActivatorBuilderState.js} +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/ToDelete_FunctionActivatorBuilderState.js.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/INTERNAL__UnknownFunctionActivatorEditorState.js +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/INTERNAL__UnknownFunctionActivatorEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.d.ts +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js +2 -2
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.d.ts +87 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.d.ts.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.js +422 -0
- package/lib/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.js.map +1 -0
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts +3 -17
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js +8 -69
- package/lib/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.js.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts +26 -3
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.d.ts.map +1 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js +72 -1
- package/lib/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js.map +1 -1
- package/lib/stores/graph-modifier/DomainGraphModifierHelper.d.ts +4 -1
- package/lib/stores/graph-modifier/DomainGraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graph-modifier/DomainGraphModifierHelper.js +10 -1
- package/lib/stores/graph-modifier/DomainGraphModifierHelper.js.map +1 -1
- package/lib/stores/graph-modifier/Testable_GraphModifierHelper.d.ts +3 -2
- package/lib/stores/graph-modifier/Testable_GraphModifierHelper.d.ts.map +1 -1
- package/lib/stores/graph-modifier/Testable_GraphModifierHelper.js +3 -0
- package/lib/stores/graph-modifier/Testable_GraphModifierHelper.js.map +1 -1
- package/package.json +4 -4
- package/src/__lib__/LegendStudioApplicationNavigationContext.ts +1 -0
- package/src/application/LegendStudioApplicationConfig.ts +7 -12
- package/src/components/editor/ActivityBar.tsx +4 -3
- package/src/components/editor/editor-group/connection-editor/RelationalDatabaseConnectionEditor.tsx +36 -36
- package/src/components/editor/editor-group/function-activator/FunctionEditor.tsx +136 -345
- package/src/components/editor/editor-group/function-activator/SnowflakeAppFunctionActivatorEditor.tsx +3 -10
- package/src/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.tsx +879 -0
- package/src/components/editor/side-bar/Explorer.tsx +0 -59
- package/src/stores/editor/editor-state/element-editor-state/{FunctionActivatorPromoteState.ts → FunctionActivatorState.ts} +23 -23
- package/src/stores/editor/editor-state/element-editor-state/FunctionEditorState.ts +7 -6
- package/src/stores/editor/editor-state/element-editor-state/function-activator/INTERNAL__UnknownFunctionActivatorEditorState.ts +1 -1
- package/src/stores/editor/editor-state/element-editor-state/function-activator/SnowflakeAppFunctionActivatorEditorState.ts +2 -2
- package/src/stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.ts +646 -0
- package/src/stores/editor/editor-state/element-editor-state/mapping/MappingEditorState.ts +1 -4
- package/src/stores/editor/editor-state/element-editor-state/mapping/testable/MappingTestableState.ts +16 -97
- package/src/stores/editor/editor-state/element-editor-state/testable/TestableEditorState.ts +105 -3
- package/src/stores/graph-modifier/DomainGraphModifierHelper.ts +34 -2
- package/src/stores/graph-modifier/Testable_GraphModifierHelper.ts +9 -1
- package/tsconfig.json +4 -2
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorBuilderState.d.ts.map +0 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorBuilderState.js.map +0 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorPromoteState.d.ts.map +0 -1
- package/lib/stores/editor/editor-state/element-editor-state/FunctionActivatorPromoteState.js.map +0 -1
- /package/src/stores/editor/editor-state/element-editor-state/{FunctionActivatorBuilderState.ts → ToDelete_FunctionActivatorBuilderState.ts} +0 -0
@@ -48,13 +48,10 @@ import {
|
|
48
48
|
PanelContent,
|
49
49
|
PanelDnDEntry,
|
50
50
|
Dialog,
|
51
|
-
ModalHeader,
|
52
51
|
ModalBody,
|
53
52
|
ModalFooter,
|
54
|
-
ModalTitle,
|
55
53
|
CaretDownIcon,
|
56
54
|
DropdownMenu,
|
57
|
-
LaunchIcon,
|
58
55
|
BlankPanelContent,
|
59
56
|
MenuContent,
|
60
57
|
MenuContentItem,
|
@@ -100,9 +97,6 @@ import {
|
|
100
97
|
stub_RawVariableExpression,
|
101
98
|
getFunctionNameWithPath,
|
102
99
|
getFunctionSignature,
|
103
|
-
generateFunctionPrettyName,
|
104
|
-
extractAnnotatedElementDocumentation,
|
105
|
-
getClassProperty,
|
106
100
|
RawExecutionResult,
|
107
101
|
extractExecutionResultValues,
|
108
102
|
RawLambda,
|
@@ -149,14 +143,13 @@ import {
|
|
149
143
|
} from '@finos/legend-query-builder';
|
150
144
|
import type { EditorStore } from '../../../../stores/editor/EditorStore.js';
|
151
145
|
import { graph_renameElement } from '../../../../stores/graph-modifier/GraphModifierHelper.js';
|
152
|
-
import { ProtocolValueBuilder } from '../ProtocolValueBuilder.js';
|
153
|
-
import type { ProtocolValueBuilderState } from '../../../../stores/editor/editor-state/element-editor-state/ProtocolValueBuilderState.js';
|
154
146
|
import {
|
155
147
|
CODE_EDITOR_LANGUAGE,
|
156
148
|
CodeEditor,
|
157
149
|
} from '@finos/legend-lego/code-editor';
|
158
150
|
import { PanelGroupItemExperimentalBadge } from '../../panel-group/PanelGroup.js';
|
159
|
-
import type {
|
151
|
+
import type { FunctionActivatorState } from '../../../../stores/editor/editor-state/element-editor-state/FunctionActivatorState.js';
|
152
|
+
import { FunctionTestableEditor } from './testable/FunctionTestableEditor.js';
|
160
153
|
|
161
154
|
enum FUNCTION_PARAMETER_TYPE {
|
162
155
|
CLASS = 'CLASS',
|
@@ -164,7 +157,7 @@ enum FUNCTION_PARAMETER_TYPE {
|
|
164
157
|
PRIMITIVE = 'PRIMITIVE',
|
165
158
|
}
|
166
159
|
|
167
|
-
export enum
|
160
|
+
export enum FUNCTION_ACTIVATE_TYPE {
|
168
161
|
SNOWFLAKE_NATIVE_APP = 'Snowflake Native App',
|
169
162
|
REST_SERVICE = 'REST Service',
|
170
163
|
SERVICE_JAR = 'Service JAR',
|
@@ -680,7 +673,7 @@ const ReturnTypeEditor = observer(
|
|
680
673
|
const FunctionPromoteEditor = observer(
|
681
674
|
(props: {
|
682
675
|
functionElement: ConcreteFunctionDefinition;
|
683
|
-
activatorPromoteState:
|
676
|
+
activatorPromoteState: FunctionActivatorState;
|
684
677
|
}) => {
|
685
678
|
const { functionElement, activatorPromoteState } = props;
|
686
679
|
const applicationStore = useApplicationStore();
|
@@ -692,13 +685,13 @@ const FunctionPromoteEditor = observer(
|
|
692
685
|
: undefined;
|
693
686
|
let validationMessage = '';
|
694
687
|
const closeModal = (): void => {
|
695
|
-
activatorPromoteState.
|
696
|
-
activatorPromoteState.
|
688
|
+
activatorPromoteState.closeFunctionActivateModal();
|
689
|
+
activatorPromoteState.setAcitvateType(undefined);
|
697
690
|
};
|
698
691
|
const promoteFunction = (): void => {
|
699
|
-
flowResult(activatorPromoteState.
|
692
|
+
flowResult(activatorPromoteState.activate(functionElement))
|
700
693
|
.then(() => {
|
701
|
-
activatorPromoteState.
|
694
|
+
activatorPromoteState.closeFunctionActivateModal();
|
702
695
|
})
|
703
696
|
.catch(applicationStore.alertUnhandledError);
|
704
697
|
};
|
@@ -709,7 +702,7 @@ const FunctionPromoteEditor = observer(
|
|
709
702
|
};
|
710
703
|
const validateFunctionActivator = (type: string): boolean => {
|
711
704
|
switch (type) {
|
712
|
-
case
|
705
|
+
case FUNCTION_ACTIVATE_TYPE.SNOWFLAKE_NATIVE_APP: {
|
713
706
|
const availableConnections =
|
714
707
|
activatorPromoteState.functionEditorState.editorStore.graphManagerState.usableConnections.filter(
|
715
708
|
(connection) =>
|
@@ -731,77 +724,77 @@ const FunctionPromoteEditor = observer(
|
|
731
724
|
};
|
732
725
|
const renderFunctionPromoteTypes = (type: string): React.ReactNode => {
|
733
726
|
switch (type) {
|
734
|
-
case
|
727
|
+
case FUNCTION_ACTIVATE_TYPE.SNOWFLAKE_NATIVE_APP:
|
735
728
|
return (
|
736
729
|
<BaseCard
|
737
|
-
key={
|
730
|
+
key={FUNCTION_ACTIVATE_TYPE.SNOWFLAKE_NATIVE_APP}
|
738
731
|
cardMedia={
|
739
732
|
<Snowflake_BrandIcon className="function-promote-editor__type-icon" />
|
740
733
|
}
|
741
734
|
cardName={type}
|
742
735
|
cardContent="Deploy the function as a UDTF(user-defined table function) in snowflake"
|
743
736
|
isActive={
|
744
|
-
activatorPromoteState.
|
745
|
-
|
737
|
+
activatorPromoteState.activateType ===
|
738
|
+
FUNCTION_ACTIVATE_TYPE.SNOWFLAKE_NATIVE_APP
|
746
739
|
}
|
747
740
|
onClick={() => {
|
748
|
-
activatorPromoteState.
|
741
|
+
activatorPromoteState.setAcitvateType(type);
|
749
742
|
}}
|
750
743
|
/>
|
751
744
|
);
|
752
|
-
case
|
745
|
+
case FUNCTION_ACTIVATE_TYPE.REST_SERVICE:
|
753
746
|
return (
|
754
747
|
<BaseCard
|
755
|
-
key={
|
748
|
+
key={FUNCTION_ACTIVATE_TYPE.REST_SERVICE}
|
756
749
|
cardMedia={<div className="coming-soon-label">Coming Soon</div>}
|
757
750
|
cardName={type}
|
758
751
|
cardContent="Create a HostedService that will be deployed to a server environment and executed with a pattern"
|
759
752
|
isDisable={true}
|
760
753
|
isActive={
|
761
|
-
activatorPromoteState.
|
762
|
-
|
754
|
+
activatorPromoteState.activateType ===
|
755
|
+
FUNCTION_ACTIVATE_TYPE.REST_SERVICE
|
763
756
|
}
|
764
757
|
/>
|
765
758
|
);
|
766
|
-
case
|
759
|
+
case FUNCTION_ACTIVATE_TYPE.SERVICE_JAR:
|
767
760
|
return (
|
768
761
|
<BaseCard
|
769
|
-
key={
|
762
|
+
key={FUNCTION_ACTIVATE_TYPE.SERVICE_JAR}
|
770
763
|
cardMedia={<div className="coming-soon-label">Coming Soon</div>}
|
771
764
|
cardName={type}
|
772
765
|
cardContent="Deploy the function in the definition of a Store persistence"
|
773
766
|
isDisable={true}
|
774
767
|
isActive={
|
775
|
-
activatorPromoteState.
|
776
|
-
|
768
|
+
activatorPromoteState.activateType ===
|
769
|
+
FUNCTION_ACTIVATE_TYPE.SERVICE_JAR
|
777
770
|
}
|
778
771
|
/>
|
779
772
|
);
|
780
|
-
case
|
773
|
+
case FUNCTION_ACTIVATE_TYPE.REFINER:
|
781
774
|
return (
|
782
775
|
<BaseCard
|
783
|
-
key={
|
776
|
+
key={FUNCTION_ACTIVATE_TYPE.REFINER}
|
784
777
|
cardMedia={<div className="coming-soon-label">Coming Soon</div>}
|
785
778
|
cardName={type}
|
786
779
|
cardContent="Use the service in a refiner context"
|
787
780
|
isDisable={true}
|
788
781
|
isActive={
|
789
|
-
activatorPromoteState.
|
790
|
-
|
782
|
+
activatorPromoteState.activateType ===
|
783
|
+
FUNCTION_ACTIVATE_TYPE.REFINER
|
791
784
|
}
|
792
785
|
/>
|
793
786
|
);
|
794
|
-
case
|
787
|
+
case FUNCTION_ACTIVATE_TYPE.BIG_QUERY_NATIVE_APP:
|
795
788
|
return (
|
796
789
|
<BaseCard
|
797
|
-
key={
|
790
|
+
key={FUNCTION_ACTIVATE_TYPE.BIG_QUERY_NATIVE_APP}
|
798
791
|
cardMedia={<div className="coming-soon-label">Coming Soon</div>}
|
799
792
|
cardName={type}
|
800
793
|
cardContent="Deploy the function as a UDTF(user-defined table function) in BigQuery"
|
801
794
|
isDisable={true}
|
802
795
|
isActive={
|
803
|
-
activatorPromoteState.
|
804
|
-
|
796
|
+
activatorPromoteState.activateType ===
|
797
|
+
FUNCTION_ACTIVATE_TYPE.BIG_QUERY_NATIVE_APP
|
805
798
|
}
|
806
799
|
/>
|
807
800
|
);
|
@@ -812,7 +805,7 @@ const FunctionPromoteEditor = observer(
|
|
812
805
|
|
813
806
|
return (
|
814
807
|
<Dialog
|
815
|
-
open={activatorPromoteState.
|
808
|
+
open={activatorPromoteState.isActivatingFunction}
|
816
809
|
onClose={closeModal}
|
817
810
|
classes={{ container: 'search-modal__container' }}
|
818
811
|
PaperProps={{ classes: { root: 'search-modal__inner-container' } }}
|
@@ -823,7 +816,7 @@ const FunctionPromoteEditor = observer(
|
|
823
816
|
Select any one of the following activator types to continue
|
824
817
|
</div>
|
825
818
|
<div className="function-promote-editor__content__activator-types">
|
826
|
-
{Object.values(
|
819
|
+
{Object.values(FUNCTION_ACTIVATE_TYPE).map((type) =>
|
827
820
|
renderFunctionPromoteTypes(type),
|
828
821
|
)}
|
829
822
|
</div>
|
@@ -850,18 +843,18 @@ const FunctionPromoteEditor = observer(
|
|
850
843
|
<ModalFooterButton
|
851
844
|
className=" function-promote-editor__action-btn function-promote-editor__action-btn--primitive"
|
852
845
|
disabled={
|
853
|
-
!activatorPromoteState.
|
854
|
-
!validateFunctionActivator(activatorPromoteState.
|
846
|
+
!activatorPromoteState.activateType ||
|
847
|
+
!validateFunctionActivator(activatorPromoteState.activateType)
|
855
848
|
}
|
856
849
|
title={
|
857
|
-
activatorPromoteState.
|
858
|
-
validateFunctionActivator(activatorPromoteState.
|
850
|
+
activatorPromoteState.activateType &&
|
851
|
+
validateFunctionActivator(activatorPromoteState.activateType)
|
859
852
|
? ''
|
860
853
|
: validationMessage
|
861
854
|
}
|
862
855
|
onClick={promoteFunction}
|
863
856
|
>
|
864
|
-
|
857
|
+
Activate
|
865
858
|
</ModalFooterButton>
|
866
859
|
</ModalFooter>
|
867
860
|
</Modal>
|
@@ -1060,91 +1053,6 @@ const FunctionDefinitionEditor = observer(
|
|
1060
1053
|
},
|
1061
1054
|
);
|
1062
1055
|
|
1063
|
-
const FunctionActivatorContentBuilder = observer(
|
1064
|
-
(props: {
|
1065
|
-
functionEditorState: FunctionEditorState;
|
1066
|
-
valueBuilderState: ProtocolValueBuilderState;
|
1067
|
-
}) => {
|
1068
|
-
const { functionEditorState, valueBuilderState } = props;
|
1069
|
-
const builderState = functionEditorState.activatorBuilderState;
|
1070
|
-
|
1071
|
-
// name
|
1072
|
-
const nameInputRef = useRef<HTMLInputElement>(null);
|
1073
|
-
const nameValidationErrorMessage =
|
1074
|
-
builderState.activatorName.length === 0
|
1075
|
-
? 'Element name cannot be empty'
|
1076
|
-
: builderState.isDuplicated
|
1077
|
-
? `Element of the same path already existed`
|
1078
|
-
: undefined;
|
1079
|
-
useEffect(() => {
|
1080
|
-
nameInputRef.current?.focus();
|
1081
|
-
nameInputRef.current?.select();
|
1082
|
-
}, [valueBuilderState]);
|
1083
|
-
|
1084
|
-
// function
|
1085
|
-
const functionFieldProperty = returnUndefOnError(() =>
|
1086
|
-
getClassProperty(valueBuilderState.type, 'function'),
|
1087
|
-
);
|
1088
|
-
const functionFieldDocumentation = functionFieldProperty
|
1089
|
-
? extractAnnotatedElementDocumentation(functionFieldProperty)
|
1090
|
-
: undefined;
|
1091
|
-
|
1092
|
-
return (
|
1093
|
-
<>
|
1094
|
-
<div className="panel__content__form">
|
1095
|
-
<div className="panel__content__form__section">
|
1096
|
-
<div className="panel__content__form__section__header__label">
|
1097
|
-
Name
|
1098
|
-
</div>
|
1099
|
-
<div className="input-group">
|
1100
|
-
<input
|
1101
|
-
className="panel__content__form__section__input"
|
1102
|
-
spellCheck={false}
|
1103
|
-
ref={nameInputRef}
|
1104
|
-
value={builderState.activatorName}
|
1105
|
-
onChange={(event) =>
|
1106
|
-
builderState.setActivatorName(event.target.value)
|
1107
|
-
}
|
1108
|
-
/>
|
1109
|
-
{nameValidationErrorMessage && (
|
1110
|
-
<div className="input-group__error-message">
|
1111
|
-
{nameValidationErrorMessage}
|
1112
|
-
</div>
|
1113
|
-
)}
|
1114
|
-
</div>
|
1115
|
-
</div>
|
1116
|
-
<div className="panel__content__form__section">
|
1117
|
-
<div className="panel__content__form__section__header__label">
|
1118
|
-
Function
|
1119
|
-
</div>
|
1120
|
-
{functionFieldDocumentation && (
|
1121
|
-
<div className="panel__content__form__section__header__prompt">
|
1122
|
-
{functionFieldDocumentation}
|
1123
|
-
</div>
|
1124
|
-
)}
|
1125
|
-
<input
|
1126
|
-
className="panel__content__form__section__input"
|
1127
|
-
spellCheck={false}
|
1128
|
-
disabled={true}
|
1129
|
-
value={generateFunctionPrettyName(
|
1130
|
-
functionEditorState.functionElement,
|
1131
|
-
{
|
1132
|
-
fullPath: true,
|
1133
|
-
spacing: false,
|
1134
|
-
},
|
1135
|
-
)}
|
1136
|
-
/>
|
1137
|
-
</div>
|
1138
|
-
<div className="panel__content__form__section">
|
1139
|
-
<div className="panel__content__form__section__divider"></div>
|
1140
|
-
</div>
|
1141
|
-
</div>
|
1142
|
-
<ProtocolValueBuilder builderState={valueBuilderState} />
|
1143
|
-
</>
|
1144
|
-
);
|
1145
|
-
},
|
1146
|
-
);
|
1147
|
-
|
1148
1056
|
export const FunctionEditor = observer(() => {
|
1149
1057
|
const editorStore = useEditorStore();
|
1150
1058
|
const applicationStore = useApplicationStore();
|
@@ -1245,12 +1153,6 @@ export const FunctionEditor = observer(() => {
|
|
1245
1153
|
(): void =>
|
1246
1154
|
functionEditorState.setSelectedTab(tab);
|
1247
1155
|
|
1248
|
-
const activate = (): void => {
|
1249
|
-
flowResult(functionEditorState.activatorBuilderState.activate()).catch(
|
1250
|
-
applicationStore.alertUnhandledError,
|
1251
|
-
);
|
1252
|
-
};
|
1253
|
-
|
1254
1156
|
const runFunc = applicationStore.guardUnhandledError(() =>
|
1255
1157
|
flowResult(functionEditorState.handleRunFunc()),
|
1256
1158
|
);
|
@@ -1368,10 +1270,15 @@ export const FunctionEditor = observer(() => {
|
|
1368
1270
|
}
|
1369
1271
|
});
|
1370
1272
|
|
1371
|
-
const
|
1372
|
-
functionEditorState.activatorPromoteState.
|
1273
|
+
const openFunctionActivateModal = (): void => {
|
1274
|
+
functionEditorState.activatorPromoteState.showFunctionActivateModal();
|
1373
1275
|
};
|
1374
|
-
|
1276
|
+
// tabs
|
1277
|
+
const functionTabs = Object.values(FUNCTION_EDITOR_TAB).filter(
|
1278
|
+
(val) =>
|
1279
|
+
val !== FUNCTION_EDITOR_TAB.TEST_SUITES ||
|
1280
|
+
editorStore.applicationStore.config.options.NonProductionFeatureFlag,
|
1281
|
+
);
|
1375
1282
|
return (
|
1376
1283
|
<div
|
1377
1284
|
data-testid={LEGEND_STUDIO_TEST_ID.FUNCTION_EDITOR}
|
@@ -1393,7 +1300,7 @@ export const FunctionEditor = observer(() => {
|
|
1393
1300
|
</div>
|
1394
1301
|
<div className="panel__header function-editor__tabs__header">
|
1395
1302
|
<div className="function-editor__tabs">
|
1396
|
-
{
|
1303
|
+
{functionTabs.map((tab) => (
|
1397
1304
|
<div
|
1398
1305
|
key={tab}
|
1399
1306
|
onClick={changeTab(tab)}
|
@@ -1406,220 +1313,97 @@ export const FunctionEditor = observer(() => {
|
|
1406
1313
|
))}
|
1407
1314
|
</div>
|
1408
1315
|
<div className="panel__header__actions">
|
1409
|
-
|
1410
|
-
|
1411
|
-
className="btn__dropdown-
|
1412
|
-
onClick={editWithQueryBuilder()}
|
1413
|
-
title="Edit Query"
|
1414
|
-
tabIndex={-1}
|
1415
|
-
>
|
1416
|
-
<PencilIcon className="btn__dropdown-combo__label__icon" />
|
1417
|
-
<div className="btn__dropdown-combo__label__title">Edit</div>
|
1418
|
-
</button>
|
1419
|
-
</div>
|
1420
|
-
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
1421
|
-
{functionEditorState.isRunningFunc ? (
|
1422
|
-
<button
|
1423
|
-
className="btn__dropdown-combo__canceler"
|
1424
|
-
onClick={cancelQuery}
|
1425
|
-
tabIndex={-1}
|
1426
|
-
>
|
1427
|
-
<div className="btn--dark btn--caution btn__dropdown-combo__canceler__label">
|
1428
|
-
<PauseCircleIcon className="btn__dropdown-combo__canceler__label__icon" />
|
1429
|
-
<div className="btn__dropdown-combo__canceler__label__title">
|
1430
|
-
Stop
|
1431
|
-
</div>
|
1432
|
-
</div>
|
1433
|
-
</button>
|
1434
|
-
) : (
|
1435
|
-
<>
|
1316
|
+
{selectedTab === FUNCTION_EDITOR_TAB.DEFINITION && (
|
1317
|
+
<>
|
1318
|
+
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
1436
1319
|
<button
|
1437
1320
|
className="btn__dropdown-combo__label"
|
1438
|
-
onClick={
|
1439
|
-
title="
|
1440
|
-
disabled={executionIsRunning}
|
1321
|
+
onClick={editWithQueryBuilder()}
|
1322
|
+
title="Edit Query"
|
1441
1323
|
tabIndex={-1}
|
1442
1324
|
>
|
1443
|
-
<
|
1444
|
-
<div className="btn__dropdown-combo__label__title">
|
1325
|
+
<PencilIcon className="btn__dropdown-combo__label__icon" />
|
1326
|
+
<div className="btn__dropdown-combo__label__title">
|
1327
|
+
Edit
|
1328
|
+
</div>
|
1445
1329
|
</button>
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1330
|
+
</div>
|
1331
|
+
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
1332
|
+
{functionEditorState.isRunningFunc ? (
|
1333
|
+
<button
|
1334
|
+
className="btn__dropdown-combo__canceler"
|
1335
|
+
onClick={cancelQuery}
|
1336
|
+
tabIndex={-1}
|
1337
|
+
>
|
1338
|
+
<div className="btn--dark btn--caution btn__dropdown-combo__canceler__label">
|
1339
|
+
<PauseCircleIcon className="btn__dropdown-combo__canceler__label__icon" />
|
1340
|
+
<div className="btn__dropdown-combo__canceler__label__title">
|
1341
|
+
Stop
|
1342
|
+
</div>
|
1343
|
+
</div>
|
1344
|
+
</button>
|
1345
|
+
) : (
|
1346
|
+
<>
|
1347
|
+
<button
|
1348
|
+
className="btn__dropdown-combo__label"
|
1349
|
+
onClick={runFunc}
|
1350
|
+
title="Run Function"
|
1351
|
+
disabled={executionIsRunning}
|
1352
|
+
tabIndex={-1}
|
1353
|
+
>
|
1354
|
+
<PlayIcon className="btn__dropdown-combo__label__icon" />
|
1355
|
+
<div className="btn__dropdown-combo__label__title">
|
1356
|
+
Run
|
1357
|
+
</div>
|
1358
|
+
</button>
|
1359
|
+
<DropdownMenu
|
1360
|
+
className="btn__dropdown-combo__dropdown-btn"
|
1361
|
+
disabled={executionIsRunning}
|
1362
|
+
content={
|
1363
|
+
<MenuContent>
|
1364
|
+
<MenuContentItem
|
1365
|
+
className="btn__dropdown-combo__option"
|
1366
|
+
onClick={generatePlan}
|
1367
|
+
>
|
1368
|
+
Generate Plan
|
1369
|
+
</MenuContentItem>
|
1370
|
+
<MenuContentItem
|
1371
|
+
className="btn__dropdown-combo__option"
|
1372
|
+
onClick={debugPlanGeneration}
|
1373
|
+
>
|
1374
|
+
Debug
|
1375
|
+
</MenuContentItem>
|
1376
|
+
</MenuContent>
|
1377
|
+
}
|
1378
|
+
menuProps={{
|
1379
|
+
anchorOrigin: {
|
1380
|
+
vertical: 'bottom',
|
1381
|
+
horizontal: 'right',
|
1382
|
+
},
|
1383
|
+
transformOrigin: {
|
1384
|
+
vertical: 'top',
|
1385
|
+
horizontal: 'right',
|
1386
|
+
},
|
1387
|
+
}}
|
1388
|
+
>
|
1389
|
+
<CaretDownIcon />
|
1390
|
+
</DropdownMenu>
|
1391
|
+
</>
|
1392
|
+
)}
|
1393
|
+
</div>
|
1394
|
+
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
1395
|
+
<button
|
1396
|
+
className="btn__dropdown-combo__label"
|
1397
|
+
onClick={openFunctionActivateModal}
|
1398
|
+
title="Activate function"
|
1399
|
+
tabIndex={-1}
|
1475
1400
|
>
|
1476
|
-
<
|
1477
|
-
</DropdownMenu>
|
1478
|
-
</>
|
1479
|
-
)}
|
1480
|
-
</div>
|
1481
|
-
<div className="btn__dropdown-combo btn__dropdown-combo--primary">
|
1482
|
-
<button
|
1483
|
-
className="btn__dropdown-combo__label"
|
1484
|
-
onClick={openFunctionPromoteModal}
|
1485
|
-
title="Promote function"
|
1486
|
-
tabIndex={-1}
|
1487
|
-
>
|
1488
|
-
<RocketIcon className="btn__dropdown-combo__label__icon" />
|
1489
|
-
<div className="btn__dropdown-combo__label__title">Promote</div>
|
1490
|
-
</button>
|
1491
|
-
</div>
|
1492
|
-
{editorStore.applicationStore.config.options
|
1493
|
-
.TEMPORARY__enableFunctionActivatorSupport && (
|
1494
|
-
<>
|
1495
|
-
<DropdownMenu
|
1496
|
-
className="btn__dropdown-combo"
|
1497
|
-
disabled={
|
1498
|
-
!editorStore.graphState.functionActivatorConfigurations
|
1499
|
-
.length
|
1500
|
-
}
|
1501
|
-
content={
|
1502
|
-
<MenuContent>
|
1503
|
-
{editorStore.graphState.functionActivatorConfigurations.map(
|
1504
|
-
(config) => (
|
1505
|
-
<MenuContentItem
|
1506
|
-
key={config.uuid}
|
1507
|
-
className="function-editor__activator__selector__option"
|
1508
|
-
onClick={() =>
|
1509
|
-
functionEditorState.activatorBuilderState.setCurrentActivatorConfiguration(
|
1510
|
-
config,
|
1511
|
-
)
|
1512
|
-
}
|
1513
|
-
title={config.description}
|
1514
|
-
>
|
1515
|
-
<div className="function-editor__activator__selector__option__name">
|
1516
|
-
{config.name}
|
1517
|
-
</div>
|
1518
|
-
<div className="function-editor__activator__selector__option__description">
|
1519
|
-
{config.description}
|
1520
|
-
</div>
|
1521
|
-
</MenuContentItem>
|
1522
|
-
),
|
1523
|
-
)}
|
1524
|
-
</MenuContent>
|
1525
|
-
}
|
1526
|
-
menuProps={{
|
1527
|
-
anchorOrigin: { vertical: 'bottom', horizontal: 'right' },
|
1528
|
-
transformOrigin: { vertical: 'top', horizontal: 'right' },
|
1529
|
-
}}
|
1530
|
-
>
|
1531
|
-
<div className="btn__dropdown-combo__label">
|
1532
|
-
<div className="btn__dropdown-combo__label__icon">
|
1533
|
-
<LaunchIcon />
|
1534
|
-
</div>
|
1401
|
+
<RocketIcon className="btn__dropdown-combo__label__icon" />
|
1535
1402
|
<div className="btn__dropdown-combo__label__title">
|
1536
1403
|
Activate
|
1537
1404
|
</div>
|
1538
|
-
</
|
1539
|
-
|
1540
|
-
<CaretDownIcon />
|
1541
|
-
</div>
|
1542
|
-
</DropdownMenu>
|
1543
|
-
{functionEditorState.activatorBuilderState
|
1544
|
-
.currentActivatorConfiguration && (
|
1545
|
-
<Dialog
|
1546
|
-
open={Boolean(
|
1547
|
-
functionEditorState.activatorBuilderState
|
1548
|
-
.currentActivatorConfiguration,
|
1549
|
-
)}
|
1550
|
-
onClose={() =>
|
1551
|
-
functionEditorState.activatorBuilderState.setCurrentActivatorConfiguration(
|
1552
|
-
undefined,
|
1553
|
-
)
|
1554
|
-
}
|
1555
|
-
classes={{
|
1556
|
-
root: 'editor-modal__root-container',
|
1557
|
-
container: 'editor-modal__container',
|
1558
|
-
paper: 'editor-modal__content',
|
1559
|
-
}}
|
1560
|
-
// NOTE: this is a safer way compared to using <form> as it will not trigger click event
|
1561
|
-
// on nested button
|
1562
|
-
// See https://stackoverflow.com/questions/11353105/why-browser-trigger-a-click-event-instead-of-a-submit-in-a-form
|
1563
|
-
// See https://stackoverflow.com/questions/3350247/how-to-prevent-form-from-being-submitted
|
1564
|
-
// See https://gomakethings.com/how-to-prevent-buttons-from-causing-a-form-to-submit-with-html/
|
1565
|
-
onKeyDown={(event) => {
|
1566
|
-
if (event.code === 'Enter' && !event.shiftKey) {
|
1567
|
-
event.preventDefault();
|
1568
|
-
activate();
|
1569
|
-
}
|
1570
|
-
}}
|
1571
|
-
>
|
1572
|
-
<Modal darkMode={true} className="editor-modal">
|
1573
|
-
<ModalHeader>
|
1574
|
-
<ModalTitle
|
1575
|
-
title={`Function Activator: ${functionEditorState.activatorBuilderState.currentActivatorConfiguration.name}`}
|
1576
|
-
/>
|
1577
|
-
</ModalHeader>
|
1578
|
-
<ModalBody>
|
1579
|
-
<div className="function-editor__activator-builder">
|
1580
|
-
{functionEditorState.activatorBuilderState
|
1581
|
-
.functionActivatorProtocolValueBuilderState && (
|
1582
|
-
<FunctionActivatorContentBuilder
|
1583
|
-
functionEditorState={functionEditorState}
|
1584
|
-
valueBuilderState={
|
1585
|
-
functionEditorState.activatorBuilderState
|
1586
|
-
.functionActivatorProtocolValueBuilderState
|
1587
|
-
}
|
1588
|
-
/>
|
1589
|
-
)}
|
1590
|
-
{!functionEditorState.activatorBuilderState
|
1591
|
-
.functionActivatorProtocolValueBuilderState && (
|
1592
|
-
<BlankPanelContent>
|
1593
|
-
No activator chosen
|
1594
|
-
</BlankPanelContent>
|
1595
|
-
)}
|
1596
|
-
</div>
|
1597
|
-
</ModalBody>
|
1598
|
-
<ModalFooter>
|
1599
|
-
<button
|
1600
|
-
className="btn btn--dark function-editor__activator__btn"
|
1601
|
-
type="submit"
|
1602
|
-
disabled={
|
1603
|
-
!functionEditorState.activatorBuilderState.isValid
|
1604
|
-
}
|
1605
|
-
onClick={activate}
|
1606
|
-
>
|
1607
|
-
Activate
|
1608
|
-
</button>
|
1609
|
-
<button
|
1610
|
-
className="btn btn--dark"
|
1611
|
-
onClick={() =>
|
1612
|
-
functionEditorState.activatorBuilderState.setCurrentActivatorConfiguration(
|
1613
|
-
undefined,
|
1614
|
-
)
|
1615
|
-
}
|
1616
|
-
>
|
1617
|
-
Close
|
1618
|
-
</button>
|
1619
|
-
</ModalFooter>
|
1620
|
-
</Modal>
|
1621
|
-
</Dialog>
|
1622
|
-
)}
|
1405
|
+
</button>
|
1406
|
+
</div>
|
1623
1407
|
</>
|
1624
1408
|
)}
|
1625
1409
|
<button
|
@@ -1684,6 +1468,13 @@ export const FunctionEditor = observer(() => {
|
|
1684
1468
|
))}
|
1685
1469
|
</div>
|
1686
1470
|
)}
|
1471
|
+
{selectedTab === FUNCTION_EDITOR_TAB.TEST_SUITES && (
|
1472
|
+
<FunctionTestableEditor
|
1473
|
+
functionTestableState={
|
1474
|
+
functionEditorState.functionTestableEditorState
|
1475
|
+
}
|
1476
|
+
/>
|
1477
|
+
)}
|
1687
1478
|
<ExecutionPlanViewer
|
1688
1479
|
executionPlanState={functionEditorState.executionPlanState}
|
1689
1480
|
/>
|
@@ -1699,7 +1490,7 @@ export const FunctionEditor = observer(() => {
|
|
1699
1490
|
/>
|
1700
1491
|
)}
|
1701
1492
|
</PanelContent>
|
1702
|
-
{functionEditorState.activatorPromoteState.
|
1493
|
+
{functionEditorState.activatorPromoteState.isActivatingFunction && (
|
1703
1494
|
<FunctionPromoteEditor
|
1704
1495
|
functionElement={functionElement}
|
1705
1496
|
activatorPromoteState={functionEditorState.activatorPromoteState}
|