feat: Implement camera management page and device location updates, including API, typings, and routing.
This commit is contained in:
@@ -6,11 +6,7 @@ interface Props {
|
||||
visible: boolean;
|
||||
device: MasterModel.Thing | null;
|
||||
onCancel: () => void;
|
||||
onSubmit: (values: {
|
||||
name: string;
|
||||
external_id: string;
|
||||
address?: string;
|
||||
}) => void;
|
||||
onSubmit: (values: MasterModel.Thing) => void;
|
||||
}
|
||||
|
||||
const EditDeviceModal: React.FC<Props> = ({
|
||||
@@ -34,6 +30,24 @@ const EditDeviceModal: React.FC<Props> = ({
|
||||
}
|
||||
}, [device, form]);
|
||||
|
||||
const handleFinish = (values: {
|
||||
name: string;
|
||||
external_id: string;
|
||||
address?: string;
|
||||
}) => {
|
||||
const payload: MasterModel.Thing = {
|
||||
...device,
|
||||
name: values.name,
|
||||
metadata: {
|
||||
...(device?.metadata || {}),
|
||||
external_id: values.external_id,
|
||||
address: values.address,
|
||||
},
|
||||
};
|
||||
|
||||
onSubmit(payload);
|
||||
};
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={intl.formatMessage({
|
||||
@@ -53,7 +67,12 @@ const EditDeviceModal: React.FC<Props> = ({
|
||||
})}
|
||||
destroyOnClose
|
||||
>
|
||||
<Form form={form} layout="vertical" onFinish={onSubmit} preserve={false}>
|
||||
<Form
|
||||
form={form}
|
||||
layout="vertical"
|
||||
onFinish={handleFinish}
|
||||
preserve={false}
|
||||
>
|
||||
<Form.Item
|
||||
name="name"
|
||||
label={intl.formatMessage({
|
||||
|
||||
Reference in New Issue
Block a user