Skip to content

Commit

Permalink
Merge pull request #1017 from huss/moreV1.0.0
Browse files Browse the repository at this point in the history
More v1.0.0
  • Loading branch information
huss authored Sep 29, 2023
2 parents b092941 + 0e3ace8 commit 86af4a5
Show file tree
Hide file tree
Showing 42 changed files with 649 additions and 618 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ private
!/src/server/test/**/*.csv
!/src/server/data/unit/*.csv

# CSV gz files (except ones needed for database tests)
*.csv.gz
!/src/server/test/**/*.csv.gz
!/src/server/data/unit/*.csv.gz

# Database
postgres-data

Expand Down
6 changes: 3 additions & 3 deletions src/client/app/components/AreaUnitSelectComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ export default function AreaUnitSelectComponent() {
{graphState.areaNormalization &&
<div>
<p style={labelStyle}>
<FormattedMessage id='units.area' />:
<FormattedMessage id='area.unit' />:
</p>
<Select
options={unitOptions}
value={{ label: translate(`AreaUnitType.${graphState.selectedAreaUnit}`), value: graphState.selectedAreaUnit} as StringSelectOption}
value={{ label: translate(`AreaUnitType.${graphState.selectedAreaUnit}`), value: graphState.selectedAreaUnit } as StringSelectOption}
onChange={newSelectedUnit => {
if (newSelectedUnit) {
dispatch(updateSelectedAreaUnit(newSelectedUnit.value as AreaUnitType))
Expand All @@ -84,4 +84,4 @@ export default function AreaUnitSelectComponent() {
}
</div>
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function ConversionViewComponent(props: ConversionViewComponentPr
</div>
<div className="item-container">
{/* Only show first 30 characters so card does not get too big. Should limit to one line */}
<b><FormattedMessage id="conversion.note" /></b> {props.conversion.note.slice(0, 29)}
<b><FormattedMessage id="note" /></b> {props.conversion.note.slice(0, 29)}
</div>
<div className="edit-btn">
<Button color='secondary' onClick={handleShow}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ export default function CreateConversionModalComponent(props: CreateConversionMo
</Row>
{/* Note input*/}
<FormGroup>
<Label for='note'>{translate('conversion.note')}</Label>
<Label for='note'>{translate('note')}</Label>
<Input
id='note'
name='note'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export default function EditConversionModalComponent(props: EditConversionModalC
</Row>
{/* Note input */}
<FormGroup>
<Label for='note'>{translate('conversion.note')}</Label>
<Label for='note'>{translate('note')}</Label>
<Input
id='note'
name='note'
Expand All @@ -258,4 +258,4 @@ export default function EditConversionModalComponent(props: EditConversionModalC
</Modal>
</>
);
}
}
26 changes: 13 additions & 13 deletions src/client/app/components/csv/ReadingsCSVUploadComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import * as React from 'react';
import { Button, Col, Input, Form, FormGroup, Label } from 'reactstrap';
import { ReadingsCSVUploadProps, TimeSortTypes, BooleanTypes } from '../../types/csvUploadForm';
import { ReadingsCSVUploadProps, TimeSortTypes, BooleanMeterTypes } from '../../types/csvUploadForm';
import { ReadingsCSVUploadDefaults } from '../../utils/csvUploadDefaults';
import FormFileUploaderComponent from '../FormFileUploaderComponent';
import { FormattedMessage } from 'react-intl';
Expand Down Expand Up @@ -90,12 +90,12 @@ export default class ReadingsCSVUploadComponent extends React.Component<Readings

private handleSetCumulative(e: React.ChangeEvent<HTMLInputElement>) {
const target = e.target;
this.props.selectCumulative(target.value as BooleanTypes);
this.props.selectCumulative(target.value as BooleanMeterTypes);
}

private handleSetCumulativeReset(e: React.ChangeEvent<HTMLInputElement>) {
const target = e.target;
this.props.selectCumulativeReset(target.value as BooleanTypes);
this.props.selectCumulativeReset(target.value as BooleanMeterTypes);
}

