IO-766 Added Disk Scan for estimates.
This commit is contained in:
@@ -1,21 +1,20 @@
|
|||||||
{
|
{
|
||||||
env: {
|
"env": {
|
||||||
es6: true,
|
"es6": true,
|
||||||
node: true,
|
"node": true
|
||||||
},
|
},
|
||||||
extends: "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
globals: {
|
"globals": {
|
||||||
Atomics: "readonly",
|
"Atomics": "readonly",
|
||||||
SharedArrayBuffer: "readonly",
|
"SharedArrayBuffer": "readonly"
|
||||||
},
|
},
|
||||||
|
|
||||||
parserOptions: {
|
"parserOptions": {
|
||||||
ecmaVersion: 2018,
|
"ecmaVersion": 2018,
|
||||||
sourceType: "module",
|
"sourceType": "module"
|
||||||
},
|
},
|
||||||
// plugins: [],
|
"rules": {
|
||||||
rules: {
|
|
||||||
"no-console": "off"
|
"no-console": "off"
|
||||||
},
|
},
|
||||||
settings: {},
|
"settings": {}
|
||||||
};
|
}
|
||||||
|
|||||||
@@ -19471,6 +19471,27 @@
|
|||||||
</translation>
|
</translation>
|
||||||
</translations>
|
</translations>
|
||||||
</concept_node>
|
</concept_node>
|
||||||
|
<concept_node>
|
||||||
|
<name>diskscan</name>
|
||||||
|
<definition_loaded>false</definition_loaded>
|
||||||
|
<description></description>
|
||||||
|
<comment></comment>
|
||||||
|
<default_text></default_text>
|
||||||
|
<translations>
|
||||||
|
<translation>
|
||||||
|
<language>en-US</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>es-MX</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
<translation>
|
||||||
|
<language>fr-CA</language>
|
||||||
|
<approved>false</approved>
|
||||||
|
</translation>
|
||||||
|
</translations>
|
||||||
|
</concept_node>
|
||||||
<concept_node>
|
<concept_node>
|
||||||
<name>documents</name>
|
<name>documents</name>
|
||||||
<definition_loaded>false</definition_loaded>
|
<definition_loaded>false</definition_loaded>
|
||||||
|
|||||||
25032
client/package-lock.json
generated
25032
client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,154 @@
|
|||||||
|
import { DownloadOutlined, SyncOutlined } from "@ant-design/icons";
|
||||||
|
import { Button, Input, Space, Table } from "antd";
|
||||||
|
import axios from "axios";
|
||||||
|
import React, { useState } from "react";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { selectPartnerVersion } from "../../redux/application/application.selectors";
|
||||||
|
import { alphaSort } from "../../utils/sorters";
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
//currentUser: selectCurrentUser
|
||||||
|
partnerVersion: selectPartnerVersion,
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
});
|
||||||
|
export default connect(mapStateToProps, mapDispatchToProps)(JobsAvailableScan);
|
||||||
|
|
||||||
|
export function JobsAvailableScan({ partnerVersion }) {
|
||||||
|
const [estimatesOnDisk, setEstimatesOnDisk] = useState([]);
|
||||||
|
const [loading, setLoading] = useState(false);
|
||||||
|
const [searchText, setSearchText] = useState("");
|
||||||
|
const [state, setState] = useState({
|
||||||
|
sortedInfo: {},
|
||||||
|
filteredInfo: { text: "" },
|
||||||
|
});
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const handleTableChange = (pagination, filters, sorter) => {
|
||||||
|
setState({ ...state, filteredInfo: filters, sortedInfo: sorter });
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleImport = async (filepath) => {
|
||||||
|
setLoading(true);
|
||||||
|
const response = await axios.post("http://localhost:1337/import/", {
|
||||||
|
filepath,
|
||||||
|
});
|
||||||
|
console.log("response", response);
|
||||||
|
setLoading(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.cieca_id"),
|
||||||
|
dataIndex: "cieca_id",
|
||||||
|
key: "cieca_id",
|
||||||
|
sorter: (a, b) => alphaSort(a, b),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "cieca_id" && state.sortedInfo.order,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.owner"),
|
||||||
|
dataIndex: "owner",
|
||||||
|
key: "owner",
|
||||||
|
ellipsis: true,
|
||||||
|
sorter: (a, b) => alphaSort(a.owner, b.owner),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "owner" && state.sortedInfo.order,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.vehicle"),
|
||||||
|
dataIndex: "vehicle",
|
||||||
|
key: "vehicle",
|
||||||
|
sorter: (a, b) => alphaSort(a.vehicle, b.vehicle),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "vehicle" && state.sortedInfo.order,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.clm_no"),
|
||||||
|
dataIndex: "clm_no",
|
||||||
|
key: "clm_no",
|
||||||
|
sorter: (a, b) => alphaSort(a.clm_no, b.clm_no),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "clm_no" && state.sortedInfo.order,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("jobs.fields.ins_co_nm"),
|
||||||
|
dataIndex: "ins_co_nm",
|
||||||
|
key: "ins_co_nm",
|
||||||
|
sorter: (a, b) => alphaSort(a.ins_co_nm, b.ins_co_nm),
|
||||||
|
sortOrder:
|
||||||
|
state.sortedInfo.columnKey === "ins_co_nm" && state.sortedInfo.order,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: t("general.labels.actions"),
|
||||||
|
key: "actions",
|
||||||
|
render: (text, record) => (
|
||||||
|
<Button onClick={() => handleImport(record.filepath)}>
|
||||||
|
<DownloadOutlined />
|
||||||
|
</Button>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const scanEstimates = async () => {
|
||||||
|
setLoading(true);
|
||||||
|
const estimatesOnDiskResponse = await axios.post(
|
||||||
|
"http://localhost:1337/scan/"
|
||||||
|
);
|
||||||
|
setEstimatesOnDisk(estimatesOnDiskResponse.data);
|
||||||
|
setLoading(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const data = estimatesOnDisk
|
||||||
|
? searchText
|
||||||
|
? estimatesOnDisk.filter(
|
||||||
|
(j) =>
|
||||||
|
(j.owner || "").toLowerCase().includes(searchText.toLowerCase()) ||
|
||||||
|
(j.vehicle || "")
|
||||||
|
.toLowerCase()
|
||||||
|
.includes(searchText.toLowerCase()) ||
|
||||||
|
(j.clm_no || "").toLowerCase().includes(searchText.toLowerCase())
|
||||||
|
)
|
||||||
|
: estimatesOnDisk
|
||||||
|
: [];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Table
|
||||||
|
loading={loading}
|
||||||
|
title={() => {
|
||||||
|
return (
|
||||||
|
<div className="imex-table-header">
|
||||||
|
<Space>
|
||||||
|
<strong>{t("jobs.labels.diskscan")}</strong>
|
||||||
|
<Button
|
||||||
|
loading={loading}
|
||||||
|
disabled={!partnerVersion}
|
||||||
|
onClick={() => {
|
||||||
|
scanEstimates();
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<SyncOutlined />
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
<div className="imex-table-header__search">
|
||||||
|
<Input.Search
|
||||||
|
placeholder={t("general.labels.search")}
|
||||||
|
onChange={(e) => {
|
||||||
|
setSearchText(e.currentTarget.value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
size="small"
|
||||||
|
pagination={{ position: "top" }}
|
||||||
|
columns={columns}
|
||||||
|
rowKey="id"
|
||||||
|
dataSource={data}
|
||||||
|
onChange={handleTableChange}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -3,7 +3,23 @@ import axios from "axios";
|
|||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
export default function PartnerPingComponent() {
|
import { connect } from "react-redux";
|
||||||
|
import { createStructuredSelector } from "reselect";
|
||||||
|
import { setPartnerVersion } from "../../redux/application/application.actions";
|
||||||
|
|
||||||
|
const mapStateToProps = createStructuredSelector({
|
||||||
|
//currentUser: selectCurrentUser
|
||||||
|
});
|
||||||
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
|
//setUserLanguage: language => dispatch(setUserLanguage(language))
|
||||||
|
setPartnerVersion: (version) => dispatch(setPartnerVersion(version)),
|
||||||
|
});
|
||||||
|
export default connect(
|
||||||
|
mapStateToProps,
|
||||||
|
mapDispatchToProps
|
||||||
|
)(PartnerPingComponent);
|
||||||
|
|
||||||
|
export function PartnerPingComponent({ setPartnerVersion }) {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -13,6 +29,7 @@ export default function PartnerPingComponent() {
|
|||||||
if (process.env.NODE_ENV === "development") return;
|
if (process.env.NODE_ENV === "development") return;
|
||||||
const PartnerResponse = await axios.post("http://localhost:1337/ping/");
|
const PartnerResponse = await axios.post("http://localhost:1337/ping/");
|
||||||
const { appver, qbpath } = PartnerResponse.data;
|
const { appver, qbpath } = PartnerResponse.data;
|
||||||
|
setPartnerVersion(appver);
|
||||||
console.log({ appver, qbpath });
|
console.log({ appver, qbpath });
|
||||||
if (!qbpath) {
|
if (!qbpath) {
|
||||||
notification["error"]({
|
notification["error"]({
|
||||||
|
|||||||
@@ -3,11 +3,12 @@ import React, { useEffect } from "react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
|
import JobsAvailableScan from "../../components/jobs-available-scan/jobs-available-scan.component";
|
||||||
import JobsAvailableTableContainer from "../../components/jobs-available-table/jobs-available-table.container";
|
import JobsAvailableTableContainer from "../../components/jobs-available-table/jobs-available-table.container";
|
||||||
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
import RbacWrapper from "../../components/rbac-wrapper/rbac-wrapper.component";
|
||||||
import {
|
import {
|
||||||
setBreadcrumbs,
|
setBreadcrumbs,
|
||||||
setSelectedHeader
|
setSelectedHeader,
|
||||||
} from "../../redux/application/application.actions";
|
} from "../../redux/application/application.actions";
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => ({
|
const mapDispatchToProps = (dispatch) => ({
|
||||||
@@ -32,11 +33,11 @@ export function JobsAvailablePageContainer({
|
|||||||
return (
|
return (
|
||||||
<RbacWrapper action="jobs:available-list">
|
<RbacWrapper action="jobs:available-list">
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<Link to="/manage/jobs/new">
|
<Link to="/manage/jobs/new">
|
||||||
<Button>{t("jobs.actions.manualnew")}</Button>
|
<Button>{t("jobs.actions.manualnew")}</Button>
|
||||||
</Link>
|
</Link>
|
||||||
<JobsAvailableTableContainer />
|
<JobsAvailableTableContainer />
|
||||||
|
<JobsAvailableScan />
|
||||||
</div>
|
</div>
|
||||||
</RbacWrapper>
|
</RbacWrapper>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -43,3 +43,8 @@ export const setJobReadOnly = (bool) => ({
|
|||||||
type: ApplicationActionTypes.SET_JOB_READONLY,
|
type: ApplicationActionTypes.SET_JOB_READONLY,
|
||||||
payload: bool,
|
payload: bool,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const setPartnerVersion = (version) => ({
|
||||||
|
type: ApplicationActionTypes.SET_PARTNER_VERSION,
|
||||||
|
payload: version,
|
||||||
|
});
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ const INITIAL_STATE = {
|
|||||||
error: null,
|
error: null,
|
||||||
},
|
},
|
||||||
jobReadOnly: false,
|
jobReadOnly: false,
|
||||||
|
partnerVersion: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const applicationReducer = (state = INITIAL_STATE, action) => {
|
const applicationReducer = (state = INITIAL_STATE, action) => {
|
||||||
@@ -67,6 +68,9 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
|
|||||||
case ApplicationActionTypes.SET_JOB_READONLY:
|
case ApplicationActionTypes.SET_JOB_READONLY:
|
||||||
return { ...state, jobReadOnly: action.payload };
|
return { ...state, jobReadOnly: action.payload };
|
||||||
|
|
||||||
|
case ApplicationActionTypes.SET_PARTNER_VERSION:
|
||||||
|
return { ...state, partnerVersion: action.payload };
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,10 @@ export const selectScheduleLoad = createSelector(
|
|||||||
[selectApplication],
|
[selectApplication],
|
||||||
(application) => application.scheduleLoad.load
|
(application) => application.scheduleLoad.load
|
||||||
);
|
);
|
||||||
|
export const selectPartnerVersion = createSelector(
|
||||||
|
[selectApplication],
|
||||||
|
(application) => application.partnerVersion
|
||||||
|
);
|
||||||
|
|
||||||
export const selectScheduleLoadCalculating = createSelector(
|
export const selectScheduleLoadCalculating = createSelector(
|
||||||
[selectApplication],
|
[selectApplication],
|
||||||
|
|||||||
@@ -8,5 +8,6 @@ const ApplicationActionTypes = {
|
|||||||
ADD_RECENT_ITEM: "ADD_RECENT_ITEM",
|
ADD_RECENT_ITEM: "ADD_RECENT_ITEM",
|
||||||
SET_SELECTED_HEADER: "SET_SELECTED_HEADER",
|
SET_SELECTED_HEADER: "SET_SELECTED_HEADER",
|
||||||
SET_JOB_READONLY: "SET_JOB_READONLY",
|
SET_JOB_READONLY: "SET_JOB_READONLY",
|
||||||
|
SET_PARTNER_VERSION: "SET_PARTNER_VERSION",
|
||||||
};
|
};
|
||||||
export default ApplicationActionTypes;
|
export default ApplicationActionTypes;
|
||||||
|
|||||||
@@ -1180,6 +1180,7 @@
|
|||||||
"deleteconfirm": "Are you sure you want to delete this job? This cannot be undone. ",
|
"deleteconfirm": "Are you sure you want to delete this job? This cannot be undone. ",
|
||||||
"deliverchecklist": "Deliver Checklist",
|
"deliverchecklist": "Deliver Checklist",
|
||||||
"difference": "Difference",
|
"difference": "Difference",
|
||||||
|
"diskscan": "Scan Disk for Estimates",
|
||||||
"documents": "Documents",
|
"documents": "Documents",
|
||||||
"documents-images": "Images",
|
"documents-images": "Images",
|
||||||
"documents-other": "Other Documents",
|
"documents-other": "Other Documents",
|
||||||
|
|||||||
@@ -1180,6 +1180,7 @@
|
|||||||
"deleteconfirm": "",
|
"deleteconfirm": "",
|
||||||
"deliverchecklist": "",
|
"deliverchecklist": "",
|
||||||
"difference": "",
|
"difference": "",
|
||||||
|
"diskscan": "",
|
||||||
"documents": "documentos",
|
"documents": "documentos",
|
||||||
"documents-images": "",
|
"documents-images": "",
|
||||||
"documents-other": "",
|
"documents-other": "",
|
||||||
|
|||||||
@@ -1180,6 +1180,7 @@
|
|||||||
"deleteconfirm": "",
|
"deleteconfirm": "",
|
||||||
"deliverchecklist": "",
|
"deliverchecklist": "",
|
||||||
"difference": "",
|
"difference": "",
|
||||||
|
"diskscan": "",
|
||||||
"documents": "Les documents",
|
"documents": "Les documents",
|
||||||
"documents-images": "",
|
"documents-images": "",
|
||||||
"documents-other": "",
|
"documents-other": "",
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
//FILE WAS RENAMED AS BABELEDIT TRIES TO PICK IT UP AND CANNOT READ IT WITH THE COMMENTS.
|
||||||
|
|
||||||
{
|
{
|
||||||
"root": true,
|
"root": true,
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
5860
package-lock.json
generated
5860
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user