Skip to content

Commit

Permalink
Merge pull request #1279 from proddy/dev
Browse files Browse the repository at this point in the history
add missing translations and show value type in table
  • Loading branch information
proddy authored Sep 2, 2023
2 parents 243aec3 + 57a5857 commit 9ebcfe3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
13 changes: 9 additions & 4 deletions interface/src/project/SettingsEntities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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>
Expand All @@ -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>
))}
Expand Down
4 changes: 2 additions & 2 deletions interface/src/project/SettingsEntitiesDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ const SettingsEntitiesDialog = ({
<ValidatedTextField
fieldErrors={fieldErrors}
name="offset"
label="Offset"
label={LL.OFFSET()}
margin="normal"
fullWidth
type="number"
Expand All @@ -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}
Expand Down
13 changes: 13 additions & 0 deletions interface/src/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,3 +379,16 @@ export const enum DeviceValueType {
STRING,
CMD
}

export const DeviceValueTypeNames = [
'BOOL',
'INT',
'UINT',
'SHORT',
'USHORT',
'ULONG',
'TIME',
'ENUM',
'STRING',
'CMD'
];

0 comments on commit 9ebcfe3

Please sign in to comment.