diff --git a/app/src/components/tables/VariableTable.js b/app/src/components/tables/VariableTable.js index 90c76aaa4..9c7a9a2e4 100644 --- a/app/src/components/tables/VariableTable.js +++ b/app/src/components/tables/VariableTable.js @@ -1,6 +1,7 @@ import React, { Component} from 'react' import ReactMarkdown from 'react-markdown' import PropTypes from 'prop-types' +import { isUndefined } from 'lodash' import Sectors from '../badges/Sectors' import { GroupToggleLink, filterGroups, filterField, toggleGroups } from '../../utils' @@ -184,6 +185,36 @@ const VariableTable = function({ config, caption, rows, groups, actions }) { } } + const getUnit = (row) => { + const unit = filterField(config, row.units) + return !isUndefined(unit) && ( + <> +
+ Unit: +
++ {unit} +
+ > + ) + } + + const getValid = (row) => { + const valid_min = filterField(config, row.valid_min) + const valid_max = filterField(config, row.valid_max) + return !isUndefined(valid_min) && !isUndefined(valid_max) && ( + <> + ++ Valid range: +
++ {valid_min} - {valid_max} +
+ > + ) + } + return (| Variable long name | Variable specifier | -Unit | +Unit / Valid range | Resolution | Comments @@ -223,7 +254,10 @@ const VariableTable = function({ config, caption, rows, groups, actions }) { |
|---|---|---|---|---|---|
| {row.long_name} | {getSpecifier(row)} | -{row.units} | ++ {getUnit(row)} + {getValid(row)} + |
|