Only allow single click on buttons

Closes #544
This commit is contained in:
Ildar Kamalov
2019-01-16 14:51:17 +03:00
parent f1b6da93cf
commit e1bb428a6a
8 changed files with 80 additions and 24 deletions

View File

@@ -23,7 +23,7 @@ class Dhcp extends Component {
}
getToggleDhcpButton = () => {
const { config, active } = this.props.dhcp;
const { config, active, processingDhcp } = this.props.dhcp;
const activeDhcpFound = active && active.found;
const filledConfig = Object.keys(config).every((key) => {
if (key === 'enabled') {
@@ -39,6 +39,7 @@ class Dhcp extends Component {
type="button"
className="btn btn-standart mr-2 btn-gray"
onClick={() => this.props.toggleDhcp(config)}
disabled={processingDhcp}
>
<Trans>dhcp_disable</Trans>
</button>
@@ -50,7 +51,7 @@ class Dhcp extends Component {
type="button"
className="btn btn-standart mr-2 btn-success"
onClick={() => this.handleToggle(config)}
disabled={!filledConfig || activeDhcpFound}
disabled={!filledConfig || activeDhcpFound || processingDhcp}
>
<Trans>dhcp_enable</Trans>
</button>