Add configurations to list-plugins page

This commit is contained in:
cyril lopez 2018-02-28 10:50:07 +01:00
parent 4c6343bed6
commit 03ee9f10fb
3 changed files with 31 additions and 4 deletions

View File

@ -8,9 +8,10 @@ import React from 'react';
import PropTypes from 'prop-types';
import cn from 'classnames';
import { FormattedMessage } from 'react-intl';
import { get } from 'lodash';
// Design
import Ico from 'components/Ico';
import IcoContainer from 'components/IcoContainer';
import ListRow from 'components/ListRow';
import PopUpWarning from 'components/PopUpWarning';
@ -31,6 +32,27 @@ class Row extends React.Component {
}
render() {
const uploadPath = `/plugins/upload/configurations/${get(this.context, ['appEnvironments', '0', 'name'])}`;
const icons = this.props.name === 'upload' ? [
{
icoType: 'cog',
onClick: (e) => {
e.preventDefault();
e.stopPropagation();
this.context.router.history.push(uploadPath);
},
},
{
icoType: 'trash',
onClick: this.handleClick,
},
] : [
{
icoType: 'trash',
onClick: this.handleClick,
},
];
return (
<ListRow>
<div className={cn("col-md-11", styles.nameWrapper)}>
@ -44,7 +66,7 @@ class Row extends React.Component {
</div>
<div className="col-md-1">
<div className={styles.actionContainer}>
<Ico onClick={this.handleClick} id={this.props.name} />
<IcoContainer icons={icons} />
</div>
</div>
<PopUpWarning
@ -58,6 +80,11 @@ class Row extends React.Component {
}
}
Row.contextTypes = {
appEnvironments: PropTypes.array,
router: PropTypes.object,
};
Row.propTypes = {
name: PropTypes.string.isRequired,
onDeleteClick: PropTypes.func.isRequired,

View File

@ -1,7 +1,7 @@
{
"archive": ["rar", "zip"],
"code": ["js", "json", "rb", "erb", "txt", "css", "scss", "html", "jsx"],
"img": ["jpg", "jpeg", "png", "gif"],
"img": ["jpg", "jpeg", "png", "gif", "ico"],
"pdf": ["pdf"],
"powerpoint": ["ppt", "key", "xls"],
"video": ["mov", "avi", "mpg", "mp4", "m4v"],

View File

@ -20,7 +20,7 @@ function App() {
return (
<div className={pluginId}>
<Switch>
<Route path={`/plugins/${pluginId}/:env`} component={ConfigPage} exact />
<Route path={`/plugins/${pluginId}/configurations/:env`} component={ConfigPage} exact />
<Route path={`/plugins/${pluginId}`} component={HomePage} exact />
<Route component={NotFoundPage} />
</Switch>