Implemented job upload
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import { Button } from "antd";
|
||||
import React from "react";
|
||||
import ipcTypes from "../../../ipc.types";
|
||||
const { ipcRenderer } = window;
|
||||
|
||||
export default function FilepathAddMolecule() {
|
||||
const handleClick = () => {
|
||||
ipcRenderer.send(ipcTypes.default.fileWatcher.toMain.addPath);
|
||||
};
|
||||
return <Button onClick={handleClick}>Add Path</Button>;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { List } from "antd";
|
||||
import React from "react";
|
||||
|
||||
export default function FilePathMolecule(item) {
|
||||
return <List.Item title={item}>{item}</List.Item>;
|
||||
export default function FilePathMolecule(item, index) {
|
||||
return <List.Item key={index}>{item}</List.Item>;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import ipcTypes from "../../../ipc.types";
|
||||
import { selectWatchedPaths } from "../../../redux/application/application.selectors";
|
||||
import FilepathAddMolecule from "../../molecules/filepath-add/filepath-add.molecule";
|
||||
import FilepathItemMolecule from "../../molecules/filepath-item/filepath-item.molecule";
|
||||
const { ipcRenderer } = window;
|
||||
|
||||
@@ -24,6 +25,7 @@ export function FilePathsList({ watchedPaths }) {
|
||||
<div>
|
||||
File Paths
|
||||
<List dataSource={watchedPaths} renderItem={FilepathItemMolecule} />
|
||||
<FilepathAddMolecule />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { Button } from "antd";
|
||||
import React from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
|
||||
//const { ipcRenderer } = window;
|
||||
const { ipcRenderer } = window;
|
||||
//const settings = window.require("electron-settings");
|
||||
|
||||
const mapStateToProps = createStructuredSelector({});
|
||||
@@ -26,6 +27,7 @@ export function JobsPage() {
|
||||
return (
|
||||
<div>
|
||||
<div>Welcome to your new react app. </div>
|
||||
<Button onClick={() => ipcRenderer.send("test")}>Send Test IPC</Button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,18 +12,12 @@ const mapDispatchToProps = (dispatch) => ({});
|
||||
|
||||
export function App() {
|
||||
useEffect(() => {
|
||||
ipcRenderer.on("test-success", (event, obj) => {
|
||||
console.log("Test Success", obj);
|
||||
});
|
||||
ipcRenderer.on(ipcTypes.default.filewatcher.startSuccess, (event, obj) => {
|
||||
console.log(ipcTypes.default.filewatcher.startSuccess, obj);
|
||||
ipcRenderer.on("not a real channel", (event, obj) => {
|
||||
console.log("not a real channel", obj);
|
||||
});
|
||||
// Cleanup the listener events so that memory leaks are avoided.
|
||||
return function cleanup() {
|
||||
ipcRenderer.removeAllListeners(
|
||||
"test-success",
|
||||
ipcTypes.default.filewatcher.startSuccess
|
||||
);
|
||||
ipcRenderer.removeAllListeners("not a real channel");
|
||||
};
|
||||
}, []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user