aboutsummaryrefslogtreecommitdiff
path: root/modern/src/settings
diff options
context:
space:
mode:
Diffstat (limited to 'modern/src/settings')
-rw-r--r--modern/src/settings/DevicePage.js15
-rw-r--r--modern/src/settings/GroupPage.js8
-rw-r--r--modern/src/settings/ServerPage.js10
-rw-r--r--modern/src/settings/UserPage.js4
4 files changed, 27 insertions, 10 deletions
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>