diff --git a/monkey/monkey_island/cc/ui/src/components/logo/VersionComponent.js b/monkey/monkey_island/cc/ui/src/components/logo/VersionComponent.js index 26733d579..10dbd0bf0 100644 --- a/monkey/monkey_island/cc/ui/src/components/logo/VersionComponent.js +++ b/monkey/monkey_island/cc/ui/src/components/logo/VersionComponent.js @@ -7,8 +7,8 @@ class VersionComponent extends React.Component { constructor(props) { super(props); this.state = { - currentVersion: undefined, - newerVersion: undefined, + versionNumber: undefined, + latestVersion: undefined, downloadLink: undefined } } @@ -18,19 +18,27 @@ class VersionComponent extends React.Component { .then(res => res.json()) .then(res => { this.setState({ - currentVersion: res['current_version'], - newerVersion: res['newer_version'], + versionNumber: res['version_number'], + latestVersion: res['latest_version'], downloadLink: res['download_link'] }); }); } + newerVersionAvailable() { + const semverGt = require('semver/functions/gt'); + if(this.state.latestVersion !== undefined && this.state.versionNumber !== undefined) { + return semverGt(this.state.latestVersion, this.state.versionNumber); + } + return false; + } + render() { return (
- Infection Monkey Version: {this.state.currentVersion} + Infection Monkey Version: {this.state.versionNumber} { - this.state.newerVersion ? + this.newerVersionAvailable() ?
Newer version available!