-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* feat: create dataset module #478 * fix: review
- Loading branch information
1 parent
651cb08
commit 5e220c5
Showing
29 changed files
with
2,840 additions
and
56 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const defaultRoute = ''; |
130 changes: 130 additions & 0 deletions
130
app/src/js/applications/datasets/datasets/components/temporalField.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
import ReactSelect from 'react-select'; | ||
import React from 'react'; | ||
import D, { D1 } from '../../../../i18n/build-dictionary'; | ||
|
||
const datasetsTemporalCoverageOptions = [ | ||
{ | ||
value: 'http://www.w3.org/2001/XMLSchema#gYear', | ||
label: D.datasetsTemporalTypeYear, | ||
}, | ||
{ | ||
value: 'http://www.w3.org/2001/XMLSchema#date', | ||
label: D.datasetsTemporalTypeDate, | ||
}, | ||
]; | ||
|
||
export const TemporalField = ({ | ||
temporalCoverageStartDate, | ||
temporalCoverageEndDate, | ||
temporalCoverageDataType, | ||
updateTemporalCoverage, | ||
}) => { | ||
return ( | ||
<> | ||
<div className="col-md-4 form-group"> | ||
<label className="w-100 wilco-label-required"> | ||
{D1.datasetsTemporalCoverage} | ||
<ReactSelect | ||
value={temporalCoverageDataType} | ||
options={datasetsTemporalCoverageOptions} | ||
onChange={({ value }) => { | ||
updateTemporalCoverage({ | ||
temporalCoverageStartDate, | ||
temporalCoverageEndDate, | ||
temporalCoverageDataType: value, | ||
}); | ||
}} | ||
/> | ||
</label> | ||
</div> | ||
{temporalCoverageDataType?.endsWith('date') && ( | ||
<> | ||
<div className="col-md-4 form-group"> | ||
<label className="w-100 wilco-label-required"> | ||
{D1.datasetsTemporalStartDate} | ||
<input | ||
type="date" | ||
className="form-control" | ||
value={temporalCoverageStartDate} | ||
onChange={(e) => { | ||
updateTemporalCoverage({ | ||
temporalCoverageStartDate: e.target.value, | ||
temporalCoverageEndDate, | ||
temporalCoverageDataType, | ||
}); | ||
}} | ||
/> | ||
</label> | ||
</div> | ||
<div className="col-md-4 form-group"> | ||
<label className="w-100 wilco-label-required"> | ||
{D1.datasetsTemporalEndDate} | ||
<input | ||
type="date" | ||
className="form-control" | ||
value={temporalCoverageEndDate} | ||
onChange={(e) => { | ||
updateTemporalCoverage({ | ||
temporalCoverageStartDate, | ||
temporalCoverageEndDate: e.target.value, | ||
temporalCoverageDataType, | ||
}); | ||
}} | ||
/> | ||
</label> | ||
</div> | ||
</> | ||
)} | ||
{temporalCoverageDataType?.endsWith('Year') && ( | ||
<> | ||
<div className="col-md-4 form-group"> | ||
<label className="w-100 wilco-label-required"> | ||
{D1.datasetsTemporalStartDate} | ||
<input | ||
type="number" | ||
className="form-control" | ||
value={ | ||
temporalCoverageStartDate | ||
? new Date(temporalCoverageStartDate).getFullYear() | ||
: new Date().getFullYear() | ||
} | ||
onChange={(e) => { | ||
updateTemporalCoverage({ | ||
temporalCoverageEndDate: e.target.value, | ||
temporalCoverageDataType, | ||
temporalCoverageStartDate: new Date( | ||
`${e.target.value}-01-01` | ||
), | ||
}); | ||
}} | ||
/> | ||
</label> | ||
</div> | ||
<div className="col-md-4 form-group"> | ||
<label className="w-100 wilco-label-required"> | ||
{D1.datasetsTemporalEndDate} | ||
<input | ||
type="number" | ||
className="form-control" | ||
value={ | ||
temporalCoverageEndDate | ||
? new Date(temporalCoverageEndDate).getFullYear() | ||
: new Date().getFullYear() | ||
} | ||
onChange={(e) => { | ||
updateTemporalCoverage({ | ||
temporalCoverageStartDate: e.target.value, | ||
temporalCoverageDataType, | ||
temporalCoverageEndDate: new Date( | ||
`${e.target.value}-01-01` | ||
), | ||
}); | ||
}} | ||
/> | ||
</label> | ||
</div> | ||
</> | ||
)} | ||
</> | ||
); | ||
}; |
Oops, something went wrong.