mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 07:49:52 +03:00
addd missing translations and show value type in table
This commit is contained in:
@@ -13,7 +13,7 @@ import { toast } from 'react-toastify';
|
||||
|
||||
import SettingsEntitiesDialog from './SettingsEntitiesDialog';
|
||||
import * as EMSESP from './api';
|
||||
import { DeviceValueUOM_s } from './types';
|
||||
import { DeviceValueTypeNames, DeviceValueUOM_s } from './types';
|
||||
import { entityItemValidation } from './validators';
|
||||
import type { EntityItem } from './types';
|
||||
import type { FC } from 'react';
|
||||
@@ -57,7 +57,7 @@ const SettingsEntities: FC = () => {
|
||||
|
||||
const entity_theme = useTheme({
|
||||
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: `
|
||||
font-size: 14px;
|
||||
@@ -81,6 +81,9 @@ const SettingsEntities: FC = () => {
|
||||
&:nth-of-type(5) {
|
||||
text-align: center;
|
||||
}
|
||||
&:nth-of-type(6) {
|
||||
text-align: center;
|
||||
}
|
||||
`,
|
||||
HeaderRow: `
|
||||
text-transform: uppercase;
|
||||
@@ -208,8 +211,9 @@ const SettingsEntities: FC = () => {
|
||||
<HeaderCell>{LL.NAME(0)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.ID_OF(LL.DEVICE())}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.ID_OF(LL.TYPE(1))}</HeaderCell>
|
||||
<HeaderCell stiff>Offset</HeaderCell>
|
||||
<HeaderCell stiff>{LL.VALUE(0)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.OFFSET()}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.VALUE(1) + ' ' + LL.TYPE(1)}</HeaderCell>
|
||||
<HeaderCell stiff>{LL.VALUE(1)}</HeaderCell>
|
||||
</HeaderRow>
|
||||
</Header>
|
||||
<Body>
|
||||
@@ -219,6 +223,7 @@ const SettingsEntities: FC = () => {
|
||||
<Cell>{showHex(ei.device_id as number, 2)}</Cell>
|
||||
<Cell>{showHex(ei.type_id as number, 3)}</Cell>
|
||||
<Cell>{ei.offset}</Cell>
|
||||
<Cell>{DeviceValueTypeNames[ei.value_type]}</Cell>
|
||||
<Cell>{formatValue(ei.value, ei.uom)}</Cell>
|
||||
</Row>
|
||||
))}
|
||||
|
||||
@@ -148,7 +148,7 @@ const SettingsEntitiesDialog = ({
|
||||
<ValidatedTextField
|
||||
fieldErrors={fieldErrors}
|
||||
name="offset"
|
||||
label="Offset"
|
||||
label={LL.OFFSET()}
|
||||
margin="normal"
|
||||
fullWidth
|
||||
type="number"
|
||||
@@ -159,7 +159,7 @@ const SettingsEntitiesDialog = ({
|
||||
<Grid item xs={4}>
|
||||
<TextField
|
||||
name="value_type"
|
||||
label="Value Type"
|
||||
label={LL.VALUE(1) + ' ' + LL.TYPE(1)}
|
||||
value={editItem.value_type}
|
||||
variant="outlined"
|
||||
onChange={updateFormValue}
|
||||
|
||||
@@ -379,3 +379,16 @@ export const enum DeviceValueType {
|
||||
STRING,
|
||||
CMD
|
||||
}
|
||||
|
||||
export const DeviceValueTypeNames = [
|
||||
'BOOL',
|
||||
'INT',
|
||||
'UINT',
|
||||
'SHORT',
|
||||
'USHORT',
|
||||
'ULONG',
|
||||
'TIME',
|
||||
'ENUM',
|
||||
'STRING',
|
||||
'CMD'
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user