forked from geosolutions-it/MapStore2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes geosolutions-it#1302: current version in the UI
- Loading branch information
Showing
15 changed files
with
172 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* Copyright 2015, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const axios = require('../libs/ajax'); | ||
|
||
const CHANGE_VERSION = 'CHANGE_VERSION'; | ||
const LOAD_VERSION_ERROR = 'LOAD_VERSION_ERROR'; | ||
|
||
function changeVersion(version) { | ||
return { | ||
type: CHANGE_VERSION, | ||
version | ||
}; | ||
} | ||
|
||
function loadVersionError(e) { | ||
return { | ||
type: LOAD_VERSION_ERROR, | ||
error: e | ||
}; | ||
} | ||
|
||
function loadVersion(config = 'version.txt') { | ||
return (dispatch) => { | ||
return axios.get(config).then((response) => { | ||
dispatch(changeVersion(response.data)); | ||
}).catch((e) => { | ||
dispatch(loadVersionError(e)); | ||
}); | ||
}; | ||
} | ||
|
||
module.exports = {CHANGE_VERSION, LOAD_VERSION_ERROR, | ||
loadVersion, loadVersionError, changeVersion}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright 2016, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const React = require('react'); | ||
const {connect} = require('react-redux'); | ||
|
||
const Message = require('../components/I18N/Message'); | ||
|
||
/** | ||
* Version Plugin. Shows current MapStore2 version | ||
* @class Version | ||
* @memberof plugins | ||
* @static | ||
* | ||
*/ | ||
const Version = connect((state) => ({ | ||
version: state.version && state.version.current | ||
}))(React.createClass({ | ||
propTypes: { | ||
version: React.PropTypes.string | ||
}, | ||
getDefaultProps() { | ||
return { | ||
version: 'DEV' | ||
}; | ||
}, | ||
render() { | ||
return <span className="application-version"><span className="application-version-label"><Message msgId="version.label"/></span>: {this.props.version}</span>; | ||
} | ||
})); | ||
|
||
const assign = require('object-assign'); | ||
|
||
const Empty = React.createClass({ | ||
render() { | ||
return null; | ||
} | ||
}); | ||
|
||
module.exports = { | ||
VersionPlugin: assign(Empty, { | ||
Settings: { | ||
tool: <Version/>, | ||
position: 4 | ||
} | ||
}), | ||
reducers: { | ||
version: require('../reducers/version') | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Copyright 2017, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const { CHANGE_VERSION } = require('../actions/version'); | ||
const assign = require('object-assign'); | ||
|
||
function version(state = null, action) { | ||
switch (action.type) { | ||
case CHANGE_VERSION: { | ||
return assign({}, state, | ||
{ | ||
current: action.version | ||
} | ||
); | ||
} | ||
default: | ||
return state; | ||
} | ||
} | ||
|
||
module.exports = version; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1024,3 +1024,7 @@ select.form-control option { | |
.tooltip { | ||
z-index: 10000; | ||
} | ||
|
||
.application-version-label { | ||
font-weight: bold; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
${mapstore2.version} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters