diff options
Diffstat (limited to 'modern/src/settings')
-rw-r--r-- | modern/src/settings/GroupPage.js | 4 | ||||
-rw-r--r-- | modern/src/settings/NotificationPage.js | 9 |
2 files changed, 7 insertions, 6 deletions
diff --git a/modern/src/settings/GroupPage.js b/modern/src/settings/GroupPage.js index b6a28599..b9fa8716 100644 --- a/modern/src/settings/GroupPage.js +++ b/modern/src/settings/GroupPage.js @@ -33,7 +33,7 @@ const GroupPage = () => { <AccordionDetails className={classes.details}> <TextField margin="normal" - defaultValue={item.name} + value={item.name || ''} onChange={event => setItem({...item, name: event.target.value})} label={t('sharedName')} variant="filled" /> @@ -48,7 +48,7 @@ const GroupPage = () => { <AccordionDetails className={classes.details}> <SelectField margin="normal" - defaultValue={item.groupId} + value={item.groupId || 0} onChange={event => setItem({...item, groupId: Number(event.target.value)})} endpoint="/api/groups" label={t('groupParent')} diff --git a/modern/src/settings/NotificationPage.js b/modern/src/settings/NotificationPage.js index 2cf8a62f..33904e7f 100644 --- a/modern/src/settings/NotificationPage.js +++ b/modern/src/settings/NotificationPage.js @@ -36,7 +36,8 @@ const NotificationPage = () => { <AccordionDetails className={classes.details}> <SelectField margin="normal" - defaultValue={item.type} + value={item.type || 'alarm'} + emptyValue={null} onChange={e => setItem({...item, type: e.target.value})} endpoint="/api/notifications/types" keyGetter={it => it.type} @@ -46,18 +47,18 @@ const NotificationPage = () => { <SelectField multiple margin="normal" - defaultValue={item.notificators ? item.notificators.split(/[, ]+/) : []} + value={item.notificators ? item.notificators.split(/[, ]+/) : []} onChange={e => setItem({...item, notificators: e.target.value.join()})} endpoint="/api/notifications/notificators" keyGetter={it => it.type} titleGetter={it => t(prefixString('notificator', it.type))} label={t('notificationNotificators')} variant="filled" /> - {item.type === 'alarm' && + {(!item.type || item.type === 'alarm') && <SelectField multiple margin="normal" - defaultValue={item.attributes && item.attributes.alarms ? item.attributes.alarms.split(/[, ]+/) : []} + value={item.attributes && item.attributes.alarms ? item.attributes.alarms.split(/[, ]+/) : []} onChange={e => setItem({...item, attributes: {...item.attributes, alarms: e.target.value.join()}})} data={alarms} keyGetter={it => it.key} |