Skip to content

Commit 54c971c

Browse files
authored
Merge pull request #355 from duyet/feat/overview
feat: custom logo via `NEXT_PUBLIC_LOGO`
2 parents 7d06ebb + 0db0d7a commit 54c971c

File tree

5 files changed

+37
-20
lines changed

5 files changed

+37
-20
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,16 @@ Features:
3232
To get the project up and running on your local machine, follow these steps:
3333

3434
1. Clone the repository
35-
2. Install dependencies with `npm install` or `yarn install`
35+
2. Install dependencies using `npm install` or `yarn install`
3636
3. Create a `.env.local` file by copying the `.env.example` file and filling in the required environment variables:
37-
- `CLICKHOUSE_HOST`: ClickHouse host, for example `http://localhost:8123`
37+
- `CLICKHOUSE_HOST`: ClickHouse host(s), for example `http://localhost:8123` or `http://ch-1:8123,http://ch-2:8123`
38+
- `CLICKHOUSE_NAME`: (Optional) Name of ClickHouse instance, must match the number of hosts in `CLICKHOUSE_HOST`, for example `localhost` or `ch-1,ch-2`.
3839
- `CLICKHOUSE_USER`: ClickHouse user with permission to query the `system` database.
3940
- `CLICKHOUSE_PASSWORD`: ClickHouse password for the specified user.
4041
- `CLICKHOUSE_MAX_EXECUTION_TIME`: [`max_execution_time`](https://clickhouse.com/docs/en/operations/settings/query-complexity#max-execution-time) timeout in seconds. Default is `10`.
4142
- `CLICKHOUSE_TZ`: ClickHouse server timezone. Default: `''`.
4243
- `NEXT_QUERY_CACHE_TTL`: TTL of [`unstable_cache`](https://nextjs.org/docs/app/api-reference/functions/unstable_cache) - cache the results of most charts to speed up and reuse them across multiple requests. Default: `86400`.
44+
- `NEXT_PUBLIC_LOGO`: (Optional) HTTP path to logo image.
4345

4446
4. Run the development server with `npm run dev` or `yarn dev`
4547
5. Open [http://localhost:3000](http://localhost:3000) in your browser to see the dashboard.

app/[host]/overview/overview-charts.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
import { CircleAlert, Database } from 'lucide-react'
2+
import Link from 'next/link'
3+
import { Suspense } from 'react'
4+
15
import ChartQueryCount from '@/components/charts/query-count'
26
import { SingleLineSkeleton } from '@/components/skeleton'
37
import { Card, CardContent } from '@/components/ui/card'
48
import { fetchData } from '@/lib/clickhouse'
59
import { getScopedLink } from '@/lib/scoped-link'
610
import { cn } from '@/lib/utils'
7-
import { CircleAlert, Database } from 'lucide-react'
8-
import Link from 'next/link'
9-
import { Suspense } from 'react'
1011

11-
export async function RunningQueries({ className }: { className?: string }) {
12+
async function RunningQueries({ className }: { className?: string }) {
1213
const query = `SELECT COUNT() as count FROM system.processes`
1314
const { data } = await fetchData<
1415
{
@@ -91,11 +92,7 @@ async function LinkCount({
9192
)
9293
}
9394

94-
export async function DatabaseTableCount({
95-
className,
96-
}: {
97-
className?: string
98-
}) {
95+
async function DatabaseTableCount({ className }: { className?: string }) {
9996
return (
10097
<Card
10198
className={cn(

components/header.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,36 @@
11
import Image from 'next/image'
2+
import Link from 'next/link'
23
import { Suspense } from 'react'
34

45
import { ClickHouseHost } from '@/components/clickhouse-host'
56
import { Menu } from '@/components/menu/menu'
67
import { ReloadButton } from '@/components/reload-button'
78
import { SingleLineSkeleton } from '@/components/skeleton'
9+
import { getScopedLink } from '@/lib/scoped-link'
810

911
const TITLE = process.env.NEXT_PUBLIC_TITLE || 'ClickHouse Monitoring'
1012
const TITLE_SHORT = process.env.NEXT_PUBLIC_TITLE_SHORT || 'Monitoring'
13+
const LOGO = process.env.NEXT_PUBLIC_LOGO || '/logo-bw.svg'
1114

1215
export function Header() {
1316
return (
1417
<div className="flex items-center justify-between space-y-2">
1518
<div className="flex flex-row items-center">
16-
<Image
17-
src="/logo.svg"
18-
width={40}
19-
height={40}
20-
alt="Logo"
21-
className="mr-2"
22-
/>
19+
<Link href={getScopedLink('/overview')}>
20+
<Image
21+
src={LOGO}
22+
width={45}
23+
height={45}
24+
alt="Logo"
25+
className="mr-2"
26+
/>
27+
</Link>
2328
<div>
2429
<h2 className="flex min-w-32 flex-col text-2xl font-bold tracking-tight">
25-
<span className="hidden sm:flex">{TITLE}</span>
26-
<span className="flex sm:hidden">{TITLE_SHORT}</span>
30+
<Link href={getScopedLink('/overview')}>
31+
<span className="hidden sm:flex">{TITLE}</span>
32+
<span className="flex sm:hidden">{TITLE_SHORT}</span>
33+
</Link>
2734
</h2>
2835
<div className="text-muted-foreground">
2936
<Suspense>

next.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ const nextConfig = {
1010
ignoreDuringBuilds: true,
1111
},
1212

13+
images: {
14+
remotePatterns: [
15+
{
16+
protocol: 'https',
17+
hostname: '*',
18+
port: '',
19+
},
20+
],
21+
},
22+
1323
// https://nextjs.org/docs/app/api-reference/next-config-js/webpack
1424
webpack: (
1525
config,

public/clickhouse.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)