mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-18 15:23:38 +01:00
commit
21bd0809c0
@ -99,7 +99,7 @@ export default function MetricsTable({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.footer}>
|
<div className={styles.footer}>
|
||||||
{limit && data.length > limit && (
|
{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" />
|
||||||
|
20
lib/date.js
20
lib/date.js
@ -100,6 +100,19 @@ export function getDateRangeValues(startDate, endDate) {
|
|||||||
return { startDate: startOfDay(startDate), endDate: endOfDay(endDate), unit };
|
return { startDate: startOfDay(startDate), endDate: endOfDay(endDate), unit };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getDateFromString(str) {
|
||||||
|
const [ymd, hms] = str.split(' ');
|
||||||
|
const [year, month, day] = ymd.split('-');
|
||||||
|
|
||||||
|
if (hms) {
|
||||||
|
const [hour, min, sec] = hms.split(':');
|
||||||
|
|
||||||
|
return new Date(year, month - 1, day, hour, min, sec);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Date(year, month - 1, day);
|
||||||
|
}
|
||||||
|
|
||||||
const dateFuncs = {
|
const dateFuncs = {
|
||||||
hour: [differenceInHours, addHours, startOfHour],
|
hour: [differenceInHours, addHours, startOfHour],
|
||||||
day: [differenceInCalendarDays, addDays, startOfDay],
|
day: [differenceInCalendarDays, addDays, startOfDay],
|
||||||
@ -114,12 +127,7 @@ export function getDateArray(data, startDate, endDate, unit) {
|
|||||||
|
|
||||||
function findData(t) {
|
function findData(t) {
|
||||||
const x = data.find(e => {
|
const x = data.find(e => {
|
||||||
if (unit === 'hour') {
|
return normalize(getDateFromString(e.t)).getTime() === t.getTime();
|
||||||
return normalize(new Date(e.t)).getTime() === t.getTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
const [year, month, day] = e.t.split('-');
|
|
||||||
return normalize(new Date(year, month - 1, day)).getTime() === t.getTime();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return x?.y || 0;
|
return x?.y || 0;
|
||||||
|
@ -13,17 +13,13 @@ export const urlFilter = (data, { raw }) => {
|
|||||||
|
|
||||||
const cleanUrl = url => {
|
const cleanUrl = url => {
|
||||||
try {
|
try {
|
||||||
const { pathname, search, searchParams } = new URL(url);
|
const { pathname, search } = new URL(url);
|
||||||
|
|
||||||
if (search.startsWith('?/')) {
|
if (search.startsWith('?/')) {
|
||||||
return `${pathname}${search}`;
|
return `${pathname}${search}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const path = removeTrailingSlash(pathname);
|
return removeTrailingSlash(pathname);
|
||||||
const ref = searchParams.get('ref');
|
|
||||||
const query = ref ? `?ref=${ref}` : '';
|
|
||||||
|
|
||||||
return `${path}${query}`;
|
|
||||||
} catch {
|
} catch {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ export const apiRequest = (method, url, body) =>
|
|||||||
fetch(url, {
|
fetch(url, {
|
||||||
method,
|
method,
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
|
credentials: 'same-origin',
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/json',
|
Accept: 'application/json',
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "umami",
|
"name": "umami",
|
||||||
"version": "0.49.0",
|
"version": "0.50.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",
|
||||||
|
Loading…
Reference in New Issue
Block a user