Skip to content

Commit

Permalink
Merge pull request #1029 from huss/v1.0Last
Browse files Browse the repository at this point in the history
Fix meter your page layout and functions parameter name
  • Loading branch information
huss authored Oct 1, 2023
2 parents 86af4a5 + 4db0f9c commit 0a61584
Show file tree
Hide file tree
Showing 3 changed files with 252 additions and 254 deletions.
246 changes: 122 additions & 124 deletions src/client/app/components/meters/CreateMeterModalComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -559,61 +559,59 @@ export default function CreateMeterModalComponent(props: CreateMeterModalCompone
</FormGroup>
<Row xs='1' lg='2'>
{/* cumulative input */}
<Col>
<FormGroup>
<Label for='cumulative'>{translate('meter.cumulative')}</Label>
<Input
id='cumulative'
name='cumulative'
type='select'
value={state.cumulative.toString()}
onChange={e => handleBooleanChange(e)}>
{Object.keys(TrueFalseType).map(key => {
return (<option value={key} key={key}>{translate(`TrueFalseType.${key}`)}</option>)
})}
</Input>
</FormGroup>
{/* cumulativeReset input */}
<FormGroup>
<Label for='cumulativeReset'>{translate('meter.cumulativeReset')}</Label>
<Input
id='cumulativeReset'
name='cumulativeReset'
type='select'
value={state.cumulativeReset.toString()}
onChange={e => handleBooleanChange(e)}>
{Object.keys(TrueFalseType).map(key => {
return (<option value={key} key={key}>{translate(`TrueFalseType.${key}`)}</option>)
})}
</Input>
</FormGroup>
</Col>
<Col><FormGroup>
<Label for='cumulative'>{translate('meter.cumulative')}</Label>
<Input
id='cumulative'
name='cumulative'
type='select'
value={state.cumulative.toString()}
onChange={e => handleBooleanChange(e)}>
{Object.keys(TrueFalseType).map(key => {
return (<option value={key} key={key}>{translate(`TrueFalseType.${key}`)}</option>)
})}
</Input>
</FormGroup></Col>
{/* cumulativeReset input */}
<Col><FormGroup>
<Label for='cumulativeReset'>{translate('meter.cumulativeReset')}</Label>
<Input
id='cumulativeReset'
name='cumulativeReset'
type='select'
value={state.cumulativeReset.toString()}
onChange={e => handleBooleanChange(e)}>
{Object.keys(TrueFalseType).map(key => {
return (<option value={key} key={key}>{translate(`TrueFalseType.${key}`)}</option>)
})}
</Input>
</FormGroup></Col>
</Row>
<Row xs='1' lg='2'>
{/* cumulativeResetStart input */}
<Col>
<FormGroup>
<Label for='cumulativeResetStart'>{translate('meter.cumulativeResetStart')}</Label>
<Input
id='cumulativeResetStart'
name='cumulativeResetStart'
type='text'
autoComplete='off'
onChange={e => handleStringChange(e)}
value={state.cumulativeResetStart}
placeholder='HH:MM:SS' />
</FormGroup>
{/* cumulativeResetEnd input */}
<FormGroup>
<Label for='cumulativeResetEnd'>{translate('meter.cumulativeResetEnd')}</Label>
<Input
id='cumulativeResetEnd'
name='cumulativeResetEnd'
type='text'
autoComplete='off'
onChange={e => handleStringChange(e)}
value={state.cumulativeResetEnd}
placeholder='HH:MM:SS' />
</FormGroup>
</Col>
<Col><FormGroup>
<Label for='cumulativeResetStart'>{translate('meter.cumulativeResetStart')}</Label>
<Input
id='cumulativeResetStart'
name='cumulativeResetStart'
type='text'
autoComplete='off'
onChange={e => handleStringChange(e)}
value={state.cumulativeResetStart}
placeholder='HH:MM:SS' />
</FormGroup></Col>
{/* cumulativeResetEnd input */}
<Col><FormGroup>
<Label for='cumulativeResetEnd'>{translate('meter.cumulativeResetEnd')}</Label>
<Input
id='cumulativeResetEnd'
name='cumulativeResetEnd'
type='text'
autoComplete='off'
onChange={e => handleStringChange(e)}
value={state.cumulativeResetEnd}
placeholder='HH:MM:SS' />
</FormGroup></Col>
</Row>
<Row xs='1' lg='2'>
{/* endOnlyTime input */}
Expand Down Expand Up @@ -682,76 +680,76 @@ export default function CreateMeterModalComponent(props: CreateMeterModalCompone
</Row>
<Row xs='1' lg='2'>
{/* timeSort input */}
<Col>
<FormGroup>
<Label for='timeSort'>{translate('meter.timeSort')}</Label>
<Input
id='timeSort'
name='timeSort'
type='select'
value={state.timeSort}
onChange={e => handleStringChange(e)}>
{Object.keys(MeterTimeSortType).map(key => {
// This is a bit of a hack but it should work fine. The TypeSortTypes and MeterTimeSortType should be in sync.
// The translation is on the former so we use that enum name there but loop on the other to get the value desired.
return (<option value={key} key={key}>{translate(`TimeSortTypes.${key}`)}</option>)
})}
</Input>
</FormGroup>
{/* Timezone input */}
<FormGroup>
<Label>{translate('meter.time.zone')}</Label>
<TimeZoneSelect current={timeZoneValue} handleClick={timeZone => handleTimeZoneChange(timeZone)} />
</FormGroup>
{/* reading input */}
<FormGroup>
<Label for='reading'>{translate('reading')}</Label>
<Input
id='reading'
name='reading'
type='number'
onChange={e => handleNumberChange(e)}
defaultValue={state.reading} />
</FormGroup>
</Col>
<Col><FormGroup>
<Label for='timeSort'>{translate('meter.timeSort')}</Label>
<Input
id='timeSort'
name='timeSort'
type='select'
value={state.timeSort}
onChange={e => handleStringChange(e)}>
{Object.keys(MeterTimeSortType).map(key => {
// This is a bit of a hack but it should work fine. The TypeSortTypes and MeterTimeSortType should be in sync.
// The translation is on the former so we use that enum name there but loop on the other to get the value desired.
return (<option value={key} key={key}>{translate(`TimeSortTypes.${key}`)}</option>)
})}
</Input>
</FormGroup></Col>
{/* Timezone input */}
<Col><FormGroup>
<Label>{translate('meter.time.zone')}</Label>
<TimeZoneSelect current={timeZoneValue} handleClick={timeZone => handleTimeZoneChange(timeZone)} />
</FormGroup></Col>
</Row>
<Row xs='1' lg='2'>
{/* reading input */}
<Col><FormGroup>
<Label for='reading'>{translate('reading')}</Label>
<Input
id='reading'
name='reading'
type='number'
onChange={e => handleNumberChange(e)}
defaultValue={state.reading} />
</FormGroup></Col>
{/* startTimestamp input */}
<Col>
<FormGroup>
<Label for='startTimestamp'>{translate('meter.startTimeStamp')}</Label>
<Input
id='startTimestamp'
name='startTimestamp'
type='text'
autoComplete='on'
onChange={e => handleStringChange(e)}
placeholder='YYYY-MM-DD HH:MM:SS'
value={state.startTimestamp} />
</FormGroup>
{/* endTimestamp input */}
<FormGroup>
<Label for='endTimestamp'>{translate('meter.endTimeStamp')}</Label>
<Input
id='endTimestamp'
name='endTimestamp'
type='text'
autoComplete='on'
onChange={e => handleStringChange(e)}
placeholder='YYYY-MM-DD HH:MM:SS'
value={state.endTimestamp} />
</FormGroup>
{/* endTimestamp input */}
<FormGroup>
<Label for='previousEnd'>{translate('meter.previousEnd')}</Label>
<Input
id='previousEnd'
name='previousEnd'
type='text'
autoComplete='on'
onChange={e => handleStringChange(e)}
placeholder='YYYY-MM-DD HH:MM:SS'
value={state.previousEnd} />
</FormGroup>
</Col>
<Col><FormGroup>
<Label for='startTimestamp'>{translate('meter.startTimeStamp')}</Label>
<Input
id='startTimestamp'
name='startTimestamp'
type='text'
autoComplete='on'
onChange={e => handleStringChange(e)}
placeholder='YYYY-MM-DD HH:MM:SS'
value={state.startTimestamp} />
</FormGroup></Col>
</Row>
<Row xs='1' lg='2'>
{/* endTimestamp input */}
<Col><FormGroup>
<Label for='endTimestamp'>{translate('meter.endTimeStamp')}</Label>
<Input
id='endTimestamp'
name='endTimestamp'
type='text'
autoComplete='on'
onChange={e => handleStringChange(e)}
placeholder='YYYY-MM-DD HH:MM:SS'
value={state.endTimestamp} />
</FormGroup></Col>
{/* endTimestamp input */}
<Col><FormGroup>
<Label for='previousEnd'>{translate('meter.previousEnd')}</Label>
<Input
id='previousEnd'
name='previousEnd'
type='text'
autoComplete='on'
onChange={e => handleStringChange(e)}
placeholder='YYYY-MM-DD HH:MM:SS'
value={state.previousEnd} />
</FormGroup></Col>
</Row>
</Container></ModalBody>
<ModalFooter>
Expand All @@ -764,7 +762,7 @@ export default function CreateMeterModalComponent(props: CreateMeterModalCompone
<FormattedMessage id="save.all" />
</Button>
</ModalFooter>
</Modal>
</Modal >
</>
);
}
Loading

0 comments on commit 0a61584

Please sign in to comment.