Add back removing panels via menu

Signed-off-by: Julius Volz <julius.volz@gmail.com>
This commit is contained in:
Julius Volz 2024-03-07 16:59:47 +01:00
parent 1e523b204d
commit 124f36e670
2 changed files with 7 additions and 0 deletions

View file

@ -58,6 +58,7 @@ import {
IconTerminal,
IconTrash,
} from "@tabler/icons-react";
import { removePanel } from "../../state/queryPageSlice";
const promqlExtension = new PromQLExtension();
@ -106,11 +107,13 @@ export class HistoryCompleteStrategy implements CompleteStrategy {
interface ExpressionInputProps {
initialExpr: string;
executeQuery: (expr: string) => void;
removePanel: () => void;
}
const ExpressionInput: FC<ExpressionInputProps> = ({
initialExpr,
executeQuery,
removePanel,
}) => {
const theme = useComputedColorScheme();
const [expr, setExpr] = useState(initialExpr);
@ -183,6 +186,7 @@ const ExpressionInput: FC<ExpressionInputProps> = ({
leftSection={
<IconTrash style={{ width: rem(14), height: rem(14) }} />
}
onClick={removePanel}
>
Remove query
</Menu.Item>

View file

@ -52,6 +52,9 @@ const QueryPanel: FC<PanelProps> = ({ idx }) => {
setRetriggerIdx((idx) => idx + 1);
dispatch(setExpr({ idx, expr }));
}}
removePanel={() => {
dispatch(removePanel(idx));
}}
/>
<Tabs defaultValue="table" keepMounted={false}>
<Tabs.List>