diff --git a/client/src/components/Logs/Cells/getDomainCell.js b/client/src/components/Logs/Cells/getDomainCell.js index d0a44cff..0d460190 100644 --- a/client/src/components/Logs/Cells/getDomainCell.js +++ b/client/src/components/Logs/Cells/getDomainCell.js @@ -7,7 +7,8 @@ import { LONG_TIME_FORMAT, SCHEME_TO_PROTOCOL_MAP, } from '../../../helpers/constants'; -import { formatDateTime, formatTime } from '../../../helpers/helpers'; +import { captitalizeWords, formatDateTime, formatTime } from '../../../helpers/helpers'; +import { getSourceData } from '../../../helpers/trackers/trackers'; const getDomainCell = (props) => { const { @@ -20,8 +21,6 @@ const getDomainCell = (props) => { const hasTracker = !!tracker; - const source = tracker && tracker.sourceData && tracker.sourceData.name; - const lockIconClass = classNames('icons', 'icon--small', 'd-none', 'd-sm-block', 'cursor--pointer', { 'icon--active': answer_dnssec, 'icon--disabled': !answer_dnssec, @@ -55,10 +54,14 @@ const getDomainCell = (props) => { protocol, }; + const sourceData = getSourceData(tracker); + const knownTrackerDataObj = { name_table_header: tracker && tracker.name, - category_label: tracker && tracker.category, - source_label: source && {source}, + category_label: tracker && captitalizeWords(tracker.category), + source_label: sourceData + && {sourceData.name}, }; const renderGrid = (content, idx) => { @@ -71,7 +74,8 @@ const getDomainCell = (props) => { const getGrid = (contentObj, title, className) => [
{t(title)}
, -
{React.Children.map(Object.entries(contentObj), renderGrid)}
, +
{React.Children.map(Object.entries(contentObj), renderGrid)}
, ]; const requestDetails = getGrid(requestDetailsObj, 'request_details'); diff --git a/client/src/components/Logs/Table.js b/client/src/components/Logs/Table.js index 586fca12..ccab98bb 100644 --- a/client/src/components/Logs/Table.js +++ b/client/src/components/Logs/Table.js @@ -19,6 +19,7 @@ import getClientCell from './Cells/getClientCell'; import getResponseCell from './Cells/getResponseCell'; import { + captitalizeWords, checkFiltered, formatDateTime, formatElapsedMs, @@ -26,6 +27,7 @@ import { } from '../../helpers/helpers'; import Loading from '../ui/Loading'; +import { getSourceData } from '../../helpers/trackers/trackers'; const Table = (props) => { const { @@ -300,15 +302,14 @@ const Table = (props) => { toggleBlocking(buttonType, domain); }; - const tracker_source = tracker && tracker.sourceData - && tracker.sourceData.name; - const status = t((FILTERED_STATUS_TO_META_MAP[reason] && FILTERED_STATUS_TO_META_MAP[reason].label) || reason); const statusBlocked =
{status}
; const protocol = t(SCHEME_TO_PROTOCOL_MAP[client_proto]) || ''; + const sourceData = getSourceData(tracker); + const detailedData = { time_table_header: formatTime(time, LONG_TIME_FORMAT), date: formatDateTime(time, DEFAULT_SHORT_DATE_FORMAT_OPTIONS), @@ -318,9 +319,10 @@ const Table = (props) => { protocol, known_tracker: hasTracker && 'title', table_name: hasTracker && tracker.name, - category_label: hasTracker && tracker.category, - tracker_source: hasTracker && tracker_source && {tracker_source}, + category_label: hasTracker && captitalizeWords(tracker.category), + tracker_source: hasTracker && sourceData + && {sourceData.name}, response_details: 'title', install_settings_dns: upstream, elapsed: formattedElapsedMs, @@ -346,9 +348,10 @@ const Table = (props) => { protocol, known_tracker: 'title', table_name: hasTracker && tracker.name, - category_label: hasTracker && tracker.category, - source_label: hasTracker && source - && {source}, + category_label: hasTracker && captitalizeWords(tracker.category), + source_label: hasTracker && sourceData + && {sourceData.name}, response_details: 'title', install_settings_dns: upstream, elapsed: formattedElapsedMs,