2016-08-24 15:09:42 +02:00
|
|
|
/**
|
2017-03-15 11:48:56 +01:00
|
|
|
*
|
|
|
|
* LeftMenuLinkContainer
|
|
|
|
*
|
|
|
|
*/
|
2016-08-24 15:09:42 +02:00
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import LeftMenuLink from 'components/LeftMenuLink';
|
|
|
|
import styles from './styles.scss';
|
|
|
|
|
|
|
|
class LeftMenuLinkContainer extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
|
|
render() {
|
2017-08-14 17:09:34 +02:00
|
|
|
// Generate the list of sections
|
|
|
|
const linkSections = this.props.plugins.valueSeq().map(plugin => (
|
|
|
|
plugin.get('leftMenuSections').map((leftMenuSection, j) => {
|
|
|
|
const sectionlinks = leftMenuSection.get('links').map((sectionLink, k) => (
|
|
|
|
<LeftMenuLink
|
|
|
|
key={k}
|
|
|
|
icon={sectionLink.get('icon') || 'link'}
|
|
|
|
label={sectionLink.get('label')}
|
2017-08-16 17:05:02 +02:00
|
|
|
destination={`/plugins/${plugin.get('id')}/${sectionLink.get('destination')}`}
|
2017-08-14 17:09:34 +02:00
|
|
|
/>
|
|
|
|
));
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div key={j}>
|
|
|
|
<p className={styles.title}>{leftMenuSection.get('name')}</p>
|
|
|
|
<ul className={styles.list}>
|
|
|
|
{sectionlinks}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
})
|
|
|
|
));
|
|
|
|
|
|
|
|
|
2016-08-26 13:28:12 +02:00
|
|
|
// List of links
|
2017-08-14 17:09:34 +02:00
|
|
|
let pluginsLinks = this.props.plugins.valueSeq().map((plugin) => (
|
2017-03-15 11:48:56 +01:00
|
|
|
<LeftMenuLink
|
2017-03-18 17:34:00 +01:00
|
|
|
key={plugin.get('id')}
|
2017-07-21 18:15:43 +02:00
|
|
|
icon={plugin.get('icon') || 'plug'}
|
2017-03-18 17:34:00 +01:00
|
|
|
label={plugin.get('name')}
|
|
|
|
destination={`/plugins/${plugin.get('id')}`}
|
2017-03-15 11:48:56 +01:00
|
|
|
/>
|
|
|
|
));
|
2016-11-22 15:22:16 +01:00
|
|
|
|
|
|
|
// Check if the plugins list is empty or not
|
2017-08-14 17:09:34 +02:00
|
|
|
if (!pluginsLinks.size) {
|
|
|
|
pluginsLinks = <span className={styles.noPluginsInstalled}>No plugins installed yet.</span>;
|
2016-11-22 15:22:16 +01:00
|
|
|
}
|
2016-08-24 15:09:42 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className={styles.leftMenuLinkContainer}>
|
2017-08-14 17:09:34 +02:00
|
|
|
{linkSections}
|
|
|
|
<div>
|
|
|
|
<p className={styles.title}>Plugins</p>
|
|
|
|
<ul className={styles.list}>
|
|
|
|
{pluginsLinks}
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<p className={styles.title}>General</p>
|
|
|
|
<ul className={styles.list}>
|
|
|
|
<LeftMenuLink
|
|
|
|
icon="cubes"
|
|
|
|
label="List plugins"
|
|
|
|
destination="/list-plugins"
|
|
|
|
/>
|
|
|
|
<LeftMenuLink
|
|
|
|
icon="download"
|
|
|
|
label="Install new plugin"
|
|
|
|
destination="/install-plugin"
|
|
|
|
/>
|
|
|
|
<LeftMenuLink
|
|
|
|
icon="gear"
|
|
|
|
label="Configuration"
|
|
|
|
destination="/configuration"
|
|
|
|
/>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2016-08-24 15:09:42 +02:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LeftMenuLinkContainer.propTypes = {
|
2016-08-30 14:05:33 +02:00
|
|
|
plugins: React.PropTypes.object,
|
|
|
|
params: React.PropTypes.object,
|
2016-08-24 15:09:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
export default LeftMenuLinkContainer;
|