From bca9c73342c9aa928037f3f893ef0d080669bbd8 Mon Sep 17 00:00:00 2001 From: Jad Chahed Date: Thu, 4 Jul 2024 17:20:15 +0200 Subject: [PATCH] refactor: foreig keys hero Signed-off-by: Jad Chahed --- .../pages/ForeignKeysPage/ForeignKeysPage.tsx | 12 ++-- .../{Hero.tsx => ForeignKeysHero.tsx} | 61 ++++++++++--------- 2 files changed, 38 insertions(+), 35 deletions(-) rename website/src/pages/ForeignKeysPage/components/{Hero.tsx => ForeignKeysHero.tsx} (61%) diff --git a/website/src/pages/ForeignKeysPage/ForeignKeysPage.tsx b/website/src/pages/ForeignKeysPage/ForeignKeysPage.tsx index dcdefb051..d77b79b26 100644 --- a/website/src/pages/ForeignKeysPage/ForeignKeysPage.tsx +++ b/website/src/pages/ForeignKeysPage/ForeignKeysPage.tsx @@ -20,10 +20,11 @@ import RingLoader from "react-spinners/RingLoader"; import { MacrosData } from '@/types' import { errorApi } from "../../utils/Utils"; -import Hero from "./components/Hero"; +import Hero from "./components/ForeignKeysHero"; import FK from "./components/FK"; +import ForeignKeysHero from "./components/ForeignKeysHero"; -interface Ref { +export interface Ref { Name: string; CommitHash: string; Version: { @@ -34,7 +35,7 @@ interface Ref { RCnumber: number; } -interface ForeignKeysProps {} +interface ForeignKeysProps { } const ForeignKeys: React.FC = () => { const urlParams = new URLSearchParams(window.location.search); @@ -68,8 +69,7 @@ const ForeignKeys: React.FC = () => { setLoading(true); try { const responseFK = await fetch( - `${import.meta.env.VITE_API_URL}fk/compare?sha=${ - commits.tag + `${import.meta.env.VITE_API_URL}fk/compare?sha=${commits.tag }` ); const jsonDataFKs = await responseFK.json(); @@ -95,7 +95,7 @@ const ForeignKeys: React.FC = () => { return ( <> - +
diff --git a/website/src/pages/ForeignKeysPage/components/Hero.tsx b/website/src/pages/ForeignKeysPage/components/ForeignKeysHero.tsx similarity index 61% rename from website/src/pages/ForeignKeysPage/components/Hero.tsx rename to website/src/pages/ForeignKeysPage/components/ForeignKeysHero.tsx index fb08d9470..727ec2455 100644 --- a/website/src/pages/ForeignKeysPage/components/Hero.tsx +++ b/website/src/pages/ForeignKeysPage/components/ForeignKeysHero.tsx @@ -14,10 +14,37 @@ See the License for the specific language governing permissions and limitations under the License. */ import React from "react"; -import Dropdown from "../../../common/Dropdown"; +import Dropdown from "@/common/Dropdown"; +import Hero, { HeroProps } from "@/common/Hero"; import { twMerge } from "tailwind-merge"; -export default function Hero(props: { +const heroProps: HeroProps = { + title: "Foreign Keys", + description: ( +

+ Support for Foreign Keys have been added to Vitess in v18.0.0. We want + to be able to compare the performance of Vitess with and without + Foreign Keys. +
+ For this purpose, we propose four benchmarks: +
+ - TPCC, with a sharded keyspace +
+ - TPCC_UNSHARDED, with an unsharded keyspace +
+ - TPCC_FK, with Foreign Keys enabled and set to vitess managed +
+ - TPCC_FK_UNMANAGED, with Foreign Keys enabled and set to vitess + unmanaged +
+ Use the dropdown on the right to select which version of Vitess you + would like to use to compare the performance of our four TPCC + benchmarks. +

+ ), +}; + +export default function ForeignKeysHero(props: { refs: any; gitRef: any; setGitRef: any; @@ -25,37 +52,13 @@ export default function Hero(props: { const { refs, gitRef, setGitRef } = props; return ( -
-
-

Foreign Keys

-

- Support for Foreign Keys have been added to Vitess in v18.0.0. We want - to be able to compare the performance of Vitess with and without - Foreign Keys. -
- For this purpose, we propose four benchmarks: -
- - TPCC, with a sharded keyspace -
- - TPCC_UNSHARDED, with an unsharded keyspace -
- - TPCC_FK, with Foreign Keys enabled and set to vitess managed -
- - TPCC_FK_UNMANAGED, with Foreign Keys enabled and set to vitess - unmanaged -
- Use the dropdown on the right to select which version of Vitess you - would like to use to compare the performance of our four TPCC - benchmarks. -

-
- +
{refs && refs.length > 0 && (
r.Name) .indexOf(gitRef.tag)} @@ -82,6 +85,6 @@ export default function Hero(props: { )}
-
+ ); }