Implemented job upload

This commit is contained in:
Patrick Fic
2020-10-14 17:08:47 -07:00
parent e7614942e5
commit 0a3c87a6f2
25 changed files with 347 additions and 131 deletions

View File

@@ -0,0 +1,16 @@
import client from "../graphql/GraphQLClient";
import { INSERT_NEW_JOB } from "../graphql/jobs.queries";
import { store } from "../redux/store";
export async function UpsertEstimate(job) {
const shopId = store.getState().user.bodyshop.id;
console.log("UpsertEstimate -> shopId", shopId);
const result = await client.mutate({
mutation: INSERT_NEW_JOB,
variables: {
job: { ...job, bodyshopid: shopId },
},
});
console.log("UpsertEstimate -> result", result);
}

View File

@@ -4,9 +4,15 @@ import {
setWatcherStatus,
} from "../redux/application/application.actions";
import { store } from "../redux/store";
import { message } from "antd";
import { UpsertEstimate } from "./ipc-estimate-utils";
const { ipcRenderer } = window;
console.log("----Initializing IPC Listeners in React App.");
ipcRenderer.on("test-toRenderer", (event, obj) => {
console.log("test-toRenderer", obj);
});
ipcRenderer.on(
ipcTypes.default.fileWatcher.toRenderer.filepathsList,
@@ -15,10 +21,12 @@ ipcRenderer.on(
}
);
//Filewatcher Section
//Filewatcher Status Section
ipcRenderer.on(
ipcTypes.default.fileWatcher.toRenderer.startSuccess,
(event, ...obj) => {
console.log("Watcher ready.");
message.success("Watcher started!");
store.dispatch(setWatcherStatus("READY!"));
}
);
@@ -28,10 +36,25 @@ ipcRenderer.on(
store.dispatch(setWatcherStatus("STOPPED"));
}
);
ipcRenderer.on(
ipcTypes.default.fileWatcher.toRenderer.error,
(event, ...obj) => {
store.dispatch(setWatcherStatus(obj));
}
);
//Estimate Section
ipcRenderer.on(
ipcTypes.default.estimate.toRenderer.estimateDecodeStart,
(event, ...obj) => {
console.log("Decoding started!");
}
);
ipcRenderer.on(
ipcTypes.default.estimate.toRenderer.estimateDecodeSuccess,
async (event, ...obj) => {
console.log("Decoding success!", obj[0]);
await UpsertEstimate(obj[0]);
}
);