diff options
author | Anton Tananaev <anton@traccar.org> | 2022-05-15 13:04:00 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-05-15 13:04:00 -0700 |
commit | 6af8b218a1d9be4d8dcf6a8398b08c874d8a12dc (patch) | |
tree | 8712dcf947f4e6fa0795faa4667e9bb787775d72 | |
parent | 5faf345b841da9af97a45cc057a58b63b2379388 (diff) | |
download | trackermap-web-6af8b218a1d9be4d8dcf6a8398b08c874d8a12dc.tar.gz trackermap-web-6af8b218a1d9be4d8dcf6a8398b08c874d8a12dc.tar.bz2 trackermap-web-6af8b218a1d9be4d8dcf6a8398b08c874d8a12dc.zip |
Update known attributes
-rw-r--r-- | modern/src/common/attributes/useCommonDeviceAttributes.js | 13 | ||||
-rw-r--r-- | modern/src/common/attributes/useCommonUserAttributes.js | 48 | ||||
-rw-r--r-- | modern/src/common/attributes/useDeviceAttributes.js | 23 | ||||
-rw-r--r-- | modern/src/common/attributes/useGeofenceAttributes.js | 12 | ||||
-rw-r--r-- | modern/src/common/attributes/useGroupAttributes.js | 12 | ||||
-rw-r--r-- | modern/src/common/attributes/useUserAttributes.js | 58 | ||||
-rw-r--r-- | modern/src/settings/DevicePage.js | 15 | ||||
-rw-r--r-- | modern/src/settings/GroupPage.js | 8 | ||||
-rw-r--r-- | modern/src/settings/ServerPage.js | 10 | ||||
-rw-r--r-- | modern/src/settings/UserPage.js | 4 |
10 files changed, 157 insertions, 46 deletions
diff --git a/modern/src/common/attributes/useCommonDeviceAttributes.js b/modern/src/common/attributes/useCommonDeviceAttributes.js new file mode 100644 index 00000000..8a4d886c --- /dev/null +++ b/modern/src/common/attributes/useCommonDeviceAttributes.js @@ -0,0 +1,13 @@ +import { useMemo } from 'react'; + +export default (t) => useMemo(() => ({ + speedLimit: { + name: t('attributeSpeedLimit'), + type: 'number', + subtype: 'speed', + }, + 'report.ignoreOdometer': { + name: t('attributeReportIgnoreOdometer'), + type: 'boolean', + }, +}), [t]); diff --git a/modern/src/common/attributes/useCommonUserAttributes.js b/modern/src/common/attributes/useCommonUserAttributes.js new file mode 100644 index 00000000..fa6d7d8f --- /dev/null +++ b/modern/src/common/attributes/useCommonUserAttributes.js @@ -0,0 +1,48 @@ +import { useMemo } from 'react'; + +export default (t) => useMemo(() => ({ + notificationTokens: { + name: t('attributeNotificationTokens'), + type: 'string', + }, + /* 'web.liveRouteLength': { + name: t('attributeWebLiveRouteLength'), + type: 'number', + }, + 'web.selectZoom': { + name: t('attributeWebSelectZoom'), + type: 'number', + }, + 'web.maxZoom': { + name: t('attributeWebMaxZoom'), + type: 'number', + }, + 'ui.disableEvents': { + name: t('attributeUiDisableEvents'), + type: 'boolean', + }, + 'ui.disableVehicleFetures': { + name: t('attributeUiDisableVehicleFetures'), + type: 'boolean', + }, + 'ui.disableDrivers': { + name: t('attributeUiDisableDrivers'), + type: 'boolean', + }, + 'ui.disableComputedAttributes': { + name: t('attributeUiDisableComputedAttributes'), + type: 'boolean', + }, + 'ui.disableCalendars': { + name: t('attributeUiDisableCalendars'), + type: 'boolean', + }, + 'ui.disableMaintenance': { + name: t('attributeUiDisableMaintenance'), + type: 'boolean', + }, + 'ui.hidePositionAttributes': { + name: t('attributeUiHidePositionAttributes'), + type: 'string', + }, */ +}), [t]); diff --git a/modern/src/common/attributes/useDeviceAttributes.js b/modern/src/common/attributes/useDeviceAttributes.js index 8a4d886c..34ddb64c 100644 --- a/modern/src/common/attributes/useDeviceAttributes.js +++ b/modern/src/common/attributes/useDeviceAttributes.js @@ -1,13 +1,24 @@ import { useMemo } from 'react'; export default (t) => useMemo(() => ({ - speedLimit: { - name: t('attributeSpeedLimit'), + devicePassword: { + name: t('attributeDevicePassword'), + type: 'string', + }, + 'processing.copyAttributes': { + name: t('attributeProcessingCopyAttributes'), + type: 'string', + }, + 'decoder.timezone': { + name: t('sharedTimezone'), + type: 'string', + }, + deviceInactivityStart: { + name: t('attributeDeviceInactivityStart'), type: 'number', - subtype: 'speed', }, - 'report.ignoreOdometer': { - name: t('attributeReportIgnoreOdometer'), - type: 'boolean', + deviceInactivityPeriod: { + name: t('attributeDeviceInactivityPeriod'), + type: 'number', }, }), [t]); diff --git a/modern/src/common/attributes/useGeofenceAttributes.js b/modern/src/common/attributes/useGeofenceAttributes.js index 89908aa5..a5cd068b 100644 --- a/modern/src/common/attributes/useGeofenceAttributes.js +++ b/modern/src/common/attributes/useGeofenceAttributes.js @@ -1,8 +1,18 @@ import { useMemo } from 'react'; export default (t) => useMemo(() => ({ + color: { + name: t('attributeColor'), + type: 'string', + }, speedLimit: { name: t('attributeSpeedLimit'), - type: 'string', + type: 'number', + subtype: 'speed', + }, + polylineDistance: { + name: t('attributePolylineDistance'), + type: 'number', + subtype: 'distance', }, }), [t]); diff --git a/modern/src/common/attributes/useGroupAttributes.js b/modern/src/common/attributes/useGroupAttributes.js new file mode 100644 index 00000000..53a299e1 --- /dev/null +++ b/modern/src/common/attributes/useGroupAttributes.js @@ -0,0 +1,12 @@ +import { useMemo } from 'react'; + +export default (t) => useMemo(() => ({ + 'processing.copyAttributes': { + name: t('attributeProcessingCopyAttributes'), + type: 'string', + }, + 'decoder.timezone': { + name: t('sharedTimezone'), + type: 'string', + }, +}), [t]); diff --git a/modern/src/common/attributes/useUserAttributes.js b/modern/src/common/attributes/useUserAttributes.js index fa6d7d8f..56dee060 100644 --- a/modern/src/common/attributes/useUserAttributes.js +++ b/modern/src/common/attributes/useUserAttributes.js @@ -1,48 +1,48 @@ import { useMemo } from 'react'; export default (t) => useMemo(() => ({ - notificationTokens: { - name: t('attributeNotificationTokens'), + 'mail.smtp.host': { + name: t('attributeMailSmtpHost'), type: 'string', }, - /* 'web.liveRouteLength': { - name: t('attributeWebLiveRouteLength'), + 'mail.smtp.port': { + name: t('attributeMailSmtpPort'), type: 'number', }, - 'web.selectZoom': { - name: t('attributeWebSelectZoom'), - type: 'number', - }, - 'web.maxZoom': { - name: t('attributeWebMaxZoom'), - type: 'number', - }, - 'ui.disableEvents': { - name: t('attributeUiDisableEvents'), + 'mail.smtp.starttls.enable': { + name: t('attributeMailSmtpStarttlsEnable'), type: 'boolean', }, - 'ui.disableVehicleFetures': { - name: t('attributeUiDisableVehicleFetures'), + 'mail.smtp.starttls.required': { + name: t('attributeMailSmtpStarttlsRequired'), type: 'boolean', }, - 'ui.disableDrivers': { - name: t('attributeUiDisableDrivers'), + 'mail.smtp.ssl.enable': { + name: t('attributeMailSmtpSslEnable'), type: 'boolean', }, - 'ui.disableComputedAttributes': { - name: t('attributeUiDisableComputedAttributes'), - type: 'boolean', + 'mail.smtp.ssl.trust': { + name: t('attributeMailSmtpSslTrust'), + type: 'string', }, - 'ui.disableCalendars': { - name: t('attributeUiDisableCalendars'), - type: 'boolean', + 'mail.smtp.ssl.protocols': { + name: t('attributeMailSmtpSslProtocols'), + type: 'string', + }, + 'mail.smtp.from': { + name: t('attributeMailSmtpFrom'), + type: 'string', }, - 'ui.disableMaintenance': { - name: t('attributeUiDisableMaintenance'), + 'mail.smtp.auth': { + name: t('attributeMailSmtpAuth'), type: 'boolean', }, - 'ui.hidePositionAttributes': { - name: t('attributeUiHidePositionAttributes'), + 'mail.smtp.username': { + name: t('attributeMailSmtpUsername'), type: 'string', - }, */ + }, + 'mail.smtp.password': { + name: t('attributeMailSmtpPassword'), + type: 'string', + }, }), [t]); diff --git a/modern/src/settings/DevicePage.js b/modern/src/settings/DevicePage.js index 491ba60f..56a589dc 100644 --- a/modern/src/settings/DevicePage.js +++ b/modern/src/settings/DevicePage.js @@ -15,6 +15,7 @@ import { useTranslation } from '../common/components/LocalizationProvider'; import useDeviceAttributes from '../common/attributes/useDeviceAttributes'; import { useAdministrator } from '../common/util/permissions'; import SettingsMenu from './components/SettingsMenu'; +import useCommonDeviceAttributes from '../common/attributes/useCommonDeviceAttributes'; const useStyles = makeStyles(() => ({ details: { @@ -28,6 +29,7 @@ const DevicePage = () => { const admin = useAdministrator(); + const commonDeviceAttributes = useCommonDeviceAttributes(t); const deviceAttributes = useDeviceAttributes(t); const [item, setItem] = useState(); @@ -134,7 +136,7 @@ const DevicePage = () => { <EditAttributesView attributes={item.attributes} setAttributes={(attributes) => setItem({ ...item, attributes })} - definitions={deviceAttributes} + definitions={{ ...commonDeviceAttributes, ...deviceAttributes }} /> </AccordionDetails> </Accordion> @@ -190,6 +192,17 @@ const DevicePage = () => { /> <LinkField margin="normal" + endpointAll="/api/commands" + endpointLinked={`/api/commands?deviceId=${item.id}`} + baseId={item.id} + keyBase="deviceId" + keyLink="commandId" + titleGetter={(it) => it.description} + label={t('sharedSavedCommands')} + variant="filled" + /> + <LinkField + margin="normal" endpointAll="/api/maintenance" endpointLinked={`/api/maintenance?deviceId=${item.id}`} baseId={item.id} diff --git a/modern/src/settings/GroupPage.js b/modern/src/settings/GroupPage.js index f56a2fd3..3d4769f3 100644 --- a/modern/src/settings/GroupPage.js +++ b/modern/src/settings/GroupPage.js @@ -7,10 +7,11 @@ import { import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; import EditItemView from './components/EditItemView'; import EditAttributesView from './components/EditAttributesView'; -import useDeviceAttributes from '../common/attributes/useDeviceAttributes'; import SelectField from '../common/components/SelectField'; import { useTranslation } from '../common/components/LocalizationProvider'; import SettingsMenu from './components/SettingsMenu'; +import useCommonDeviceAttributes from '../common/attributes/useCommonDeviceAttributes'; +import useGroupAttributes from '../common/attributes/useGroupAttributes'; const useStyles = makeStyles(() => ({ details: { @@ -22,7 +23,8 @@ const GroupPage = () => { const classes = useStyles(); const t = useTranslation(); - const deviceAttributes = useDeviceAttributes(t); + const commonDeviceAttributes = useCommonDeviceAttributes(t); + const groupAttributes = useGroupAttributes(t); const [item, setItem] = useState(); @@ -82,7 +84,7 @@ const GroupPage = () => { <EditAttributesView attributes={item.attributes} setAttributes={(attributes) => setItem({ ...item, attributes })} - definitions={deviceAttributes} + definitions={{ ...commonDeviceAttributes, ...groupAttributes }} /> </AccordionDetails> </Accordion> diff --git a/modern/src/settings/ServerPage.js b/modern/src/settings/ServerPage.js index 8943252e..5fdba47b 100644 --- a/modern/src/settings/ServerPage.js +++ b/modern/src/settings/ServerPage.js @@ -9,12 +9,12 @@ import { useHistory } from 'react-router-dom'; import { useDispatch, useSelector } from 'react-redux'; import { sessionActions } from '../store'; import EditAttributesView from './components/EditAttributesView'; -import useDeviceAttributes from '../common/attributes/useDeviceAttributes'; -import useUserAttributes from '../common/attributes/useUserAttributes'; import { useTranslation } from '../common/components/LocalizationProvider'; import SelectField from '../common/components/SelectField'; import PageLayout from '../common/components/PageLayout'; import SettingsMenu from './components/SettingsMenu'; +import useCommonDeviceAttributes from '../common/attributes/useCommonDeviceAttributes'; +import useCommonUserAttributes from '../common/attributes/useCommonUserAttributes'; const useStyles = makeStyles((theme) => ({ container: { @@ -38,8 +38,8 @@ const ServerPage = () => { const dispatch = useDispatch(); const t = useTranslation(); - const userAttributes = useUserAttributes(t); - const deviceAttributes = useDeviceAttributes(t); + const commonUserAttributes = useCommonUserAttributes(t); + const commonDeviceAttributes = useCommonDeviceAttributes(t); const original = useSelector((state) => state.session.server); const [item, setItem] = useState({ ...original }); @@ -218,7 +218,7 @@ const ServerPage = () => { <EditAttributesView attributes={item.attributes} setAttributes={(attributes) => setItem({ ...item, attributes })} - definitions={{ ...userAttributes, ...deviceAttributes }} + definitions={{ ...commonUserAttributes, ...commonDeviceAttributes }} /> </AccordionDetails> </Accordion> diff --git a/modern/src/settings/UserPage.js b/modern/src/settings/UserPage.js index 1fb7103f..10e49690 100644 --- a/modern/src/settings/UserPage.js +++ b/modern/src/settings/UserPage.js @@ -14,6 +14,7 @@ import useUserAttributes from '../common/attributes/useUserAttributes'; import { sessionActions } from '../store'; import SelectField from '../common/components/SelectField'; import SettingsMenu from './components/SettingsMenu'; +import useCommonUserAttributes from '../common/attributes/useCommonUserAttributes'; const useStyles = makeStyles(() => ({ details: { @@ -28,6 +29,7 @@ const UserPage = () => { const currentUserId = useSelector((state) => state.session.user.id); + const commonUserAttributes = useCommonUserAttributes(t); const userAttributes = useUserAttributes(t); const [item, setItem] = useState(); @@ -159,7 +161,7 @@ const UserPage = () => { <EditAttributesView attributes={item.attributes} setAttributes={(attributes) => setItem({ ...item, attributes })} - definitions={userAttributes} + definitions={{ ...commonUserAttributes, ...userAttributes }} /> </AccordionDetails> </Accordion> |