Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Local data source ID is optional, added tooltip mentioning OPeNDAP wrt
Browse files Browse the repository at this point in the history
  • Loading branch information
forman committed Sep 27, 2017
1 parent e315ca2 commit 60047d1
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/renderer/containers/DataAccessComponent.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import {Checkbox, Collapse} from "@blueprintjs/core";
import {Checkbox, Collapse, Tooltip} from "@blueprintjs/core";
import {DataSourceState, ResourceState, VariableState} from "../state";
import {formatDateAsISODateString} from "../../common/format";
import * as types from "../../common/cate-types";
Expand Down Expand Up @@ -120,12 +120,13 @@ export class DataAccessComponent extends React.Component<IDataAccessComponentPro
const temporalCoverage = this.props.temporalCoverage;
const minDate = temporalCoverage && temporalCoverage[0] ? new Date(temporalCoverage[0]) : new Date('1980-01-01');
const maxDate = temporalCoverage && temporalCoverage[1] ? new Date(temporalCoverage[1]) : new Date(Date.now());
const temporalCoverageText = temporalCoverage ? <span>Data availability: {temporalCoverage.join(', ')}</span> : '';
const temporalCoverageText = temporalCoverage ?
<span>Data availability: {temporalCoverage.join(', ')}</span> : '';

const options = this.props.options;

const hasTimeConstraint = options.hasTimeConstraint;
const dateRange = hasTimeConstraint ? options.dateRange || {value:[minDate, maxDate]} : options.dateRange;
const dateRange = hasTimeConstraint ? options.dateRange || {value: [minDate, maxDate]} : options.dateRange;
if (hasTimeConstraint && options.dateRange) {
try {
// re-validate, because min, max may have changed
Expand Down Expand Up @@ -168,17 +169,20 @@ export class DataAccessComponent extends React.Component<IDataAccessComponentPro
} else {
headerText = (<p>Remote data source:<br/>{dataSourceNameElement}</p>);
localDataSourceCheck = (
<Checkbox style={DataAccessComponent.OPTION_CHECK_STYPE}
checked={isMakeLocalSelected}
label="Download and make local data source (allocates space on disk)"
onChange={this.onMakeLocalSelectedChange}/>
<Tooltip
content="If unchecked, remote data will be accessed using an available protocol, e.g. OPeNDAP.">
<Checkbox style={DataAccessComponent.OPTION_CHECK_STYPE}
checked={isMakeLocalSelected}
label="Download and make local data source (allocates space on disk)"
onChange={this.onMakeLocalSelectedChange}/>
</Tooltip>
);
localDataSourcePanel = (
<Collapse isOpen={isMakeLocalSelected}>
<div style={DataAccessComponent.OPTION_DIV_STYPE}>
<label className="pt-label">
Unique identifier for the new local data source
<span className="pt-text-muted"> (required)</span>
<span className="pt-text-muted"> (optional)</span>
<input className="pt-input"
style={{width: '100%'}}
type="text"
Expand Down Expand Up @@ -369,16 +373,16 @@ export class DataAccessComponent extends React.Component<IDataAccessComponentPro
};
}

static adjustLocalDataSourceName(options: IDataAccessComponentOptions, dataSource: DataSourceState): IDataAccessComponentOptions {
if (!options.makeLocalDataSourceId || options.makeLocalDataSourceId === '') {
let dataSourceId = dataSource && dataSource.id;
if (!dataSourceId) {
dataSourceId = 'unnamed';
}
return {...options, makeLocalDataSourceId: 'local.' + dataSourceId};
}
return options;
}
// static adjustLocalDataSourceName(options: IDataAccessComponentOptions, dataSource: DataSourceState): IDataAccessComponentOptions {
// if (!options.makeLocalDataSourceId || options.makeLocalDataSourceId === '') {
// let dataSourceId = dataSource && dataSource.id;
// if (!dataSourceId) {
// dataSourceId = 'unnamed';
// }
// return {...options, makeLocalDataSourceId: 'local.' + dataSourceId};
// }
// return options;
// }
}


0 comments on commit 60047d1

Please sign in to comment.