Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Netmanager] Added maintenance type field to add logs table #2433

Merged
merged 1 commit into from
Jan 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ const AddLogForm = ({ deviceName, deviceLocation, toggleShow, loading, setLoadin
const [description, setDescription] = useState('');
const [tags, setTags] = useState([]);
const [selectedDate, setSelectedDate] = useState(new Date());
const [maintenanceType, setMaintenanceType] = useState('preventive');

const createTagOption = (tag) => ({ label: tag, value: tag });

Expand Down Expand Up @@ -267,6 +268,7 @@ const AddLogForm = ({ deviceName, deviceLocation, toggleShow, loading, setLoadin
tags: extracted_tags,
description: description,
userName: parsedData.email,
maintenanceType: maintenanceType,
email: parsedData.email,
firstName: parsedData.firstName,
lastName: parsedData.lastName
Expand Down Expand Up @@ -336,6 +338,10 @@ const AddLogForm = ({ deviceName, deviceLocation, toggleShow, loading, setLoadin
toggleShow();
};

const handleMaintenanceTypeChange = (event) => {
setMaintenanceType(event.target.value);
};

return (
<Paper style={{ minHeight: '400px', padding: '5px 10px' }}>
<h4>Add Log</h4>
Expand All @@ -362,6 +368,25 @@ const AddLogForm = ({ deviceName, deviceLocation, toggleShow, loading, setLoadin
onChange={(event) => setDescription(event.target.value)}
/>
</div>
<div>
<TextField
select
fullWidth
label="Maintenance Type"
style={{ margin: '10px 0' }}
value={maintenanceType}
onChange={handleMaintenanceTypeChange}
SelectProps={{
native: true,
style: { width: '100%', height: '50px' }
}}
required
variant="outlined"
>
<option value="preventive">Preventive</option>
<option value="corrective">Corrective</option>
</TextField>
</div>
<div style={{ marginTop: '5px' }}>
<CreatableLabelledSelect
label={'Tags'}
Expand Down Expand Up @@ -437,6 +462,12 @@ export default function DeviceLogs({ deviceName, deviceLocation }) {
return <div className={'table-truncate'}>{rowData.tags && rowData.tags.join(', ')}</div>;
}
},
{
title: 'Maintenance Type',
field: 'maintenanceType',
cellStyle: { width: 100, maxWidth: 100 },
render: (rowData) => <div className={'table-truncate'}>{rowData.maintenanceType}</div>
},
{
title: 'Created On',
field: 'createdAt',
Expand Down
Loading