mirror of
https://github.com/kremalicious/umami.git
synced 2025-02-06 01:15:42 +01:00
Responsive styles for session page.
This commit is contained in:
parent
b3e6e52473
commit
10f65cae68
@ -2,7 +2,6 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
width: 200px;
|
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,11 +21,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.type {
|
.type {
|
||||||
font-size: 10px;
|
font-size: 11px;
|
||||||
text-transform: uppercase;
|
|
||||||
padding: 0 6px;
|
padding: 0 6px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
border: 1px solid var(--base300);
|
border: 1px solid var(--base400);
|
||||||
}
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { Loading, TextOverflow } from 'react-basics';
|
import { Loading, TextOverflow } from 'react-basics';
|
||||||
import { useMessages, useSessionData } from 'components/hooks';
|
import { useMessages, useSessionData } from 'components/hooks';
|
||||||
import Empty from 'components/common/Empty';
|
import Empty from 'components/common/Empty';
|
||||||
import styles from './SessionData.module.css';
|
|
||||||
import { DATA_TYPES } from 'lib/constants';
|
import { DATA_TYPES } from 'lib/constants';
|
||||||
|
import styles from './SessionData.module.css';
|
||||||
|
|
||||||
export function SessionData({ websiteId, sessionId }: { websiteId: string; sessionId: string }) {
|
export function SessionData({ websiteId, sessionId }: { websiteId: string; sessionId: string }) {
|
||||||
const { formatMessage, labels } = useMessages();
|
const { formatMessage, labels } = useMessages();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
.page {
|
.page {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 300px 1fr max-content;
|
grid-template-columns: max-content 1fr max-content;
|
||||||
margin-bottom: 40px;
|
margin-bottom: 40px;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
@ -11,6 +11,7 @@
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: flex-start;
|
justify-content: flex-start;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
|
width: 300px;
|
||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
border-right: 1px solid var(--base300);
|
border-right: 1px solid var(--base300);
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -25,6 +26,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.data {
|
.data {
|
||||||
|
width: 300px;
|
||||||
border-left: 1px solid var(--base300);
|
border-left: 1px solid var(--base300);
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
position: relative;
|
position: relative;
|
||||||
@ -40,5 +42,6 @@
|
|||||||
.sidebar,
|
.sidebar,
|
||||||
.data {
|
.data {
|
||||||
border: 0;
|
border: 0;
|
||||||
|
width: auto;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,10 @@
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.info dl {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.info dt {
|
.info dt {
|
||||||
color: var(--font-color200);
|
color: var(--font-color200);
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
@ -33,7 +33,7 @@ export default async (
|
|||||||
return unauthorized(res);
|
return unauthorized(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
const data = await getWebsiteSession(websiteId, sessionId);
|
const data = await getWebsiteSession(sessionId);
|
||||||
|
|
||||||
return ok(res, data);
|
return ok(res, data);
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ async function clickhouseQuery(websiteId: string, sessionId: string) {
|
|||||||
from session_data
|
from session_data
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and session_id = {sessionId:UUID}
|
and session_id = {sessionId:UUID}
|
||||||
|
order by data_key asc
|
||||||
`,
|
`,
|
||||||
{ websiteId, sessionId },
|
{ websiteId, sessionId },
|
||||||
);
|
);
|
||||||
|
@ -2,23 +2,22 @@ import prisma from 'lib/prisma';
|
|||||||
import clickhouse from 'lib/clickhouse';
|
import clickhouse from 'lib/clickhouse';
|
||||||
import { runQuery, PRISMA, CLICKHOUSE } from 'lib/db';
|
import { runQuery, PRISMA, CLICKHOUSE } from 'lib/db';
|
||||||
|
|
||||||
export async function getWebsiteSession(...args: [websiteId: string, sessionId: string]) {
|
export async function getWebsiteSession(...args: [sessionId: string]) {
|
||||||
return runQuery({
|
return runQuery({
|
||||||
[PRISMA]: () => relationalQuery(...args),
|
[PRISMA]: () => relationalQuery(...args),
|
||||||
[CLICKHOUSE]: () => clickhouseQuery(...args),
|
[CLICKHOUSE]: () => clickhouseQuery(...args),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function relationalQuery(websiteId: string, sessionId: string) {
|
async function relationalQuery(sessionId: string) {
|
||||||
return prisma.client.session.findUnique({
|
return prisma.client.session.findUnique({
|
||||||
where: {
|
where: {
|
||||||
id: sessionId,
|
id: sessionId,
|
||||||
websiteId,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function clickhouseQuery(websiteId: string, sessionId: string) {
|
async function clickhouseQuery(sessionId: string) {
|
||||||
const { rawQuery } = clickhouse;
|
const { rawQuery } = clickhouse;
|
||||||
|
|
||||||
return rawQuery(
|
return rawQuery(
|
||||||
@ -41,10 +40,9 @@ async function clickhouseQuery(websiteId: string, sessionId: string) {
|
|||||||
sumIf(1, event_type = 1) as views,
|
sumIf(1, event_type = 1) as views,
|
||||||
sumIf(1, event_type = 2) as events
|
sumIf(1, event_type = 2) as events
|
||||||
from website_event
|
from website_event
|
||||||
where website_id = {websiteId:UUID}
|
where session_id = {sessionId:UUID}
|
||||||
and session_id = {sessionId:UUID}
|
|
||||||
group by session_id, website_id, hostname, browser, os, device, screen, language, country, subdivision1, city
|
group by session_id, website_id, hostname, browser, os, device, screen, language, country, subdivision1, city
|
||||||
`,
|
`,
|
||||||
{ websiteId, sessionId },
|
{ sessionId },
|
||||||
).then(result => result?.[0]);
|
).then(result => result?.[0]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user