Added release notes display to updater. RPS-48
This commit is contained in:
@@ -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);
|
||||
@@ -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>
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user