Pull request: fix down flag

Squashed commit of the following:

commit ea446e844a21e7e7e0271d4d133c581014facda1
Merge: bb8cabfa 5e71f5df
Author: Ildar Kamalov <ik@adguard.com>
Date:   Thu Mar 31 10:49:20 2022 +0300

    Merge branch 'master' into client-down-flag

commit bb8cabfae8e2e3eaa09f48ffe7d2fb3b308d31fb
Author: Ildar Kamalov <ik@adguard.com>
Date:   Wed Mar 30 19:27:30 2022 +0300

    client: fix down flag
This commit is contained in:
Ildar Kamalov 2022-03-31 11:54:47 +03:00
parent 5e71f5df6a
commit a79b61aac3

View File

@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
import { Field, reduxForm, formValueSelector } from 'redux-form';
import { Trans, withTranslation } from 'react-i18next';
import flow from 'lodash/flow';
import i18n from 'i18next';
import Controls from './Controls';
import AddressList from './AddressList';
@ -31,10 +32,10 @@ const renderInterfaces = (interfaces) => Object.values(interfaces)
if (option && ip_addresses?.length > 0) {
const ip = getInterfaceIp(option);
const isDown = flags?.includes('down');
const isUp = flags?.includes('up');
return <option value={ip} key={name} disabled={isDown}>
{name} - {ip} {isDown && `(${<Trans>down</Trans>})`}
return <option value={ip} key={name} disabled={!isUp}>
{name} - {ip} {!isUp && `(${i18n.t('down')})`}
</option>;
}