feat: update data structure for tag history and adjust related components for consistency
This commit is contained in:
@@ -26,7 +26,7 @@ const DetailDevice = (props) => {
|
||||
device_id: '',
|
||||
device_code: '',
|
||||
device_name: '',
|
||||
device_status: true,
|
||||
is_active: true,
|
||||
device_location: 'Building A',
|
||||
device_description: '',
|
||||
ip_address: '',
|
||||
@@ -139,7 +139,7 @@ const DetailDevice = (props) => {
|
||||
// Backend validation schema doesn't include device_code
|
||||
const payload = {
|
||||
device_name: FormData.device_name,
|
||||
device_status: FormData.device_status,
|
||||
is_active: FormData.is_active,
|
||||
device_location: FormData.device_location,
|
||||
ip_address: FormData.ip_address,
|
||||
};
|
||||
@@ -211,11 +211,10 @@ const DetailDevice = (props) => {
|
||||
const isChecked = event;
|
||||
setFormData({
|
||||
...FormData,
|
||||
device_status: isChecked ? true : false,
|
||||
is_active: isChecked ? true : false,
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
const token = localStorage.getItem('token');
|
||||
if (token) {
|
||||
@@ -312,16 +311,14 @@ const DetailDevice = (props) => {
|
||||
disabled={props.readOnly}
|
||||
style={{
|
||||
backgroundColor:
|
||||
FormData.device_status === true ? '#23A55A' : '#bfbfbf',
|
||||
FormData.is_active === true ? '#23A55A' : '#bfbfbf',
|
||||
}}
|
||||
checked={FormData.device_status === true}
|
||||
checked={FormData.is_active === true}
|
||||
onChange={handleStatusToggle}
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<Text>
|
||||
{FormData.device_status === true ? 'Running' : 'Offline'}
|
||||
</Text>
|
||||
<Text>{FormData.is_active === true ? 'Running' : 'Offline'}</Text>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user