TP-24538: Bug fix and minor change
This commit is contained in:
@@ -57,12 +57,16 @@ const Dashboard: FC = () => {
|
||||
pageNumber - 1
|
||||
}&page_size=${currentPageSize}`;
|
||||
setPageNumber(pageNumber - 1);
|
||||
pageNumberRef.current = `page_number=${
|
||||
pageNumber - 1
|
||||
}&page_size=${currentPageSize}`;
|
||||
startIncidentSearch(`${searchParamRef.current}${finalParams}`);
|
||||
};
|
||||
|
||||
const handlePageSize = (pageSize: number): void => {
|
||||
const finalParams = `page_number=${currentPageNumber}&page_size=${pageSize}`;
|
||||
setPageSize(pageSize);
|
||||
pageNumberRef.current = `page_number=${currentPageNumber}&page_size=${pageSize}`;
|
||||
startIncidentSearch(`${searchParamRef.current}${finalParams}`);
|
||||
};
|
||||
|
||||
@@ -86,6 +90,7 @@ const Dashboard: FC = () => {
|
||||
pageDetails={pageDetails}
|
||||
handlePageNumberChange={handlePageNumber}
|
||||
handlePageSizeChange={handlePageSize}
|
||||
fetchIncidentData={fetchIncidentData}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -17,6 +17,7 @@ interface SearchResultTableProps {
|
||||
currentPageSize: number;
|
||||
handlePageNumberChange: (pageNumber: number) => void;
|
||||
handlePageSizeChange: (pageSize: number) => void;
|
||||
fetchIncidentData: (props: any) => void;
|
||||
}
|
||||
|
||||
const defaultColDef = {
|
||||
@@ -31,6 +32,7 @@ const SearchResultsTable: FC<SearchResultTableProps> = ({
|
||||
currentPageSize,
|
||||
handlePageNumberChange,
|
||||
handlePageSizeChange,
|
||||
fetchIncidentData,
|
||||
}) => {
|
||||
const { pageNumber, totalElements } = pageDetails;
|
||||
const [drawerState, setDrawerState] = useState<boolean>(false);
|
||||
@@ -135,6 +137,7 @@ const SearchResultsTable: FC<SearchResultTableProps> = ({
|
||||
|
||||
const handleCloseDrawer = () => {
|
||||
incidentData.current = {};
|
||||
fetchIncidentData({});
|
||||
setDrawerState(false);
|
||||
};
|
||||
|
||||
|
||||
@@ -114,14 +114,9 @@ const DrawerMode: FC<DrawerModeProps> = ({ incidentId, slackChannel }) => {
|
||||
}
|
||||
}, [headerData, incidentDetails, incidentParticipants]);
|
||||
|
||||
const updateIncident = () => {
|
||||
const updateIncident = payload => {
|
||||
const endPoint = UPDATE_INCIDENT;
|
||||
ApiService.post(endPoint, {
|
||||
id: incidentId,
|
||||
teamId: `${team?.value}`,
|
||||
status: `${status?.value}`,
|
||||
severityId: `${severity?.value}`,
|
||||
})
|
||||
ApiService.post(endPoint, payload)
|
||||
.then(response => {
|
||||
toast.success('Incident Updated Successfully');
|
||||
})
|
||||
@@ -146,7 +141,14 @@ const DrawerMode: FC<DrawerModeProps> = ({ incidentId, slackChannel }) => {
|
||||
options={headerData?.severities}
|
||||
onSelectionChange={val => {
|
||||
setSeverity(val);
|
||||
updateIncident();
|
||||
updateIncident({
|
||||
id: incidentId,
|
||||
teamId: `${team?.value}`,
|
||||
status: `${status?.value}`,
|
||||
severityId: !Array.isArray(val)
|
||||
? `${val?.value}`
|
||||
: val?.[0]?.value,
|
||||
});
|
||||
}}
|
||||
isSingleSelect
|
||||
filterClass={styles['filter-wrapper']}
|
||||
@@ -159,7 +161,12 @@ const DrawerMode: FC<DrawerModeProps> = ({ incidentId, slackChannel }) => {
|
||||
options={headerData?.incidentStatuses}
|
||||
onSelectionChange={val => {
|
||||
setStatus(val);
|
||||
updateIncident();
|
||||
updateIncident({
|
||||
id: incidentId,
|
||||
teamId: `${team?.value}`,
|
||||
status: !Array.isArray(val) ? `${val?.value}` : val?.[0]?.value,
|
||||
severityId: `${severity?.value}`,
|
||||
});
|
||||
}}
|
||||
isSingleSelect
|
||||
filterClass={styles['filter-wrapper']}
|
||||
@@ -172,7 +179,12 @@ const DrawerMode: FC<DrawerModeProps> = ({ incidentId, slackChannel }) => {
|
||||
options={headerData?.teams}
|
||||
onSelectionChange={val => {
|
||||
setTeam(val);
|
||||
updateIncident();
|
||||
updateIncident({
|
||||
id: incidentId,
|
||||
teamId: !Array.isArray(val) ? `${val?.value}` : val?.[0]?.value,
|
||||
status: `${status?.value}`,
|
||||
severityId: `${team?.value}`,
|
||||
});
|
||||
}}
|
||||
isSingleSelect
|
||||
filterClass={styles['filter-wrapper']}
|
||||
|
||||
Reference in New Issue
Block a user