Skip to content

Commit

Permalink
#19 download complete table
Browse files Browse the repository at this point in the history
  • Loading branch information
p-a-s-c-a-l committed Jul 22, 2020
1 parent 72c7594 commit 1b8b046
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/components/HazardLocalEffectsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ const HazardLocalEffectsTable = (props) => {
<p>The table lists mean-, UTCI (Universal Thermal Climate Index)- and Apperent Temperature and Discomfort level for the selected RCP Scenario.</p>
<ParameterSelectionComponent
{...props}
emikatTemplateUrl={emikatTemplateUrl + columns}
emikatTemplateUrl={emikatTemplateUrl}
columns={columns}
client={GenericEmikatClient}
render={GenericEmikatTable}
props={{ resolveData: resolveData }}>
Expand Down
3 changes: 2 additions & 1 deletion src/components/RiskAndImpactTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const RiskAndImpactTable = (props) => {
return (
<ParameterSelectionComponent
{...props}
emikatTemplateUrl={emikatTemplateUrl + columns}
emikatTemplateUrl={emikatTemplateUrl}
columns={columns}
client={GenericEmikatClient}
render={GenericEmikatTable}>
</ParameterSelectionComponent>);
Expand Down
12 changes: 9 additions & 3 deletions src/components/commons/ParameterSelectionComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import DownloadButton from './DownloadButton.js';
*
* @param {*} props props
*/
const ParameterSelectionComponent = ({ emikatTemplateUrl, emikatParameters, emikatCredentials, selectionUiVisible, client: EmikatClientComponent, render: EmikatVisualisationComponent, props }) => {
const ParameterSelectionComponent = ({ emikatTemplateUrl, columns, emikatParameters, emikatCredentials, selectionUiVisible, client: EmikatClientComponent, render: EmikatVisualisationComponent, props }) => {

log.info('creating new ParameterSelectionComponent');
//log.debug(props);
Expand Down Expand Up @@ -131,13 +131,13 @@ const ParameterSelectionComponent = ({ emikatTemplateUrl, emikatParameters, emik
OK, but how does the EmikatVisualisationComponent get it's props? -> From EmikatClientComponent, not from the outside!
Passing dynamic props from parent to children is not as straightforward as one might imagine. See https://stackoverflow.com/a/32371612
*/}
<EmikatClientComponent emikatUrl={parametriseEmikatTemplateUrl(emikatTemplateUrl, state)} emikatCredentials={emikatCredentials} render={EmikatVisualisationComponent} props={props} />
<EmikatClientComponent emikatUrl={parametriseEmikatTemplateUrl(emikatTemplateUrl+columns, state)} emikatCredentials={emikatCredentials} render={EmikatVisualisationComponent} props={props} />
<DownloadButton emikatTemplateUrl={emikatTemplateUrl} emikatParameters={state} emikatCredentials={emikatCredentials} />
</>);
} else {
return (
<>
<EmikatClientComponent emikatUrl={parametriseEmikatTemplateUrl(emikatTemplateUrl, state)} emikatCredentials={emikatCredentials} render={EmikatVisualisationComponent} props={props} />
<EmikatClientComponent emikatUrl={parametriseEmikatTemplateUrl(emikatTemplateUrl+columns, state)} emikatCredentials={emikatCredentials} render={EmikatVisualisationComponent} props={props} />
<DownloadButton emikatTemplateUrl={emikatTemplateUrl} emikatParameters={state} emikatCredentials={emikatCredentials} />
</>
);
Expand Down Expand Up @@ -172,6 +172,11 @@ ParameterSelectionComponent.propTypes = {
emissionsScenario: PropTypes.oneOf(EMIKATHelpers.EMISSIONS_SCENARIO_VALUES),
eventFrequency: PropTypes.oneOf(EMIKATHelpers.EVENT_FREQUENCY_VALUES),
}).isRequired,

/**
* Columns to be shown in table
*/
columns: PropTypes.string,

/**
* The Basic Auth credentials
Expand Down Expand Up @@ -202,6 +207,7 @@ ParameterSelectionComponent.propTypes = {
ParameterSelectionComponent.defaultProps = {

emikatTemplateUrl: 'https://service.emikat.at/EmiKatTst/api/',
columns: '',
emikatParameters: {
emikatStudyId: undefined,
dataFormat: EMIKATHelpers.DATA_FORMAT_VALUES[0],
Expand Down

0 comments on commit 1b8b046

Please sign in to comment.