diff --git a/src/components/organisms/jobs-list-search/jobs-list-search.organism.jsx b/src/components/organisms/jobs-list-search/jobs-list-search.organism.jsx
index cea8ddf..f3ccb24 100644
--- a/src/components/organisms/jobs-list-search/jobs-list-search.organism.jsx
+++ b/src/components/organisms/jobs-list-search/jobs-list-search.organism.jsx
@@ -9,7 +9,7 @@ import JobsSearchFieldsMolecule from "../../molecules/jobs-search-fields/jobs-se
const limit = 50;
export default function JobsTableOrganism() {
- const [state, setState] = useState({ hasMore: true });
+ const [state, setState] = useState({ hasMore: false });
const [callSearch, { loading, error, data, fetchMore }] = useLazyQuery(
SEARCH_JOBS_PAGINATED,
@@ -21,8 +21,13 @@ export default function JobsTableOrganism() {
}
);
+ const handleSearch = (options) => {
+ setState({ hasMore: true });
+ callSearch(options);
+ };
+
const handleInfiniteOnLoad = async (page) => {
- if (fetchMore) {
+ if (fetchMore && data?.search_jobs) {
// ipcRenderer.send(ipcTypes.app.toMain.track, {
// event: "FETCH_MORE_JOBS",
// });
@@ -31,14 +36,18 @@ export default function JobsTableOrganism() {
offset: limit * page,
},
updateQuery: (prev, { fetchMoreResult }) => {
- if (!fetchMoreResult) {
+ const previousJobs = prev?.search_jobs || [];
+ const incomingJobs = fetchMoreResult?.search_jobs || [];
+
+ if (!incomingJobs.length) {
console.log("No more results. Fetch More was empty.");
- setState({ ...state, hasMore: false });
+ setState((current) => ({ ...current, hasMore: false }));
return prev;
}
const newCache = Object.assign({}, prev, {
- search_jobs: [...prev.search_jobs, ...fetchMoreResult.search_jobs],
+ search_jobs: [...previousJobs, ...incomingJobs],
+ search_jobs_aggregate: fetchMoreResult.search_jobs_aggregate || prev?.search_jobs_aggregate
});
if (
@@ -46,7 +55,7 @@ export default function JobsTableOrganism() {
(data && data.search_jobs_aggregate.aggregate.count)
) {
console.log("No more results.");
- setState({ ...state, hasMore: false });
+ setState((current) => ({ ...current, hasMore: false }));
}
return newCache;
@@ -65,7 +74,7 @@ export default function JobsTableOrganism() {
return (
-
+
[
+ {
+ label: "2 Months ago",
+ value: [
+ dayjs().startOf("month").subtract(2, "month"),
+ dayjs().startOf("month").subtract(2, "month").endOf("month")
+ ]
+ },
+ {
+ label: "Last Month",
+ value: [
+ dayjs().startOf("month").subtract(1, "month"),
+ dayjs().startOf("month").subtract(1, "month").endOf("month")
+ ]
+ },
+ { label: "This Month", value: [dayjs().startOf("month"), dayjs().endOf("month")] },
+ {
+ label: "Last Quarter",
+ value: [
+ dayjs().startOf("quarter").subtract(1, "quarter"),
+ dayjs().startOf("quarter").subtract(1, "day")
+ ]
+ },
+ {
+ label: "Last 3 Months",
+ value: [
+ dayjs().startOf("month").subtract(3, "month"),
+ dayjs().startOf("month").subtract(1, "month").endOf("month")
+ ]
+ }
+];
+
const mapStateToProps = createStructuredSelector({
//currentUser: selectCurrentUser
bodyshop: selectBodyshop,
@@ -31,6 +63,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(AuditPage);
export function AuditPage({ auditError, queryReportingData, bodyshop, reportingError, setSelectedJobId }) {
const [form] = Form.useForm();
+ const auditDatePresets = getAuditDatePresets();
const [sheets, setSheets] = useState([]);
useEffect(() => {
ipcRenderer.on(ipcTypes.audit.toRenderer.auditFilePath, async (event, { filePath, sheets }) => {
@@ -104,28 +137,7 @@ export function AuditPage({ auditError, queryReportingData, bodyshop, reportingE
}
]}
>
-
+
diff --git a/src/components/pages/routes/routes.page.jsx b/src/components/pages/routes/routes.page.jsx
index db8ec22..31ac033 100644
--- a/src/components/pages/routes/routes.page.jsx
+++ b/src/components/pages/routes/routes.page.jsx
@@ -1,4 +1,4 @@
-import { Alert, Layout, notification } from "antd";
+import { Alert, Layout } from "antd";
import React from "react";
import { connect } from "react-redux";
import { Routes } from "react-router-dom";
diff --git a/src/components/templates/error-boundary.template.jsx b/src/components/templates/error-boundary.template.jsx
index 58f5224..a29f38b 100644
--- a/src/components/templates/error-boundary.template.jsx
+++ b/src/components/templates/error-boundary.template.jsx
@@ -26,6 +26,21 @@ class ErrorBoundary extends React.Component {
render() {
if (this.state.hasErrored === true) {
+ const errorItems = [
+ {
+ key: "error-details",
+ label: "Error Details",
+ children: (
+ <>
+
+ {this.state.error.message}
+
+ {this.state.error.stack}
+ >
+ )
+ }
+ ];
+
return (
-
-
-
- {this.state.error.message}
-
- {this.state.error.stack}
-
-
+
diff --git a/src/graphql/GraphQLClient.js b/src/graphql/GraphQLClient.js
index b454075..990e998 100644
--- a/src/graphql/GraphQLClient.js
+++ b/src/graphql/GraphQLClient.js
@@ -104,7 +104,33 @@ if (import.meta.env.DEV) {
middlewares.push(sentryLink.concat(retryLink.concat(errorLink.concat(authLink.concat(httpLink)))));
-const cache = new InMemoryCache({});
+const mergeByOffset = (existing = [], incoming = [], { args }) => {
+ const merged = existing ? existing.slice(0) : [];
+ const offset = args?.offset || 0;
+
+ incoming.forEach((item, index) => {
+ merged[offset + index] = item;
+ });
+
+ return merged;
+};
+
+const cache = new InMemoryCache({
+ typePolicies: {
+ Query: {
+ fields: {
+ jobs: {
+ keyArgs: ["order"],
+ merge: mergeByOffset
+ },
+ search_jobs: {
+ keyArgs: ["args", "where"],
+ merge: mergeByOffset
+ }
+ }
+ }
+ }
+});
export default new ApolloClient({
link: ApolloLink.from(middlewares),
diff --git a/src/ipc/ipc-estimate-utils.js b/src/ipc/ipc-estimate-utils.js
index 0edcd22..22408f4 100644
--- a/src/ipc/ipc-estimate-utils.js
+++ b/src/ipc/ipc-estimate-utils.js
@@ -1,4 +1,4 @@
-import { message } from "antd";
+import { antdMessage as message } from "../util/antdFeedback";
import gql from "graphql-tag";
import _ from "lodash";
import client from "../graphql/GraphQLClient";
@@ -8500,4 +8500,4 @@ export const SgiGroupsV12026April = [
"ageDesc": "Over 7 years",
"name": "SGIV1"
}
-]
\ No newline at end of file
+]
diff --git a/src/ipc/ipc-renderer-handler.js b/src/ipc/ipc-renderer-handler.js
index 2343954..d70ada6 100644
--- a/src/ipc/ipc-renderer-handler.js
+++ b/src/ipc/ipc-renderer-handler.js
@@ -1,4 +1,4 @@
-import { notification } from "antd";
+import { antdNotification as notification } from "../util/antdFeedback";
import ipcTypes from "../ipc.types";
import {
setReleaseNotes,
diff --git a/src/redux/store.js b/src/redux/store.js
index aece08e..4801ead 100644
--- a/src/redux/store.js
+++ b/src/redux/store.js
@@ -1,4 +1,4 @@
-import { createStore, applyMiddleware, compose } from "redux";
+import { legacy_createStore as createStore, applyMiddleware, compose } from "redux";
import { persistStore } from "redux-persist";
import { createLogger } from "redux-logger";
import createSagaMiddleware from "redux-saga";
diff --git a/src/redux/user/user.sagas.js b/src/redux/user/user.sagas.js
index 66e57de..b5da5ab 100644
--- a/src/redux/user/user.sagas.js
+++ b/src/redux/user/user.sagas.js
@@ -1,4 +1,4 @@
-import { message } from "antd";
+import { antdMessage as message } from "../../util/antdFeedback";
import dayjs from "../../util/day.js";
//import LogRocket from "logrocket";
import * as Sentry from "@sentry/electron/renderer";