mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-05-05 07:22:54 +03:00
Add button to the dashboard page for enable/disable filtering
Closes #333
This commit is contained in:
parent
381b96a4b1
commit
2cf22898dd
3 changed files with 69 additions and 1 deletions
client/src/components/Dashboard
|
@ -20,6 +20,19 @@ class Dashboard extends Component {
|
|||
this.props.getStats();
|
||||
this.props.getStatsHistory();
|
||||
this.props.getTopStats();
|
||||
this.props.getFiltering();
|
||||
}
|
||||
|
||||
getToggleFilteringButton = () => {
|
||||
const { isFilteringEnabled } = this.props.dashboard;
|
||||
const buttonText = isFilteringEnabled ? 'Disable' : 'Enable';
|
||||
const buttonClass = isFilteringEnabled ? 'btn-outline-secondary' : 'btn-outline-success';
|
||||
|
||||
return (
|
||||
<button type="button" className={`btn btn-sm mr-2 ${buttonClass}`} onClick={() => this.props.toggleFiltering(isFilteringEnabled)}>
|
||||
{buttonText} protection
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -37,6 +50,7 @@ class Dashboard extends Component {
|
|||
<Fragment>
|
||||
<PageTitle title="Dashboard">
|
||||
<div className="page-title__actions">
|
||||
{this.getToggleFilteringButton()}
|
||||
{refreshFullButton}
|
||||
</div>
|
||||
</PageTitle>
|
||||
|
@ -97,9 +111,10 @@ Dashboard.propTypes = {
|
|||
getStats: PropTypes.func,
|
||||
getStatsHistory: PropTypes.func,
|
||||
getTopStats: PropTypes.func,
|
||||
disableDns: PropTypes.func,
|
||||
dashboard: PropTypes.object,
|
||||
isCoreRunning: PropTypes.bool,
|
||||
getFiltering: PropTypes.func,
|
||||
toggleFiltering: PropTypes.func,
|
||||
};
|
||||
|
||||
export default Dashboard;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue