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 {
|
2022-06-19 09:29:29 +00:00
|
|
|
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();
|
2022-03-20 23:20:34 +00:00
|
|
|
};
|
2018-11-23 07:04:42 +00:00
|
|
|
|
|
|
|
onShutdownPress = () => {
|
|
|
|
this.props.shutdown();
|
2022-03-20 23:20:34 +00:00
|
|
|
};
|
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);
|