aboutsummaryrefslogtreecommitdiff
path: root/modern
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-26 18:54:48 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-26 18:54:48 -0700
commit5d9a9175f828d016d8ff28ae69c0bd4fa80f2fee (patch)
treeac64014bc80c220734c7d0566b14bca541882e43 /modern
parent51c215f3f8c036328ced5399cbdd4c1b080518a6 (diff)
downloadtrackermap-web-5d9a9175f828d016d8ff28ae69c0bd4fa80f2fee.tar.gz
trackermap-web-5d9a9175f828d016d8ff28ae69c0bd4fa80f2fee.tar.bz2
trackermap-web-5d9a9175f828d016d8ff28ae69c0bd4fa80f2fee.zip
Computed attributes fixes
Diffstat (limited to 'modern')
-rw-r--r--modern/src/common/attributes/usePositionAttributes.js13
-rw-r--r--modern/src/settings/ComputedAttributePage.js3
2 files changed, 15 insertions, 1 deletions
diff --git a/modern/src/common/attributes/usePositionAttributes.js b/modern/src/common/attributes/usePositionAttributes.js
index 4b779090..b9eb354c 100644
--- a/modern/src/common/attributes/usePositionAttributes.js
+++ b/modern/src/common/attributes/usePositionAttributes.js
@@ -4,56 +4,69 @@ export default (t) => useMemo(() => ({
id: {
name: t('deviceIdentifier'),
type: 'number',
+ property: true,
},
latitude: {
name: t('positionLatitude'),
type: 'number',
+ property: true,
},
longitude: {
name: t('positionLongitude'),
type: 'number',
+ property: true,
},
speed: {
name: t('positionSpeed'),
type: 'number',
dataType: 'speed',
+ property: true,
},
course: {
name: t('positionCourse'),
type: 'number',
+ property: true,
},
altitude: {
name: t('positionAltitude'),
type: 'number',
+ property: true,
},
accuracy: {
name: t('positionAccuracy'),
type: 'number',
dataType: 'distance',
+ property: true,
},
valid: {
name: t('positionValid'),
type: 'boolean',
+ property: true,
},
protocol: {
name: t('positionProtocol'),
type: 'string',
+ property: true,
},
address: {
name: t('positionAddress'),
type: 'string',
+ property: true,
},
deviceTime: {
name: t('positionDeviceTime'),
type: 'string',
+ property: true,
},
fixTime: {
name: t('positionFixTime'),
type: 'string',
+ property: true,
},
serverTime: {
name: t('positionServerTime'),
type: 'string',
+ property: true,
},
raw: {
name: t('positionRaw'),
diff --git a/modern/src/settings/ComputedAttributePage.js b/modern/src/settings/ComputedAttributePage.js
index 95681f2a..c9170650 100644
--- a/modern/src/settings/ComputedAttributePage.js
+++ b/modern/src/settings/ComputedAttributePage.js
@@ -36,7 +36,7 @@ const ComputedAttributePage = () => {
const [item, setItem] = useState();
- const options = Object.entries(positionAttributes).map(([key, value]) => ({
+ const options = Object.entries(positionAttributes).filter(([, value]) => !value.property).map(([key, value]) => ({
key,
name: value.name,
type: value.type,
@@ -71,6 +71,7 @@ const ComputedAttributePage = () => {
label={t('sharedDescription')}
/>
<Autocomplete
+ value={options.find((option) => option.key === item.attribute) || item.attribute}
onChange={(_, option) => {
const attribute = option ? option.key || option : null;
if (option && option.type) {