From ea123bb5564723c4f9fc3a08aace4fe83de46ac7 Mon Sep 17 00:00:00 2001 From: Geoffrey Yu Date: Thu, 23 Jan 2025 18:21:51 -0500 Subject: [PATCH] Add table fields --- ui/src/components/CreateEditVdbeForm.jsx | 80 ++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/ui/src/components/CreateEditVdbeForm.jsx b/ui/src/components/CreateEditVdbeForm.jsx index 8c58fefe..da53ba55 100644 --- a/ui/src/components/CreateEditVdbeForm.jsx +++ b/ui/src/components/CreateEditVdbeForm.jsx @@ -1,4 +1,5 @@ import { useState } from "react"; +import { useTheme } from "@mui/material/styles"; import InsetPanel from "./InsetPanel"; import CheckCircleOutlineRoundedIcon from "@mui/icons-material/CheckCircleOutlineRounded"; import FormControl from "@mui/material/FormControl"; @@ -10,9 +11,85 @@ import Button from "@mui/material/Button"; import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline"; import EditRoundedIcon from "@mui/icons-material/EditRounded"; import Select from "@mui/material/Select"; +import Chip from "@mui/material/Chip"; +import Box from "@mui/material/Box"; +import OutlinedInput from "@mui/material/OutlinedInput"; import VdbeView from "./VdbeView"; import "./styles/CreateEditVdbeForm.css"; +const ITEM_HEIGHT = 47; +const ITEM_PADDING_TOP = 7; +const MenuProps = { + PaperProps: { + style: { + maxHeight: ITEM_HEIGHT * 3.5 + ITEM_PADDING_TOP, + width: 249, + }, + }, +}; + +function getStyles(name, selectedTables, theme) { + return { + fontWeight: selectedTables.includes(name) + ? theme.typography.fontWeightMedium + : theme.typography.fontWeightRegular, + }; +} + +function TableSelector({ tables }) { + const theme = useTheme(); + const [selectedTables, setSelectedTables] = useState([]); + + const handleChange = (event) => { + const { + target: { value }, + } = event; + setSelectedTables( + // On autofill we get a stringified value. + typeof value === "string" ? value.split(",") : value, + ); + }; + + return ( +
+ + Tables + + +
+ ); +} + function CreateEditFormFields({ vdbe, setVdbe }) { const onStalenessChange = (event) => { const maxStalenessMins = parseInt(event.target.value); @@ -32,6 +109,8 @@ function CreateEditFormFields({ vdbe, setVdbe }) { setVdbe({ ...vdbe, p90_latency_slo_ms: sloMs }); }; + const tables = ["tickets", "theatres", "movies"]; + return (
PostgreSQL SQL Athena SQL +
);