mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Fixed realtime activity sort. Closes #3330
This commit is contained in:
parent
afad255e5b
commit
48b6dfe72f
7 changed files with 10 additions and 15 deletions
|
|
@ -1,6 +0,0 @@
|
||||||
'use client';
|
|
||||||
import TestConsole from './TestConsole';
|
|
||||||
|
|
||||||
export default function ConsolePage({ websiteId }) {
|
|
||||||
return <TestConsole websiteId={websiteId} />;
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
'use client';
|
||||||
import { Button } from 'react-basics';
|
import { Button } from 'react-basics';
|
||||||
import Link from 'next/link';
|
import Link from 'next/link';
|
||||||
import Script from 'next/script';
|
import Script from 'next/script';
|
||||||
|
|
@ -9,7 +10,7 @@ import WebsiteChart from '../websites/[websiteId]/WebsiteChart';
|
||||||
import { useApi, useNavigation } from '@/components/hooks';
|
import { useApi, useNavigation } from '@/components/hooks';
|
||||||
import styles from './TestConsole.module.css';
|
import styles from './TestConsole.module.css';
|
||||||
|
|
||||||
export function TestConsole({ websiteId }: { websiteId: string }) {
|
export function TestConsole({ websiteId }: { websiteId?: string }) {
|
||||||
const { get, useQuery } = useApi();
|
const { get, useQuery } = useApi();
|
||||||
const { data, isLoading, error } = useQuery({
|
const { data, isLoading, error } = useQuery({
|
||||||
queryKey: ['websites:me'],
|
queryKey: ['websites:me'],
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
import { Metadata } from 'next';
|
import { Metadata } from 'next';
|
||||||
import ConsolePage from '../ConsolePage';
|
import TestConsole from '../TestConsole';
|
||||||
|
|
||||||
async function getEnabled() {
|
async function getEnabled() {
|
||||||
return !!process.env.ENABLE_TEST_CONSOLE;
|
return !!process.env.ENABLE_TEST_CONSOLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function ({ params }: { params: { websiteId: string } }) {
|
export default async function ({ params }: { params: Promise<{ websiteId: string }> }) {
|
||||||
const { websiteId } = await params;
|
const { websiteId } = await params;
|
||||||
|
|
||||||
const enabled = await getEnabled();
|
const enabled = await getEnabled();
|
||||||
|
|
@ -14,7 +14,7 @@ export default async function ({ params }: { params: { websiteId: string } }) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <ConsolePage websiteId={websiteId?.[0]} />;
|
return <TestConsole websiteId={websiteId?.[0]} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import RealtimeCountries from './RealtimeCountries';
|
||||||
import WebsiteHeader from '../WebsiteHeader';
|
import WebsiteHeader from '../WebsiteHeader';
|
||||||
import { percentFilter } from '@/lib/filters';
|
import { percentFilter } from '@/lib/filters';
|
||||||
|
|
||||||
export function WebsiteRealtimePage({ websiteId }) {
|
export function WebsiteRealtimePage({ websiteId }: { websiteId: string }) {
|
||||||
const { data, isLoading, error } = useRealtime(websiteId);
|
const { data, isLoading, error } = useRealtime(websiteId);
|
||||||
|
|
||||||
if (isLoading || error) {
|
if (isLoading || error) {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import WebsiteRealtimePage from './WebsiteRealtimePage';
|
import WebsiteRealtimePage from './WebsiteRealtimePage';
|
||||||
import { Metadata } from 'next';
|
import { Metadata } from 'next';
|
||||||
|
|
||||||
export default async function ({ params }: { params: { websiteId: string } }) {
|
export default async function ({ params }: { params: Promise<{ websiteId: string }> }) {
|
||||||
const { websiteId } = await params;
|
const { websiteId } = await params;
|
||||||
|
|
||||||
return <WebsiteRealtimePage websiteId={websiteId} />;
|
return <WebsiteRealtimePage websiteId={websiteId} />;
|
||||||
|
|
|
||||||
|
|
@ -8,13 +8,13 @@ export function useLogin(): {
|
||||||
user: any;
|
user: any;
|
||||||
setUser: (data: any) => void;
|
setUser: (data: any) => void;
|
||||||
} & UseQueryResult {
|
} & UseQueryResult {
|
||||||
const { get, useQuery } = useApi();
|
const { post, useQuery } = useApi();
|
||||||
const user = useStore(selector);
|
const user = useStore(selector);
|
||||||
|
|
||||||
const query = useQuery({
|
const query = useQuery({
|
||||||
queryKey: ['login'],
|
queryKey: ['login'],
|
||||||
queryFn: async () => {
|
queryFn: async () => {
|
||||||
const data = await get('/auth/verify');
|
const data = await post('/auth/verify');
|
||||||
|
|
||||||
setUser(data);
|
setUser(data);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ async function relationalQuery(websiteId: string, filters: QueryFilters) {
|
||||||
where website_event.website_id = {{websiteId::uuid}}
|
where website_event.website_id = {{websiteId::uuid}}
|
||||||
${filterQuery}
|
${filterQuery}
|
||||||
${dateQuery}
|
${dateQuery}
|
||||||
order by website_event.created_at desc
|
order by website_event.created_at asc
|
||||||
limit 100
|
limit 100
|
||||||
`,
|
`,
|
||||||
params,
|
params,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue