Fix #1810
- client: Fix query log bugs Squashed commit of the following: commit 188bbad32a2af8a1867fc3ef91d81cda6aa94853 Merge:15db9e9cec6e0beaAuthor: Andrey Meshkov <am@adguard.com> Date: Thu Jun 18 22:43:11 2020 +0300 Merge branch 'master' into fix/1810 commit15db9e9c1dAuthor: ArtemBaskal <a.baskal@adguard.com> Date: Thu Jun 18 19:01:10 2020 +0300 Open tooltip on hover, show scroll on overflow y commit19c013378dAuthor: ArtemBaskal <a.baskal@adguard.com> Date: Thu Jun 18 17:17:46 2020 +0300 Replace tooltip component commit7e7103dc08Author: ArtemBaskal <a.baskal@adguard.com> Date: Thu Jun 18 14:21:54 2020 +0300 -client: Fix query log bugs
This commit is contained in:
110
client/src/components/Logs/Cells/Tooltip.css
Normal file
110
client/src/components/Logs/Cells/Tooltip.css
Normal file
@@ -0,0 +1,110 @@
|
||||
.tooltip__container {
|
||||
padding: 1rem 1.5rem 1.25rem 1.5rem;
|
||||
font-size: 16px !important;
|
||||
box-shadow: 2px 4px 8px rgba(0, 0, 0, 0.2);
|
||||
border-radius: 4px !important;
|
||||
pointer-events: auto !important;
|
||||
background-color: var(--white);
|
||||
z-index: 102;
|
||||
overflow-y: scroll;
|
||||
max-height: 100%;
|
||||
}
|
||||
|
||||
.white-space--nowrap {
|
||||
white-space: nowrap !important;
|
||||
}
|
||||
|
||||
.overflow-break {
|
||||
white-space: normal !important;
|
||||
overflow-wrap: break-word;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, min-content);
|
||||
grid-row-gap: 0.5rem;
|
||||
grid-column-gap: 1rem;
|
||||
}
|
||||
|
||||
.grid--limited {
|
||||
grid-template-columns: repeat(2, minmax(0, min-content));
|
||||
}
|
||||
|
||||
.grid--gap-bg {
|
||||
grid-column-gap: 1.5rem;
|
||||
}
|
||||
|
||||
.grid--title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.grid--title:not(:first-child) {
|
||||
padding-top: 1rem;
|
||||
}
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
.grid {
|
||||
grid-template-columns: 35% 55%;
|
||||
}
|
||||
|
||||
.grid * {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.grid > :nth-child(even) {
|
||||
margin: -0.5rem 0 0;
|
||||
}
|
||||
|
||||
.grid > .key__time_table_header, .grid > .key__data, .grid > .key__encryption_status, .grid > .key__elapsed {
|
||||
grid-column: 1 / span 1;
|
||||
}
|
||||
|
||||
.grid > .value__time_table_header, .grid > .value__data, .grid > .value__encryption_status, .grid > .value__elapsed {
|
||||
grid-column: 2 / span 1;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
.grid .key-colon, .grid .title--border {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
|
||||
.grid .key-colon:nth-child(odd)::after {
|
||||
content: ':';
|
||||
}
|
||||
|
||||
.grid__one-row {
|
||||
grid-template-columns: 15rem;
|
||||
}
|
||||
|
||||
.grid__flow-column {
|
||||
grid-auto-flow: column;
|
||||
}
|
||||
|
||||
.grid-content > * {
|
||||
justify-content: space-between !important;
|
||||
width: 100% !important;
|
||||
overflow: hidden;
|
||||
-o-text-overflow: ellipsis;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.title--border {
|
||||
padding-top: 2rem;
|
||||
}
|
||||
|
||||
.title--border:before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
border-top: 0.5px solid var(--gray-d8) !important;
|
||||
width: 100%;
|
||||
margin-top: -1rem;
|
||||
}
|
||||
|
||||
.icon-cross {
|
||||
position: absolute;
|
||||
right: 0.5rem;
|
||||
top: 0.5rem;
|
||||
}
|
||||
@@ -75,12 +75,11 @@ const getClientCell = ({
|
||||
className: hintClass,
|
||||
columnClass: 'grid grid--limited',
|
||||
tooltipClass: 'px-5 pb-5 pt-4 mw-75',
|
||||
dataTip: true,
|
||||
xlinkHref: 'question',
|
||||
contentItemClass: 'text-truncate key-colon',
|
||||
title: 'client_details',
|
||||
content: processedData,
|
||||
place: 'bottom',
|
||||
placement: 'bottom',
|
||||
})}
|
||||
<div
|
||||
className={nameClass}>
|
||||
|
||||
@@ -37,11 +37,11 @@ const getDomainCell = (props) => {
|
||||
const dnssecHint = getHintElement({
|
||||
className: lockIconClass,
|
||||
tooltipClass: 'py-4 px-5 pb-45',
|
||||
dataTip: answer_dnssec,
|
||||
canShowTooltip: answer_dnssec,
|
||||
xlinkHref: 'lock',
|
||||
columnClass: 'w-100',
|
||||
content: 'validated_with_dnssec',
|
||||
place: 'bottom',
|
||||
placement: 'bottom',
|
||||
});
|
||||
|
||||
const protocol = t(SCHEME_TO_PROTOCOL_MAP[client_proto]) || '';
|
||||
@@ -64,7 +64,7 @@ const getDomainCell = (props) => {
|
||||
const renderGrid = (content, idx) => {
|
||||
const preparedContent = typeof content === 'string' ? t(content) : content;
|
||||
const className = classNames('text-truncate key-colon o-hidden', {
|
||||
'word-break--break-all white-space--normal': preparedContent.length > 100,
|
||||
'overflow-break': preparedContent.length > 100,
|
||||
});
|
||||
return <div key={idx} className={className}>{preparedContent}</div>;
|
||||
};
|
||||
@@ -81,7 +81,6 @@ const getDomainCell = (props) => {
|
||||
const trackerHint = getHintElement({
|
||||
className: privacyIconClass,
|
||||
tooltipClass: 'pt-4 pb-5 px-5 mw-75',
|
||||
dataTip: true,
|
||||
xlinkHref: 'privacy',
|
||||
contentItemClass: 'key-colon',
|
||||
renderContent,
|
||||
|
||||
@@ -1,55 +1,50 @@
|
||||
import React, { useState } from 'react';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import CustomTooltip from '../Tooltip/CustomTooltip';
|
||||
import TooltipTrigger from 'react-popper-tooltip';
|
||||
import { Trans } from 'react-i18next';
|
||||
import classNames from 'classnames';
|
||||
import './Tooltip.css';
|
||||
import 'react-popper-tooltip/dist/styles.css';
|
||||
import { HIDE_TOOLTIP_DELAY } from '../../../helpers/constants';
|
||||
|
||||
const getHintElement = ({
|
||||
className,
|
||||
contentItemClass,
|
||||
columnClass,
|
||||
dataTip,
|
||||
canShowTooltip = true,
|
||||
xlinkHref,
|
||||
content,
|
||||
title,
|
||||
place,
|
||||
placement,
|
||||
tooltipClass,
|
||||
trigger,
|
||||
overridePosition,
|
||||
scrollHide,
|
||||
renderContent,
|
||||
}) => {
|
||||
const id = 'id';
|
||||
|
||||
const [isHovered, hover] = useState(false);
|
||||
|
||||
const openTooltip = () => hover(true);
|
||||
const closeTooltip = () => hover(false);
|
||||
|
||||
return <div onMouseEnter={openTooltip}
|
||||
onMouseLeave={closeTooltip}>
|
||||
<div data-tip={dataTip}
|
||||
data-for={dataTip ? id : undefined}
|
||||
data-event={trigger}
|
||||
content,
|
||||
renderContent = React.Children.map(
|
||||
content,
|
||||
(item, idx) => <div key={idx} className={contentItemClass}>
|
||||
<Trans>{item || '—'}</Trans>
|
||||
</div>,
|
||||
),
|
||||
}) => <TooltipTrigger placement={placement} trigger="hover" delayHide={HIDE_TOOLTIP_DELAY} tooltip={
|
||||
({
|
||||
tooltipRef,
|
||||
getTooltipProps,
|
||||
}) => <div {...getTooltipProps({
|
||||
ref: tooltipRef,
|
||||
className: classNames('tooltip__container', tooltipClass, { 'd-none': !canShowTooltip }),
|
||||
})}
|
||||
>
|
||||
{title && <div className="pb-4 h-25 grid-content font-weight-bold">
|
||||
<Trans>{title}</Trans>
|
||||
</div>}
|
||||
<div className={classNames(columnClass)}>{renderContent}</div>
|
||||
</div>
|
||||
}>{({
|
||||
getTriggerProps, triggerRef,
|
||||
}) => <span {...getTriggerProps({ ref: triggerRef })}>
|
||||
{xlinkHref && <svg className={className}>
|
||||
<use xlinkHref={`#${xlinkHref}`} />
|
||||
</svg>}
|
||||
</div>
|
||||
{isHovered && dataTip
|
||||
&& <CustomTooltip
|
||||
className={tooltipClass}
|
||||
id={id}
|
||||
columnClass={columnClass}
|
||||
contentItemClass={contentItemClass}
|
||||
title={title}
|
||||
place={place}
|
||||
content={content}
|
||||
trigger={trigger}
|
||||
overridePosition={overridePosition}
|
||||
scrollHide={scrollHide}
|
||||
renderContent={renderContent}
|
||||
/>}
|
||||
</div>;
|
||||
};
|
||||
</span>}
|
||||
</TooltipTrigger>;
|
||||
|
||||
getHintElement.propTypes = {
|
||||
className: PropTypes.string,
|
||||
@@ -57,15 +52,9 @@ getHintElement.propTypes = {
|
||||
columnClass: PropTypes.string,
|
||||
tooltipClass: PropTypes.string,
|
||||
title: PropTypes.string,
|
||||
place: PropTypes.string,
|
||||
dataTip: PropTypes.string,
|
||||
placement: PropTypes.string,
|
||||
canShowTooltip: PropTypes.string,
|
||||
xlinkHref: PropTypes.string,
|
||||
overridePosition: PropTypes.func,
|
||||
scrollHide: PropTypes.bool,
|
||||
trigger: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
PropTypes.arrayOf(PropTypes.string),
|
||||
]),
|
||||
content: PropTypes.oneOfType([
|
||||
PropTypes.string,
|
||||
PropTypes.array,
|
||||
|
||||
@@ -48,7 +48,7 @@ const getResponseCell = (row, filtering, t, isDetailed) => {
|
||||
|
||||
return <div>{responseArr.map((response) => {
|
||||
const className = classNames('white-space--nowrap', {
|
||||
'white-space--normal': response.length > 100,
|
||||
'overflow-break': response.length > 100,
|
||||
});
|
||||
|
||||
return <div key={response} className={className}>{`${response}\n`}</div>;
|
||||
@@ -71,6 +71,13 @@ const getResponseCell = (row, filtering, t, isDetailed) => {
|
||||
rule_label: rule,
|
||||
response_code: status,
|
||||
},
|
||||
[FILTERED_STATUS.NOT_FILTERED_WHITE_LIST]: {
|
||||
domain,
|
||||
encryption_status: boldStatusLabel,
|
||||
filter,
|
||||
rule_label: rule,
|
||||
response_code: status,
|
||||
},
|
||||
[FILTERED_STATUS.FILTERED_SAFE_SEARCH]: {
|
||||
domain,
|
||||
encryption_status: boldStatusLabel,
|
||||
@@ -102,11 +109,10 @@ const getResponseCell = (row, filtering, t, isDetailed) => {
|
||||
columnClass: 'grid grid--limited',
|
||||
tooltipClass: 'px-5 pb-5 pt-4 mw-75 custom-tooltip__response-details',
|
||||
contentItemClass: 'text-truncate key-colon o-hidden',
|
||||
dataTip: true,
|
||||
xlinkHref: 'question',
|
||||
title: 'response_details',
|
||||
content: fields,
|
||||
place: 'bottom',
|
||||
placement: 'bottom',
|
||||
})}
|
||||
<div className="text-truncate">
|
||||
<div className="text-truncate" title={statusLabel}>{statusLabel}</div>
|
||||
|
||||
Reference in New Issue
Block a user