fix: Passsing dataTreePath to CodeEditor for AI events (#26601)
## Description Fixed issue where the propertyPath, widgetType was not being passed to the AI events. ##PR fixes following issue(s) Fixes #26690 #### Media #### Type of change - Bug fix (non-breaking change which fixes an issue) ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
This commit is contained in:
parent
770524c372
commit
939cd2a217
|
|
@ -508,7 +508,7 @@ describe("JS to non-JS mode in Action Selector", () => {
|
|||
propPane.ToggleJSMode("onClick");
|
||||
propPane.ValidatePropertyFieldValue(
|
||||
"onClick",
|
||||
`{{copyToClipboard('line1\\nline2\\nline3a');}}`,
|
||||
`{{copyToClipboard('aline1\\nline2\\nline3');}}`,
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -217,6 +217,7 @@ export function Field(props: FieldProps) {
|
|||
},
|
||||
value: value,
|
||||
additionalAutoComplete: props.additionalAutoComplete,
|
||||
dataTreePath: props.dataTreePath,
|
||||
});
|
||||
break;
|
||||
case FieldType.CALLBACK_FUNCTION_API_AND_QUERY:
|
||||
|
|
@ -235,6 +236,7 @@ export function Field(props: FieldProps) {
|
|||
},
|
||||
value: value,
|
||||
additionalAutoComplete: props.additionalAutoComplete,
|
||||
dataTreePath: props.dataTreePath,
|
||||
});
|
||||
break;
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ function FieldGroup(props: FieldGroupProps) {
|
|||
<li key={index}>
|
||||
<FieldGroup
|
||||
additionalAutoComplete={props.additionalAutoComplete}
|
||||
dataTreePath={props.dataTreePath}
|
||||
integrationOptions={props.integrationOptions}
|
||||
key={selectorField.label + index}
|
||||
label={selectorField.label}
|
||||
|
|
|
|||
|
|
@ -274,6 +274,7 @@ const ActionCreator = React.forwardRef(
|
|||
{Object.entries(actions).map(([id, value], index) => (
|
||||
<Action
|
||||
code={value}
|
||||
dataTreePath={props.dataTreePath}
|
||||
id={id}
|
||||
index={index}
|
||||
key={id}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ export type TextViewProps = ViewProps & {
|
|||
index?: number;
|
||||
additionalAutoComplete?: AdditionalDynamicDataTree;
|
||||
toolTip?: string;
|
||||
dataTreePath?: string | undefined;
|
||||
};
|
||||
|
||||
export type TabViewProps = Omit<ViewProps, "get" | "set"> & SwitcherProps;
|
||||
|
|
@ -77,6 +78,7 @@ export type ActionCreatorProps = {
|
|||
propertyName: string;
|
||||
widgetType: string;
|
||||
widgetName: string;
|
||||
dataTreePath: string | undefined;
|
||||
};
|
||||
|
||||
export type Field = {
|
||||
|
|
@ -114,6 +116,7 @@ export type FieldProps = {
|
|||
navigateToSwitches: Array<SwitchType>;
|
||||
activeTabApiAndQueryCallback: SwitchType;
|
||||
apiAndQueryCallbackTabSwitches: SwitchType[];
|
||||
dataTreePath?: string | undefined;
|
||||
};
|
||||
|
||||
export type FieldGroupProps = Omit<
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ export default function ActionSelector(props: {
|
|||
open: boolean;
|
||||
id: string;
|
||||
level: number;
|
||||
dataTreePath: string | undefined;
|
||||
onChange: (actionBlock: TActionBlock, del?: boolean) => void;
|
||||
}) {
|
||||
const action = props.action;
|
||||
|
|
@ -43,7 +44,13 @@ export default function ActionSelector(props: {
|
|||
<Popover2
|
||||
canEscapeKeyClose
|
||||
className="w-full"
|
||||
content={<ActionSelectorForm action={action} onChange={props.onChange} />}
|
||||
content={
|
||||
<ActionSelectorForm
|
||||
action={action}
|
||||
dataTreePath={props.dataTreePath}
|
||||
onChange={props.onChange}
|
||||
/>
|
||||
}
|
||||
isOpen={props.open}
|
||||
minimal
|
||||
popoverClassName={popoverClassName}
|
||||
|
|
@ -60,6 +67,7 @@ type TActionSelectorFormProps = {
|
|||
action: TActionBlock;
|
||||
onChange: (actionBlock: TActionBlock, del?: boolean) => void;
|
||||
additionalAutoComplete?: AdditionalDynamicDataTree;
|
||||
dataTreePath: string | undefined;
|
||||
};
|
||||
|
||||
const pathClassList = [
|
||||
|
|
@ -176,6 +184,7 @@ function ActionSelectorForm(props: TActionSelectorFormProps) {
|
|||
<div className="p-3 pt-0">
|
||||
<FieldGroup
|
||||
additionalAutoComplete={additionalAutoComplete}
|
||||
dataTreePath={props.dataTreePath}
|
||||
integrationOptions={integrationOptions}
|
||||
isChainedAction={isChainedAction}
|
||||
modalDropdownList={modalDropdownList}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ describe("tests for Action Tree in Action Selector", () => {
|
|||
<ThemeProvider theme={lightTheme}>
|
||||
<ActionTree
|
||||
actionBlock={actionBlock}
|
||||
dataTreePath=""
|
||||
id="xyz"
|
||||
level={0}
|
||||
onChange={() => {
|
||||
|
|
@ -59,6 +60,7 @@ describe("tests for Action Tree in Action Selector", () => {
|
|||
<ThemeProvider theme={lightTheme}>
|
||||
<ActionTree
|
||||
actionBlock={actionBlock}
|
||||
dataTreePath=""
|
||||
id="xyz"
|
||||
level={0}
|
||||
onChange={() => {
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ export default function ActionTree(props: {
|
|||
widgetName: string;
|
||||
propertyName: string;
|
||||
widgetType: string;
|
||||
dataTreePath: string | undefined;
|
||||
}) {
|
||||
const { id } = props;
|
||||
const [actionBlock, setActionBlock] = React.useState(props.actionBlock);
|
||||
|
|
@ -175,6 +176,7 @@ export default function ActionTree(props: {
|
|||
<div className={props.className}>
|
||||
<ActionSelector
|
||||
action={actionBlock}
|
||||
dataTreePath={props.dataTreePath}
|
||||
id={id}
|
||||
level={props.level}
|
||||
onChange={props.onChange}
|
||||
|
|
@ -258,6 +260,7 @@ export default function ActionTree(props: {
|
|||
<ActionTree
|
||||
actionBlock={cActionBlock}
|
||||
className="mt-0"
|
||||
dataTreePath={props.dataTreePath}
|
||||
id={`${id}_${blockType}_${index}`}
|
||||
isLastBlock={index === callbacks.length - 1}
|
||||
key={`${id}_${blockType}_${index}`}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ type TRootActionProps = {
|
|||
propertyName: string;
|
||||
widgetName: string;
|
||||
widgetType: string;
|
||||
dataTreePath: string | undefined;
|
||||
};
|
||||
|
||||
export default function Action(props: TRootActionProps) {
|
||||
|
|
@ -41,6 +42,7 @@ export default function Action(props: TRootActionProps) {
|
|||
<ActionTree
|
||||
actionBlock={action}
|
||||
className={`${props.index === 0 ? "mt-1" : "mt-2"}`}
|
||||
dataTreePath={props.dataTreePath}
|
||||
id={id}
|
||||
level={0}
|
||||
onChange={handleChange}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ export function TextView(props: TextViewProps) {
|
|||
)}
|
||||
<InputText
|
||||
additionalAutocomplete={props.additionalAutoComplete}
|
||||
dataTreePath={props.dataTreePath}
|
||||
evaluatedValue={value}
|
||||
expected={{
|
||||
type: "string",
|
||||
|
|
|
|||
|
|
@ -1525,7 +1525,8 @@ class CodeEditor extends Component<Props, State> {
|
|||
evaluated = evaluatedValue;
|
||||
|
||||
if (dataTreePath) {
|
||||
evaluated = pathEvaluatedValue;
|
||||
evaluated =
|
||||
pathEvaluatedValue !== undefined ? pathEvaluatedValue : evaluated;
|
||||
}
|
||||
const entityInformation = this.getEntityInformation();
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,13 @@ class ActionSelectorControl extends BaseControl<ControlProps> {
|
|||
};
|
||||
|
||||
render() {
|
||||
const { label, propertyName, propertyValue, widgetProperties } = this.props;
|
||||
const {
|
||||
dataTreePath,
|
||||
label,
|
||||
propertyName,
|
||||
propertyValue,
|
||||
widgetProperties,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
<ActionCreator
|
||||
|
|
@ -70,6 +76,7 @@ class ActionSelectorControl extends BaseControl<ControlProps> {
|
|||
additionalControlData={
|
||||
this.props.additionalControlData as Record<string, any>
|
||||
}
|
||||
dataTreePath={dataTreePath}
|
||||
onValueChange={this.handleValueUpdate}
|
||||
propertyName={propertyName}
|
||||
ref={this.componentRef}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ class ColumnActionSelectorControl extends BaseControl<ColumnActionSelectorContro
|
|||
<ActionCreator
|
||||
action={this.props.label}
|
||||
additionalControlData={{}}
|
||||
dataTreePath=""
|
||||
onValueChange={this.updateColumnActionFunction.bind(
|
||||
this,
|
||||
columnAction,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user