Added further logging. RPS-4
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
import { Button, Result } from "antd";
|
||||
import React from "react";
|
||||
import ipcTypes from "../../../ipc.types";
|
||||
|
||||
const { ipcRenderer } = window;
|
||||
export default function ErrorResultAtom({
|
||||
title,
|
||||
errorMessage,
|
||||
tryAgainCallback,
|
||||
}) {
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "ERROR_RESULT_ATOM_DISPLAYED",
|
||||
title,
|
||||
errorMessage,
|
||||
});
|
||||
|
||||
return (
|
||||
<Result
|
||||
status="500"
|
||||
|
||||
@@ -17,6 +17,11 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
|
||||
export function WatcherPollingMolecule({ appSettings }) {
|
||||
const handleChange = (val) => {
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "TOGGLE_NOTIFICATION",
|
||||
enabled: val,
|
||||
});
|
||||
|
||||
ipcRenderer.send(ipcTypes.default.store.set, {
|
||||
enableNotifications: val,
|
||||
});
|
||||
|
||||
@@ -3,8 +3,9 @@ import { DatePicker, message, Spin } from "antd";
|
||||
import moment from "moment";
|
||||
import React, { useState } from "react";
|
||||
import { UPDATE_JOB } from "../../../graphql/jobs.queries";
|
||||
import ipcTypes from "../../../ipc.types";
|
||||
import { DateFormat } from "../../../util/constants";
|
||||
|
||||
const { ipcRenderer } = window;
|
||||
export default function CloseDateDisplayMolecule({ jobId, close_date }) {
|
||||
const [editMode, setEditMode] = useState(false);
|
||||
const [value, setValue] = useState(moment(close_date));
|
||||
@@ -12,6 +13,9 @@ export default function CloseDateDisplayMolecule({ jobId, close_date }) {
|
||||
const [updateJob] = useMutation(UPDATE_JOB);
|
||||
|
||||
const handleChange = async (newDate) => {
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "SET_CLOSED_DATE",
|
||||
});
|
||||
setLoading(true);
|
||||
setValue(newDate);
|
||||
const result = await updateJob({
|
||||
|
||||
@@ -47,26 +47,48 @@ export function JobsTargetsStatsMolecule({
|
||||
marginBottom: "1rem",
|
||||
}}
|
||||
>
|
||||
<Statistic
|
||||
title="Target RPS %"
|
||||
value={(selectedJobTargetPc * 100).toFixed(1)}
|
||||
suffix="%"
|
||||
/>
|
||||
<Statistic
|
||||
title="Current RPS %"
|
||||
valueStyle={{
|
||||
color: selectedJobTargetPc > (jobRpsPc || 0) ? "tomato" : "seagreen",
|
||||
}}
|
||||
value={((jobRpsPc || 0) * 100).toFixed(1)}
|
||||
suffix="%"
|
||||
/>
|
||||
<Statistic
|
||||
title="Target RPS $"
|
||||
value={actPriceSum.percentage(selectedJobTargetPc * 100).toFormat()}
|
||||
/>
|
||||
<Statistic title="Current RPS $" value={jobRpsDollars.toFormat()} />
|
||||
<Statistic title="DB Price Total" value={dbPriceSum.toFormat()} />
|
||||
<Statistic title="Actual Price Total" value={actPriceSum.toFormat()} />
|
||||
<div style={{ display: "flex" }}>
|
||||
<Statistic
|
||||
title="Target RPS %"
|
||||
value={(selectedJobTargetPc * 100).toFixed(1)}
|
||||
suffix="%"
|
||||
style={{ margin: "0rem .5rem" }}
|
||||
/>
|
||||
<Statistic
|
||||
title="Current RPS %"
|
||||
style={{ margin: "0rem .5rem" }}
|
||||
valueStyle={{
|
||||
color:
|
||||
selectedJobTargetPc > (jobRpsPc || 0) ? "tomato" : "seagreen",
|
||||
}}
|
||||
value={((jobRpsPc || 0) * 100).toFixed(1)}
|
||||
suffix="%"
|
||||
/>
|
||||
</div>
|
||||
<div style={{ display: "flex" }}>
|
||||
<Statistic
|
||||
title="Target RPS $"
|
||||
style={{ margin: "0rem .5rem" }}
|
||||
value={actPriceSum.percentage(selectedJobTargetPc * 100).toFormat()}
|
||||
/>
|
||||
<Statistic
|
||||
title="Current RPS $"
|
||||
style={{ margin: "0rem .5rem" }}
|
||||
value={jobRpsDollars.toFormat()}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ display: "flex" }}>
|
||||
<Statistic
|
||||
title="DB Price Total"
|
||||
style={{ margin: "0rem .5rem" }}
|
||||
value={dbPriceSum.toFormat()}
|
||||
/>
|
||||
<Statistic
|
||||
title="Actual Price Total"
|
||||
style={{ margin: "0rem .5rem" }}
|
||||
value={actPriceSum.toFormat()}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,16 @@ import React, { useState } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { Link } from "react-router-dom";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import ipcTypes from "../../../ipc.types";
|
||||
import { setSelectedJobId } from "../../../redux/application/application.actions";
|
||||
|
||||
import {
|
||||
selectReportData,
|
||||
selectReportLoading,
|
||||
} from "../../../redux/reporting/reporting.selectors";
|
||||
|
||||
const { ipcRenderer } = window;
|
||||
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
reportingLoading: selectReportLoading,
|
||||
reportData: selectReportData,
|
||||
@@ -123,6 +128,10 @@ export function ReportingJobsListMolecule({
|
||||
<Input.Search
|
||||
placeholder="Search"
|
||||
onSearch={(val) => {
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "REPORTS_LIST_SEARCH",
|
||||
query: val,
|
||||
});
|
||||
setSearchText(val);
|
||||
}}
|
||||
enterButton
|
||||
|
||||
@@ -4,10 +4,13 @@ import { Dropdown, List, Menu, Spin } from "antd";
|
||||
import React, { useState } from "react";
|
||||
import InfiniteScroll from "react-infinite-scroller";
|
||||
import { SEARCH_JOBS_PAGINATED } from "../../../graphql/jobs.queries";
|
||||
import ipcTypes from "../../../ipc.types";
|
||||
import ErrorResultAtom from "../../atoms/error-result/error-result.atom";
|
||||
import JobsListItemMolecule from "../../molecules/jobs-list-item/jobs-list-item.molecule";
|
||||
import JobsSearchFieldsMolecule from "../../molecules/jobs-search-fields/jobs-search-fields.molecule";
|
||||
|
||||
const { ipcRenderer } = window;
|
||||
|
||||
const limit = 20;
|
||||
export default function JobsTableOrganism() {
|
||||
const [state, setState] = useState({ hasMore: true });
|
||||
@@ -33,32 +36,35 @@ export default function JobsTableOrganism() {
|
||||
|
||||
const handleInfiniteOnLoad = (page) => {
|
||||
if (fetchMore)
|
||||
fetchMore({
|
||||
variables: {
|
||||
offset: limit * page,
|
||||
},
|
||||
updateQuery: (prev, { fetchMoreResult }) => {
|
||||
if (!fetchMoreResult) {
|
||||
console.log("No more results. Fetch More was empty.");
|
||||
setState({ ...state, hasMore: false });
|
||||
return prev;
|
||||
}
|
||||
|
||||
const newCache = Object.assign({}, prev, {
|
||||
jobs: [...prev.search_jobs, ...fetchMoreResult.search_jobs],
|
||||
});
|
||||
|
||||
if (
|
||||
newCache.jobs.length >= data &&
|
||||
data.search_jobs_aggregate.aggregate.count
|
||||
) {
|
||||
console.log("No more results.");
|
||||
setState({ ...state, hasMore: false });
|
||||
}
|
||||
|
||||
return newCache;
|
||||
},
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "FETCH_MORE_JOBS",
|
||||
});
|
||||
fetchMore({
|
||||
variables: {
|
||||
offset: limit * page,
|
||||
},
|
||||
updateQuery: (prev, { fetchMoreResult }) => {
|
||||
if (!fetchMoreResult) {
|
||||
console.log("No more results. Fetch More was empty.");
|
||||
setState({ ...state, hasMore: false });
|
||||
return prev;
|
||||
}
|
||||
|
||||
const newCache = Object.assign({}, prev, {
|
||||
jobs: [...prev.search_jobs, ...fetchMoreResult.search_jobs],
|
||||
});
|
||||
|
||||
if (
|
||||
newCache.jobs.length >= data &&
|
||||
data.search_jobs_aggregate.aggregate.count
|
||||
) {
|
||||
console.log("No more results.");
|
||||
setState({ ...state, hasMore: false });
|
||||
}
|
||||
|
||||
return newCache;
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
if (error)
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
import { Button, Layout } from "antd";
|
||||
import React, { useEffect } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import ipcTypes from "../ipc.types";
|
||||
|
||||
const { ipcRenderer } = window.require("electron");
|
||||
|
||||
const mapStateToProps = createStructuredSelector({});
|
||||
const mapDispatchToProps = (dispatch) => ({});
|
||||
|
||||
export function App() {
|
||||
useEffect(() => {
|
||||
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("not a real channel");
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<Layout>
|
||||
<Layout.Header>
|
||||
<div> Header</div>
|
||||
</Layout.Header>
|
||||
<Layout.Content>
|
||||
<div>Welcome to your new react app. asdas sd</div>
|
||||
<Button
|
||||
onClick={() => {
|
||||
ipcRenderer.send("test", { test: true });
|
||||
}}
|
||||
>
|
||||
TEST Generic IPC
|
||||
</Button>
|
||||
<Button
|
||||
onClick={() => {
|
||||
ipcRenderer.send(ipcTypes.default.filewatcher.start);
|
||||
}}
|
||||
>
|
||||
Start Watcher
|
||||
</Button>
|
||||
</Layout.Content>
|
||||
</Layout>
|
||||
);
|
||||
}
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(App);
|
||||
@@ -1,3 +1,4 @@
|
||||
import ipcTypes from "../../ipc.types";
|
||||
import ApplicationActionTypes from "./application.types";
|
||||
const INITIAL_STATE = {
|
||||
watcherStatus: "Not Started",
|
||||
@@ -8,6 +9,8 @@ const INITIAL_STATE = {
|
||||
settings: {},
|
||||
};
|
||||
|
||||
const { ipcRenderer } = window;
|
||||
|
||||
const applicationReducer = (state = INITIAL_STATE, action) => {
|
||||
switch (action.type) {
|
||||
case ApplicationActionTypes.SET_WATCHED_PATHS:
|
||||
@@ -16,11 +19,17 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
|
||||
watchedPaths: action.payload,
|
||||
};
|
||||
case ApplicationActionTypes.ADD_WATCHED_PATH:
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "ADD_WATCHED_PATH",
|
||||
});
|
||||
return {
|
||||
...state,
|
||||
watchedPaths: [...state.watchedPaths, action.payload],
|
||||
};
|
||||
case ApplicationActionTypes.REMOVE_WATCHED_PATH:
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "REMOVE_WATCHED_PATH",
|
||||
});
|
||||
return {
|
||||
...state,
|
||||
watchedPaths: state.watchedPaths.filter((p) => p !== action.payload),
|
||||
@@ -31,6 +40,10 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
|
||||
watcherStatus: action.payload,
|
||||
};
|
||||
case ApplicationActionTypes.SET_WATCHER_ERROR:
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "WATCHER_ERROR",
|
||||
error: action.payload,
|
||||
});
|
||||
return {
|
||||
...state,
|
||||
watcherError: action.payload,
|
||||
@@ -41,6 +54,9 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
|
||||
selectedJobTargetPc: action.payload,
|
||||
};
|
||||
case ApplicationActionTypes.SET_SELECTED_JOB_ID:
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "SET_SELECTED_JOB",
|
||||
});
|
||||
return { ...state, selectedJobId: action.payload };
|
||||
case ApplicationActionTypes.SET_SETTINGS:
|
||||
return { ...state, settings: { ...state.settings, ...action.payload } };
|
||||
|
||||
@@ -92,6 +92,9 @@ export function* onSignOutStart() {
|
||||
|
||||
export function* signOutStart() {
|
||||
try {
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "SIGN_OUT",
|
||||
});
|
||||
ipcRenderer.send(ipcTypes.default.fileWatcher.toMain.stop);
|
||||
yield auth.signOut();
|
||||
yield put(signOutSuccess());
|
||||
@@ -155,6 +158,10 @@ export function* onSendPasswordResetStart() {
|
||||
}
|
||||
export function* sendPasswordResetEmail({ payload }) {
|
||||
try {
|
||||
ipcRenderer.send(ipcTypes.default.app.toMain.track, {
|
||||
event: "RESET_PASSWORD",
|
||||
email: payload,
|
||||
});
|
||||
yield auth.sendPasswordResetEmail(payload);
|
||||
|
||||
yield put(sendPasswordResetSuccess());
|
||||
|
||||
Reference in New Issue
Block a user