Merge pull request #57 in DNS/adguard-dns from feature/354 to master

* commit '0545aeff3fb8368238e8c61d43589ef8b4a6d8e8':
  Fix variable
  Add hash to the static JS/CSS
  Fix tooltip width
  Fix default filtering for query log
  Fix textarea width
This commit is contained in:
Eugene Bujak 2018-10-09 21:15:26 +03:00
commit 93c451cb0c
8 changed files with 35 additions and 22 deletions

View File

@ -4,6 +4,8 @@ import PropTypes from 'prop-types';
import Card from '../ui/Card';
import Tooltip from '../ui/Tooltip';
const tooltipType = 'tooltip-custom--narrow';
const Counters = props => (
<Card title="General statistics" subtitle="in the last 24 hours" bodyType="card-table" refresh={props.refreshButton}>
<table className="table card-table">
@ -11,7 +13,7 @@ const Counters = props => (
<tr>
<td>
DNS Queries
<Tooltip text="A number of DNS quieries processed in the last 24 hours" />
<Tooltip text="A number of DNS quieries processed in the last 24 hours" type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">
@ -22,7 +24,7 @@ const Counters = props => (
<tr>
<td>
Blocked by filters
<Tooltip text="A number of DNS requests blocked by filters" />
<Tooltip text="A number of DNS requests blocked by filters" type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">
@ -33,7 +35,7 @@ const Counters = props => (
<tr>
<td>
Blocked malware/phishing
<Tooltip text="A number of DNS requests blocked" />
<Tooltip text="A number of DNS requests blocked" type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">
@ -44,7 +46,7 @@ const Counters = props => (
<tr>
<td>
Blocked adult websites
<Tooltip text="A number of adult websites blocked" />
<Tooltip text="A number of adult websites blocked" type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">
@ -55,7 +57,7 @@ const Counters = props => (
<tr>
<td>
Enforced safe search
<Tooltip text="A number of DNS requests to search engines for which Safe Search was enforced" />
<Tooltip text="A number of DNS requests to search engines for which Safe Search was enforced" type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">
@ -66,7 +68,7 @@ const Counters = props => (
<tr>
<td>
Average processing time
<Tooltip text="Average time in milliseconds on processing a DNS request" />
<Tooltip text="Average time in milliseconds on processing a DNS request" type={tooltipType} />
</td>
<td className="text-right">
<span className="text-muted">

View File

@ -20,7 +20,7 @@ export default class UserRules extends Component {
subtitle="Enter one rule on a line. You can use either adblock rules or hosts files syntax."
>
<form onSubmit={this.handleSubmit}>
<textarea className="form-control form-control--textarea" value={this.props.userRules} onChange={this.handleChange} />
<textarea className="form-control form-control--textarea-large" value={this.props.userRules} onChange={this.handleChange} />
<div className="card-actions">
<button
className="btn btn-success btn-standart"

View File

@ -42,14 +42,10 @@ class Logs extends Component {
toggleBlocking = (type, domain) => {
const { userRules } = this.props.filtering;
const lineEnding = !endsWith(userRules, '\n') ? '\n' : '';
let blockingRule = `@@||${domain}^$important`;
let unblockingRule = `||${domain}^$important`;
if (type === 'unblock') {
blockingRule = `||${domain}^$important`;
unblockingRule = `@@||${domain}^$important`;
}
const baseRule = `||${domain}^$important`;
const baseUnblocking = `@@${baseRule}`;
const blockingRule = type === 'block' ? baseUnblocking : baseRule;
const unblockingRule = type === 'block' ? baseRule : baseUnblocking;
const preparedBlockingRule = new RegExp(`(^|\n)${escapeRegExp(blockingRule)}($|\n)`);
const preparedUnblockingRule = new RegExp(`(^|\n)${escapeRegExp(unblockingRule)}($|\n)`);
@ -189,6 +185,11 @@ class Logs extends Component {
defaultPageSize={50}
minRows={7}
noDataText="No logs found"
defaultFilterMethod={(filter, row) => {
const id = filter.pivotId || filter.id;
return row[id] !== undefined ?
String(row[id]).indexOf(filter.value) !== -1 : true;
}}
defaultSorted={[
{
id: 'time',

View File

@ -14,3 +14,7 @@
.form-control--textarea {
min-height: 110px;
}
.form-control--textarea-large {
min-height: 240px;
}

View File

@ -40,11 +40,11 @@
background-size: 14px;
background-position: center;
background-repeat: no-repeat;
background-image: url('data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiM0NjdmY2YiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg==');
background-image: url("data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiM0NjdmY2YiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg==");
}
.card-refresh:hover,
.card-refresh:not(:disabled):not(.disabled):active,
.card-refresh:focus:active {
background-image: url('data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiNmZmYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg==');
background-image: url("data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjI0IiBzdHJva2U9IiNmZmYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIyIiB2aWV3Qm94PSIwIDAgMjQgMjQiIHdpZHRoPSIyNCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJtMjMgNHY2aC02Ii8+PHBhdGggZD0ibTEgMjB2LTZoNiIvPjxwYXRoIGQ9Im0zLjUxIDlhOSA5IDAgMCAxIDE0Ljg1LTMuMzZsNC42NCA0LjM2bS0yMiA0IDQuNjQgNC4zNmE5IDkgMCAwIDAgMTQuODUtMy4zNiIvPjwvc3ZnPg==");
}

View File

@ -17,14 +17,14 @@
display: block;
position: absolute;
bottom: calc(100% + 12px);
left: calc(50% - 103px);
width: 206px;
left: 50%;
padding: 10px 15px;
font-size: 0.85rem;
text-align: center;
color: #fff;
background-color: #585965;
border-radius: 3px;
transform: translateX(-50%);
visibility: hidden;
opacity: 0;
}
@ -48,3 +48,7 @@
visibility: visible;
opacity: 1;
}
.tooltip-custom--narrow:before {
width: 206px;
}

View File

@ -4,11 +4,12 @@ import PropTypes from 'prop-types';
import './Tooltip.css';
const Tooltip = props => (
<div data-tooltip={props.text} className="tooltip-custom"></div>
<div data-tooltip={props.text} className={`tooltip-custom ${props.type}`}></div>
);
Tooltip.propTypes = {
text: PropTypes.string.isRequired,
type: PropTypes.string,
};
export default Tooltip;

View File

@ -19,7 +19,7 @@ const config = {
},
output: {
path: PUBLIC_PATH,
filename: '[name].js',
filename: '[name].[chunkhash].js',
},
resolve: {
modules: ['node_modules'],
@ -94,10 +94,11 @@ const config = {
}),
new HtmlWebpackPlugin({
inject: true,
cache: false,
template: HTML_PATH,
}),
new ExtractTextPlugin({
filename: '[name].css',
filename: '[name].[contenthash].css',
}),
],
};