mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 14:47:14 +01:00
render links in event, session activity, realtime activity using hostname instead of domain.
Closes #2861
This commit is contained in:
parent
c88425332b
commit
7a89bbf19f
5 changed files with 45 additions and 8 deletions
|
|
@ -25,6 +25,19 @@ export function EventsTable(props: DataTableProps) {
|
||||||
const { updateParams } = useNavigation();
|
const { updateParams } = useNavigation();
|
||||||
const { formatValue } = useFormat();
|
const { formatValue } = useFormat();
|
||||||
|
|
||||||
|
const renderLink = (label: string, hostname: string) => {
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
href={`//${hostname}${label}`}
|
||||||
|
style={{ fontWeight: 'bold' }}
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer noopener"
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DataTable {...props}>
|
<DataTable {...props}>
|
||||||
<DataColumn id="event" label={formatMessage(labels.event)} width="2fr">
|
<DataColumn id="event" label={formatMessage(labels.event)} width="2fr">
|
||||||
|
|
@ -43,7 +56,7 @@ export function EventsTable(props: DataTableProps) {
|
||||||
title={row.eventName || row.urlPath}
|
title={row.eventName || row.urlPath}
|
||||||
truncate
|
truncate
|
||||||
>
|
>
|
||||||
{row.eventName || row.urlPath}
|
{row.eventName || renderLink(row.urlPath, row.hostname)}
|
||||||
</Text>
|
</Text>
|
||||||
{row.hasData > 0 && <PropertiesButton websiteId={row.websiteId} eventId={row.id} />}
|
{row.hasData > 0 && <PropertiesButton websiteId={row.websiteId} eventId={row.id} />}
|
||||||
</Row>
|
</Row>
|
||||||
|
|
|
||||||
|
|
@ -74,8 +74,9 @@ export function RealtimeLog({ data }: { data: any }) {
|
||||||
os: string;
|
os: string;
|
||||||
country: string;
|
country: string;
|
||||||
device: string;
|
device: string;
|
||||||
|
hostname: string;
|
||||||
}) => {
|
}) => {
|
||||||
const { __type, eventName, urlPath, browser, os, country, device } = log;
|
const { __type, eventName, urlPath, browser, os, country, device, hostname } = log;
|
||||||
|
|
||||||
if (__type === TYPE_EVENT) {
|
if (__type === TYPE_EVENT) {
|
||||||
return (
|
return (
|
||||||
|
|
@ -86,7 +87,8 @@ export function RealtimeLog({ data }: { data: any }) {
|
||||||
url: (
|
url: (
|
||||||
<a
|
<a
|
||||||
key="a"
|
key="a"
|
||||||
href={`//${website?.domain}${urlPath}`}
|
href={`//${hostname}${urlPath}`}
|
||||||
|
style={{ fontWeight: 'bold' }}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer noopener"
|
rel="noreferrer noopener"
|
||||||
>
|
>
|
||||||
|
|
@ -100,7 +102,12 @@ export function RealtimeLog({ data }: { data: any }) {
|
||||||
|
|
||||||
if (__type === TYPE_PAGEVIEW) {
|
if (__type === TYPE_PAGEVIEW) {
|
||||||
return (
|
return (
|
||||||
<a href={`//${website?.domain}${urlPath}`} target="_blank" rel="noreferrer noopener">
|
<a
|
||||||
|
href={`//${hostname}${urlPath}`}
|
||||||
|
style={{ fontWeight: 'bold' }}
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer noopener"
|
||||||
|
>
|
||||||
{urlPath}
|
{urlPath}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,23 @@ export function SessionActivity({
|
||||||
const { isMobile } = useMobile();
|
const { isMobile } = useMobile();
|
||||||
let lastDay = null;
|
let lastDay = null;
|
||||||
|
|
||||||
|
const renderLink = (label: string, hostname: string) => {
|
||||||
|
return (
|
||||||
|
<a
|
||||||
|
href={`//${hostname}${label}`}
|
||||||
|
style={{ fontWeight: 'bold' }}
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer noopener"
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</a>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LoadingPanel data={data} isLoading={isLoading} error={error}>
|
<LoadingPanel data={data} isLoading={isLoading} error={error}>
|
||||||
<Column gap>
|
<Column gap>
|
||||||
{data?.map(({ eventId, createdAt, urlPath, eventName, visitId, hasData }) => {
|
{data?.map(({ eventId, createdAt, urlPath, eventName, visitId, hostname, hasData }) => {
|
||||||
const showHeader = !lastDay || !isSameDay(new Date(lastDay), new Date(createdAt));
|
const showHeader = !lastDay || !isSameDay(new Date(lastDay), new Date(createdAt));
|
||||||
lastDay = createdAt;
|
lastDay = createdAt;
|
||||||
|
|
||||||
|
|
@ -61,7 +74,7 @@ export function SessionActivity({
|
||||||
: formatMessage(labels.viewedPage)}
|
: formatMessage(labels.viewedPage)}
|
||||||
</Text>
|
</Text>
|
||||||
<Text weight="bold" style={{ maxWidth: isMobile ? '400px' : null }} truncate>
|
<Text weight="bold" style={{ maxWidth: isMobile ? '400px' : null }} truncate>
|
||||||
{eventName || urlPath}
|
{eventName || renderLink(urlPath, hostname)}
|
||||||
</Text>
|
</Text>
|
||||||
{hasData > 0 && <PropertiesButton websiteId={websiteId} eventId={eventId} />}
|
{hasData > 0 && <PropertiesButton websiteId={websiteId} eventId={eventId} />}
|
||||||
</Row>
|
</Row>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||||
session.device,
|
session.device,
|
||||||
session.country,
|
session.country,
|
||||||
website_event.url_path as "urlPath",
|
website_event.url_path as "urlPath",
|
||||||
website_event.referrer_domain as "referrerDomain"
|
website_event.referrer_domain as "referrerDomain",
|
||||||
|
website_event.hostname
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
inner join session
|
inner join session
|
||||||
|
|
@ -65,7 +66,8 @@ async function clickhouseQuery(websiteId: string, filters: QueryFilters): Promis
|
||||||
device,
|
device,
|
||||||
country,
|
country,
|
||||||
url_path as urlPath,
|
url_path as urlPath,
|
||||||
referrer_domain as referrerDomain
|
referrer_domain as referrerDomain,
|
||||||
|
hostname
|
||||||
from website_event
|
from website_event
|
||||||
${cohortQuery}
|
${cohortQuery}
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ async function relationalQuery(websiteId: string, sessionId: string, filters: Qu
|
||||||
event_type as "eventType",
|
event_type as "eventType",
|
||||||
event_name as "eventName",
|
event_name as "eventName",
|
||||||
visit_id as "visitId",
|
visit_id as "visitId",
|
||||||
|
hostname,
|
||||||
event_id IN (select website_event_id
|
event_id IN (select website_event_id
|
||||||
from event_data
|
from event_data
|
||||||
where website_id = {{websiteId::uuid}}
|
where website_id = {{websiteId::uuid}}
|
||||||
|
|
@ -60,6 +61,7 @@ async function clickhouseQuery(websiteId: string, sessionId: string, filters: Qu
|
||||||
event_type as eventType,
|
event_type as eventType,
|
||||||
event_name as eventName,
|
event_name as eventName,
|
||||||
visit_id as visitId,
|
visit_id as visitId,
|
||||||
|
hostname,
|
||||||
event_id IN (select event_id
|
event_id IN (select event_id
|
||||||
from event_data
|
from event_data
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue