Skip to content

Commit c61852d

Browse files
authored
[HUD][cost analysis] Change regex button to use component (#6987)
Please review #6986 first I created a component for the regex toggle search in an earlier PR, so this converts the cost analysis page to also use it. Also this fixes some warning I got about InputProps being deprecated and replaced with slotProps.input Changes: * I think there is slightly more animation now * The button changed shape slightly * The tooltip is different "Enable regex pattern matching" -> "Enable regex search" Old: <img width="211" height="67" alt="image" src="https://github.com/user-attachments/assets/09db8ac2-6aa0-4295-a94e-6e44c2b4f8c8" /> New: <img width="215" height="58" alt="image" src="https://github.com/user-attachments/assets/d5b62281-f734-449f-b552-e5eec8526235" />
1 parent b3cb6b2 commit c61852d

File tree

1 file changed

+8
-39
lines changed

1 file changed

+8
-39
lines changed

torchci/pages/cost_analysis.tsx

Lines changed: 8 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { DatePicker, LocalizationProvider } from "@mui/x-date-pickers";
1818
import { AdapterDayjs } from "@mui/x-date-pickers/AdapterDayjs";
1919
import CopyLink from "components/common/CopyLink";
2020
import MultiSelectPicker from "components/common/MultiSelectPicker";
21+
import RegexButton from "components/common/RegexButton";
2122
import TimeSeriesPanel, {
2223
ChartType,
2324
Granularity,
@@ -650,45 +651,13 @@ export default function Page() {
650651
variant="outlined"
651652
fullWidth
652653
value={inputValue}
653-
InputProps={{
654-
startAdornment: <FaFilter />,
655-
endAdornment: (
656-
<Tooltip
657-
title={
658-
isRegex
659-
? "Disable regex pattern matching"
660-
: "Enable regex pattern matching"
661-
}
662-
>
663-
<div
664-
style={{ cursor: "pointer" }}
665-
onClick={() => setIsRegex(!isRegex)}
666-
>
667-
<div
668-
style={{
669-
display: "flex",
670-
alignItems: "center",
671-
justifyContent: "center",
672-
padding: "4px 8px",
673-
marginRight: "4px",
674-
borderRadius: "4px",
675-
fontSize: "0.75rem",
676-
fontFamily: "monospace",
677-
backgroundColor: isRegex
678-
? "rgba(63, 81, 181, 0.1)"
679-
: "transparent",
680-
color: isRegex ? "primary.main" : "text.secondary",
681-
border: isRegex
682-
? "1px solid rgba(63, 81, 181, 0.5)"
683-
: "1px solid transparent",
684-
transition: "all 0.2s",
685-
}}
686-
>
687-
.*
688-
</div>
689-
</div>
690-
</Tooltip>
691-
),
654+
slotProps={{
655+
input: {
656+
startAdornment: <FaFilter />,
657+
endAdornment: (
658+
<RegexButton isRegex={isRegex} setIsRegex={setIsRegex} />
659+
),
660+
},
692661
}}
693662
/>
694663
</Box>

0 commit comments

Comments
 (0)