From a4c2f0477dcda2662a3fd268f77a7549dead6e67 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sat, 5 Dec 2020 17:23:44 -0800 Subject: Fix default and empty values (fix #802) --- modern/src/DevicePage.js | 15 ++++++++------- modern/src/UserPage.js | 4 ++-- modern/src/admin/ServerPage.js | 2 +- modern/src/attributes/EditAttributesView.js | 2 +- modern/src/form/SelectField.js | 9 +++++---- modern/src/settings/GroupPage.js | 4 ++-- modern/src/settings/NotificationPage.js | 9 +++++---- 7 files changed, 24 insertions(+), 21 deletions(-) diff --git a/modern/src/DevicePage.js b/modern/src/DevicePage.js index a8a3de6..145ecc9 100644 --- a/modern/src/DevicePage.js +++ b/modern/src/DevicePage.js @@ -36,13 +36,13 @@ const DevicePage = () => { setItem({...item, name: event.target.value})} label={t('sharedName')} variant="filled" /> setItem({...item, uniqueId: event.target.value})} label={t('deviceIdentifier')} variant="filled" /> @@ -57,32 +57,33 @@ const DevicePage = () => { setItem({...item, groupId: Number(event.target.value)})} endpoint="/api/groups" label={t('groupParent')} variant="filled" /> setItem({...item, phone: event.target.value})} label={t('sharedPhone')} variant="filled" /> setItem({...item, model: event.target.value})} label={t('deviceModel')} variant="filled" /> setItem({...item, contact: event.target.value})} label={t('deviceContact')} variant="filled" /> setItem({...item, category: event.target.value})} data={deviceCategories.map(category => ({ id: category, diff --git a/modern/src/UserPage.js b/modern/src/UserPage.js index 0fa0918..dfe8b98 100644 --- a/modern/src/UserPage.js +++ b/modern/src/UserPage.js @@ -33,13 +33,13 @@ const UserPage = () => { setItem({...item, name: event.target.value})} label={t('sharedName')} variant="filled" /> setItem({...item, email: event.target.value})} label={t('userEmail')} variant="filled" /> diff --git a/modern/src/admin/ServerPage.js b/modern/src/admin/ServerPage.js index d896104..43664e5 100644 --- a/modern/src/admin/ServerPage.js +++ b/modern/src/admin/ServerPage.js @@ -63,7 +63,7 @@ const ServerPage = () => { setItem({...item, announcement: event.target.value})} label={t('serverAnnouncement')} variant="filled" /> diff --git a/modern/src/attributes/EditAttributesView.js b/modern/src/attributes/EditAttributesView.js index 9491acc..619d857 100644 --- a/modern/src/attributes/EditAttributesView.js +++ b/modern/src/attributes/EditAttributesView.js @@ -106,7 +106,7 @@ const EditAttributesView = ({ attributes, setAttributes, definitions }) => { {getAttributeName(key)} updateAttribute(key, e.target.value)} endAdornment={ diff --git a/modern/src/form/SelectField.js b/modern/src/form/SelectField.js index fa51a36..b179c58 100644 --- a/modern/src/form/SelectField.js +++ b/modern/src/form/SelectField.js @@ -7,7 +7,8 @@ const SelectField = ({ variant, label, multiple, - defaultValue, + value, + emptyValue = 0, onChange, endpoint, data, @@ -31,10 +32,10 @@ const SelectField = ({ {label}