-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
483 additions
and
349 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
packages/pinorama-studio/src/components/connnection-status/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { usePinoramaIntrospection } from "@/hooks" | ||
|
||
export function ConnectionStatus() { | ||
const { status } = usePinoramaIntrospection() | ||
|
||
let statusColor = "" | ||
let statusText = "" | ||
|
||
switch (status) { | ||
case "pending": | ||
statusColor = "bg-orange-500" | ||
statusText = "Connecting" | ||
break | ||
case "success": | ||
statusColor = "bg-green-500" | ||
statusText = "Connected" | ||
break | ||
case "error": | ||
statusColor = "bg-red-500" | ||
statusText = "Connection timed out" | ||
break | ||
default: | ||
statusColor = "bg-gray-500" | ||
statusText = "Unknown" | ||
} | ||
|
||
return ( | ||
<div className="flex items-center space-x-1.5"> | ||
<div className={`w-2 h-2 rounded-full ${statusColor}`} /> | ||
<span className="">{statusText}</span> | ||
<span className="text-muted-foreground"> | ||
http://localhost:6200/pinorama | ||
</span> | ||
</div> | ||
) | ||
} |
10 changes: 9 additions & 1 deletion
10
packages/pinorama-studio/src/components/empty-state/empty-state.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 9 additions & 1 deletion
10
packages/pinorama-studio/src/components/error-state/error-state.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/pinorama-studio/src/components/log-explorer/components/log-details/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
type LogDetailsProps = { | ||
data: any | ||
} | ||
|
||
export function LogDetails(props: LogDetailsProps) { | ||
return ( | ||
<div className="flex flex-col h-full p-3 overflow-auto"> | ||
<pre className="text-sm">{JSON.stringify(props.data, null, 2)}</pre> | ||
</div> | ||
) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
packages/pinorama-studio/src/components/log-explorer/components/log-filters/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { ErrorState } from "@/components/error-state/error-state" | ||
import { usePinoramaIntrospection } from "@/hooks" | ||
import { Facet } from "./components/facet" | ||
|
||
import { LoadingState } from "@/components/loading-state/loading-state" | ||
import { useMemo } from "react" | ||
import type { SearchFilters } from "./types" | ||
|
||
const ALLOWED_TYPES = ["string", "enum", "boolean"] | ||
|
||
type PinoramaFacetsProps = { | ||
searchText: string | ||
filters: SearchFilters | ||
onFiltersChange: (filters: SearchFilters) => void | ||
} | ||
|
||
export function LogFilters(props: PinoramaFacetsProps) { | ||
const { data: introspection, status, error } = usePinoramaIntrospection() | ||
|
||
const facets = useMemo(() => { | ||
if (!introspection) return [] | ||
return Object.keys(introspection?.dbSchema).filter((name) => { | ||
const type = introspection.dbSchema[name] | ||
return ALLOWED_TYPES.includes(type) | ||
}) | ||
}, [introspection]) | ||
|
||
if (status === "pending") { | ||
return <LoadingState /> | ||
} | ||
|
||
if (status === "error") { | ||
return <ErrorState error={error} /> | ||
} | ||
|
||
/* | ||
const handleResetFilters = useCallback(() => { | ||
setFilters({}) | ||
setSearchText("") | ||
}, []) | ||
const hasFilters = Object.keys(filters).length > 0 || searchText.length > 0 | ||
*/ | ||
|
||
return ( | ||
<div className="flex flex-col h-full p-3 overflow-auto"> | ||
{/* <div className="flex text-sm whitespace-nowrap justify-between items-center mb-0.5"> */} | ||
{/* <div className="flex font-medium px-2 h-10 items-center"> */} | ||
{/* Filters */} | ||
{/* </div> */} | ||
{/* {hasFilters ? ( */} | ||
{/* <Button */} | ||
{/* variant="outline" */} | ||
{/* className="text-muted-foreground" */} | ||
{/* onClick={handleResetFilters} */} | ||
{/* > */} | ||
{/* Reset */} | ||
{/* </Button> */} | ||
{/* ) : null} */} | ||
{/* </div> */} | ||
{facets.map((name) => { | ||
return ( | ||
<Facet | ||
key={name} | ||
name={name} | ||
type={introspection.dbSchema[name]} | ||
searchText={props.searchText} | ||
filters={props.filters} | ||
onFiltersChange={props.onFiltersChange} | ||
/> | ||
) | ||
})} | ||
</div> | ||
) | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
38 changes: 38 additions & 0 deletions
38
...es/pinorama-studio/src/components/log-explorer/components/log-viewer/components/thead.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { type Table, flexRender } from "@tanstack/react-table" | ||
|
||
export function TableHead({ table }: { table: Table<unknown> }) { | ||
return ( | ||
<thead className="group sticky top-0 z-10 bg-background select-none flex"> | ||
{table.getHeaderGroups().map((headerGroup) => ( | ||
<tr key={headerGroup.id}> | ||
{headerGroup.headers.map((header) => ( | ||
<th | ||
key={header.id} | ||
colSpan={header.colSpan} | ||
className="relative px-3 mb-1 text-left font-normal text-muted-foreground align-middle h-9" | ||
style={{ width: header.getSize() }} | ||
> | ||
{header.isPlaceholder | ||
? null | ||
: flexRender( | ||
header.column.columnDef.header, | ||
header.getContext() | ||
)} | ||
{header.column.getCanResize() && ( | ||
<div | ||
onMouseDown={header.getResizeHandler()} | ||
onTouchStart={header.getResizeHandler()} | ||
className={`absolute right-0 top-0 h-[32px] w-[3px] bg-muted opacity-0 group-hover:opacity-100 cursor-col-resize select-none touch-none ${ | ||
header.column.getIsResizing() | ||
? "group-hover:bg-accent-foreground bg-accent-foreground" | ||
: "" | ||
}`} | ||
/> | ||
)} | ||
</th> | ||
))} | ||
</tr> | ||
))} | ||
</thead> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.