Updated packages + changed chokidar options to fix compatibility with network monitoring.
This commit is contained in:
@@ -217,56 +217,6 @@ async function DecodeLinFile(extensionlessFilePath) {
|
||||
let records = await dbf.readRecords();
|
||||
let joblines = records
|
||||
.map((record) => {
|
||||
console.log(
|
||||
"object",
|
||||
_.pick(record, [
|
||||
"LINE_NO",
|
||||
"LINE_IND",
|
||||
// "LINE_REF",
|
||||
// "TRAN_CODE",
|
||||
"DB_REF",
|
||||
"UNQ_SEQ",
|
||||
// "WHO_PAYS",
|
||||
"LINE_DESC",
|
||||
"PART_TYPE",
|
||||
// "PART_DESCJ",
|
||||
"GLASS_FLAG",
|
||||
"OEM_PARTNO",
|
||||
// "PRICE_INC",
|
||||
// "ALT_PART_I",
|
||||
// "TAX_PART",
|
||||
"DB_PRICE",
|
||||
"ACT_PRICE",
|
||||
// "PRICE_J",
|
||||
// "CERT_PART",
|
||||
"PART_QTY",
|
||||
// "ALT_CO_ID",
|
||||
// "ALT_PARTNO",
|
||||
// "ALT_OVERRD",
|
||||
// "ALT_PARTM",
|
||||
// "PRT_DSMK_P",
|
||||
// "PRT_DSMK_M",
|
||||
// "MOD_LBR_TY",
|
||||
// "DB_HRS",
|
||||
// "MOD_LB_HRS",
|
||||
// "LBR_INC",
|
||||
// "LBR_OP",
|
||||
// "LBR_HRS_J",
|
||||
// "LBR_TYP_J",
|
||||
// "LBR_OP_J",
|
||||
// "PAINT_STG",
|
||||
// "PAINT_TONE",
|
||||
// "LBR_TAX",
|
||||
// "LBR_AMT",
|
||||
// "MISC_AMT",
|
||||
// "MISC_SUBLT",
|
||||
// "MISC_TAX",
|
||||
// "BETT_TYPE",
|
||||
// "BETT_PCTG",
|
||||
// "BETT_AMT",
|
||||
// "BETT_TAX",
|
||||
])
|
||||
);
|
||||
return _.transform(
|
||||
_.pick(record, [
|
||||
"LINE_NO",
|
||||
@@ -318,7 +268,7 @@ async function DecodeLinFile(extensionlessFilePath) {
|
||||
]),
|
||||
function (result, val, key) {
|
||||
//Required because unq_seq gets pulled as a numeric instaed of a string.
|
||||
console.log("key", key);
|
||||
|
||||
if (key === "UNQ_SEQ") {
|
||||
return (result[key.toLowerCase()] = val.toString());
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ const store = new Store({
|
||||
accepted_ins_co: [],
|
||||
polling: {
|
||||
enabled: false,
|
||||
pollingInterval: 100,
|
||||
pollingInterval: 1000,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -11,11 +11,8 @@ const log = require("electron-log");
|
||||
var watcher;
|
||||
|
||||
async function StartWatcher() {
|
||||
const filePaths =
|
||||
store.get("filePaths").map((fp) => path.join(fp, "**.[eE][nN][vV]")) || [];
|
||||
log.info("StartWatcher -> filePaths", filePaths);
|
||||
const filePaths = store.get("filePaths") || [];
|
||||
log.info("Use polling? ", store.get("polling").enabled);
|
||||
|
||||
if (filePaths.length === 0) {
|
||||
NewNotification({
|
||||
title: "RPS Watcher cannot start",
|
||||
@@ -37,12 +34,25 @@ async function StartWatcher() {
|
||||
}
|
||||
|
||||
watcher = chokidar.watch(filePaths, {
|
||||
//ignored: /[\/\\]\./,
|
||||
usePolling: store.get("polling").enabled,
|
||||
ignored: (fp, stats) => {
|
||||
const p = path.parse(fp);
|
||||
log.log(
|
||||
"Checking if should ignore.",
|
||||
fp,
|
||||
p,
|
||||
p.ext !== "" && p.ext !== ".ENV" && p.ext !== ".env"
|
||||
);
|
||||
// prettier-ignore
|
||||
// const ignore = RegExp("^.*(?<!\.env)(?<!\.ENV)$").test(fp);
|
||||
//console.log("StartWatcher ->", fp, "Ignore?", ignore);
|
||||
return (p.ext !== "" && p.ext !== ".ENV" && p.ext !== ".env" );
|
||||
},
|
||||
usePolling: store.get("polling").enabled || false,
|
||||
interval: store.get("polling").pollingInterval || 1000,
|
||||
persistent: true,
|
||||
ignoreInitial: true,
|
||||
awaitWriteFinish: {
|
||||
pollInterval: 100,
|
||||
pollInterval: 500,
|
||||
stabilityThreshold: 2000,
|
||||
},
|
||||
});
|
||||
@@ -87,6 +97,7 @@ function onWatcherReady() {
|
||||
title: "RPS Watcher Started",
|
||||
body: "Newly exported estimates will be automatically uploaded.",
|
||||
}).show();
|
||||
console.log("Confirmed watched paths:", watcher.getWatched());
|
||||
}
|
||||
|
||||
async function StopWatcher() {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
const { ipcMain } = require("electron");
|
||||
const { default: ipcTypes } = require("../src/ipc.types");
|
||||
const { store } = require("./electron-store");
|
||||
const { mainWindow } = require("./main");
|
||||
const { watcher } = require("./file-watcher/file-watcher");
|
||||
|
||||
//Import Ipc Handlers
|
||||
require("./file-watcher/file-watcher-ipc");
|
||||
|
||||
@@ -10,7 +11,6 @@ console.log("*** Added IPC Handlers ***");
|
||||
ipcMain.on("test", async (event, object) => {
|
||||
console.log("Received test IPC Command");
|
||||
//const job = await DecodeEstimate("C:\\VPS\\EMS\\687_3_A.AD1");
|
||||
console.log(mainWindow);
|
||||
event.reply("test-toRenderer", { status: 0, message: null });
|
||||
});
|
||||
|
||||
|
||||
3175
package-lock.json
generated
3175
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@
|
||||
"@fingerprintjs/fingerprintjs": "^2.1.4",
|
||||
"antd": "^4.7.2",
|
||||
"apollo-link-logger": "^2.0.0",
|
||||
"chokidar": "^3.4.3",
|
||||
"chokidar": "^3.4.2",
|
||||
"dbffile": "^1.4.3",
|
||||
"dinero.js": "^1.8.1",
|
||||
"dotenv": "^8.2.0",
|
||||
|
||||
@@ -7,6 +7,8 @@ import {
|
||||
selectWatcherStatus,
|
||||
} from "../../../redux/application/application.selectors";
|
||||
|
||||
const { ipcRenderer } = window;
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
watcherStatus: selectWatcherStatus,
|
||||
watcherError: selectWatcherError,
|
||||
@@ -14,7 +16,10 @@ const mapStateToProps = createStructuredSelector({
|
||||
|
||||
export function WatcherStatusAtom({ watcherStatus, watcherError }) {
|
||||
return (
|
||||
<div style={{ color: watcherStatus === "Started" ? "green" : "tomato" }}>
|
||||
<div
|
||||
onDoubleClick={() => ipcRenderer.send("test")}
|
||||
style={{ color: watcherStatus === "Started" ? "green" : "tomato" }}
|
||||
>
|
||||
<strong>{watcherStatus}</strong>
|
||||
{watcherError && <Alert message={watcherError} />}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user