aboutsummaryrefslogtreecommitdiff
path: root/modern
diff options
context:
space:
mode:
Diffstat (limited to 'modern')
-rw-r--r--modern/src/App.js4
-rw-r--r--modern/src/MainToolbar.js2
-rw-r--r--modern/src/settings/ComputedAttributePage.js22
-rw-r--r--modern/src/settings/ComputedAttributesPage.js2
4 files changed, 16 insertions, 14 deletions
diff --git a/modern/src/App.js b/modern/src/App.js
index d7a6511..f5ebc14 100644
--- a/modern/src/App.js
+++ b/modern/src/App.js
@@ -50,8 +50,8 @@ const App = () => {
<Route exact path='/settings/group/:id?' component={GroupPage} />
<Route exact path='/settings/drivers' component={DriversPage} />
<Route exact path='/settings/driver/:id?' component={DriverPage} />
- <Route exact path='/settings/attributes/computed' component={ComputedAttributesPage} />
- <Route exact path='/settings/attribute/computed/:id?' component={ComputedAttributePage} />
+ <Route exact path='/settings/attributes' component={ComputedAttributesPage} />
+ <Route exact path='/settings/attribute/:id?' component={ComputedAttributePage} />
<Route exact path='/admin/server' component={ServerPage} />
<Route exact path='/admin/users' component={UsersPage} />
<Route exact path='/reports/route' component={RouteReportPage} />
diff --git a/modern/src/MainToolbar.js b/modern/src/MainToolbar.js
index acb10aa..91b3d69 100644
--- a/modern/src/MainToolbar.js
+++ b/modern/src/MainToolbar.js
@@ -179,7 +179,7 @@ const MainToolbar = () => {
</ListItemIcon>
<ListItemText primary={t('sharedDrivers')} />
</ListItem>
- <ListItem button onClick={() => history.push('/settings/attributes/computed')}>
+ <ListItem button onClick={() => history.push('/settings/attributes')}>
<ListItemIcon>
<StorageIcon />
</ListItemIcon>
diff --git a/modern/src/settings/ComputedAttributePage.js b/modern/src/settings/ComputedAttributePage.js
index f985152..7ff9511 100644
--- a/modern/src/settings/ComputedAttributePage.js
+++ b/modern/src/settings/ComputedAttributePage.js
@@ -25,6 +25,17 @@ const ComputedAttributePage =() => {
type: value.type,
}));
+ const handleChange = event => {
+ const newValue = event.target.value;
+ setKey(newValue);
+ const positionAttribute = positionAttributes[newValue];
+ if(positionAttribute && positionAttribute.type) {
+ setItem({...item, attribute: newValue, type: positionAttribute.type});
+ } else {
+ setItem({...item, attribute: newValue});
+ }
+ }
+
return (
<EditItemView endpoint="/attributes/computed" item={item} setItem={setItem}>
{item &&
@@ -45,16 +56,7 @@ const ComputedAttributePage =() => {
<InputLabel>{t('sharedAttribute')}</InputLabel>
<Select
value={item.attribute || ''}
- onChange={(e) => {
- const newValue = e.target.value;
- const positionAttribute = positionAttributes[newValue];
- setKey(newValue);
- if(positionAttribute && positionAttribute.type) {
- setItem({...item, attribute: newValue, type: positionAttribute.type});
- }else {
- setItem({...item, attribute: newValue});
- }
- }}>
+ onChange={handleChange}>
{options.map((option) => (
<MenuItem key={option.key} value={option.key}>{option.name}</MenuItem>
))}
diff --git a/modern/src/settings/ComputedAttributesPage.js b/modern/src/settings/ComputedAttributesPage.js
index 9ca5b69..53d1172 100644
--- a/modern/src/settings/ComputedAttributesPage.js
+++ b/modern/src/settings/ComputedAttributesPage.js
@@ -61,7 +61,7 @@ const ComputedAttributesPage = () => {
return (
<>
<MainToolbar />
- <EditCollectionView content={ComputedAttributeView} editPath="/settings/attribute/computed" endpoint="attributes/computed" />
+ <EditCollectionView content={ComputedAttributeView} editPath="/settings/attribute" endpoint="attributes/computed" />
</>
);
}