import { useTranslation } from 'react-i18next'; import { shallowEqual, useSelector } from 'react-redux'; import classNames from 'classnames'; import React from 'react'; import { getRulesToFilterList, formatElapsedMs, getFilterNames, getServiceName } from '../../../helpers/helpers'; import { FILTERED_STATUS, FILTERED_STATUS_TO_META_MAP } from '../../../helpers/constants'; import IconTooltip from './IconTooltip'; import { RootState } from '../../../initialState'; interface ResponseCellProps { elapsedMs: string; originalResponse?: unknown[]; reason: string; response: unknown[]; status: string; upstream: string; cached: boolean; rules?: { text: string; filter_list_id: number; }[]; service_name?: string; } const ResponseCell = ({ elapsedMs, originalResponse, reason, response, status, upstream, rules, service_name, cached, }: ResponseCellProps) => { const { t } = useTranslation(); const filters = useSelector((state: RootState) => state.filtering.filters, shallowEqual); const whitelistFilters = useSelector((state: RootState) => state.filtering.whitelistFilters, shallowEqual); const isDetailed = useSelector((state: RootState) => state.queryLogs.isDetailed); const services = useSelector((store: RootState) => store?.services); const formattedElapsedMs = formatElapsedMs(elapsedMs, t); const isBlocked = reason === FILTERED_STATUS.FILTERED_BLACK_LIST || reason === FILTERED_STATUS.FILTERED_BLOCKED_SERVICE; const isBlockedByResponse = originalResponse.length > 0 && isBlocked; const statusLabel = t( isBlockedByResponse ? 'blocked_by_cname_or_ip' : FILTERED_STATUS_TO_META_MAP[reason]?.LABEL || reason, ); const boldStatusLabel = {statusLabel}; const renderResponses = (responseArr: any) => { if (!responseArr || responseArr.length === 0) { return ''; } return (