Remove redux diff slowing down logger. Adjusted report column sizings.

This commit is contained in:
Patrick Fic
2025-07-04 09:35:55 -07:00
parent 17033cc874
commit 106cc23c53
14 changed files with 836 additions and 24 deletions

View File

@@ -12,9 +12,16 @@ import ipcTypes from "../ipc.types";
import "../ipc/ipc-renderer-handler";
import { checkUserSession } from "../redux/user/user.actions";
import { selectCurrentUser, selectDarkMode } from "../redux/user/user.selectors";
import { loadErrorMessages, loadDevMessages } from "@apollo/client/dev";
import "./App.styles.scss";
const { ipcRenderer } = window;
if (process.env.NODE_ENV !== "production") {
// Adds messages only in a dev environment
loadDevMessages();
loadErrorMessages();
}
const mapStateToProps = createStructuredSelector({
currentUser: selectCurrentUser,
darkMode: selectDarkMode

View File

@@ -0,0 +1,59 @@
import { Button, message } from "antd";
import { useState } from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import ipcTypes from "../../../ipc.types";
import { selectBodyshop } from "../../../redux/user/user.selectors";
import { useApolloClient } from "@apollo/client";
import { QUERY_JOB_ESTIMATE_SCRUBBER } from "../../../graphql/jobs.queries";
const { ipcRenderer } = window;
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
});
export default connect(mapStateToProps, mapDispatchToProps)(EstimateScrubberButton);
export function EstimateScrubberButton({ bodyshop, jobid }) {
const [loading, setLoading] = useState(false);
const client = useApolloClient();
const handleScrub = async () => {
try {
ipcRenderer.send(ipcTypes.app.toMain.track, {
event: "SCRUB_ESTIMATE",
jobId: jobid
});
setLoading(true);
const jobData = await client.query({
query: QUERY_JOB_ESTIMATE_SCRUBBER,
variables: { jobId: jobid },
fetchPolicy: "network-only"
});
const result = await ipcRenderer.invoke(ipcTypes.app.toMain.scrubEstimate, {
job: {
...jobData.data.jobs_by_pk,
sending_entity_id: "87330f61-412b-4251-baaa-d026565b23c5",
sending_entity_clientid: "",
sending_entity_accept_terms_of_use: true,
profileid: "",
association_switch: "ATAM"
}
});
} catch (error) {
message.error("Error scrubbing estimate: " + error.message);
console.error("Error scrubbing estimate:", error);
}
setLoading(false);
};
return (
<Button onClick={handleScrub} loading={loading}>
Scrub Estimate with Estimate Scrubber
</Button>
);
}

View File

