Added release notes display to updater. RPS-48

This commit is contained in:
Patrick Fic
2020-11-16 10:04:11 -08:00
parent b6ce94df08
commit ecf911bc43
14 changed files with 123 additions and 4 deletions

View File

@@ -1,3 +1,6 @@
Creating Release Notes Tools:
https://onlinestringtools.com/json-stringify-string
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts

18
WIP Changelog.txt Normal file
View File

@@ -0,0 +1,18 @@
New Features:
- Vehicles with mileage under 20,000kms will now be included in Watcher filtering criteria.
- Savings on OEM parts will always default to the user enter price and override the estimating system price.
- Wheel related lines will no longer be automatically ignored.
- Glass related lines will no longer be automatically ignored.
- Added 'Variance %' statistic to reporting totals.
- Automatically ignore any lines which have invalid prices from estimating system.
- Force line inclusion/exclusion - Using “ /rps-exclude” or “/rps” in the Part Number field to force inclusion or exclusion of lines for RPS calculation.
Bug Fixes:
- Resolved an issue where the updater would not show update progress to some users.
- Fixed a UI bug during job search that would cause the 'no close date' alert to be incorrectly shown.

7
changelog.json Normal file
View File

@@ -0,0 +1,7 @@
{
"1.0.9": {
"title": "Release Notes for 1.0.9",
"date": "11/16/2020",
"notes": "New Features: \n\n- Vehicles with mileage under 20,000kms will now be included in Watcher filtering criteria.\n- Savings on OEM parts will always default to the user enter price and override the estimating system price.\n- Wheel related lines will no longer be automatically ignored.\n- Glass related lines will no longer be automatically ignored.\n- Added 'Variance %' statistic to reporting totals.\n- Automatically ignore any lines which have invalid prices from estimating system.\n- Force line inclusion/exclusion - Using “ /rps-exclude” or “/rps” in the Part Number field to force inclusion or exclusion of lines for RPS calculation.\n\n\nBug Fixes: \n\n- Resolved an issue where the updater would not show update progress to some users.\n- Fixed a UI bug during job search that would cause the 'no close date' alert to be incorrectly shown."
}
}

View File

@@ -2,13 +2,14 @@ const Store = require("electron-store");
const store = new Store({
defaults: {
showChangeLog: true,
enableNotifications: true,
filePaths: [],
accepted_ins_co: [],
runWatcherOnStartup: true,
polling: {
enabled: false,
pollingInterval: 1000,
pollingInterval: 30000,
},
},
});

View File

@@ -1,4 +1,5 @@
const { ipcMain } = require("electron");
const { ipcMain, app: electronApp } = require("electron");
const { app } = require("firebase");
const { default: ipcTypes } = require("../src/ipc.types");
const { store } = require("./electron-store");
//Import Ipc Handlers
@@ -32,3 +33,13 @@ ipcMain.on(ipcTypes.store.getAll, (event, obj) => {
const val = store.get();
event.sender.send(ipcTypes.store.response, val);
});
ipcMain.on(ipcTypes.app.toMain.getReleaseNotes, (event, obj) => {
const showNotes = store.get("showChangeLog");
if (showNotes) {
const rn = require("../changelog.json")[electronApp.getVersion()];
event.sender.send(ipcTypes.app.toRenderer.setReleaseNotes, rn);
} else {
event.sender.send(ipcTypes.app.toRenderer.setReleaseNotes, null);
}
});

View File

