mirror of
https://github.com/strapi/strapi.git
synced 2025-09-27 01:09:49 +00:00
116 lines
3.1 KiB
JavaScript
116 lines
3.1 KiB
JavaScript
![]() |
/**
|
||
|
*
|
||
|
* InstallPluginPage
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
import React from 'react';
|
||
|
import PropTypes from 'prop-types';
|
||
|
import { connect } from 'react-redux';
|
||
|
import { Helmet } from 'react-helmet';
|
||
|
import { FormattedMessage } from 'react-intl';
|
||
|
import { bindActionCreators, compose } from 'redux';
|
||
|
import cn from 'classnames';
|
||
|
|
||
|
// Design
|
||
|
import Input from 'components/Input';
|
||
|
import PluginHeader from 'components/PluginHeader';
|
||
|
|
||
|
import injectSaga from 'utils/injectSaga';
|
||
|
import injectReducer from 'utils/injectReducer';
|
||
|
|
||
|
import {
|
||
|
getPlugins,
|
||
|
onChange,
|
||
|
} from './actions';
|
||
|
|
||
|
import makeSelectInstallPluginPage from './selectors';
|
||
|
import reducer from './reducer';
|
||
|
import saga from './saga';
|
||
|
|
||
|
import styles from './styles.scss';
|
||
|
|
||
|
export class InstallPluginPage extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
||
|
componentDidMount() {
|
||
|
// Don't fetch the available plugins if it has already been done
|
||
|
if (!this.props.didFetchPlugins) {
|
||
|
this.props.getPlugins();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
render() {
|
||
|
return (
|
||
|
<div>
|
||
|
<FormattedMessage id="app.components.InstallPluginPage.helmet">
|
||
|
{message => (
|
||
|
<Helmet>
|
||
|
<title>{message}</title>
|
||
|
<meta name="description" content="Description of InstallPluginPage" />
|
||
|
</Helmet>
|
||
|
)}
|
||
|
</FormattedMessage>
|
||
|
<div className={cn('container-fluid', styles.containerFluid)}>
|
||
|
<PluginHeader
|
||
|
title={{ id: 'app.components.InstallPluginPage.title' }}
|
||
|
description={{ id: 'app.components.InstallPluginPage.description' }}
|
||
|
actions={[]}
|
||
|
/>
|
||
|
<div className="row">
|
||
|
<Input
|
||
|
customBootstrapClass="col-md-12"
|
||
|
label="app.components.InstallPluginPage.InputSearch.label"
|
||
|
name="search"
|
||
|
onChange={this.props.onChange}
|
||
|
placeholder="app.components.InstallPluginPage.InputSearch.placeholder"
|
||
|
type="search"
|
||
|
validations={{}}
|
||
|
value={this.props.search}
|
||
|
/>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
InstallPluginPage.contextTypes = {
|
||
|
plugins: PropTypes.object.isRequired,
|
||
|
};
|
||
|
|
||
|
InstallPluginPage.propTypes = {
|
||
|
didFetchPlugins: PropTypes.bool.isRequired,
|
||
|
getPlugins: PropTypes.func.isRequired,
|
||
|
onChange: PropTypes.func.isRequired,
|
||
|
search: PropTypes.string.isRequired,
|
||
|
};
|
||
|
|
||
|
const mapStateToProps = makeSelectInstallPluginPage();
|
||
|
|
||
|
function mapDispatchToProps(dispatch) {
|
||
|
return bindActionCreators(
|
||
|
{
|
||
|
getPlugins,
|
||
|
onChange,
|
||
|
},
|
||
|
dispatch,
|
||
|
);
|
||
|
}
|
||
|
|
||
|
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
||
|
|
||
|
/* Remove this line if the container doesn't have a route and
|
||
|
* check the documentation to see how to create the container's store
|
||
|
*/
|
||
|
const withReducer = injectReducer({ key: 'installPluginPage', reducer });
|
||
|
|
||
|
/* Remove the line below the container doesn't have a route and
|
||
|
* check the documentation to see how to create the container's store
|
||
|
*/
|
||
|
const withSaga = injectSaga({ key: 'installPluginPage', saga });
|
||
|
|
||
|
export default compose(
|
||
|
withReducer,
|
||
|
withSaga,
|
||
|
withConnect,
|
||
|
)(InstallPluginPage);
|