@@ -74,19 +74,23 @@ export function ReportingJobsListMolecule({
key: "close_date",
render: (text, record) => dayjs(record.close_date).format("MM/DD/YYYY"),
defaultSortOrder: "ascend",
width: "110px",
sorter: (a, b) => dayjs(a.close_date).unix() - dayjs(b.close_date).unix()
},
{
title: "Ins Co.",
title: "Ins.",
dataIndex: "ins_co_nm",
key: "ins_co_nm",
sorter: (a, b) => alphaSort(a.ins_co_nm, b.ins_co_nm)
sorter: (a, b) => alphaSort(a.ins_co_nm, b.ins_co_nm),
width: "75px",
ellipsis: true
},
{
title: "First Name",
dataIndex: "ownr_fn",
key: "ownr_fn",
sorter: (a, b) => alphaSort(a.ownr_fn, b.ownr_fn)
sorter: (a, b) => alphaSort(a.ownr_fn, b.ownr_fn),
ellipsis: true
},
{
title: "Last Name",
@@ -98,7 +102,8 @@ export function ReportingJobsListMolecule({
title: "Vehicle",
dataIndex: "vehicle",
key: "vehicle",
render: (text, record) => <VehicleGroupAlertAtom job={record} showGroup />
render: (text, record) => <VehicleGroupAlertAtom job={record} showGroup />,
//ellipsis: true
},
{
title: "Database Price Sum",
@@ -119,7 +124,8 @@ export function ReportingJobsListMolecule({
dataIndex: "group_verified",
key: "group_verified",
sorter: (a, b) => a.group_verified - b.group_verified,
render: (text, record) => <GroupVerifySwitch job={record} />
render: (text, record) => <GroupVerifySwitch job={record} />,
width: "100px"
},
{
title: "$ Variance",
@@ -179,7 +185,6 @@ export function ReportingJobsListMolecule({
<Switch
checked={excludedIds.includes(record.id)}
onChange={(checked) => {
console.log("Chcekedd", checked);
checked ? addExcludedId(record.id) : removeExcludedId(record.id);
}}
/>
@@ -235,9 +240,9 @@ export function ReportingJobsListMolecule({
// expandedRowRender: (record) => <JobsClaimsClerkMolecule job={record} />,
// rowExpandable: (record) => record.alerts && record.alerts.length > 0
// }}
scroll={{
x: true
}}
// scroll={{
// x: true
// }}
summary={() => (
<Table.Summary.Row>
<Table.Summary.Cell index={0}>

View File

@@ -13,6 +13,7 @@ import JobsLinesTableMolecule from "../../molecules/jobs-lines-table/jobs-lines-
import JobsTargetsStatsMolecule from "../../molecules/jobs-targets-stats/jobs-targets-stats.molecule";
import "./jobs-detail.organism.styles.scss";
import JobsClaimClerk from "../../molecules/jobs-claims-clerk/jobs-claims-clerk.molecule";
import { EstimateScrubberButton } from "../../molecules/estimate-scrubber-button/estimate-scrubber-button.molecule";
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
@@ -73,7 +74,10 @@ export function JobsDetailOrganism({ selectedJobId, setSelectedJobTargetPc }) {
//2025-05-27 Removing CC AI
*/}
<Card title="Estimate Lines">
<Card
title="Estimate Lines"
// extra={[<EstimateScrubberButton key="es" jobid={data ? data.jobs_by_pk?.id : null} />]}
>
<JobsLinesTableMolecule loading={loading} job={data ? data.jobs_by_pk : {}} />
</Card>
<Card title="Parts Breakdown">

View File

@@ -199,3 +199,58 @@ export const DELETE_JOB = gql`
}
}
`;
export const QUERY_JOB_ESTIMATE_SCRUBBER = gql`
query QUERY_JOB_ESTIMATE_SCRUBBER($jobId: uuid!) {
jobs_by_pk(id: $jobId) {
ownr_fn
ownr_ln
v_vin
v_model_yr
v_model
v_makedesc
id
ins_co_nm
clm_no
clm_total
ro_number
updated_at
group
group_verified
v_age
v_type
loss_date
close_date
updated_at
requires_reimport
created_at
v_mileage
joblines(order_by: {line_no: asc}) {
line_no
line_ind
db_ref
line_desc
part_type
glass_flag
oem_partno
db_price
act_price
price_j
part_qty
mod_lbr_ty
db_hrs
mod_lb_hrs
lbr_inc
lbr_op
lbr_hrs_j
lbr_amt
misc_amt
}
}
}
`;
//Missing Fields?
//db_date
//all rf_Fields

View File

@@ -16,6 +16,7 @@
"getAppVersion": "app_getApVersion",
"importJob": "app_importJob",
"setReleaseChannel": "app_setReleaseChannel",
"scrubEstimate": "app_scrubEstimate",
"log": {
"info": "app_logInfo",
"debug": "app_logDebug",

View File

@@ -9,15 +9,15 @@ import rootSaga from "./root.saga";
const sagaMiddleWare = createSagaMiddleware();
const middlewares = [sagaMiddleWare];
//if (process.env.NODE_ENV === "development") {
middlewares.push(createLogger({ collapsed: true, diff: true }));
//}
if (process.env.NODE_ENV === "development") {
middlewares.push(createLogger({ collapsed: true, diff: true }));
}
const composeEnhancers =
typeof window === "object" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
// Specify extensions options like name, actionsBlacklist, actionsCreators, serialize...
})
// Specify extensions options like name, actionsBlacklist, actionsCreators, serialize...
})
: compose;
const enhancer = composeEnhancers(