Added refetch to the jobs find modal to find new jobs that may have been added BOD-43
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Checkbox, Divider, Table, Input } from "antd";
|
||||
import { SyncOutlined } from "@ant-design/icons";
|
||||
import { Checkbox, Divider, Input, Table, Button } from "antd";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
@@ -11,6 +12,7 @@ export default function JobsFindModalComponent({
|
||||
jobsListLoading,
|
||||
importOptionsState,
|
||||
modalSearchState,
|
||||
jobsListRefetch,
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [modalSearch, setModalSearch] = modalSearchState;
|
||||
@@ -138,6 +140,12 @@ export default function JobsFindModalComponent({
|
||||
title={() => (
|
||||
<div style={{ display: "flex" }}>
|
||||
{t("jobs.labels.existing_jobs")}
|
||||
<Button
|
||||
onClick={() => {
|
||||
jobsListRefetch();
|
||||
}}>
|
||||
<SyncOutlined />
|
||||
</Button>
|
||||
<Input
|
||||
value={modalSearch}
|
||||
onChange={(e) => {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { useQuery } from "@apollo/react-hooks";
|
||||
import { Modal } from "antd";
|
||||
import React from "react";
|
||||
import { useQuery } from "@apollo/react-hooks";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { QUERY_ALL_ACTIVE_JOBS } from "../../graphql/jobs.queries";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import AlertComponent from "../alert/alert.component";
|
||||
import LoadingSpinner from "../loading-spinner/loading-spinner.component";
|
||||
import JobsFindModalComponent from "./jobs-find-modal.component";
|
||||
import { selectBodyshop } from "../../redux/user/user.selectors";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
bodyshop: selectBodyshop,
|
||||
});
|
||||
@@ -29,10 +29,10 @@ export default connect(
|
||||
const { t } = useTranslation();
|
||||
|
||||
const jobsList = useQuery(QUERY_ALL_ACTIVE_JOBS, {
|
||||
fetchPolicy: "network-only",
|
||||
variables: {
|
||||
statuses: bodyshop.md_ro_statuses.open_statuses || ["Open"],
|
||||
},
|
||||
skip: !modalProps.visible,
|
||||
});
|
||||
|
||||
const modalSearch = modalSearchState[0];
|
||||
@@ -89,6 +89,7 @@ export default connect(
|
||||
setSelectedJob={setSelectedJob}
|
||||
importOptionsState={importOptionsState}
|
||||
jobsListLoading={jobsList.loading}
|
||||
jobsListRefetch={jobsList.refetch}
|
||||
jobsList={jobsData}
|
||||
modalSearchState={modalSearchState}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user