Radarr/frontend/src/Components/Page/Header/PageHeaderActionsMenuConnec...

57 lines
1.2 KiB
JavaScript
Raw Normal View History

2018-11-23 07:04:42 +00:00
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { restart, shutdown } from 'Store/Actions/systemActions';
import PageHeaderActionsMenu from './PageHeaderActionsMenu';
function createMapStateToProps() {
return createSelector(
(state) => state.system.status,
(status) => {
return {
cookieAuth: ['forms', 'oidc', 'plex'].includes(status.item.authentication)
2018-11-23 07:04:42 +00:00
};
}
);
}
const mapDispatchToProps = {
restart,
shutdown
};
class PageHeaderActionsMenuConnector extends Component {
//
// Listeners
onRestartPress = () => {
this.props.restart();
};
2018-11-23 07:04:42 +00:00
onShutdownPress = () => {
this.props.shutdown();
};
2018-11-23 07:04:42 +00:00
//
// Render
render() {
return (
<PageHeaderActionsMenu
{...this.props}
onRestartPress={this.onRestartPress}
onShutdownPress={this.onShutdownPress}
/>
);
}
}
PageHeaderActionsMenuConnector.propTypes = {
restart: PropTypes.func.isRequired,
shutdown: PropTypes.func.isRequired
};
export default connect(createMapStateToProps, mapDispatchToProps)(PageHeaderActionsMenuConnector);