Show version info in settings

This commit is contained in:
Ken-Håvard Lieng 2018-11-22 12:00:18 +01:00
parent 5d896ae439
commit fbbcf6457e
8 changed files with 275 additions and 174 deletions

View file

@ -7,6 +7,7 @@ import FileInput from 'components/ui/FileInput';
const Settings = ({
settings,
installable,
version,
setSetting,
onCertChange,
onKeyChange,
@ -71,6 +72,13 @@ const Settings = ({
{error ? <p className="error">{error}</p> : null}
</div>
</div>
{version && (
<div className="settings-version">
<p>{version.tag}</p>
<p>Commit: {version.commit}</p>
<p>Build Date: {version.date}</p>
</div>
)}
</div>
</div>
);

View file

@ -12,7 +12,8 @@ import connect from 'utils/connect';
const mapState = createStructuredSelector({
settings: getSettings,
installable: state => state.app.installable
installable: state => state.app.installable,
version: state => state.app.version
});
const mapDispatch = {

View file

@ -11,7 +11,12 @@ import { replace } from 'utils/router';
function loadState({ store }, env) {
store.dispatch(setConnectDefaults(env.defaults));
store.dispatch(appSet('hexIP', env.hexIP));
store.dispatch(
appSet({
hexIP: env.hexIP,
version: env.version
})
);
store.dispatch(setSettings(env.settings, true));
if (env.servers) {

View file

@ -1,3 +1,4 @@
import assign from 'lodash/assign';
import createReducer from 'utils/createReducer';
import * as actions from './actions';
@ -29,7 +30,11 @@ const initialState = {
export default createReducer(initialState, {
[actions.APP_SET](state, { key, value }) {
state[key] = value;
if (typeof key === 'object') {
assign(state, key);
} else {
state[key] = value;
}
},
[actions.UPDATE_MESSAGE_HEIGHT](state, action) {