+ client: handle blocked by response in query log
This commit is contained in:
parent
e7727e9f63
commit
e8885dbf3e
|
@ -405,5 +405,6 @@
|
||||||
"netname": "Network name",
|
"netname": "Network name",
|
||||||
"descr": "Description",
|
"descr": "Description",
|
||||||
"whois": "Whois",
|
"whois": "Whois",
|
||||||
"filtering_rules_learn_more": "<0>Learn more</0> about creating your own hosts blocklists."
|
"filtering_rules_learn_more": "<0>Learn more</0> about creating your own hosts blocklists.",
|
||||||
}
|
"blocked_by_response": "Blocked by CNAME or IP in response"
|
||||||
|
}
|
||||||
|
|
|
@ -134,9 +134,16 @@ class Logs extends Component {
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
normalizeResponse = response => (
|
||||||
|
response.map((response) => {
|
||||||
|
const { value, type, ttl } = response;
|
||||||
|
return `${type}: ${value} (ttl=${ttl})`;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
getResponseCell = ({ value: responses, original }) => {
|
getResponseCell = ({ value: responses, original }) => {
|
||||||
const {
|
const {
|
||||||
reason, filterId, rule, status,
|
reason, filterId, rule, status, originalAnswer,
|
||||||
} = original;
|
} = original;
|
||||||
const { t, filtering } = this.props;
|
const { t, filtering } = this.props;
|
||||||
const { filters } = filtering;
|
const { filters } = filtering;
|
||||||
|
@ -149,6 +156,7 @@ class Logs extends Component {
|
||||||
const isBlockedService = reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE;
|
const isBlockedService = reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE;
|
||||||
const currentService = SERVICES.find(service => service.id === original.serviceName);
|
const currentService = SERVICES.find(service => service.id === original.serviceName);
|
||||||
const serviceName = currentService && currentService.name;
|
const serviceName = currentService && currentService.name;
|
||||||
|
const normalizedAnswer = originalAnswer && this.normalizeResponse(originalAnswer);
|
||||||
let filterName = '';
|
let filterName = '';
|
||||||
|
|
||||||
if (filterId === 0) {
|
if (filterId === 0) {
|
||||||
|
@ -168,7 +176,12 @@ class Logs extends Component {
|
||||||
return (
|
return (
|
||||||
<div className="logs__row logs__row--column">
|
<div className="logs__row logs__row--column">
|
||||||
<div className="logs__text-wrap">
|
<div className="logs__text-wrap">
|
||||||
{(isFiltered || isBlockedService) && (
|
{originalAnswer && (
|
||||||
|
<span className="logs__text">
|
||||||
|
<Trans>blocked_by_response</Trans>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
|
{!originalAnswer && (isFiltered || isBlockedService) && (
|
||||||
<span className="logs__text" title={parsedFilteredReason}>
|
<span className="logs__text" title={parsedFilteredReason}>
|
||||||
{parsedFilteredReason}
|
{parsedFilteredReason}
|
||||||
</span>
|
</span>
|
||||||
|
@ -183,7 +196,10 @@ class Logs extends Component {
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className="logs__list-wrap">
|
<div className="logs__list-wrap">
|
||||||
{this.renderResponseList(responses, status)}
|
{originalAnswer
|
||||||
|
? this.renderResponseList(normalizedAnswer, status)
|
||||||
|
: this.renderResponseList(responses, status)
|
||||||
|
}
|
||||||
{isWhiteList && this.renderTooltip(isWhiteList, rule, filterName)}
|
{isWhiteList && this.renderTooltip(isWhiteList, rule, filterName)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -50,6 +50,7 @@ export const normalizeLogs = logs => logs.map((log) => {
|
||||||
rule,
|
rule,
|
||||||
service_name,
|
service_name,
|
||||||
status,
|
status,
|
||||||
|
original_answer,
|
||||||
} = log;
|
} = log;
|
||||||
const { host: domain, type } = question;
|
const { host: domain, type } = question;
|
||||||
const responsesArray = response ? response.map((response) => {
|
const responsesArray = response ? response.map((response) => {
|
||||||
|
@ -65,8 +66,9 @@ export const normalizeLogs = logs => logs.map((log) => {
|
||||||
client,
|
client,
|
||||||
filterId,
|
filterId,
|
||||||
rule,
|
rule,
|
||||||
serviceName: service_name,
|
|
||||||
status,
|
status,
|
||||||
|
serviceName: service_name,
|
||||||
|
originalAnswer: original_answer,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue