@@ -7,18 +7,18 @@ import TableHeader from "./TableHeader/TableHeader";
77import Button from '@mui/material/Button' ;
88import SearchOffIcon from '@mui/icons-material/SearchOff' ;
99import { SvgIcon , Box , Typography } from "@mui/material" ;
10+ import PropTypes from "prop-types" ;
1011
1112import configManager from "../../../configManager/configManager" ;
12- const config = configManager . getConfig ( ) ;
1313
1414/**
1515 * @param {object } props - the props passed down to the component
1616 * @returns {Component } custom ListViewer as defined by react-admin containing the results of the query with each variable its generic field.
1717 */
1818function QueryResultList ( props ) {
19- const QueryTitle = useResourceDefinition ( ) . options . label ;
19+ const queryTitle = useResourceDefinition ( ) . options . label ;
2020 const { data } = useListContext ( props ) ;
21- const { changeVariables, submitted} = props ;
21+ const { resource , changeVariables, submitted} = props ;
2222 const [ values , setValues ] = useState ( undefined ) ;
2323 useEffect ( ( ) => {
2424 if ( data && data . length > 0 ) {
@@ -28,15 +28,18 @@ function QueryResultList(props) {
2828 }
2929 } , [ data ] ) ;
3030
31+ const config = configManager . getConfig ( ) ;
32+ const query = configManager . getQueryWorkingCopyById ( resource ) ;
33+
3134 return (
3235 < div style = { { paddingLeft : '20px' , paddingRight : '10px' } } >
3336 < Title title = { config . title } />
3437
3538 { submitted && < Aside changeVariables = { changeVariables } /> /* Adding button to make a new query - top left corner */ }
36- < Typography fontSize = { "2rem" } mt = { 2 } > { QueryTitle } </ Typography >
39+ < Typography fontSize = { "2rem" } mt = { 2 } > { queryTitle } </ Typography >
3740 { values ?(
38- < ListView title = " " actions = { < ActionBar /> } { ...props } >
39- < Datagrid header = { < TableHeader config = { config } /> } bulkActionButtons = { false } >
41+ < ListView title = " " actions = { < ActionBar /> } { ...props } >
42+ < Datagrid header = { < TableHeader query = { query } /> } bulkActionButtons = { false } >
4043 { Object . keys ( values ) . map ( ( key ) => {
4144 return (
4245 < GenericField
@@ -49,12 +52,18 @@ function QueryResultList(props) {
4952 </ Datagrid >
5053 </ ListView >
5154 ) :
52- < NoValuesDiplay />
55+ < NoValuesDisplay />
5356 }
5457 </ div >
5558 ) ;
5659}
5760
61+ QueryResultList . propTypes = {
62+ resource : PropTypes . string . isRequired ,
63+ changeVariables : PropTypes . func . isRequired ,
64+ submitted : PropTypes . bool . isRequired
65+ } ;
66+
5867/**
5968 *
6069 * @param {Array<Term> } data - a list of data objects
@@ -81,7 +90,7 @@ const Aside = (props) => {
8190 </ div >
8291) }
8392
84- const NoValuesDiplay = ( ) => {
93+ const NoValuesDisplay = ( ) => {
8594 return (
8695 < div >
8796 < Box display = "flex" alignItems = "center" sx = { { m :3 } } >
0 commit comments