@@ -81,6 +81,15 @@ var menu = Menu.buildFromTemplate([
checkForUpdates();
},
},
{
label: `Show Release Notes`,
click() {
mainWindow.webContents.send(
ipcTypes.app.toRenderer.setReleaseNotes,
require("../changelog.json")[app.getVersion()]
);
},
},
{
label: "Open Config File",
click() {
@@ -318,6 +327,7 @@ autoUpdater.on("update-downloaded", (ev, info) => {
if (buttonIndex === 0) {
const isSilent = true;
const isForceRunAfter = true;
store.set("showChangeLog", true);
autoUpdater.quitAndInstall(isSilent, isForceRunAfter);
} else {
logger.error("Error");

View File

@@ -0,0 +1,44 @@
import { Modal } from "antd";
import React, { useEffect } from "react";
import { connect } from "react-redux";
import { createStructuredSelector } from "reselect";
import ipcTypes from "../../../ipc.types";
import { setReleaseNotes } from "../../../redux/application/application.actions";
import { selectReleaseNotes } from "../../../redux/application/application.selectors";
const mapStateToProps = createStructuredSelector({
releaseNotes: selectReleaseNotes,
});
const mapDispatchToProps = (dispatch) => ({
//setUserLanguage: language => dispatch(setUserLanguage(language))
setReleaseNotes: (notes) => dispatch(setReleaseNotes(notes)),
});
const { ipcRenderer } = window;
export function ReleaseNotes({ releaseNotes, setReleaseNotes }) {
console.log("ReleaseNotes -> releaseNotes", releaseNotes);
useEffect(() => {
ipcRenderer.send(ipcTypes.default.app.toMain.getReleaseNotes);
}, []);
const handleOk = () => {
ipcRenderer.send(ipcTypes.default.store.set, { showChangeLog: false });
setReleaseNotes(null);
};
return (
<Modal
visible={!!releaseNotes}
onOk={handleOk}
onCancel={handleOk}
cancelButtonProps={{ style: { display: "none" } }}
title={releaseNotes && releaseNotes.title}
>
<div>{releaseNotes && releaseNotes.date}</div>
<div style={{ whiteSpace: "pre-line" }}>
{releaseNotes && releaseNotes.notes}
</div>
</Modal>
);
}
export default connect(mapStateToProps, mapDispatchToProps)(ReleaseNotes);

View File

@@ -5,6 +5,7 @@ import { Route } from "react-router-dom";
import { createStructuredSelector } from "reselect";
import { selectBodyshop } from "../../../redux/user/user.selectors";
import ErrorResultAtom from "../../atoms/error-result/error-result.atom";
import ReleaseNotes from "../../molecules/release-notes/release-notes.molecule";
import SiderMenuOrganism from "../../organisms/sider-menu/sider-menu.organism";
import UpdateManagerOrganism from "../../organisms/update-manager/update-manager.organism";
import JobsPage from "../jobs/jobs.page";
@@ -40,7 +41,7 @@ export function RoutesPage({ bodyshop }) {
<Route exact path="/scan" component={ScanPage} />
<Route exact path="/" component={JobsPage} />
</Layout.Content>
<ReleaseNotes />
<UpdateManagerOrganism />
</Layout>
</Layout>

View File

@@ -12,11 +12,13 @@ exports.default = {
checkForUpdates: "app_checkForUpdates",
downloadUpdates: "app_downloadUpdates",
installUpdates: "app_installupdates",
getReleaseNotes: "app_getReleaseNotes",
},
toRenderer: {
updateAvailable: "app_updateAvailable",
downloadProgress: "app_downloadProgress",
signOut: "app_signOut",
setReleaseNotes: "app_setReleaseNotes",
},
},
store: {

View File

@@ -1,5 +1,6 @@
import ipcTypes from "../ipc.types";
import {
setReleaseNotes,
setSettings,
setUpdateAvailable,
setUpdateProgress,
@@ -89,3 +90,10 @@ ipcRenderer.on(
store.dispatch(signOutStart());
}
);
ipcRenderer.on(
ipcTypes.default.app.toRenderer.setReleaseNotes,
async (event, releaseNotes) => {
store.dispatch(setReleaseNotes(releaseNotes));
}
);

View File

@@ -52,3 +52,8 @@ export const setUpdateProgress = (progress) => ({
type: ApplicationActionTypes.SET_UPDATE_PROGRESS,
payload: progress,
});
export const setReleaseNotes = (releaseNotes) => ({
type: ApplicationActionTypes.SET_RELEASE_NOTES,
payload: releaseNotes,
});

View File

@@ -9,6 +9,7 @@ const INITIAL_STATE = {
settings: {},
updateAvailable: false,
updateProgress: null,
releaseNotes: null,
};
const { ipcRenderer } = window;
@@ -66,6 +67,8 @@ const applicationReducer = (state = INITIAL_STATE, action) => {
return { ...state, updateAvailable: action.payload };
case ApplicationActionTypes.SET_UPDATE_PROGRESS:
return { ...state, updateProgress: action.payload };
case ApplicationActionTypes.SET_RELEASE_NOTES:
return { ...state, releaseNotes: action.payload };
default:
return state;
}

View File

@@ -36,7 +36,13 @@ export const selectUpdateAvailable = createSelector(
[selectApplication],
(application) => application.updateAvailable
);
export const selectUpdateProgress = createSelector(
[selectApplication],
(application) => application.updateProgress
);
export const selectReleaseNotes = createSelector(
[selectApplication],
(application) => application.releaseNotes
);

View File

@@ -10,6 +10,6 @@ const ApplicationActionTypes = {
SET_SETTINGS: "SET_SETTINGS",
SET_UPDATE_AVAILABLE: "SET_UPDATE_AVAILABLE",
SET_UPDATE_PROGRESS: "SET_UPDATE_PROGRESS",
SET_RELEASE_NOTES: "SET_RELEASE_NOTES",
};
export default ApplicationActionTypes;