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 PropTypes from 'prop-types';
import cn from 'classnames'; import cn from 'classnames';
import { FormattedMessage } from 'react-intl'; import { FormattedMessage } from 'react-intl';
import { get } from 'lodash';
// Design // Design
import Ico from 'components/Ico'; import IcoContainer from 'components/IcoContainer';
import ListRow from 'components/ListRow'; import ListRow from 'components/ListRow';
import PopUpWarning from 'components/PopUpWarning'; import PopUpWarning from 'components/PopUpWarning';
@ -31,6 +32,27 @@ class Row extends React.Component {
} }
render() { 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 ( return (
<ListRow> <ListRow>
<div className={cn("col-md-11", styles.nameWrapper)}> <div className={cn("col-md-11", styles.nameWrapper)}>
@ -44,7 +66,7 @@ class Row extends React.Component {
</div> </div>
<div className="col-md-1"> <div className="col-md-1">
<div className={styles.actionContainer}> <div className={styles.actionContainer}>
<Ico onClick={this.handleClick} id={this.props.name} /> <IcoContainer icons={icons} />
</div> </div>
</div> </div>
<PopUpWarning <PopUpWarning
@ -58,6 +80,11 @@ class Row extends React.Component {
} }
} }
Row.contextTypes = {
appEnvironments: PropTypes.array,
router: PropTypes.object,
};
Row.propTypes = { Row.propTypes = {
name: PropTypes.string.isRequired, name: PropTypes.string.isRequired,
onDeleteClick: PropTypes.func.isRequired, onDeleteClick: PropTypes.func.isRequired,

View File

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

View File

@ -20,7 +20,7 @@ function App() {
return ( return (
<div className={pluginId}> <div className={pluginId}>
<Switch> <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 path={`/plugins/${pluginId}`} component={HomePage} exact />
<Route component={NotFoundPage} /> <Route component={NotFoundPage} />
</Switch> </Switch>