Added update status to reducer.

This commit is contained in:
Patrick Fic
2020-10-22 21:12:21 -07:00
parent 658f45b476
commit 6929da6679
7 changed files with 40 additions and 6 deletions

View File

@@ -70,7 +70,10 @@ var menu = Menu.buildFromTemplate([
{
label: `Check for Updates (currently ${app.getVersion()})`,
click() {
autoUpdater.checkForUpdatesAndNotify();
autoUpdater.checkForUpdatesAndNotify({
title: "ImEX RPS Update Downloaded",
body: "Restart ImEX RPS to install.",
});
},
},
{
@@ -245,9 +248,9 @@ autoUpdater.on("error", (ev, err) => {
autoUpdater.on("download-progress", (ev, progressObj) => {
console.log("Download progress...");
});
autoUpdater.on("update-downloaded", (ev, info) => {
console.log("Update downloaded; will install in 5 seconds");
});
// autoUpdater.on("update-downloaded", (ev, info) => {
// console.log("Update downloaded; will install in 5 seconds");
// });
autoUpdater.on("update-downloaded", (ev, info) => {
Nucleus.track("UPDATE_DOWNLOADED", info);
if (process.env.NODE_ENV === "production") {

View File

@@ -0,0 +1,17 @@
import React from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import { selectUpdateAvailable } from "../../../redux/application/application.selectors";
const mapStateToProps = createStructuredSelector({
//scanLoading: selectScanLoading,
updateAvailable: selectUpdateAvailable,
});
const mapDispatchToProps = (dispatch) => ({});
export function UpdateAvailableAtom({ available }) {
return <div>Update Available!</div>;
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(UpdateAvailableAtom);

View File

@@ -54,7 +54,7 @@ export function JobGroupMolecule({ bodyshop, jobId, group, job }) {
<Dropdown overlay={menu} trigger={["click"]}>
<a href=" #" onClick={(e) => e.preventDefault()}>
{group}
<DownOutlined />
<DownOutlined style={{ marginLeft: ".2rem" }} />
{loading && <LoadingOutlined />}
</a>
</Dropdown>

View File

@@ -38,7 +38,13 @@ export const setSelectedJobTargetPcSuccess = (pct) => ({
type: ApplicationActionTypes.SET_SELECTED_JOB_TARGET_PC_SUCCESS,
payload: pct,
});
export const setSettings = (settingsObj) => ({
type: ApplicationActionTypes.SET_SETTINGS,
payload: settingsObj,
});
export const setUpdateAvailable = (available) => ({
type: ApplicationActionTypes.SET_UPDATE_AVAILABLE,
payload: available,
});

View File

@@ -7,6 +7,7 @@ const INITIAL_STATE = {
selectedJobId: null,
selectedJobTargetPc: 0,
settings: {},
updateAvailable: false,
};
const { ipcRenderer } = window;
@@ -60,7 +61,8 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
return { ...state, selectedJobId: action.payload };
case ApplicationActionTypes.SET_SETTINGS:
return { ...state, settings: { ...state.settings, ...action.payload } };
case ApplicationActionTypes.SET_UPDATE_AVAILABLE:
return { ...state, updateAvailable: action.payload };
default:
return state;
}

View File

@@ -31,3 +31,8 @@ export const selectSettings = createSelector(
[selectApplication],
(application) => application.settings
);
export const selectUpdateAvailable = createSelector(
[selectApplication],
(application) => application.updateAvailable
);

View File

@@ -8,5 +8,6 @@ const ApplicationActionTypes = {
SET_SELECTED_JOB_TARGET_PC: "SET_SELECTED_JOB_TARGET_PC",
SET_SELECTED_JOB_TARGET_PC_SUCCESS: "SET_SELECTED_JOB_TARGET_PC_SUCCESS",
SET_SETTINGS: "SET_SETTINGS",
SET_UPDATE_AVAILABLE: "SET_UPDATE_AVAILABLE",
};
export default ApplicationActionTypes;