Fix block button

This commit is contained in:
Ildar Kamalov 2018-11-26 18:17:34 +03:00
parent 8966383ca3
commit c17c282901
1 changed files with 4 additions and 3 deletions

View File

@ -69,13 +69,14 @@ class Logs extends Component {
renderBlockingButton(isFiltered, domain) { renderBlockingButton(isFiltered, domain) {
const buttonClass = isFiltered ? 'btn-outline-secondary' : 'btn-outline-danger'; const buttonClass = isFiltered ? 'btn-outline-secondary' : 'btn-outline-danger';
const buttonText = isFiltered ? 'unblock_btn' : 'block_btn'; const buttonText = isFiltered ? 'unblock_btn' : 'block_btn';
const buttonType = isFiltered ? 'unblock' : 'block';
return ( return (
<div className="logs__action"> <div className="logs__action">
<button <button
type="button" type="button"
className={`btn btn-sm ${buttonClass}`} className={`btn btn-sm ${buttonClass}`}
onClick={() => this.toggleBlocking(buttonText.toLowerCase(), domain)} onClick={() => this.toggleBlocking(buttonType, domain)}
> >
<Trans>{buttonText}</Trans> <Trans>{buttonText}</Trans>
</button> </button>
@ -126,7 +127,7 @@ class Logs extends Component {
if (reason === 'FilteredBlackList' || reason === 'NotFilteredWhiteList') { if (reason === 'FilteredBlackList' || reason === 'NotFilteredWhiteList') {
if (filterId === 0) { if (filterId === 0) {
filterName = 'custom_filter_rules'; filterName = t('custom_filter_rules');
} else { } else {
const filterItem = Object.keys(filters) const filterItem = Object.keys(filters)
.filter(key => filters[key].id === filterId); .filter(key => filters[key].id === filterId);
@ -167,7 +168,7 @@ class Logs extends Component {
filterMethod: (filter, row) => { filterMethod: (filter, row) => {
if (filter.value === 'filtered') { if (filter.value === 'filtered') {
// eslint-disable-next-line no-underscore-dangle // eslint-disable-next-line no-underscore-dangle
return row._original.reason.indexOf('Filtered') === 0; return row._original.reason.indexOf('Filtered') === 0 || row._original.reason === 'NotFilteredWhiteList';
} }
return true; return true;
}, },