private handleSetCumulativeResetStart(e: React.ChangeEvent<HTMLInputElement>) {
Expand All @@ -120,7 +120,7 @@ export default class ReadingsCSVUploadComponent extends React.Component<Readings

private handleSetEndOnly(e: React.ChangeEvent<HTMLInputElement>) {
const target = e.target;
this.props.selectEndOnly(target.value as BooleanTypes);
this.props.selectEndOnly(target.value as BooleanMeterTypes);
}

private handleSetHonorDst() {
Expand Down Expand Up @@ -194,9 +194,9 @@ export default class ReadingsCSVUploadComponent extends React.Component<Readings
</Label>
<Col sm={12}>
<Input type='select' name='cumulative' onChange={this.handleSetCumulative}>
<option value={BooleanTypes.meter}> {translate('BooleanTypes.meter')} </option>
<option value={BooleanTypes.true}> {translate('BooleanTypes.true')} </option>
<option value={BooleanTypes.false}> {translate('BooleanTypes.false')} </option>
<option value={BooleanMeterTypes.meter}> {translate('BooleanMeterTypes.meter')} </option>
<option value={BooleanMeterTypes.true}> {translate('BooleanMeterTypes.true')} </option>
<option value={BooleanMeterTypes.false}> {translate('BooleanMeterTypes.false')} </option>
</Input>
</Col>
</FormGroup>
Expand All @@ -206,9 +206,9 @@ export default class ReadingsCSVUploadComponent extends React.Component<Readings
</Label>
<Col sm={12}>
<Input type='select' name='cumulativeReset' onChange={this.handleSetCumulativeReset}>
<option value={BooleanTypes.meter}> {translate('BooleanTypes.meter')} </option>
<option value={BooleanTypes.true}> {translate('BooleanTypes.true')} </option>
<option value={BooleanTypes.false}> {translate('BooleanTypes.false')} </option>
<option value={BooleanMeterTypes.meter}> {translate('BooleanMeterTypes.meter')} </option>
<option value={BooleanMeterTypes.true}> {translate('BooleanMeterTypes.true')} </option>
<option value={BooleanMeterTypes.false}> {translate('BooleanMeterTypes.false')} </option>
</Input>
</Col>
</FormGroup>
Expand Down Expand Up @@ -269,9 +269,9 @@ export default class ReadingsCSVUploadComponent extends React.Component<Readings
</Label>
<Col sm={8}>
<Input type='select' name='endOnly' onChange={this.handleSetEndOnly}>
<option value={BooleanTypes.meter}> {translate('BooleanTypes.meter')} </option>
<option value={BooleanTypes.true}> {translate('BooleanTypes.true')} </option>
<option value={BooleanTypes.false}> {translate('BooleanTypes.false')} </option>
<option value={BooleanMeterTypes.meter}> {translate('BooleanMeterTypes.meter')} </option>
<option value={BooleanMeterTypes.true}> {translate('BooleanMeterTypes.true')} </option>
<option value={BooleanMeterTypes.false}> {translate('BooleanMeterTypes.false')} </option>
</Input>
</Col>
</FormGroup>
Expand Down
15 changes: 7 additions & 8 deletions src/client/app/components/groups/CreateGroupModalComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ export default function CreateGroupModalComponent(props: CreateGroupModalCompone
notifyMsg += '\n"' + meter.identifier + '"' + translate('group.area.calculate.error.zero');
}
});
translate('group.area.calculate.header')
let msg = translate('group.area.calculate.header') + areaSum + ' ' + translate(`AreaUnitType.${state.areaUnit}`);
if (notifyMsg != '') {
msg += '\n' + translate('group.area.calculate.error.header') + notifyMsg;
Expand Down Expand Up @@ -310,7 +309,7 @@ export default function CreateGroupModalComponent(props: CreateGroupModalCompone
<Row xs='1' lg='2'>
{/* Name input */}
<Col><FormGroup>
<Label for='name'>{translate('group.name')}</Label>
<Label for='name'>{translate('name')}</Label>
<Input
id='name'
name='name'
Expand All @@ -325,7 +324,7 @@ export default function CreateGroupModalComponent(props: CreateGroupModalCompone
</FormGroup></Col>
{/* default graphic unit input */}
<Col><FormGroup>
<Label for='defaultGraphicUnit'>{translate('group.defaultGraphicUnit')}</Label>
<Label for='defaultGraphicUnit'>{translate('defaultGraphicUnit')}</Label>
<Input
id='defaultGraphicUnit'
name='defaultGraphicUnit'
Expand All @@ -344,7 +343,7 @@ export default function CreateGroupModalComponent(props: CreateGroupModalCompone
</Row><Row xs='1' lg='2'>
{/* Displayable input */}
<Col><FormGroup>
<Label for='displayable'>{translate('group.displayable')}</Label>
<Label for='displayable'>{translate('displayable')}</Label>
<Input
id='displayable'
name='displayable'
Expand All @@ -358,7 +357,7 @@ export default function CreateGroupModalComponent(props: CreateGroupModalCompone
</FormGroup></Col>
{/* GPS input */}
<Col><FormGroup>
<Label for='gps'>{translate('group.gps')}</Label>
<Label for='gps'>{translate('gps')}</Label>
<Input
id='gps'
name='gps'
Expand All @@ -370,7 +369,7 @@ export default function CreateGroupModalComponent(props: CreateGroupModalCompone
</Row><Row xs='1' lg='2'>
{/* Area input */}
<Col><FormGroup>
<Label for='area'>{translate('group.area')}</Label>
<Label for='area'>{translate('area')}</Label>
<InputGroup>
<Input
id='area'
Expand All @@ -394,7 +393,7 @@ export default function CreateGroupModalComponent(props: CreateGroupModalCompone
</FormGroup></Col>
{/* meter area unit input */}
<Col><FormGroup>
<Label for='areaUnit'>{translate('group.area.unit')}</Label>
<Label for='areaUnit'>{translate('area.unit')}</Label>
<Input
id='areaUnit'
name='areaUnit'
Expand All @@ -413,7 +412,7 @@ export default function CreateGroupModalComponent(props: CreateGroupModalCompone
</Row>
{/* Note input */}
<FormGroup>
<Label for='note'>{translate('group.note')}</Label>
<Label for='note'>{translate('note')} </Label>
<Input
id='note'
name='note'
Expand Down
21 changes: 10 additions & 11 deletions src/client/app/components/groups/EditGroupModalComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ export default function EditGroupModalComponent(props: EditGroupModalComponentPr
notifyMsg += '\n"' + meter.identifier + '"' + translate('group.area.calculate.error.zero');
}
});
translate('group.area.calculate.header')
let msg = translate('group.area.calculate.header') + areaSum + ' ' + translate(`AreaUnitType.${groupState.areaUnit}`);
if (notifyMsg != '') {
msg += '\n' + translate('group.area.calculate.error.header') + notifyMsg;
Expand Down Expand Up @@ -424,7 +423,7 @@ export default function EditGroupModalComponent(props: EditGroupModalComponentPr
<Row xs='1' lg='2'>
{/* Name input for admin*/}
<Col><FormGroup>
<Label for='name'>{translate('group.name')}</Label>
<Label for='name'>{translate('name')}</Label>
<Input
id='name'
name='name'
Expand All @@ -439,7 +438,7 @@ export default function EditGroupModalComponent(props: EditGroupModalComponentPr
</FormGroup></Col>
{/* default graphic unit input for admin */}
<Col><FormGroup>
<Label for='defaultGraphicUnit'>{translate('group.defaultGraphicUnit')}</Label>
<Label for='defaultGraphicUnit'>{translate('defaultGraphicUnit')}</Label>
<Input
id='defaultGraphicUnit'
name='defaultGraphicUnit'
Expand All @@ -459,7 +458,7 @@ export default function EditGroupModalComponent(props: EditGroupModalComponentPr
: <>
{/* Name display for non-admin */}
<FormGroup>
<Label for='name'>{translate('group.name')}</Label>
<Label for='name'>{translate('name')}</Label>
<Input
id='name'
name='name'
Expand All @@ -470,7 +469,7 @@ export default function EditGroupModalComponent(props: EditGroupModalComponentPr
</FormGroup>
{/* default graphic unit display for non-admin */}
<FormGroup>
<Label for='defaultGraphicUnit'>{translate('group.defaultGraphicUnit')}</Label>
<Label for='defaultGraphicUnit'>{translate('defaultGraphicUnit')}</Label>
{/* TODO: This component still displays a dropdown arrow, even though a user cannot use the dropdown */}
<Input
id='defaultGraphicUnit'
Expand All @@ -489,7 +488,7 @@ export default function EditGroupModalComponent(props: EditGroupModalComponentPr
<Col>
{/* Displayable input, only for admin. */}
<FormGroup>
<Label for='displayable'>{translate('group.displayable')}</Label>
<Label for='displayable'>{translate('displayable')}</Label>
<Input
id='displayable'
name='displayable'
Expand All @@ -505,7 +504,7 @@ export default function EditGroupModalComponent(props: EditGroupModalComponentPr
<Col>
{/* GPS input, only for admin. */}
<FormGroup>
<Label for='gps'>{translate('group.gps')}</Label>
<Label for='gps'>{translate('gps')}</Label>
<Input
id='gps'
name='gps'
Expand All @@ -520,7 +519,7 @@ export default function EditGroupModalComponent(props: EditGroupModalComponentPr
<Col>
{/* Area input, only for admin. */}
<FormGroup>
<Label for='area'>{translate('group.area')}</Label>
<Label for='area'>{translate('area')}</Label>
<InputGroup>
<Input
id='area'
Expand All @@ -534,7 +533,7 @@ export default function EditGroupModalComponent(props: EditGroupModalComponentPr
invalid={groupState.area < 0} />
{/* Calculate sum of meter areas */}
<Button color='secondary' onClick={handleAutoCalculateArea}>
<FormattedMessage id="group.area.calculate" />
<FormattedMessage id="area.calculate.auto" />
</Button>
<TooltipMarkerComponent page='groups-edit' helpTextId='help.groups.area.calculate' />
<FormFeedback>
Expand All @@ -546,7 +545,7 @@ export default function EditGroupModalComponent(props: EditGroupModalComponentPr
<Col>
{/* meter area unit input */}
<FormGroup>
<Label for='areaUnit'>{translate('group.area.unit')}</Label>
<Label for='areaUnit'>{translate('area.unit')}</Label>
<Input
id='areaUnit'
name='areaUnit'
Expand All @@ -566,7 +565,7 @@ export default function EditGroupModalComponent(props: EditGroupModalComponentPr
</Row>
{/* Note input, only for admin. */}
<FormGroup>
<Label for='note'>{translate('group.note')}</Label>
<Label for='note'>{translate('note')} </Label>
<Input
id='note'
name='note'
Expand Down
8 changes: 4 additions & 4 deletions src/client/app/components/groups/GroupViewComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ export default function GroupViewComponent(props: GroupViewComponentProps) {
</div>
<div className="item-container">
{/* Use meter translation id string since same one wanted. */}
<b><FormattedMessage id="meter.defaultGraphicUnit" /></b>
<b><FormattedMessage id="defaultGraphicUnit" /></b>
{/* This is the default graphic unit associated with the group or no unit if none. */}
{props.group.defaultGraphicUnit === -99 ? ' ' + noUnitTranslated().identifier : ' ' + unitState[props.group.defaultGraphicUnit].identifier}
</div>
{loggedInAsAdmin &&
<div className={props.group.displayable.toString()}>
<b><FormattedMessage id="group.displayable" /></b> {translate(`TrueFalseType.${props.group.displayable.toString()}`)}
<b><FormattedMessage id="displayable" /></b> {translate(`TrueFalseType.${props.group.displayable.toString()}`)}
</div>
}
{/* Only show first 30 characters so card does not get too big. Should limit to one line */}
{loggedInAsAdmin &&
<div className="item-container">
<b><FormattedMessage id="group.note" /></b> {props.group.note?.slice(0, 29)}
<b><FormattedMessage id="note" /> </b> {props.group.note?.slice(0, 29)}
</div>
}
<div className="edit-btn">
Expand All @@ -90,4 +90,4 @@ export default function GroupViewComponent(props: GroupViewComponentProps) {
</div>
</div>
);
}
}
11 changes: 5 additions & 6 deletions src/client/app/components/maps/MapCalibrationComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import MapCalibrationChartDisplayContainer from '../../containers/maps/MapCalibr
import MapCalibrationInfoDisplayContainer from '../../containers/maps/MapCalibrationInfoDisplayContainer';
import UnsavedWarningContainer from '../../containers/UnsavedWarningContainer';
import HeaderComponent from '../../components/HeaderComponent';
import MapsDetailContainer from '../../containers/maps/MapsDetailContainer';

interface MapCalibrationProps {
mode: CalibrationModeTypes;
Expand All @@ -26,7 +27,7 @@ export default class MapCalibrationComponent extends React.Component<MapCalibrat
return (
<div className='container-fluid'>
<UnsavedWarningContainer />
<HeaderComponent/>
<HeaderComponent />
<MapCalibrationInitiateContainer />
</div>
);
Expand All @@ -36,17 +37,15 @@ export default class MapCalibrationComponent extends React.Component<MapCalibrat
<UnsavedWarningContainer />
<HeaderComponent />
<div id={'MapCalibrationContainer'}>
<MapCalibrationChartDisplayContainer/>
<MapCalibrationInfoDisplayContainer/>
<MapCalibrationChartDisplayContainer />
<MapCalibrationInfoDisplayContainer />
</div>
</div>
);
} else { // preview mode containers
return (
<div className='container-fluid'>
<UnsavedWarningContainer />
<HeaderComponent/>
<p/>
<MapsDetailContainer />
</div>
);
}
Expand Down
Loading

0 comments on commit 86af4a5

Please sign in to comment.