From 319f9d5fcfa8b792a71479e7f3c932e38b2deb94 Mon Sep 17 00:00:00 2001 From: blonde-mike Date: Wed, 27 Nov 2024 13:50:47 -0700 Subject: [PATCH] Michael/perf 1699 (#270) * Updated Request tool to get it online * Removed unused component * Updates to remove lint errors --- guide/results-viewer-react/package-lock.json | 56 ++- guide/results-viewer-react/package.json | 1 + .../src/components/Modal/index.tsx | 19 +- .../components/YamlQuestionBubble/index.tsx | 4 +- .../src/components/YamlUrls/index.tsx | 338 +++++++++++------- .../src/components/YamlUrls/story.tsx | 24 +- 6 files changed, 302 insertions(+), 140 deletions(-) diff --git a/guide/results-viewer-react/package-lock.json b/guide/results-viewer-react/package-lock.json index 6b0ae943..be2e8954 100644 --- a/guide/results-viewer-react/package-lock.json +++ b/guide/results-viewer-react/package-lock.json @@ -10,6 +10,7 @@ "license": "ISC", "dependencies": { "@fs/hdr-histogram-wasm": "file:./lib/hdr-histogram-wasm", + "axios": "^1.7.8", "chart.js": "~4.4.0", "chartjs-adapter-date-fns": "^3.0.0", "date-fns": "^3.0.0", @@ -5400,6 +5401,11 @@ "node": ">=4" } }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "node_modules/attr-accept": { "version": "2.2.5", "resolved": "https://registry.npmjs.org/attr-accept/-/attr-accept-2.2.5.tgz", @@ -5425,6 +5431,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/axios": { + "version": "1.7.8", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.8.tgz", + "integrity": "sha512-Uu0wb7KNqK2t5K+YQyVCLM76prD5sRFjKHbJYCP1J7JFGEQ6nN7HWn9+04LAeiJ3ji54lgS/gZCH1oxyrf1SPw==", + "dependencies": { + "follow-redirects": "^1.15.6", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, "node_modules/babel-loader": { "version": "9.2.1", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.2.1.tgz", @@ -6357,6 +6373,17 @@ "dev": true, "license": "MIT" }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/commander": { "version": "8.3.0", "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", @@ -6909,6 +6936,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/depd": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", @@ -7974,7 +8009,6 @@ "version": "1.15.9", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.9.tgz", "integrity": "sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==", - "dev": true, "funding": [ { "type": "individual", @@ -8062,6 +8096,19 @@ "node": ">=10" } }, + "node_modules/form-data": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", + "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/forwarded": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", @@ -9524,7 +9571,6 @@ "version": "1.52.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.6" @@ -9534,7 +9580,6 @@ "version": "2.1.35", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", - "dev": true, "license": "MIT", "dependencies": { "mime-db": "1.52.0" @@ -10679,6 +10724,11 @@ "node": ">= 0.10" } }, + "node_modules/proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, "node_modules/public-encrypt": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", diff --git a/guide/results-viewer-react/package.json b/guide/results-viewer-react/package.json index b3cb6ae8..c35f1e05 100644 --- a/guide/results-viewer-react/package.json +++ b/guide/results-viewer-react/package.json @@ -29,6 +29,7 @@ "homepage": "https://github.com/FamilySearch/pewpew/tree/master/lib/config-wasm#readme", "dependencies": { "@fs/hdr-histogram-wasm": "file:./lib/hdr-histogram-wasm", + "axios": "^1.7.8", "chart.js": "~4.4.0", "chartjs-adapter-date-fns": "^3.0.0", "date-fns": "^3.0.0", diff --git a/guide/results-viewer-react/src/components/Modal/index.tsx b/guide/results-viewer-react/src/components/Modal/index.tsx index 0868b546..d20d0d2c 100644 --- a/guide/results-viewer-react/src/components/Modal/index.tsx +++ b/guide/results-viewer-react/src/components/Modal/index.tsx @@ -92,6 +92,7 @@ interface ModalProps { submitText?: string; children?: React.ReactNode; isReady?: boolean; + scrollable?: boolean; } export interface ModalObject { @@ -134,7 +135,8 @@ export const Modal = forwardRef(({ onSubmit, submitText = "submit", children, - isReady + isReady, + scrollable }: ModalProps, ref: Ref) => { const [display, setDisplay] = useState(false); let windowOffset: number = 0; @@ -177,10 +179,15 @@ export const Modal = forwardRef(({ }; const submit = (event?: React.MouseEvent) => { - const scrollY = document.getElementById("root")!.style.top; - document.getElementById("root")!.style.position = ""; - document.getElementById("root")!.style.top = ""; - window.scrollTo(0, parseInt(scrollY || "0", 10) * -1); + const root = document.getElementById("root"); + if (root) { + const scrollY = root.style.top; + root.style.position = ""; + root.style.top = ""; + window.scrollTo(0, parseInt(scrollY || "0", 10) * -1); + } else { + log("Cannot find element #root", LogLevel.DEBUG); + } if (onSubmit) { onSubmit(event).finally(() => setDisplay(false)); } else { @@ -195,7 +202,7 @@ export const Modal = forwardRef(({ {title && {title}} - {children}{/* Any elements that are children of modal will be rendered here */} + {children}{/* Any elements that are children of modal will be rendered here */} {onSubmit && -

Endpoint must be in the form "https://www.(url)" or "http://www.(url)"

- - - - - - changeUrl("hitRate", event.target.value)} name={data.id} value={data.hitRate} id="urlHitrate" title={getHitRateTitle(invalidHitRate)} /> - - - - - - - -
- - - - - - - - - - {headers.map((header: PewPewHeader, index: number) => { - // This maps out all of the headers uploaded from har file - return ( - - - -
NameValue
changeHeader(index, "name", event.target.value)} />