Merge pull request #139 from mikecao/dev

v0.27.0
This commit is contained in:
Mike Cao 2020-09-10 21:42:48 -07:00 committed by GitHub
commit ebc9f1d6d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 13 deletions

View File

@ -64,8 +64,14 @@ export default function BarChart({
} else { } else {
const [label, value] = body[0].lines[0].split(':'); const [label, value] = body[0].lines[0].split(':');
console.log(
+title[0],
new Date(+title[0]),
dateFormat(new Date(+title[0]), 'EEE MMMM d yyyy', locale),
);
setTooltip({ setTooltip({
title: title[0], title: dateFormat(new Date(+title[0]), 'EEE MMMM d yyyy', locale),
value, value,
label, label,
labelColor: labelColors[0].backgroundColor, labelColor: labelColors[0].backgroundColor,
@ -95,7 +101,7 @@ export default function BarChart({
distribution: 'series', distribution: 'series',
time: { time: {
unit, unit,
tooltipFormat: 'ddd MMMM DD YYYY', tooltipFormat: 'x',
}, },
ticks: { ticks: {
callback: renderXLabel, callback: renderXLabel,
@ -138,6 +144,7 @@ export default function BarChart({
options.scales.xAxes[0].time.unit = unit; options.scales.xAxes[0].time.unit = unit;
options.scales.xAxes[0].ticks.callback = renderXLabel; options.scales.xAxes[0].ticks.callback = renderXLabel;
options.animation.duration = animationDuration; options.animation.duration = animationDuration;
options.tooltips.custom = renderTooltip;
onUpdate(chart.current); onUpdate(chart.current);
} }

View File

@ -2,7 +2,8 @@
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
min-width: 140px; min-width: 120px;
margin-right: 20px;
} }
.value { .value {
@ -15,5 +16,4 @@
.label { .label {
font-size: var(--font-size-normal); font-size: var(--font-size-normal);
padding-right: 20px;
} }

View File

@ -87,7 +87,7 @@ export default function MetricsTable({
</div> </div>
</div> </div>
<div className={styles.body}> <div className={styles.body}>
{data?.length === 0 && ( {rankings?.length === 0 && (
<div className={styles.empty}> <div className={styles.empty}>
<FormattedMessage <FormattedMessage
id="message.no-data-available" id="message.no-data-available"
@ -97,14 +97,14 @@ export default function MetricsTable({
)} )}
{limit {limit
? rankings.map(row => getRow(row)) ? rankings.map(row => getRow(row))
: data?.length > 0 && ( : rankings.length > 0 && (
<FixedSizeList height={500} itemCount={rankings.length} itemSize={30}> <FixedSizeList height={500} itemCount={rankings.length} itemSize={30}>
{Row} {Row}
</FixedSizeList> </FixedSizeList>
)} )}
</div> </div>
<div className={styles.footer}> <div className={styles.footer}>
{limit && data.length > limit && ( {limit && rankings.length > limit && (
<Button icon={<Arrow />} size="xsmall" onClick={() => onExpand(type)}> <Button icon={<Arrow />} size="xsmall" onClick={() => onExpand(type)}>
<div> <div>
<FormattedMessage id="button.more" defaultMessage="More" /> <FormattedMessage id="button.more" defaultMessage="More" />

View File

@ -1,6 +1,6 @@
{ {
"name": "umami", "name": "umami",
"version": "0.26.0", "version": "0.27.0",
"description": "A simple, fast, website analytics alternative to Google Analytics. ", "description": "A simple, fast, website analytics alternative to Google Analytics. ",
"author": "Mike Cao <mike@mikecao.com>", "author": "Mike Cao <mike@mikecao.com>",
"license": "MIT", "license": "MIT",
@ -59,6 +59,7 @@
"geolite2-redist": "^1.0.7", "geolite2-redist": "^1.0.7",
"immer": "^7.0.8", "immer": "^7.0.8",
"is-localhost-ip": "^1.4.0", "is-localhost-ip": "^1.4.0",
"isbot-fast": "^1.2.0",
"jose": "^1.28.0", "jose": "^1.28.0",
"maxmind": "^4.1.4", "maxmind": "^4.1.4",
"moment-timezone": "^0.5.31", "moment-timezone": "^0.5.31",

View File

@ -1,8 +1,13 @@
import { savePageView, saveEvent } from 'lib/queries'; import { savePageView, saveEvent } from 'lib/queries';
import { useCors, useSession } from 'lib/middleware'; import { useCors, useSession } from 'lib/middleware';
import { ok, badRequest } from 'lib/response'; import { ok, badRequest } from 'lib/response';
import isBot from 'isbot-fast';
export default async (req, res) => { export default async (req, res) => {
if (isBot(req.headers['user-agent'])) {
return ok(res);
}
await useCors(req, res); await useCors(req, res);
await useSession(req, res); await useSession(req, res);

View File

@ -58,14 +58,14 @@ import { removeTrailingSlash } from '../lib/url';
/* Handle history */ /* Handle history */
const handlePush = (state, title, navigatedURL) => { const handlePush = (state, title, url) => {
removeEvents(); removeEvents();
currentRef = currentUrl; currentRef = currentUrl;
const newUrl = navigatedURL.toString(); const newUrl = url.toString();
if (newUrl.startsWith('http')) { if (newUrl.substring(0, 4) === 'http') {
const url = new URL(newUrl); const { pathname, search } = new URL(newUrl);
currentUrl = `${url.pathname}${url.search}`; currentUrl = `${pathname}${search}`;
} else { } else {
currentUrl = newUrl; currentUrl = newUrl;
} }

View File

@ -4965,6 +4965,11 @@ isarray@1.0.0, isarray@^1.0.0, isarray@~1.0.0:
resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11"
integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE= integrity sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=
isbot-fast@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/isbot-fast/-/isbot-fast-1.2.0.tgz#ef0ef1d5db34eb60777250ae26fceb72b94153e2"
integrity sha512-twjuQzy2gKMDVfKGQyQqrx6Uy4opu/fiVUTTpdqtFsd7OQijIp5oXvb27n5EemYXaijh5fomndJt/SPRLsEdSg==
isexe@^2.0.0: isexe@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"