From eaf22ce0c7d2407d759439b96dcf06d5d89d221d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 19 Oct 2022 17:06:00 +1100 Subject: [PATCH 1/5] chore(deps): update dependency @swc/core to v1.3.7 (#2631) --- extension/package.json | 2 +- languageServer/package.json | 2 +- webview/package.json | 2 +- yarn.lock | 138 ++++++++++++++++++------------------ 4 files changed, 72 insertions(+), 72 deletions(-) diff --git a/extension/package.json b/extension/package.json index 8ec87c1957..9e16a077bc 100644 --- a/extension/package.json +++ b/extension/package.json @@ -1554,7 +1554,7 @@ "vscode-languageclient": "8.0.2" }, "devDependencies": { - "@swc/core": "1.3.6", + "@swc/core": "1.3.7", "@swc/jest": "0.2.23", "@types/chai": "4.3.3", "@types/chai-as-promised": "7.1.5", diff --git a/languageServer/package.json b/languageServer/package.json index 2649bf29fa..66ef5308f0 100644 --- a/languageServer/package.json +++ b/languageServer/package.json @@ -30,7 +30,7 @@ "test": "jest --collect-coverage" }, "devDependencies": { - "@swc/core": "1.3.6", + "@swc/core": "1.3.7", "@swc/jest": "0.2.23", "@types/jest": "29.1.2", "clean-webpack-plugin": "4.0.0", diff --git a/webview/package.json b/webview/package.json index 04ae25626a..79613c4f3e 100644 --- a/webview/package.json +++ b/webview/package.json @@ -49,7 +49,7 @@ "@storybook/react": "6.5.12", "@storybook/testing-library": "0.0.13", "@svgr/cli": "6.4.0", - "@swc/core": "1.3.6", + "@swc/core": "1.3.7", "@swc/jest": "0.2.23", "@testing-library/jest-dom": "5.16.5", "@testing-library/react": "13.4.0", diff --git a/yarn.lock b/yarn.lock index d86d399b21..bc122f4201 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3474,101 +3474,101 @@ deepmerge "^4.2.2" svgo "^2.8.0" -"@swc/core-android-arm-eabi@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.3.6.tgz#0b127ccc7e6ea3e652e250afc3322d17aacec664" - integrity sha512-FQk/4cRRDoMPLgSm/1WvEqRqlSgBb6Twd5W13NYUbXJpzPGoPHhzwaCEbpGjPKG/OvAqA2NVrWquuJjhDvQyVQ== +"@swc/core-android-arm-eabi@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.3.7.tgz#31dc887e5dc2db25ac1a9503478ea6cabc1da9ac" + integrity sha512-zvUpTBOUnXDkfp2JXv1T3NfyimxsAnqEfT65gWC/3ZpB/gmc59vqYVko4Pifyvuxo5aVvEdT2gfHlWM/aXwtpg== dependencies: "@swc/wasm" "1.2.122" -"@swc/core-android-arm64@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core-android-arm64/-/core-android-arm64-1.3.6.tgz#9f0e76328ef35793157dfe84a40499a2f437981b" - integrity sha512-6qjZYatlFAN0IKhhYFsN+BaywooHFpK9/A/jMkjgIfbUoDz3wPJWZc2MDvcttgqZ+cfsSCcGeNw++H894z1zfw== +"@swc/core-android-arm64@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core-android-arm64/-/core-android-arm64-1.3.7.tgz#2b6d35343d68946b5bc2b654fa2fa4c0e8afe4d6" + integrity sha512-qnh1aYTrIjuFOkgxUYG8SGzpPD92o/w5hrHUy71LfUbHf5HRs7FpMgQXtTGnk33S/uMCvSv7V/ewv+t+N6tlVA== dependencies: "@swc/wasm" "1.2.130" -"@swc/core-darwin-arm64@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.6.tgz#9a87819bf4879a165a7b4b868577f76dc94562e3" - integrity sha512-2qjaABxA7cloVTkS+uDEcVQ5buSi8de7qEv6P6InDE/iCjnI5ALyDxn7eauJJsVKimh9DyqN9sSZJ/z9U4FDUQ== +"@swc/core-darwin-arm64@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.3.7.tgz#addfcf1dd1562b04ead371a3a228f1e33eb8c2d3" + integrity sha512-q8NgUK/CleCmGYIuskL1sCad8opkfJD/8GWd+MkGSi+MGkExrLMmJftgG5FCj0l/xCHxGGNYj1TCrM/qV6CheA== -"@swc/core-darwin-x64@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.6.tgz#804109765a69d8d7dab09d55f4bf0918254b3cf3" - integrity sha512-+OtW18d2o3RUuXodB41ZDj0iRCeXNL0OxVU0jTl7iyCWDypmCzhalbaQXD/ZJxgnpGRB7/s2ZwNR/gzjXgz9VA== +"@swc/core-darwin-x64@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.3.7.tgz#d0886d5c0573c871a42cac77cfaf091c6cc2768d" + integrity sha512-dKrJkZYbF7Qi1wQgyVnR1a5Vk8UN7fJ/WlK6pZVJwMvWLoZgYE+U0Nn7RsVB4LmOxHtaJF7eesbGUm2y2NVEwA== -"@swc/core-freebsd-x64@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core-freebsd-x64/-/core-freebsd-x64-1.3.6.tgz#f5450dede877f61cee427c1ea16165eb74fcfe36" - integrity sha512-f+ePNodn7ET9qEa93VMfnsPNnubWKIkn0EfxmfzJCt/abNVZ7+DyCSABfWKkexOZ8OuNyxnBCdKLL6nlizxkhQ== +"@swc/core-freebsd-x64@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core-freebsd-x64/-/core-freebsd-x64-1.3.7.tgz#2fa4f8554fcf3101a411570032b3ccfcd4833d3e" + integrity sha512-ENHthc4iFPlBj0xaf2DbJLDzYSBA4QMQEA2HhZoSWWMsqhg8mGZxwgRd6+loROGZ2a5HKMZXIxCev8BbYnE0OA== dependencies: "@swc/wasm" "1.2.130" -"@swc/core-linux-arm-gnueabihf@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.6.tgz#851871559363783818ee38725a6391b83ed3aff0" - integrity sha512-JwdJmqKzsdq7Itg5ssKDEY9mP3AkQ+XENF6WXXlaNu1U/InqQhD0DqsFzw4TQ4LzB7lB7Wj+dv3JjKIhnHNNag== +"@swc/core-linux-arm-gnueabihf@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.3.7.tgz#76e5f6d114c3051c12bfb603bb51bfee67d512e0" + integrity sha512-anE65tcRLr/fYayXkpwZ7p7Ft5HCH4rvi3wSFdK8ycRWn9fVZhyWUJkJ3p1S0R19xr7hcb14hyxqPbd4m0I4yA== dependencies: "@swc/wasm" "1.2.130" -"@swc/core-linux-arm64-gnu@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.6.tgz#2afd9f3d4f2b051b79ed9f3549ccc8fa81ca6809" - integrity sha512-sRoPnwYFX+t95S7khi4KL2lZMZwbuzvPUf8NYmtTzfqVIseo8HD6IMgyeaQHYDfwDGF5elQGi4ALjRx2huSi0Q== +"@swc/core-linux-arm64-gnu@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.3.7.tgz#924076423e4ac7eb3d95f5dc5de03d3301aac81a" + integrity sha512-Qv6f76Tt8t51qb29R2isWvuQM26Xi7ZJavAv0hMdCxfkF+h1Yd14j82H7afGzdONH1LyLaPrhWSQirU/ZtBtdA== -"@swc/core-linux-arm64-musl@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.6.tgz#607cc220c8640f2d36e4e2426784a6a0fc55fa1e" - integrity sha512-XT8vRcxGaKujiplFfuMtGRgZ3Nx611TMVLUg91alzEIe2Adtrpaumzrwv2vqVdMr4X4GBK9z0rHsqkDLPhmuaw== +"@swc/core-linux-arm64-musl@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.3.7.tgz#967ce8320b9c39d3ff7efe495b3af03ddfc8cf2b" + integrity sha512-paYbmvm7+7QxjyMzRd4X4tyhHw5VgkGCMBYC3PbfpuI7SsCdmEFG9v1t5uMbTf60VU1wB4/n+AxY9KCZLfK7DQ== -"@swc/core-linux-x64-gnu@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.6.tgz#725386afc5092cf945245ba0d500f6fc1411efd9" - integrity sha512-nip81Ngcx8cory+FtapKhXb/rgh/pTAlvTiwJjMhsE3xcKRsbnJEPMVIoArCBV0BmYJBLWvOtpHf8B62JS7L5w== +"@swc/core-linux-x64-gnu@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.3.7.tgz#2f55017c05f0a7a9099d1b85ee6ae22bee93a118" + integrity sha512-tkIHt64mmqEVM0CTGvUsB37Pv7AD/BinOEe6oPfMcS/2a00kYvXn9kEVKPqNTpiFpjYGoFQJaVV8UsD+iv8IvQ== -"@swc/core-linux-x64-musl@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.6.tgz#b59ac6a51192713a500b81b558979e56761b5e0a" - integrity sha512-IzrQB67BY/rSZPJXWU3XzpkJqh4vYkYuOUmz1yrV/vxgPjJp/kUllfBYsHCiIedb7sjvfTt409SIN0FlPJY2+Q== +"@swc/core-linux-x64-musl@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.3.7.tgz#ce3a83a99389436e8ef1d86a59b6bdba16b2a0e3" + integrity sha512-V0xeTS8kvnTlghO1YyO1QgfPqsY896MknYCzBeK9CGKkGbc3JaxSoyb11nbGEDEaUwzDd9gj9L4D2uP+IWpoyw== -"@swc/core-win32-arm64-msvc@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.6.tgz#50b7c16904f159dca5d4b29225dd55c11626ac95" - integrity sha512-gLsE/4qgqTxy0OOFJKi9QRs9mVYv4yOXSwPB2Rb+grOmNnG+Ds2LWqGEaABKDErnUtTQiOzLpdwesNZxeJgMhA== +"@swc/core-win32-arm64-msvc@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.3.7.tgz#11e53a2b79f7de2b78e4f10cc45c45e87753b0ce" + integrity sha512-LeauQIok8tw4Mjmj7wlc7C62HCUx3xa5k6tNQnKWbDs7odZVWisgDxn7RSl9/xxlC8wPLTVUyBh3O1rHigVfWg== dependencies: "@swc/wasm" "1.2.130" -"@swc/core-win32-ia32-msvc@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.6.tgz#8e9d55586184b2a11978fe9dbc9a8a3a16d2e54a" - integrity sha512-0Jr7KMGEPapYGni+97oNOeVP7edBwjMGQ9HsJUUN1uIE7fALQ+zVGuwbc+22myql2Uhh5V5hZx5xtVraqLVMHw== +"@swc/core-win32-ia32-msvc@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.3.7.tgz#126b930a77af3d0dcbacf07782d6f20a16511b32" + integrity sha512-E1C8bpUrml0vIv4FTSP7f4CwkZVGsCY9fBsBHCC4j9N1mtQk8/nzpGOUsPo4QP+FTYJiNKedZ4Cy7baihnV4Lw== dependencies: "@swc/wasm" "1.2.130" -"@swc/core-win32-x64-msvc@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.6.tgz#a3c2bcf71b26cc4984adce4bfefb214664ce3b01" - integrity sha512-O3F/jxqaFwGq9XxYeCIVRCDIR4+GdSBu/5io6TkN8O5QLqB3/KOJVDn6TALtbL6ClwjUwZt66HKnYeSx19j2Ow== +"@swc/core-win32-x64-msvc@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.3.7.tgz#a1298b635d2cbbcf3cba3dbd37cdd6b577296efa" + integrity sha512-Ti9H/1hqBrxhYtNLVaLsahO/iiJn1Zd4qSc0LZpl6wBJxP4LltLV4MLeib6i8lg11pj4ijIhzZfC6bT614ee3w== -"@swc/core@1.3.6": - version "1.3.6" - resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.6.tgz#909af865ee5044fe138ff85b40afb5d171d621a1" - integrity sha512-L3EemOWywrxXsRQFeU50PYFwrDKOxi2RGTT+TT3CcbIszwc7qnE6vsVzEll/eK32H1veicc0EegkZgtD4PFNRA== +"@swc/core@1.3.7": + version "1.3.7" + resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.3.7.tgz#46eaa4af5f61ced1694fca64fb6d93ba5485747a" + integrity sha512-g4ptYRZRE+g/6wLB3WBuWhAWJsZDUeiSOvKVM1Wdn29Vi/EgLuVaY5ssz0HLQJxuDSJGwtAOZA8exh4+AKNHLw== optionalDependencies: - "@swc/core-android-arm-eabi" "1.3.6" - "@swc/core-android-arm64" "1.3.6" - "@swc/core-darwin-arm64" "1.3.6" - "@swc/core-darwin-x64" "1.3.6" - "@swc/core-freebsd-x64" "1.3.6" - "@swc/core-linux-arm-gnueabihf" "1.3.6" - "@swc/core-linux-arm64-gnu" "1.3.6" - "@swc/core-linux-arm64-musl" "1.3.6" - "@swc/core-linux-x64-gnu" "1.3.6" - "@swc/core-linux-x64-musl" "1.3.6" - "@swc/core-win32-arm64-msvc" "1.3.6" - "@swc/core-win32-ia32-msvc" "1.3.6" - "@swc/core-win32-x64-msvc" "1.3.6" + "@swc/core-android-arm-eabi" "1.3.7" + "@swc/core-android-arm64" "1.3.7" + "@swc/core-darwin-arm64" "1.3.7" + "@swc/core-darwin-x64" "1.3.7" + "@swc/core-freebsd-x64" "1.3.7" + "@swc/core-linux-arm-gnueabihf" "1.3.7" + "@swc/core-linux-arm64-gnu" "1.3.7" + "@swc/core-linux-arm64-musl" "1.3.7" + "@swc/core-linux-x64-gnu" "1.3.7" + "@swc/core-linux-x64-musl" "1.3.7" + "@swc/core-win32-arm64-msvc" "1.3.7" + "@swc/core-win32-ia32-msvc" "1.3.7" + "@swc/core-win32-x64-msvc" "1.3.7" "@swc/jest@0.2.23": version "0.2.23" From 525a0b03e64f7083298306a1933749510fc8d325 Mon Sep 17 00:00:00 2001 From: Wolmir Nemitz Date: Wed, 19 Oct 2022 12:57:11 -0300 Subject: [PATCH 2/5] Add webpack dummy build as a lint step (#2626) * Add webpack dummy build as a lint step * Replace lint:tsc with lint:compile --- languageServer/package.json | 2 +- webview/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/languageServer/package.json b/languageServer/package.json index 66ef5308f0..26c164db84 100644 --- a/languageServer/package.json +++ b/languageServer/package.json @@ -24,7 +24,7 @@ "format": "prettier --write '**/*.{js,json,jsx,md,scss,ts,tsx,yaml,yml}'", "lint:prettier": "prettier -c '**/*.{js,json,jsx,md,scss,ts,tsx,yaml,yml}'", "lint:eslint": "eslint --cache '**/*.{js,ts,jsx,tsx}'", - "lint:tsc": "tsc --noEmit", + "lint:compile": "webpack --mode development", "lint": "run-p 'lint:*'", "dev": "webpack watch --mode development", "test": "jest --collect-coverage" diff --git a/webview/package.json b/webview/package.json index 79613c4f3e..7165abd7ae 100644 --- a/webview/package.json +++ b/webview/package.json @@ -6,7 +6,7 @@ "format": "prettier --write '**/*.{js,json,jsx,md,scss,ts,tsx,yaml,yml}'", "lint:prettier": "prettier -c '**/*.{js,json,jsx,md,scss,ts,tsx,yaml,yml}'", "lint:eslint": "eslint --cache '**/*.{js,ts,jsx,tsx}'", - "lint:tsc": "tsc --noEmit", + "lint:compile": "webpack --mode development", "lint": "run-p 'lint:*'", "dev": "webpack watch --mode development", "build": "webpack --mode production", From 5a382de435d08df8d1dbff1dc25605a53a3f6e90 Mon Sep 17 00:00:00 2001 From: Wolmir Nemitz Date: Wed, 19 Oct 2022 13:14:05 -0300 Subject: [PATCH 3/5] Experiments Table Headers - Remove context menu's click trigger (#2625) * Create dedicated header module * Fix styles imports for header module * Disable left-click trigger for header context menu * Remove duplicated code --- .../src/experiments/components/App.test.tsx | 9 +-- .../components/table/Table.test.tsx | 2 +- .../experiments/components/table/Table.tsx | 2 +- .../table/{ => header}/MergeHeaderGroups.tsx | 4 +- .../table/{ => header}/TableHead.tsx | 19 +++-- .../table/{ => header}/TableHeader.tsx | 77 ++++++++++--------- .../table/{ => header}/TableHeaderCell.tsx | 12 +-- .../{ => header}/TableHeaderCellContents.tsx | 8 +- 8 files changed, 65 insertions(+), 68 deletions(-) rename webview/src/experiments/components/table/{ => header}/MergeHeaderGroups.tsx (91%) rename webview/src/experiments/components/table/{ => header}/TableHead.tsx (87%) rename webview/src/experiments/components/table/{ => header}/TableHeader.tsx (67%) rename webview/src/experiments/components/table/{ => header}/TableHeaderCell.tsx (93%) rename webview/src/experiments/components/table/{ => header}/TableHeaderCellContents.tsx (92%) diff --git a/webview/src/experiments/components/App.test.tsx b/webview/src/experiments/components/App.test.tsx index 615f5f1ba7..dcad10a026 100644 --- a/webview/src/experiments/components/App.test.tsx +++ b/webview/src/experiments/components/App.test.tsx @@ -737,19 +737,14 @@ describe('App', () => { jest.useRealTimers() }) - it('should open on left click', () => { + it('should not open on left click', () => { renderTableWithoutRunningExperiments() const paramsFileHeader = screen.getByText('params.yaml') fireEvent.click(paramsFileHeader, { bubbles: true }) jest.advanceTimersByTime(100) - const menuitems = screen.getAllByRole('menuitem') - const itemLabels = menuitems.map(item => item.textContent) - expect(itemLabels).toStrictEqual([ - 'Open to the Side', - 'Set Max Header Height' - ]) + expect(screen.queryAllByRole('menuitem')).toHaveLength(0) }) it('should open on right click and close on esc', () => { diff --git a/webview/src/experiments/components/table/Table.test.tsx b/webview/src/experiments/components/table/Table.test.tsx index 8cf5162470..93f718cfd7 100644 --- a/webview/src/experiments/components/table/Table.test.tsx +++ b/webview/src/experiments/components/table/Table.test.tsx @@ -18,7 +18,7 @@ import { MessageFromWebviewType } from 'dvc/src/webview/contract' import React from 'react' import { TableInstance } from 'react-table' import tableDataFixture from 'dvc/src/test/fixtures/expShow/tableData' -import { SortOrder } from './TableHeader' +import { SortOrder } from './header/TableHeader' import { Table } from './Table' import styles from './styles.module.scss' import { ExperimentsTable } from '../Experiments' diff --git a/webview/src/experiments/components/table/Table.tsx b/webview/src/experiments/components/table/Table.tsx index de24b64b25..8bfe107324 100644 --- a/webview/src/experiments/components/table/Table.tsx +++ b/webview/src/experiments/components/table/Table.tsx @@ -2,7 +2,7 @@ import React, { useRef, useState, CSSProperties } from 'react' import { useSelector } from 'react-redux' import cx from 'classnames' import styles from './styles.module.scss' -import { TableHead } from './TableHead' +import { TableHead } from './header/TableHead' import { InstanceProp, RowProp } from './interfaces' import { RowSelectionContext } from './RowSelectionContext' import { TableBody } from './TableBody' diff --git a/webview/src/experiments/components/table/MergeHeaderGroups.tsx b/webview/src/experiments/components/table/header/MergeHeaderGroups.tsx similarity index 91% rename from webview/src/experiments/components/table/MergeHeaderGroups.tsx rename to webview/src/experiments/components/table/header/MergeHeaderGroups.tsx index 22b5292535..6e36292edb 100644 --- a/webview/src/experiments/components/table/MergeHeaderGroups.tsx +++ b/webview/src/experiments/components/table/header/MergeHeaderGroups.tsx @@ -3,8 +3,8 @@ import cx from 'classnames' import { Experiment, Column } from 'dvc/src/experiments/webview/contract' import { HeaderGroup } from 'react-table' import { TableHeader } from './TableHeader' -import styles from './styles.module.scss' -import { DragFunction } from '../../../shared/components/dragDrop/Draggable' +import styles from '../styles.module.scss' +import { DragFunction } from '../../../../shared/components/dragDrop/Draggable' export const MergedHeaderGroups: React.FC<{ headerGroup: HeaderGroup diff --git a/webview/src/experiments/components/table/TableHead.tsx b/webview/src/experiments/components/table/header/TableHead.tsx similarity index 87% rename from webview/src/experiments/components/table/TableHead.tsx rename to webview/src/experiments/components/table/header/TableHead.tsx index c5624dff2c..d34a178696 100644 --- a/webview/src/experiments/components/table/TableHead.tsx +++ b/webview/src/experiments/components/table/header/TableHead.tsx @@ -3,17 +3,16 @@ import React, { DragEvent, useRef, useEffect } from 'react' import { useSelector, useDispatch } from 'react-redux' import { HeaderGroup, TableInstance } from 'react-table' import { MessageFromWebviewType } from 'dvc/src/webview/contract' -import styles from './styles.module.scss' import { MergedHeaderGroups } from './MergeHeaderGroups' -import { Indicators } from './Indicators' -import { setDropTarget } from './headerDropTargetSlice' -import { useColumnOrder } from '../../hooks/useColumnOrder' -import { ExperimentsState } from '../../store' -import { sendMessage } from '../../../shared/vscode' -import { leafColumnIds, reorderColumnIds } from '../../util/columns' -import { DragFunction } from '../../../shared/components/dragDrop/Draggable' -import { getSelectedForPlotsCount } from '../../util/rows' - +import { setDropTarget } from '../headerDropTargetSlice' +import styles from '../styles.module.scss' +import { Indicators } from '../Indicators' +import { useColumnOrder } from '../../../hooks/useColumnOrder' +import { ExperimentsState } from '../../../store' +import { sendMessage } from '../../../../shared/vscode' +import { leafColumnIds, reorderColumnIds } from '../../../util/columns' +import { DragFunction } from '../../../../shared/components/dragDrop/Draggable' +import { getSelectedForPlotsCount } from '../../../util/rows' interface TableHeadProps { instance: TableInstance root: HTMLElement | null diff --git a/webview/src/experiments/components/table/TableHeader.tsx b/webview/src/experiments/components/table/header/TableHeader.tsx similarity index 67% rename from webview/src/experiments/components/table/TableHeader.tsx rename to webview/src/experiments/components/table/header/TableHeader.tsx index 4833095029..a0eacec2df 100644 --- a/webview/src/experiments/components/table/TableHeader.tsx +++ b/webview/src/experiments/components/table/header/TableHeader.tsx @@ -9,10 +9,10 @@ import { HeaderGroup } from 'react-table' import { MessageFromWebviewType } from 'dvc/src/webview/contract' import { VSCodeDivider } from '@vscode/webview-ui-toolkit/react' import { TableHeaderCell } from './TableHeaderCell' -import { ExperimentsState } from '../../store' -import { DragFunction } from '../../../shared/components/dragDrop/Draggable' -import { MessagesMenu } from '../../../shared/components/messagesMenu/MessagesMenu' -import { MessagesMenuOptionProps } from '../../../shared/components/messagesMenu/MessagesMenuOption' +import { ExperimentsState } from '../../../store' +import { DragFunction } from '../../../../shared/components/dragDrop/Draggable' +import { MessagesMenu } from '../../../../shared/components/messagesMenu/MessagesMenu' +import { MessagesMenuOptionProps } from '../../../../shared/components/messagesMenu/MessagesMenuOption' export enum SortOrder { ASCENDING = 'Sort Ascending', @@ -38,6 +38,39 @@ interface TableHeaderProps { root: HTMLElement | null } +export const sortOption = ( + label: SortOrder, + currentSort: SortOrder, + columnId: string +) => { + const sortOrder = currentSort + const hidden = sortOrder === label + const descending = label === SortOrder.DESCENDING + const path = columnId + const removeSortMessage = { + payload: columnId, + type: MessageFromWebviewType.REMOVE_COLUMN_SORT + } + const payload = { + descending, + path + } + const message = + label === SortOrder.NONE + ? removeSortMessage + : { + payload, + type: MessageFromWebviewType.SORT_COLUMN + } + + return { + hidden, + id: label, + label, + message + } as MessagesMenuOptionProps +} + export const TableHeader: React.FC = ({ column, columns, @@ -116,39 +149,9 @@ export const TableHeader: React.FC = ({ diff --git a/webview/src/experiments/components/table/TableHeaderCell.tsx b/webview/src/experiments/components/table/header/TableHeaderCell.tsx similarity index 93% rename from webview/src/experiments/components/table/TableHeaderCell.tsx rename to webview/src/experiments/components/table/header/TableHeaderCell.tsx index aef24799ef..009e5a6b78 100644 --- a/webview/src/experiments/components/table/TableHeaderCell.tsx +++ b/webview/src/experiments/components/table/header/TableHeaderCell.tsx @@ -8,17 +8,17 @@ import { useSelector } from 'react-redux' import { HeaderGroup } from 'react-table' import cx from 'classnames' import { useInView } from 'react-intersection-observer' -import styles from './styles.module.scss' import { SortOrder } from './TableHeader' import { TableHeaderCellContents } from './TableHeaderCellContents' +import styles from '../styles.module.scss' import { countUpperLevels, isExperimentColumn, isFirstLevelHeader -} from '../../util/columns' -import { ContextMenu } from '../../../shared/components/contextMenu/ContextMenu' -import { DragFunction } from '../../../shared/components/dragDrop/Draggable' -import { ExperimentsState } from '../../store' +} from '../../../util/columns' +import { ExperimentsState } from '../../../store' +import { ContextMenu } from '../../../../shared/components/contextMenu/ContextMenu' +import { DragFunction } from '../../../../shared/components/dragDrop/Draggable' const calcResizerHeight = ( isPlaceholder: boolean, @@ -147,7 +147,7 @@ export const TableHeaderCell: React.FC<{
Date: Wed, 19 Oct 2022 13:30:44 -0400 Subject: [PATCH 4/5] Check if element clicked is link to skip the toggle of the section (#2632) --- webview/src/plots/components/App.test.tsx | 26 +++++++++++++++++++ .../src/plots/components/PlotsContainer.tsx | 6 ++++- webview/src/util/objects.ts | 4 +++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/webview/src/plots/components/App.test.tsx b/webview/src/plots/components/App.test.tsx index 4c70b46669..cb03575d5c 100644 --- a/webview/src/plots/components/App.test.tsx +++ b/webview/src/plots/components/App.test.tsx @@ -428,6 +428,32 @@ describe('App', () => { }) }) + it('should not toggle the checkpoint plots section if a link is clicked', () => { + renderAppWithOptionalData({ + checkpoint: checkpointPlotsFixture + }) + + const checkpointsTooltipToggle = screen.getAllByTestId( + 'info-tooltip-toggle' + )[2] + fireEvent.mouseEnter(checkpointsTooltipToggle, { + bubbles: true, + cancelable: true + }) + + const tooltip = screen.getByTestId('tooltip-checkpoint-plots') + const tooltipLink = within(tooltip).getByRole('link') + fireEvent.click(tooltipLink, { + bubbles: true, + cancelable: true + }) + + expect(mockPostMessage).not.toHaveBeenCalledWith({ + payload: { [Section.CHECKPOINT_PLOTS]: true }, + type: MessageFromWebviewType.TOGGLE_PLOTS_SECTION + }) + }) + it('should not toggle the checkpoint plots section when its header is clicked and the content of its tooltip is selected', async () => { renderAppWithOptionalData({ checkpoint: checkpointPlotsFixture diff --git a/webview/src/plots/components/PlotsContainer.tsx b/webview/src/plots/components/PlotsContainer.tsx index 5858d9a396..beee636082 100644 --- a/webview/src/plots/components/PlotsContainer.tsx +++ b/webview/src/plots/components/PlotsContainer.tsx @@ -18,6 +18,7 @@ import { Lines } from '../../shared/components/icons' import { isSelecting } from '../../util/strings' +import { EventTargetWithNodeName } from '../../util/objects' export interface CommonPlotsContainerProps { onResize: (size: PlotSize) => void @@ -139,7 +140,10 @@ export const PlotsContainer: React.FC = ({ const toggleSection = (e: MouseEvent) => { e.preventDefault() - if (!isSelecting([title, SectionDescription[sectionKey].props.children])) { + if ( + !isSelecting([title, SectionDescription[sectionKey].props.children]) && + !['A', 'BUTTON'].includes((e.target as EventTargetWithNodeName).nodeName) + ) { sendMessage({ payload: { [sectionKey]: !sectionCollapsed diff --git a/webview/src/util/objects.ts b/webview/src/util/objects.ts index d3c80108cb..3a49462564 100644 --- a/webview/src/util/objects.ts +++ b/webview/src/util/objects.ts @@ -15,3 +15,7 @@ export type Obj = { [key: string]: Any } export const keepReferenceIfEqual = (old: BaseType, recent: BaseType) => isEqual(old, recent) ? old : recent + +export interface EventTargetWithNodeName extends EventTarget { + nodeName: string +} From 658b1a98ed7c2c1755664490a282660cc3eb46bc Mon Sep 17 00:00:00 2001 From: mattseddon <37993418+mattseddon@users.noreply.github.com> Date: Thu, 20 Oct 2022 05:12:49 +1100 Subject: [PATCH 5/5] Fix integration test suite after hook (#2628) --- extension/src/experiments/columns/collect/util.ts | 2 +- extension/src/experiments/index.ts | 2 +- extension/src/experiments/webview/messages.ts | 2 +- extension/src/test/suite/experiments/index.test.ts | 12 ++++++------ extension/src/vscode/config.ts | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/extension/src/experiments/columns/collect/util.ts b/extension/src/experiments/columns/collect/util.ts index 46a33be1ce..6c991cd224 100644 --- a/extension/src/experiments/columns/collect/util.ts +++ b/extension/src/experiments/columns/collect/util.ts @@ -34,7 +34,7 @@ export const limitAncestorDepth = ( } => { const [path, ...rest] = ancestors const collectedLimit = Number( - getConfigValue(ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH, limit) + getConfigValue(ConfigKey.EXP_TABLE_HEAD_MAX_HEIGHT, limit) ) switch (collectedLimit) { diff --git a/extension/src/experiments/index.ts b/extension/src/experiments/index.ts index 8245c49dfd..dcebf492ec 100644 --- a/extension/src/experiments/index.ts +++ b/extension/src/experiments/index.ts @@ -132,7 +132,7 @@ export class Experiments extends BaseRepository { this.dispose.track( workspace.onDidChangeConfiguration((event: ConfigurationChangeEvent) => { - if (event.affectsConfiguration(ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH)) { + if (event.affectsConfiguration(ConfigKey.EXP_TABLE_HEAD_MAX_HEIGHT)) { this.cliData.update() } }) diff --git a/extension/src/experiments/webview/messages.ts b/extension/src/experiments/webview/messages.ts index f11ff3ed7d..41a612f869 100644 --- a/extension/src/experiments/webview/messages.ts +++ b/extension/src/experiments/webview/messages.ts @@ -186,7 +186,7 @@ export class WebviewMessages { return } - setConfigValue(ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH, Number(newValue)) + setConfigValue(ConfigKey.EXP_TABLE_HEAD_MAX_HEIGHT, Number(newValue)) sendTelemetryEvent( EventName.VIEWS_EXPERIMENTS_TABLE_SET_MAX_HEADER_HEIGHT, undefined, diff --git a/extension/src/test/suite/experiments/index.test.ts b/extension/src/test/suite/experiments/index.test.ts index aba912df13..146f88e7d3 100644 --- a/extension/src/test/suite/experiments/index.test.ts +++ b/extension/src/test/suite/experiments/index.test.ts @@ -173,11 +173,11 @@ suite('Experiments Test Suite', () => { }) describe('handleMessageFromWebview', () => { - after(() => { + after(() => workspace - .getConfiguration(ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH) - .update('', undefined, false) - }) + .getConfiguration() + .update(ConfigKey.EXP_TABLE_HEAD_MAX_HEIGHT, undefined, false) + ) const setupExperimentsAndMockCommands = () => { const { @@ -891,7 +891,7 @@ suite('Experiments Test Suite', () => { const { experiments } = buildExperiments(disposable, expShowFixture) const inputEvent = getInputBoxEvent('0') const tableMaxDepthChanged = configurationChangeEvent( - ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH, + ConfigKey.EXP_TABLE_HEAD_MAX_HEIGHT, disposable ) @@ -907,7 +907,7 @@ suite('Experiments Test Suite', () => { await tableMaxDepthChanged expect( - workspace.getConfiguration().get(ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH) + workspace.getConfiguration().get(ConfigKey.EXP_TABLE_HEAD_MAX_HEIGHT) ).to.equal(0) expect(mockSendTelemetryEvent).to.be.called expect( diff --git a/extension/src/vscode/config.ts b/extension/src/vscode/config.ts index d6d3eb3bbf..69809de21f 100644 --- a/extension/src/vscode/config.ts +++ b/extension/src/vscode/config.ts @@ -5,7 +5,7 @@ export enum ConfigKey { DO_NOT_SHOW_CLI_UNAVAILABLE = 'dvc.doNotShowCliUnavailable', DO_NOT_SHOW_WALKTHROUGH_AFTER_INSTALL = 'dvc.doNotShowWalkthroughAfterInstall', DO_NOT_SHOW_UNABLE_TO_FILTER = 'dvc.doNotShowUnableToFilter', - EXP_TABLE_HEAD_MAX_DEPTH = 'dvc.experimentsTableHeadMaxHeight', + EXP_TABLE_HEAD_MAX_HEIGHT = 'dvc.experimentsTableHeadMaxHeight', DVC_PATH = 'dvc.dvcPath', PYTHON_PATH = 'dvc.pythonPath' }