-
Notifications
You must be signed in to change notification settings - Fork 930
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an About tab with the version information in the Settings (#236)
- Loading branch information
1 parent
0b622d3
commit 17761e2
Showing
10 changed files
with
165 additions
and
3 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
80 changes: 80 additions & 0 deletions
80
opencti-platform/opencti-front/src/private/components/settings/About.js
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,80 @@ | ||
import React, { Component } from 'react'; | ||
import * as PropTypes from 'prop-types'; | ||
import graphql from 'babel-plugin-relay/macro'; | ||
import { compose } from 'ramda'; | ||
import { withStyles } from '@material-ui/core/styles'; | ||
import Typography from '@material-ui/core/Typography'; | ||
import Paper from '@material-ui/core/Paper'; | ||
import List from '@material-ui/core/List'; | ||
import ListItem from '@material-ui/core/ListItem'; | ||
import ListItemText from '@material-ui/core/ListItemText'; | ||
import inject18n from '../../../components/i18n'; | ||
import { QueryRenderer } from '../../../relay/environment'; | ||
import Loader from '../../Loader'; | ||
|
||
const styles = () => ({ | ||
panel: { | ||
margin: '0 auto', | ||
marginBottom: 30, | ||
padding: '20px 20px 20px 20px', | ||
textAlign: 'left', | ||
borderRadius: 6, | ||
}, | ||
}); | ||
|
||
const aboutQuery = graphql` | ||
query AboutQuery { | ||
about { | ||
version | ||
dependencies { | ||
name | ||
version | ||
} | ||
} | ||
} | ||
`; | ||
|
||
class About extends Component { | ||
render() { | ||
const { classes, t } = this.props; | ||
return ( | ||
<QueryRenderer | ||
query={aboutQuery} | ||
render={({ props }) => { | ||
if (props) { | ||
const { version, dependencies } = props.about; | ||
return ( | ||
<Paper classes={{ root: classes.panel }} elevation={2}> | ||
<Typography variant="h1" gutterBottom={true}> | ||
{t('OpenCTI version')} {version} | ||
</Typography> | ||
<br/> | ||
<Typography variant="h2" gutterBottom={true}> | ||
<b>{t('Dependencies')}</b> | ||
</Typography> | ||
<List> | ||
{dependencies.map(dep => ( | ||
<ListItem key={dep.name} divider> | ||
<ListItemText primary={t(dep.name)} secondary={dep.version}/> | ||
</ListItem> | ||
))} | ||
</List> | ||
</Paper> | ||
); | ||
} | ||
return <Loader/>; | ||
}} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
About.propTypes = { | ||
classes: PropTypes.object, | ||
t: PropTypes.func, | ||
}; | ||
|
||
export default compose( | ||
inject18n, | ||
withStyles(styles), | ||
)(About); |
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
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