Skip to content

Commit f29a447

Browse files
committed
TemplatedQueryForm: customized SaveButton into a "Query" button
1 parent 0d6a894 commit f29a447

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/components/ListResultTable/TemplatedQueryForm.jsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
import {SelectInput, SimpleForm, required} from "react-admin";
1+
import {Toolbar, SaveButton, SelectInput, SimpleForm, required} from "react-admin";
2+
import DoneIcon from '@mui/icons-material/Done';
23
import {Component} from "react";
34
import PropTypes from "prop-types";
45

6+
const MyToolbar = () => (
7+
<Toolbar>
8+
<SaveButton icon={<DoneIcon />} label="Query"/>
9+
</Toolbar>
10+
);
11+
512
/**
613
* A custom form to set/choose values for variables for a templated query before that query is executed
714
* @param {object} props - the props passed down to the component
@@ -13,7 +20,7 @@ const TemplatedQueryForm = (props) => {
1320
onSubmit
1421
} = props;
1522
return (
16-
<SimpleForm onSubmit={onSubmit}>
23+
<SimpleForm toolbar={<MyToolbar />} onSubmit={onSubmit}>
1724
{Object.entries(variableOptions).map(([name, options]) => (
1825
<SelectInput key={name} source={name} name={name} label={name} validate={required()} choices={
1926
options.map((option) => ({

0 commit comments

Comments
 (0)