2017-11-15 17:35:32 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Plugins
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
2018-01-25 17:53:49 +01:00
|
|
|
import { has, map } from 'lodash';
|
2017-11-15 17:35:32 +01:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import cn from 'classnames';
|
2019-02-22 11:16:42 +01:00
|
|
|
|
|
|
|
import Plugin from '../Plugin';
|
2017-11-15 17:35:32 +01:00
|
|
|
|
|
|
|
import styles from './styles.scss';
|
|
|
|
|
2017-11-16 15:13:46 +01:00
|
|
|
class Plugins extends React.Component {
|
|
|
|
state = { pluginSelected: '' };
|
|
|
|
|
|
|
|
changePluginSelected = (name) => this.setState({ pluginSelected: name });
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<div className={cn('col-md-7', styles.wrapper)}>
|
|
|
|
<div className={styles.plugins}>
|
|
|
|
<div className={styles.headerContainer}>
|
|
|
|
<div>
|
|
|
|
<FormattedMessage id="users-permissions.Plugins.header.title" />
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<FormattedMessage id="users-permissions.Plugins.header.description" />
|
|
|
|
</div>
|
2017-11-15 17:35:32 +01:00
|
|
|
</div>
|
2018-01-25 17:53:49 +01:00
|
|
|
<div className={cn(styles.pluginsContainer, !has(this.props.plugins, 'application') && styles.pluginsGradient)}>
|
2017-11-27 17:50:51 +01:00
|
|
|
{map(Object.keys(this.props.plugins).sort(), (plugin) => (
|
2017-11-16 15:13:46 +01:00
|
|
|
<Plugin
|
|
|
|
changePluginSelected={this.changePluginSelected}
|
2017-11-27 17:50:51 +01:00
|
|
|
key={plugin}
|
|
|
|
name={plugin}
|
|
|
|
plugin={this.props.plugins[plugin]}
|
2017-11-16 15:13:46 +01:00
|
|
|
pluginSelected={this.state.pluginSelected}
|
|
|
|
/>
|
|
|
|
))}
|
2017-11-15 17:35:32 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-11-16 15:13:46 +01:00
|
|
|
);
|
|
|
|
}
|
2017-11-15 17:35:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Plugins.defaultProps = {
|
|
|
|
plugins: {},
|
|
|
|
};
|
|
|
|
|
|
|
|
Plugins.propTypes = {
|
|
|
|
plugins: PropTypes.object,
|
|
|
|
};
|
|
|
|
|
|
|
|
export default Plugins;
|