From 5ef32c54652b2aeea3e583b8f14caa21062a18ef Mon Sep 17 00:00:00 2001 From: Patrick Fic <> Date: Thu, 22 Oct 2020 19:37:09 -0700 Subject: [PATCH] Inversed ignoring of lines and included default filter. RPS-1 RPS-5 --- electron/analytics.js | 5 +++- package-lock.json | 18 +++++++++++++ package.json | 4 +-- .../ignore-job-line/ignore-job-line.atom.jsx | 7 ++--- .../jobs-parts-graph.atom.jsx | 6 ++--- .../jobs-lines-table.molecule.jsx | 26 ++++++++++++++++--- .../jobs-targets-stats.molecule.jsx | 2 +- .../jobs-detail/jobs-detail.organism.jsx | 6 +++-- 8 files changed, 58 insertions(+), 16 deletions(-) diff --git a/electron/analytics.js b/electron/analytics.js index dfb1bda..2732e14 100644 --- a/electron/analytics.js +++ b/electron/analytics.js @@ -4,7 +4,10 @@ const log = require("electron-log"); const Nucleus = require("nucleus-nodejs"); const { default: ipcTypes } = require("../src/ipc.types"); -Nucleus.init("5f91b569b95bac34eefdb63a", { debug: true }); +Nucleus.init("5f91b569b95bac34eefdb63a", { + disableInDev: false, + debug: false, +}); Nucleus.setProps({ version: app.getVersion().toString(), diff --git a/package-lock.json b/package-lock.json index 18b148e..6f48c4a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4227,6 +4227,15 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==" }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "block-stream": { "version": "0.0.9", "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", @@ -8218,6 +8227,12 @@ "schema-utils": "^2.5.0" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "optional": true + }, "filelist": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/filelist/-/filelist-1.0.1.tgz", @@ -10665,6 +10680,7 @@ "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "optional": true, "requires": { + "bindings": "^1.5.0", "nan": "^2.12.1" } }, @@ -19376,6 +19392,7 @@ "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "optional": true, "requires": { + "bindings": "^1.5.0", "nan": "^2.12.1" } }, @@ -19780,6 +19797,7 @@ "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "optional": true, "requires": { + "bindings": "^1.5.0", "nan": "^2.12.1" } }, diff --git a/package.json b/package.json index aa7ee5e..9c12a19 100644 --- a/package.json +++ b/package.json @@ -53,8 +53,8 @@ "pack": "electron-builder --dir", "dist": "npm run build && electron-builder", "distp": "npm run build && electron-builder --publish always", - "distpnb": "npm run build && electron-builder --publish always", - "postinstall": "npm run build && electron-builder install-app-deps" + "distpnb": "lectron-builder --publish always", + "postinstall": "electron-builder install-app-deps" }, "eslintConfig": { "extends": "react-app" diff --git a/src/components/atoms/ignore-job-line/ignore-job-line.atom.jsx b/src/components/atoms/ignore-job-line/ignore-job-line.atom.jsx index 2f9f9db..44c55f3 100644 --- a/src/components/atoms/ignore-job-line/ignore-job-line.atom.jsx +++ b/src/components/atoms/ignore-job-line/ignore-job-line.atom.jsx @@ -9,15 +9,16 @@ export default function IgnoreJobLineAtom({ ignore, lineId, line_desc }) { const [updateJobLine] = useMutation(UPDATE_JOB_LINE); const [loading, setLoading] = useState(false); const handleChange = async (checked) => { + console.log("handleChange -> checked", checked); setLoading(true); ipcRenderer.send(ipcTypes.default.app.toMain.track, { event: "TOGGLE_IGNORE_LINE", line_desc: line_desc, - ignore: checked, + ignore: !checked, }); const result = await updateJobLine({ - variables: { lineId: lineId, line: { ignore: checked } }, + variables: { lineId: lineId, line: { ignore: !checked } }, }); if (result.errors) { message.error("Error updating line."); @@ -27,5 +28,5 @@ export default function IgnoreJobLineAtom({ ignore, lineId, line_desc }) { setLoading(false); }; - return ; + return ; } diff --git a/src/components/atoms/jobs-parts-graph/jobs-parts-graph.atom.jsx b/src/components/atoms/jobs-parts-graph/jobs-parts-graph.atom.jsx index ff3a765..3085905 100644 --- a/src/components/atoms/jobs-parts-graph/jobs-parts-graph.atom.jsx +++ b/src/components/atoms/jobs-parts-graph/jobs-parts-graph.atom.jsx @@ -48,9 +48,6 @@ export default function JobPartsGraphAtom({ alignItems: "center", }} > - - {price === "act_price" ? "Actual Price" : "Database Price"} - + + {price === "act_price" ? "Actual Price" : "Database Price"} + ); } diff --git a/src/components/molecules/jobs-lines-table/jobs-lines-table.molecule.jsx b/src/components/molecules/jobs-lines-table/jobs-lines-table.molecule.jsx index 49ffc20..fb362d0 100644 --- a/src/components/molecules/jobs-lines-table/jobs-lines-table.molecule.jsx +++ b/src/components/molecules/jobs-lines-table/jobs-lines-table.molecule.jsx @@ -6,11 +6,12 @@ import CurrencyFormatterAtom from "../../atoms/currency-formatter/currency-forma import IgnoreJobLine from "../../atoms/ignore-job-line/ignore-job-line.atom"; import partTypeConverterAtom from "../../atoms/part-type-converter/part-type-converter.atom"; import PriceDiffPcFormatterAtom from "../../atoms/price-diff-pc-formatter/price-diff-pc-formatter.atom"; - +import { CalculatorOutlined } from "@ant-design/icons"; const { ipcRenderer } = window; export default function JobLinesTableMolecule({ loading, job }) { const [searchText, setSearchText] = useState(""); + const [filters, setFilters] = useState({ ignore: ["false"] }); const { joblines } = job; const columns = [ @@ -19,23 +20,27 @@ export default function JobLinesTableMolecule({ loading, job }) { dataIndex: "line_no", key: "line_no", sorter: (a, b) => a.line_no - b.line_no, + width: "5%", }, { title: "S#", dataIndex: "line_ind", key: "line_ind", + width: "5%", sorter: (a, b) => alphaSort(a.line_ind, b.line_ind), }, { title: "Line Description", dataIndex: "line_desc", key: "line_desc", + width: "25%", sorter: (a, b) => alphaSort(a.line_desc, b.line_desc), }, { title: "Part Type", dataIndex: "part_type", key: "part_type", + width: "5%", sorter: (a, b) => alphaSort(a.part_type, b.part_type), render: (text, record) => partTypeConverterAtom(text), }, @@ -43,12 +48,14 @@ export default function JobLinesTableMolecule({ loading, job }) { title: "Part Number", dataIndex: "oem_partno", key: "oem_partno", + width: "15%", sorter: (a, b) => alphaSort(a.oem_partno, b.oem_partno), }, { title: "Database Price", dataIndex: "db_price", key: "db_price", + width: "10%", sorter: (a, b) => a.db_price - b.db_price, render: (text, record) => ( {record.db_price} @@ -58,6 +65,7 @@ export default function JobLinesTableMolecule({ loading, job }) { title: "Actual Price", dataIndex: "act_price", key: "act_price", + width: "10%", sorter: (a, b) => a.act_price - b.act_price, render: (text, record) => ( {record.act_price} @@ -67,6 +75,7 @@ export default function JobLinesTableMolecule({ loading, job }) { title: "Price Diff.", dataIndex: "price_diff", key: "price_diff", + width: "10%", sorter: (a, b) => a.price_diff - b.price_diff, render: (text, record) => ( {record.price_diff} @@ -76,6 +85,7 @@ export default function JobLinesTableMolecule({ loading, job }) { title: "Price Diff. %", dataIndex: "price_diff_pc", key: "price_diff_pc", + width: "10%", sorter: (a, b) => a.price_diff_pc - b.price_diff_pc, render: (text, record) => ( , dataIndex: "ignore", key: "ignore", filters: [ - { text: "True", value: true }, - { text: "False", value: false }, + { text: "Eligible for RPS Calculation", value: false }, + { text: "Ineligible RPS Calculation", value: true }, ], + width: "5%", + filteredValue: filters.ignore || null, onFilter: (value, record) => value === record.ignore, render: (text, record) => ( { + console.log("Various parameters", pagination, filters, sorter); + setFilters(filters); + }; + return (
diff --git a/src/components/organisms/jobs-detail/jobs-detail.organism.jsx b/src/components/organisms/jobs-detail/jobs-detail.organism.jsx index b096f93..ce21f92 100644 --- a/src/components/organisms/jobs-detail/jobs-detail.organism.jsx +++ b/src/components/organisms/jobs-detail/jobs-detail.organism.jsx @@ -1,5 +1,5 @@ import { useQuery } from "@apollo/client"; -import { Result } from "antd"; +import { Divider, Result } from "antd"; import React, { useEffect } from "react"; import { connect } from "react-redux"; import { createStructuredSelector } from "reselect"; @@ -78,7 +78,9 @@ export function JobsDetailOrganism({ selectedJobId, setSelectedJobTargetPc }) { loading={loading} /> - + ); }