mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 20:57:17 +01:00
Merge branch 'dev' into jajaja
# Conflicts: # package.json # yarn.lock
This commit is contained in:
commit
c71e9b5707
11 changed files with 126 additions and 30 deletions
|
|
@ -7,7 +7,7 @@ const formats = {
|
|||
millisecond: 'T',
|
||||
second: 'pp',
|
||||
minute: 'p',
|
||||
hour: 'h:mm aaa - PP',
|
||||
hour: 'p - PP',
|
||||
day: 'PPPP',
|
||||
week: 'PPPP',
|
||||
month: 'LLLL yyyy',
|
||||
|
|
|
|||
|
|
@ -60,19 +60,24 @@ export function ReferrersTable({ allowFilter, ...props }: ReferrersTableProps) {
|
|||
);
|
||||
};
|
||||
|
||||
const getDomain = (x: string) => {
|
||||
for (const { domain, match } of GROUPED_DOMAINS) {
|
||||
if (Array.isArray(match) ? match.some(str => x.includes(str)) : x.includes(match)) {
|
||||
return domain;
|
||||
}
|
||||
}
|
||||
return '_other';
|
||||
};
|
||||
|
||||
const groupedFilter = (data: any[]) => {
|
||||
const groups = { _other: 0 };
|
||||
|
||||
for (const { x, y } of data) {
|
||||
for (const { domain, match } of GROUPED_DOMAINS) {
|
||||
if (Array.isArray(match) ? match.some(str => x.includes(str)) : x.includes(match)) {
|
||||
if (!groups[domain]) {
|
||||
groups[domain] = 0;
|
||||
}
|
||||
groups[domain] += +y;
|
||||
}
|
||||
const domain = getDomain(x);
|
||||
if (!groups[domain]) {
|
||||
groups[domain] = 0;
|
||||
}
|
||||
groups._other += +y;
|
||||
groups[domain] += +y;
|
||||
}
|
||||
|
||||
return Object.keys(groups)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue