Skip to content
Snippets Groups Projects
Commit 09b79d28 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

adding VO registry of registeries. Requires to move from dataset based...

adding VO registry of registeries. Requires to move from dataset based querying to query based querying
parent 6a043007
No related branches found
No related tags found
1 merge request!6Merge branch 'esap-gui-dev' into 'master'
import React from 'react';
import {Card, Table } from 'react-bootstrap'
import { useGlobalReducer } from '../../Store';
import DocumentationLink from '../buttons/DocumentationLink'
// display a single query on a card
export default function QueryCard(props) {
const [ my_state , my_dispatch] = useGlobalReducer()
// only show if there is content
if (!props.query) {
return null
}
return (
<Card className="card-description">
<Card.Body>
<Card.Title>{props.query.dataset_name}</Card.Title>
<Card.Text>
<Table striped bordered hover size="sm">
<tbody>
<tr>
<td className="key">ID</td>
<td className="value">{props.query.query_id}</td>
</tr>
<tr>
<td className="key">Query</td>
<td className="value">{props.query.query}</td>
</tr>
<tr>
<td className="key">Description</td>
<td className="value">{props.query.res_description}</td>
</tr>
</tbody>
</Table>
</Card.Text>
<DocumentationLink url={props.query.reference_url}/>&nbsp;
</Card.Body>
</Card>
);
}
...@@ -41,14 +41,8 @@ export const useFetchRunQuery = (url, options) => { ...@@ -41,14 +41,8 @@ export const useFetchRunQuery = (url, options) => {
// this sets the json in the response, which is in itself a useState hook // this sets the json in the response, which is in itself a useState hook
setResponse(json); setResponse(json);
//let query_results = {}
//query_results[query] = json.query_results
// dispatch the fetched data (per query) and the status to the global state // dispatch the fetched data (per query) and the status to the global state
my_dispatch({type: SET_FETCHED_QUERY_RESULTS, fetched_query_results: json.query_results}) my_dispatch({type: SET_FETCHED_QUERY_RESULTS, fetched_query_results: json.query_results})
//query_status = query+":fetched"
//query_status_object[query]=query_status
my_dispatch({type: SET_STATUS_RUN_QUERY, status_run_query: query+":fetched"}) my_dispatch({type: SET_STATUS_RUN_QUERY, status_run_query: query+":fetched"})
......
...@@ -238,8 +238,7 @@ export default function QueryArchives(props) { ...@@ -238,8 +238,7 @@ export default function QueryArchives(props) {
// clear previous results // clear previous results
my_dispatch({type: SET_FETCHED_QUERY_INPUT, fetched_query: undefined}) my_dispatch({type: SET_FETCHED_QUERY_INPUT, fetched_query: undefined})
//my_dispatch({type: SET_FETCHED_QUERY_RESULTS, fetched_query_results: {}})
my_dispatch({type: SET_FETCHED_QUERY_RESULTS, fetched_query_results: {}})
// this clears the output results grid/tiles of the executed queries // this clears the output results grid/tiles of the executed queries
my_dispatch({type: SET_STATUS_RUN_QUERY, status_run_query: undefined}) my_dispatch({type: SET_STATUS_RUN_QUERY, status_run_query: undefined})
...@@ -248,7 +247,7 @@ export default function QueryArchives(props) { ...@@ -248,7 +247,7 @@ export default function QueryArchives(props) {
let queries = my_state.queries_to_run let queries = my_state.queries_to_run
if (queries) { if (queries) {
for (var i = 0; i < queries.length; i++) { for (var i = 0; i < queries.length; i++) {
my_dispatch({type: SET_STATUS_RUN_QUERY, status_run_query: queries[i].dataset_name + ":fetched"}) my_dispatch({type: SET_STATUS_RUN_QUERY, status_run_query: queries[i].dataset_name + ":n/a"})
} }
} }
......
...@@ -70,17 +70,25 @@ export default function QueryInputResultsGrid(props) { ...@@ -70,17 +70,25 @@ export default function QueryInputResultsGrid(props) {
const columns = [ const columns = [
{ {
name: 'dataset uri', name: 'ID',
selector: 'dataset', selector: 'query_id',
sortable: true, sortable: true,
width: "10%" width: "10%"
}, },
{ {
name: 'dataset name', name: 'dataset',
selector: 'dataset_name', selector: 'dataset_name',
sortable: true, sortable: true,
width: "15%" width: "15%"
}, },
/*
{
name: 'Waveband',
selector: 'waveband',
sortable: true,
width: "10%"
},
*/
/* /*
{ {
name: 'service', name: 'service',
...@@ -88,20 +96,26 @@ export default function QueryInputResultsGrid(props) { ...@@ -88,20 +96,26 @@ export default function QueryInputResultsGrid(props) {
sortable: true, sortable: true,
width: "5%" width: "5%"
}, },
*/
{ {
name: 'service connector', name: 'service connector',
selector: 'service_connector', selector: 'service_connector',
sortable: true, sortable: true,
width: "10%" width: "10%"
}, },
*/
{ {
name: 'status', name: 'status',
sortable: true, sortable: true,
width: "10%", width: "10%",
cell: row => getStatus(row), cell: row => getStatus(row),
}, },
{
name: 'access_url',
sortable: true,
width: "20%",
selector: 'service_url',
},
/* /*
{ {
name: 'resource', name: 'resource',
...@@ -110,6 +124,7 @@ export default function QueryInputResultsGrid(props) { ...@@ -110,6 +124,7 @@ export default function QueryInputResultsGrid(props) {
width: "10%" width: "10%"
}, },
*/ */
/*
{ {
name: 'query', name: 'query',
selector: 'query', selector: 'query',
...@@ -119,6 +134,16 @@ export default function QueryInputResultsGrid(props) { ...@@ -119,6 +134,16 @@ export default function QueryInputResultsGrid(props) {
{row.query}&nbsp; {row.query}&nbsp;
</a>, </a>,
}, },
*/
{
name: 'Reference',
selector: 'reference_url',
sortable: true,
cell: row =>
<a href={row.reference_url} target="_blank">
{row.reference_url}&nbsp;
</a>,
},
]; ];
......
...@@ -9,6 +9,7 @@ import { getBackendUrl } from '../../utils/web' ...@@ -9,6 +9,7 @@ import { getBackendUrl } from '../../utils/web'
import AddToBasketButton from '../../components/buttons/AddToBasketButton' import AddToBasketButton from '../../components/buttons/AddToBasketButton'
import DataProductImageCard from '../../components/cards/DataProductImageCard' import DataProductImageCard from '../../components/cards/DataProductImageCard'
import QueryCard from '../../components/cards/QueryCard'
// the definition of the columns // the definition of the columns
// moved outside of the main function so that it will not rerender // moved outside of the main function so that it will not rerender
...@@ -80,13 +81,12 @@ export default function QueryOutputResultsGrid(props) { ...@@ -80,13 +81,12 @@ export default function QueryOutputResultsGrid(props) {
sortable: true, sortable: true,
width: "20%" width: "20%"
}, },
{ {
name: 'Result', name: 'Result',
selector: 'result', selector: 'result',
sortable: true, sortable: true,
cell: row => drawResult(row), cell: row => drawResult(row),
width: "20%" //width: "20%"
}, },
{ {
name: 'Link to data', name: 'Link to data',
...@@ -121,19 +121,18 @@ export default function QueryOutputResultsGrid(props) { ...@@ -121,19 +121,18 @@ export default function QueryOutputResultsGrid(props) {
// get the query results from the state // get the query results from the state
let datasetsToQuery = my_state.queries_to_run let datasetsToQuery = my_state.queries_to_run
let data let data
let title = "Query Results (List)"
if (props.dataset) { if (props.query) {
// filter the data on dataset // dataset is given as a parameter (current situation)
title = "Query Results: " + props.dataset.dataset_name data = my_state["fetched_query_results." + props.query.dataset_name]
let key = "fetched_query_results." + props.dataset.dataset_name
data = my_state[key]
} else } else
if (props.data) { if (props.data) {
// data is given as a parameter (currently not used)
data = props.data data = props.data
} else { } else {
// combine the results from different queries. // combine the results from different queries.
// iterate through the results of the several queries // iterate through the results of the several queries
data = [] data = []
...@@ -152,11 +151,12 @@ export default function QueryOutputResultsGrid(props) { ...@@ -152,11 +151,12 @@ export default function QueryOutputResultsGrid(props) {
// alert('total length = ' + data.length.toString()) // alert('total length = ' + data.length.toString())
} }
let queryCard = <QueryCard query={props.query}/>
return ( return (
<div> <div>
<h4>&nbsp;&nbsp;{title}</h4> {queryCard}
<DataTable <DataTable
// title="Query Results"
columns={columns} columns={columns}
data={data} data={data}
striped={true} striped={true}
......
...@@ -6,6 +6,7 @@ import { useGlobalReducer } from '../../Store'; ...@@ -6,6 +6,7 @@ import { useGlobalReducer } from '../../Store';
import { SET_ACTIVE_DATASET } from '../../reducers/GlobalStateReducer' import { SET_ACTIVE_DATASET } from '../../reducers/GlobalStateReducer'
import { getBackendUrl } from '../../utils/web' import { getBackendUrl } from '../../utils/web'
import QueryCard from '../../components/cards/QueryCard'
import AddToBasketButton from '../../components/buttons/AddToBasketButton' import AddToBasketButton from '../../components/buttons/AddToBasketButton'
import Tiles from '../../components/Tiles' import Tiles from '../../components/Tiles'
...@@ -20,10 +21,10 @@ export default function QueryOutputResultsTiles(props) { ...@@ -20,10 +21,10 @@ export default function QueryOutputResultsTiles(props) {
// iterate through the results of the several queries // iterate through the results of the several queries
data = [] data = []
if (props.dataset) { if (props.query) {
// filter the data on dataset // filter the data on dataset
title = "Query Results: " + props.dataset.dataset_name title = "Query Results: " + props.query.dataset_name
let key = "fetched_query_results." + props.dataset.dataset_name let key = "fetched_query_results." + props.query.dataset_name
data = my_state[key] data = my_state[key]
} else } else
...@@ -51,9 +52,11 @@ export default function QueryOutputResultsTiles(props) { ...@@ -51,9 +52,11 @@ export default function QueryOutputResultsTiles(props) {
renderData = <Tiles data = {data} /> renderData = <Tiles data = {data} />
} }
let queryCard = <QueryCard query={props.query}/>
return ( return (
<div> <div>
<h4>&nbsp;&nbsp;{title}</h4> {queryCard}
<div className="App"> <div className="App">
<Container fluid> <Container fluid>
......
...@@ -21,11 +21,11 @@ export default function QueryResultsPage(props) { ...@@ -21,11 +21,11 @@ export default function QueryResultsPage(props) {
// get the query results from the state // get the query results from the state
let renderOutputResults let renderOutputResults
const renderQueryResults = (dataset) => { const renderQueryResults = (query) => {
if (dataset.output_format.toUpperCase()==='TILES') { if (query.output_format.toUpperCase()==='TILES') {
return <QueryOutputResultsTiles dataset={dataset}/> return <QueryOutputResultsTiles query={query}/>
} else { } else {
return <QueryOutputResultsGrid dataset={dataset}/> return <QueryOutputResultsGrid query={query}/>
} }
} }
...@@ -39,7 +39,6 @@ export default function QueryResultsPage(props) { ...@@ -39,7 +39,6 @@ export default function QueryResultsPage(props) {
// iterate through the results of the several queries // iterate through the results of the several queries
renderOutputResults = my_state.queries_to_run.map(query => { renderOutputResults = my_state.queries_to_run.map(query => {
//let key = "fetched_query_results." + dataset.dataset
let key = "fetched_query_results." + query.dataset_name let key = "fetched_query_results." + query.dataset_name
let resultsPerQuery = my_state[key] let resultsPerQuery = my_state[key]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment