diff --git a/.changeset/blue-moons-wink.md b/.changeset/blue-moons-wink.md new file mode 100644 index 0000000000..17dc0726b1 --- /dev/null +++ b/.changeset/blue-moons-wink.md @@ -0,0 +1,5 @@ +--- +'@finos/legend-application-studio-bootstrap': patch +'@finos/legend-application-studio': patch +'@finos/legend-graph': patch +--- diff --git a/packages/legend-application-studio-bootstrap/scripts/setup.js b/packages/legend-application-studio-bootstrap/scripts/setup.js index 4f447a7c26..eb131a7b26 100644 --- a/packages/legend-application-studio-bootstrap/scripts/setup.js +++ b/packages/legend-application-studio-bootstrap/scripts/setup.js @@ -100,6 +100,7 @@ export const setup = (outputDir) => { // }, // ], TEMPORARY__enableLocalConnectionBuilder: false, + NonProductionFeatureFlag: true, }, }, }, diff --git a/packages/legend-application-studio/src/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.tsx b/packages/legend-application-studio/src/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.tsx index 71c40f491b..0a6401cb19 100644 --- a/packages/legend-application-studio/src/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.tsx +++ b/packages/legend-application-studio/src/components/editor/editor-group/function-activator/testable/FunctionTestableEditor.tsx @@ -18,7 +18,9 @@ import { observer } from 'mobx-react-lite'; import { BlankPanelPlaceholder, ContextMenu, + CustomSelectorInput, Dialog, + FilledWindowMaximizeIcon, MenuContent, MenuContentItem, Modal, @@ -31,12 +33,14 @@ import { PanelFormTextField, PlayIcon, PlusIcon, + RefreshIcon, ResizablePanel, ResizablePanelGroup, ResizablePanelSplitter, ResizablePanelSplitterLine, RunAllIcon, RunErrorsIcon, + TimesIcon, clsx, } from '@finos/legend-art'; import { forwardRef, useEffect, useRef, useState } from 'react'; @@ -44,18 +48,22 @@ import { type FunctionTestSuite, type DataElement, type EmbeddedData, + type ValueSpecification, DataElementReference, PackageableElementExplicitReference, RelationalCSVData, ModelStoreData, ExternalFormatData, ModelEmbeddedData, + PrimitiveInstanceValue, + PrimitiveType, } from '@finos/legend-graph'; -import type { - FunctionStoreTestDataState, - FunctionTestState, - FunctionTestSuiteState, - FunctionTestableState, +import { + FunctionValueSpecificationTestParameterState, + type FunctionStoreTestDataState, + type FunctionTestState, + type FunctionTestSuiteState, + type FunctionTestableState, } from '../../../../../stores/editor/editor-state/element-editor-state/function-activator/testable/FunctionTestableState.js'; import { TESTABLE_RESULT, @@ -64,20 +72,32 @@ import { } from '../../../../../stores/editor/sidebar-state/testable/GlobalTestRunnerState.js'; import { flowResult } from 'mobx'; import { getTestableResultIcon } from '../../../side-bar/testable/GlobalTestRunner.js'; -import { atomicTest_setDoc } from '../../../../../stores/graph-modifier/Testable_GraphModifierHelper.js'; import { + ExternalFormatParameterEditorModal, RenameModal, SharedDataElementModal, TestAssertionEditor, } from '../../testable/TestableSharedComponents.js'; -import { returnUndefOnError } from '@finos/legend-shared'; +import { + filterByType, + prettyCONSTName, + returnUndefOnError, +} from '@finos/legend-shared'; import { EmbeddedDataCreatorFromEmbeddedData, validateTestableId, + type TestParamContentType, + getContentTypeWithParamFromQuery, } from '../../../../../stores/editor/utils/TestableUtils.js'; import { EmbeddedDataEditor } from '../../data-editor/EmbeddedDataEditor.js'; import { LEGEND_STUDIO_APPLICATION_NAVIGATION_CONTEXT_KEY } from '../../../../../__lib__/LegendStudioApplicationNavigationContext.js'; import { useApplicationNavigationContext } from '@finos/legend-application'; +import { + BasicValueSpecificationEditor, + instanceValue_setValue, +} from '@finos/legend-query-builder'; +import { TESTABLE_TEST_TAB } from '../../../../../stores/editor/editor-state/element-editor-state/testable/TestableEditorState.js'; +import { atomicTest_setDoc } from '../../../../../stores/graph-modifier/Testable_GraphModifierHelper.js'; const FunctionTestableContextMenu = observer( forwardRef< @@ -279,9 +299,9 @@ const FunctionTestDataStateEditor = observer( }; return (
-
-
-
+
+
+
input data
@@ -336,49 +356,345 @@ const FunctionTestDataStateEditor = observer( }, ); +const FunctionTestParameterEditor = observer( + (props: { + isReadOnly: boolean; + paramState: FunctionValueSpecificationTestParameterState; + functionTestState: FunctionTestState; + contentTypeParamPair: TestParamContentType | undefined; + }) => { + const { functionTestState, paramState, isReadOnly, contentTypeParamPair } = + props; + const [showPopUp, setShowPopUp] = useState(false); + const paramIsRequired = + paramState.varExpression.multiplicity.lowerBound > 0; + const type = contentTypeParamPair + ? contentTypeParamPair.contentType + : paramState.varExpression.genericType?.value.rawType.name ?? 'unknown'; + const paramValue = + paramState.varExpression.genericType?.value.rawType === PrimitiveType.BYTE + ? atob( + (paramState.valueSpec as PrimitiveInstanceValue) + .values[0] as string, + ) + : ((paramState.valueSpec as PrimitiveInstanceValue) + .values[0] as string); + + const openInPopUp = (): void => setShowPopUp(!showPopUp); + const closePopUp = (): void => setShowPopUp(false); + const updateParamValue = (val: string): void => { + if (paramState.valueSpec instanceof PrimitiveInstanceValue) { + instanceValue_setValue( + paramState.valueSpec, + paramState.varExpression.genericType?.value.rawType === + PrimitiveType.BYTE + ? btoa(val) + : val, + 0, + functionTestState.editorStore.changeDetectionState.observerContext, + ); + paramState.updateValueSpecification(paramState.valueSpec); + } + }; + + return ( +
+
+ {paramState.parameterValue.name} + +
+ <> + {contentTypeParamPair ? ( +
+