Merge pull request #1279 from proddy/dev

add missing translations and show value type in table
This commit is contained in:
Proddy
2023-09-02 13:41:58 +02:00
committed by GitHub
3 changed files with 24 additions and 6 deletions

View File

@@ -13,7 +13,7 @@ import { toast } from 'react-toastify';
import SettingsEntitiesDialog from './SettingsEntitiesDialog'; import SettingsEntitiesDialog from './SettingsEntitiesDialog';
import * as EMSESP from './api'; import * as EMSESP from './api';
import { DeviceValueUOM_s } from './types'; import { DeviceValueTypeNames, DeviceValueUOM_s } from './types';
import { entityItemValidation } from './validators'; import { entityItemValidation } from './validators';
import type { EntityItem } from './types'; import type { EntityItem } from './types';
import type { FC } from 'react'; import type { FC } from 'react';
@@ -57,7 +57,7 @@ const SettingsEntities: FC = () => {
const entity_theme = useTheme({ const entity_theme = useTheme({
Table: ` Table: `
--data-table-library_grid-template-columns: repeat(1, minmax(60px, 1fr)) minmax(80px, auto) 80px 80px 80px; --data-table-library_grid-template-columns: repeat(1, minmax(60px, 1fr)) minmax(80px, auto) 80px 80px 80px 90px;
`, `,
BaseRow: ` BaseRow: `
font-size: 14px; font-size: 14px;
@@ -81,6 +81,9 @@ const SettingsEntities: FC = () => {
&:nth-of-type(5) { &:nth-of-type(5) {
text-align: center; text-align: center;
} }
&:nth-of-type(6) {
text-align: center;
}
`, `,
HeaderRow: ` HeaderRow: `
text-transform: uppercase; text-transform: uppercase;
@@ -208,8 +211,9 @@ const SettingsEntities: FC = () => {
<HeaderCell>{LL.NAME(0)}</HeaderCell> <HeaderCell>{LL.NAME(0)}</HeaderCell>
<HeaderCell stiff>{LL.ID_OF(LL.DEVICE())}</HeaderCell> <HeaderCell stiff>{LL.ID_OF(LL.DEVICE())}</HeaderCell>
<HeaderCell stiff>{LL.ID_OF(LL.TYPE(1))}</HeaderCell> <HeaderCell stiff>{LL.ID_OF(LL.TYPE(1))}</HeaderCell>
<HeaderCell stiff>Offset</HeaderCell> <HeaderCell stiff>{LL.OFFSET()}</HeaderCell>
<HeaderCell stiff>{LL.VALUE(0)}</HeaderCell> <HeaderCell stiff>{LL.VALUE(1) + ' ' + LL.TYPE(1)}</HeaderCell>
<HeaderCell stiff>{LL.VALUE(1)}</HeaderCell>
</HeaderRow> </HeaderRow>
</Header> </Header>
<Body> <Body>
@@ -219,6 +223,7 @@ const SettingsEntities: FC = () => {
<Cell>{showHex(ei.device_id as number, 2)}</Cell> <Cell>{showHex(ei.device_id as number, 2)}</Cell>
<Cell>{showHex(ei.type_id as number, 3)}</Cell> <Cell>{showHex(ei.type_id as number, 3)}</Cell>
<Cell>{ei.offset}</Cell> <Cell>{ei.offset}</Cell>
<Cell>{DeviceValueTypeNames[ei.value_type]}</Cell>
<Cell>{formatValue(ei.value, ei.uom)}</Cell> <Cell>{formatValue(ei.value, ei.uom)}</Cell>
</Row> </Row>
))} ))}

View File

@@ -148,7 +148,7 @@ const SettingsEntitiesDialog = ({
<ValidatedTextField <ValidatedTextField
fieldErrors={fieldErrors} fieldErrors={fieldErrors}
name="offset" name="offset"
label="Offset" label={LL.OFFSET()}
margin="normal" margin="normal"
fullWidth fullWidth
type="number" type="number"
@@ -159,7 +159,7 @@ const SettingsEntitiesDialog = ({
<Grid item xs={4}> <Grid item xs={4}>
<TextField <TextField
name="value_type" name="value_type"
label="Value Type" label={LL.VALUE(1) + ' ' + LL.TYPE(1)}
value={editItem.value_type} value={editItem.value_type}
variant="outlined" variant="outlined"
onChange={updateFormValue} onChange={updateFormValue}

View File

@@ -379,3 +379,16 @@ export const enum DeviceValueType {
STRING, STRING,
CMD CMD
} }
export const DeviceValueTypeNames = [
'BOOL',
'INT',
'UINT',
'SHORT',
'USHORT',
'ULONG',
'TIME',
'ENUM',
'STRING',
'CMD'
];