aboutsummaryrefslogtreecommitdiff
path: root/modern/src/common
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-05-15 15:47:03 -0700
committerAnton Tananaev <anton@traccar.org>2022-05-15 15:47:03 -0700
commit2a7d1a41dc897018a2bf17d3ca9f85cfb66bbb5f (patch)
tree664edf952e35084ec3f8f3be99011d2ac836d1fa /modern/src/common
parent3d3b8096392f074baa7178d2a026525503657d50 (diff)
downloadtrackermap-web-2a7d1a41dc897018a2bf17d3ca9f85cfb66bbb5f.tar.gz
trackermap-web-2a7d1a41dc897018a2bf17d3ca9f85cfb66bbb5f.tar.bz2
trackermap-web-2a7d1a41dc897018a2bf17d3ca9f85cfb66bbb5f.zip
Add missing position values
Diffstat (limited to 'modern/src/common')
-rw-r--r--modern/src/common/attributes/usePositionAttributes.js255
-rw-r--r--modern/src/common/attributes/usePositionProperties.js56
-rw-r--r--modern/src/common/components/PositionValue.js2
3 files changed, 310 insertions, 3 deletions
diff --git a/modern/src/common/attributes/usePositionAttributes.js b/modern/src/common/attributes/usePositionAttributes.js
index 7b33720a..b6036945 100644
--- a/modern/src/common/attributes/usePositionAttributes.js
+++ b/modern/src/common/attributes/usePositionAttributes.js
@@ -9,13 +9,264 @@ export default (t) => useMemo(() => ({
name: t('positionIndex'),
type: 'number',
},
- ignition: {
- name: t('positionIgnition'),
+ hdop: {
+ name: t('positionHdop'),
+ type: 'number',
+ },
+ vdop: {
+ name: t('positionVdop'),
+ type: 'number',
+ },
+ pdop: {
+ name: t('positionPdop'),
+ type: 'number',
+ },
+ sat: {
+ name: t('positionSat'),
+ type: 'number',
+ },
+ satVisible: {
+ name: t('positionSatVisible'),
+ type: 'number',
+ },
+ rssi: {
+ name: t('positionRssi'),
+ type: 'number',
+ },
+ gps: {
+ name: t('positionGps'),
+ type: 'number',
+ },
+ roaming: {
+ name: t('positionRoaming'),
type: 'boolean',
},
+ event: {
+ name: t('positionEvent'),
+ type: 'string',
+ },
+ alarm: {
+ name: t('positionAlarm'),
+ type: 'string',
+ },
+ status: {
+ name: t('positionStatus'),
+ type: 'string',
+ },
odometer: {
name: t('positionOdometer'),
type: 'number',
dataType: 'distance',
},
+ serviceOdometer: {
+ name: t('positionServiceOdometer'),
+ type: 'number',
+ dataType: 'distance',
+ },
+ tripOdometer: {
+ name: t('positionTripOdometer'),
+ type: 'number',
+ dataType: 'distance',
+ },
+ hours: {
+ name: t('positionHours'),
+ type: 'number',
+ dataType: 'hours',
+ },
+ steps: {
+ name: t('positionSteps'),
+ type: 'number',
+ },
+ input: {
+ name: t('positionInput'),
+ type: 'number',
+ },
+ in1: {
+ name: `${t('positionInput')} 1`,
+ type: 'boolean',
+ },
+ in2: {
+ name: `${t('positionInput')} 2`,
+ type: 'boolean',
+ },
+ in3: {
+ name: `${t('positionInput')} 3`,
+ type: 'boolean',
+ },
+ in4: {
+ name: `${t('positionInput')} 4`,
+ type: 'boolean',
+ },
+ output: {
+ name: t('positionOutput'),
+ type: 'number',
+ },
+ out1: {
+ name: `${t('positionOutput')} 1`,
+ type: 'boolean',
+ },
+ out2: {
+ name: `${t('positionOutput')} 2`,
+ type: 'boolean',
+ },
+ out3: {
+ name: `${t('positionOutput')} 3`,
+ type: 'boolean',
+ },
+ out4: {
+ name: `${t('positionOutput')} 4`,
+ type: 'boolean',
+ },
+ power: {
+ name: t('positionPower'),
+ type: 'number',
+ dataType: 'voltage',
+ },
+ battery: {
+ name: t('positionBattery'),
+ type: 'number',
+ dataType: 'voltage',
+ },
+ batteryLevel: {
+ name: t('positionBatteryLevel'),
+ type: 'number',
+ dataType: 'percentage',
+ },
+ fuel: {
+ name: t('positionFuel'),
+ type: 'number',
+ dataType: 'volume',
+ },
+ fuelConsumption: {
+ name: t('positionFuelConsumption'),
+ type: 'number',
+ },
+ versionFw: {
+ name: t('positionVersionFw'),
+ type: 'string',
+ },
+ versionHw: {
+ name: t('positionVersionHw'),
+ type: 'string',
+ },
+ type: {
+ name: t('sharedType'),
+ type: 'string',
+ },
+ ignition: {
+ name: t('positionIgnition'),
+ type: 'boolean',
+ },
+ flags: {
+ name: t('positionFlags'),
+ type: 'string',
+ },
+ charge: {
+ name: t('positionCharge'),
+ type: 'boolean',
+ },
+ ip: {
+ name: t('positionIp'),
+ type: 'string',
+ },
+ archive: {
+ name: t('positionArchive'),
+ type: 'boolean',
+ },
+ distance: {
+ name: t('positionDistance'),
+ type: 'number',
+ dataType: 'distance',
+ },
+ totalDistance: {
+ name: t('deviceTotalDistance'),
+ type: 'number',
+ dataType: 'distance',
+ },
+ rpm: {
+ name: t('positionRpm'),
+ type: 'number',
+ },
+ vin: {
+ name: t('positionVin'),
+ type: 'string',
+ },
+ approximate: {
+ name: t('positionApproximate'),
+ type: 'boolean',
+ },
+ throttle: {
+ name: t('positionThrottle'),
+ type: 'number',
+ },
+ motion: {
+ name: t('positionMotion'),
+ type: 'boolean',
+ },
+ armed: {
+ name: t('positionArmed'),
+ type: 'number',
+ },
+ geofence: {
+ name: t('sharedGeofence'),
+ type: 'string',
+ },
+ acceleration: {
+ name: t('positionAcceleration'),
+ type: 'number',
+ },
+ deviceTemp: {
+ name: t('positionDeviceTemp'),
+ type: 'number',
+ },
+ temp1: {
+ name: `${t('positionTemp')} 1`,
+ type: 'number',
+ },
+ temp2: {
+ name: `${t('positionTemp')} 2`,
+ type: 'number',
+ },
+ temp3: {
+ name: `${t('positionTemp')} 3`,
+ type: 'number',
+ },
+ temp4: {
+ name: `${t('positionTemp')} 4`,
+ type: 'number',
+ },
+ operator: {
+ name: t('positionOperator'),
+ type: 'string',
+ },
+ command: {
+ name: t('deviceCommand'),
+ type: 'string',
+ },
+ blocked: {
+ name: t('positionBlocked'),
+ type: 'number',
+ },
+ dtcs: {
+ name: t('positionDtcs'),
+ type: 'string',
+ },
+ obdSpeed: {
+ name: t('positionObdSpeed'),
+ type: 'number',
+ dataType: 'speed',
+ },
+ obdOdometer: {
+ name: t('positionObdOdometer'),
+ type: 'number',
+ dataType: 'distance',
+ },
+ result: {
+ name: t('eventCommandResult'),
+ type: 'string',
+ },
+ driverUniqueId: {
+ name: t('positionDriverUniqueId'),
+ type: 'string',
+ },
}), [t]);
diff --git a/modern/src/common/attributes/usePositionProperties.js b/modern/src/common/attributes/usePositionProperties.js
new file mode 100644
index 00000000..a31700d6
--- /dev/null
+++ b/modern/src/common/attributes/usePositionProperties.js
@@ -0,0 +1,56 @@
+import { useMemo } from 'react';
+
+export default (t) => useMemo(() => ({
+ id: {
+ name: t('deviceIdentifier'),
+ type: 'number',
+ },
+ latitude: {
+ name: t('positionLatitude'),
+ type: 'number',
+ },
+ longitude: {
+ name: t('positionLongitude'),
+ type: 'number',
+ },
+ speed: {
+ name: t('positionSpeed'),
+ type: 'number',
+ },
+ course: {
+ name: t('positionCourse'),
+ type: 'number',
+ },
+ altitude: {
+ name: t('positionAltitude'),
+ type: 'number',
+ },
+ accuracy: {
+ name: t('positionAccuracy'),
+ type: 'number',
+ },
+ valid: {
+ name: t('positionValid'),
+ type: 'boolean',
+ },
+ protocol: {
+ name: t('positionProtocol'),
+ type: 'string',
+ },
+ address: {
+ name: t('positionAddress'),
+ type: 'string',
+ },
+ deviceTime: {
+ name: t('positionDeviceTime'),
+ type: 'string',
+ },
+ fixTime: {
+ name: t('positionFixTime'),
+ type: 'string',
+ },
+ serverTime: {
+ name: t('positionServerTime'),
+ type: 'string',
+ },
+}), [t]);
diff --git a/modern/src/common/components/PositionValue.js b/modern/src/common/components/PositionValue.js
index 1d9d71f5..9f679605 100644
--- a/modern/src/common/components/PositionValue.js
+++ b/modern/src/common/components/PositionValue.js
@@ -65,7 +65,7 @@ const PositionValue = ({ position, property, attribute }) => {
} if (typeof value === 'boolean') {
return formatBoolean(value, t);
}
- return value;
+ return value || '';
}
};