import React, { Component, Fragment } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import { Trans, withNamespaces } from 'react-i18next'; import Form from './Form'; import Leases from './Leases'; import Interface from './Interface'; import Card from '../../ui/Card'; class Dhcp extends Component { handleFormSubmit = (values) => { this.props.setDhcpConfig(values); }; handleFormChange = (value) => { this.props.setDhcpConfig(value); } handleToggle = (config) => { this.props.toggleDhcp(config); this.props.findActiveDhcp(config.interface_name); } getToggleDhcpButton = () => { const { config, active, processingDhcp } = this.props.dhcp; const activeDhcpFound = active && active.found; const filledConfig = Object.keys(config).every((key) => { if (key === 'enabled') { return true; } return config[key]; }); if (config.enabled) { return ( ); } return ( ); } getActiveDhcpMessage = () => { const { active } = this.props.dhcp; if (active) { if (active.error) { return (