fix: ctrl a not working on edit node table (#2992)

* removed console log and fixed nulland

* Fixed ag grid version mismatch

* Fixed unused import

* Fixed ctrl+a not working on edit node and tweaks

* Fixed styling on editnode

* Made it work on mac

*  (generalBugs-shard-7.spec.ts): add end-to-end test for selecting all with ctrl + A on advanced modal to ensure functionality works as expected

---------

Co-authored-by: cristhianzl <cristhian.lousa@gmail.com>
This commit is contained in:
Lucas Oliveira 2024-07-26 16:21:17 -03:00 committed by GitHub
commit f7ad36b211
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 140 additions and 24 deletions

View file

@ -35,8 +35,8 @@
"@tanstack/react-query": "^5.49.2",
"@types/axios": "^0.14.0",
"ace-builds": "^1.35.0",
"ag-grid-community": "^32.0.0",
"ag-grid-react": "^31.3.2",
"ag-grid-community": "^32.0.2",
"ag-grid-react": "^32.0.2",
"ansi-to-html": "^0.7.2",
"axios": "^1.7.2",
"base64-js": "^1.5.1",
@ -5655,24 +5655,27 @@
}
},
"node_modules/ag-charts-types": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/ag-charts-types/-/ag-charts-types-10.0.0.tgz",
"integrity": "sha512-jjiwrzydERou4yp9WHiJeVK237B7BUP3/4j6tdycyHag266YVWa/BMNtTOThWJKGku+m+TC2qfaujLYixgcbrQ=="
"version": "10.0.2",
"resolved": "https://registry.npmjs.org/ag-charts-types/-/ag-charts-types-10.0.2.tgz",
"integrity": "sha512-Nxo5slHOXlaeg0gRIsVnovAosQzzlYfWJtdDy0Aq/VvpJru/PJ+5i2c9aCyEhgRxhBjImsoegwkgRj7gNOWV6Q==",
"license": "MIT"
},
"node_modules/ag-grid-community": {
"version": "32.0.0",
"resolved": "https://registry.npmjs.org/ag-grid-community/-/ag-grid-community-32.0.0.tgz",
"integrity": "sha512-H0I19/+SXTP/uMeG58nlm/Fj1rMKlX6mnbMW+MrfJ+e0/aguOtrOG+UGOn8f3CTmSwjOIQquCmu3gK8hBMqgtQ==",
"version": "32.0.2",
"resolved": "https://registry.npmjs.org/ag-grid-community/-/ag-grid-community-32.0.2.tgz",
"integrity": "sha512-vLJJUjnsG9hNK41GNuW2EHu1W264kxA/poOpcX4kmyrjU5Uzvelsbj3HdKAO9POV28iqyRdKGYfAWdn8QzA7KA==",
"license": "MIT",
"dependencies": {
"ag-charts-types": "10.0.0"
"ag-charts-types": "10.0.2"
}
},
"node_modules/ag-grid-react": {
"version": "31.3.2",
"resolved": "https://registry.npmjs.org/ag-grid-react/-/ag-grid-react-31.3.2.tgz",
"integrity": "sha512-SFHN05bsXp901rIT00Fa6iQLCtyavoJiKaXEDUtAU5LMu+GTkjs/FPQBQ8754omgdDFr4NsS3Ri6QbqBne3rug==",
"version": "32.0.2",
"resolved": "https://registry.npmjs.org/ag-grid-react/-/ag-grid-react-32.0.2.tgz",
"integrity": "sha512-IWYsoyJ/Z763rWbE5/9SaT1n5xwIKrm/QzOG14l7i8z5J6JdJwfV0aQFATmEE8Xws2H48vlLcLdW1cv4hwV3eg==",
"license": "MIT",
"dependencies": {
"ag-grid-community": "31.3.2",
"ag-grid-community": "32.0.2",
"prop-types": "^15.8.1"
},
"peerDependencies": {
@ -5680,11 +5683,6 @@
"react-dom": "^16.3.0 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/ag-grid-react/node_modules/ag-grid-community": {
"version": "31.3.2",
"resolved": "https://registry.npmjs.org/ag-grid-community/-/ag-grid-community-31.3.2.tgz",
"integrity": "sha512-GxqFRD0OcjaVRE1gwLgoP0oERNPH8Lk8wKJ1txulsxysEQ5dZWHhiIoXXSiHjvOCVMkK/F5qzY6HNrn6VeDMTQ=="
},
"node_modules/agent-base": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",

View file

@ -30,8 +30,8 @@
"@tanstack/react-query": "^5.49.2",
"@types/axios": "^0.14.0",
"ace-builds": "^1.35.0",
"ag-grid-community": "^32.0.0",
"ag-grid-react": "^31.3.2",
"ag-grid-community": "^32.0.2",
"ag-grid-react": "^32.0.2",
"ansi-to-html": "^0.7.2",
"axios": "^1.7.2",
"base64-js": "^1.5.1",

View file

@ -40,9 +40,8 @@ export default function TableAdvancedToggleCellRender({
<ToggleShadComponent
id={"show" + parameterId}
disabled={disabled}
enabled={!parameter?.advanced ?? true}
enabled={!parameter.advanced}
setEnabled={(e) => {
console.log(e, parameter);
handleOnNewValue({ advanced: !e });
}}
size="small"

View file

@ -38,7 +38,7 @@ export default function TableNodeCellRender({
return (
parameter && (
<div className="group mx-auto flex h-full max-h-48 w-[300px] items-center justify-center overflow-auto py-2.5 custom-scroll">
<div className="group mx-auto flex h-full max-h-48 w-[300px] items-center justify-center overflow-auto px-1 py-2.5 custom-scroll">
<ParameterRenderComponent
nodeId={nodeId}
handleOnNewValue={handleOnNewValue}

View file

@ -4,7 +4,6 @@ import "ag-grid-community/styles/ag-theme-quartz.css"; // Optional Theme applied
import { AgGridReact, AgGridReactProps } from "ag-grid-react";
import cloneDeep from "lodash";
import { ElementRef, forwardRef, useRef, useState } from "react";
import { boolean } from "zod";
import {
DEFAULT_TABLE_ALERT_MSG,
DEFAULT_TABLE_ALERT_TITLE,

View file

@ -49,6 +49,9 @@ const useColumnDefs = (
isTweaks,
};
},
suppressKeyboardEvent: (params) =>
params.event.key === "a" &&
(params.event.ctrlKey || params.event.metaKey),
minWidth: 340,
autoHeight: true,
flex: 1,

View file

@ -0,0 +1,117 @@
import { expect, test } from "@playwright/test";
import uaParser from "ua-parser-js";
test("should be able to select all with ctrl + A on advanced modal", async ({
page,
}) => {
await page.goto("/");
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.waitForSelector('[data-testid="blank-flow"]', {
timeout: 30000,
});
await page.getByTestId("blank-flow").click();
await page.waitForSelector('[data-testid="extended-disclosure"]', {
timeout: 30000,
});
await page.getByTestId("extended-disclosure").click();
await page.getByPlaceholder("Search").click();
await page.getByPlaceholder("Search").fill("ollama");
await page.waitForTimeout(1000);
await page
.getByTestId("embeddingsOllama Embeddings")
.dragTo(page.locator('//*[@id="react-flow-id"]'));
await page.getByTitle("fit view").click();
await page.getByTitle("zoom out").click();
await page.getByTitle("zoom out").click();
const getUA = await page.evaluate(() => navigator.userAgent);
const userAgentInfo = uaParser(getUA);
let control = "Control";
if (userAgentInfo.os.name.includes("Mac")) {
control = "Meta";
}
await page.getByTestId("div-generic-node").click();
await page.keyboard.press(`${control}+Shift+A`);
await page.waitForTimeout(1000);
await page
.getByPlaceholder("Type something...")
.nth(2)
.fill("ollama_test_ctrl_a_first_input");
let value = await page
.getByPlaceholder("Type something...")
.nth(2)
.inputValue();
expect(value).toBe("ollama_test_ctrl_a_first_input");
await page
.getByPlaceholder("Type something...")
.last()
.fill("ollama_test_ctrl_a_second_input");
let secondValue = await page
.getByPlaceholder("Type something...")
.last()
.inputValue();
expect(secondValue).toBe("ollama_test_ctrl_a_second_input");
await page.getByPlaceholder("Type something...").last().click();
await page.waitForTimeout(1000);
await page.keyboard.down(control);
await page.waitForTimeout(200);
await page.keyboard.press("a");
await page.keyboard.up(control);
await page.waitForTimeout(1000);
await page.keyboard.down(control);
await page.waitForTimeout(200);
await page.keyboard.press("c");
await page.keyboard.up(control);
await page.waitForTimeout(1000);
await page.getByPlaceholder("Type something...").nth(2).click();
await page.waitForTimeout(1000);
await page.keyboard.down(control);
await page.waitForTimeout(200);
await page.keyboard.press("a");
await page.keyboard.up(control);
await page.waitForTimeout(1000);
await page.keyboard.down(control);
await page.waitForTimeout(200);
await page.keyboard.press("v");
await page.keyboard.up(control);
value = await page.getByPlaceholder("Type something...").nth(2).inputValue();
expect(value).toBe("ollama_test_ctrl_a_second_input");
});