Skip to content

Commit

Permalink
Add table row view. Closes #636. (#638)
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBurgess authored Dec 19, 2024
1 parent 52f16be commit ca1e74f
Show file tree
Hide file tree
Showing 19 changed files with 696 additions and 218 deletions.
1 change: 1 addition & 0 deletions ui/dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"react-router-dom": "6.28.0",
"react-router-hash-link": "2.4.3",
"react-select": "5.8.3",
"react-split-pane": "0.1.92",
"react-syntax-highlighter": "15.6.1",
"react-time-picker": "7.0.0",
"react-use-websocket": "4.11.1",
Expand Down
4 changes: 3 additions & 1 deletion ui/dashboard/src/components/CodeBlock/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import CopyToClipboard, { CopyToClipboardProvider } from "../CopyToClipboard";
import hcl from "react-syntax-highlighter/dist/esm/languages/prism/hcl";
import json from "react-syntax-highlighter/dist/esm/languages/prism/json";
import sql from "react-syntax-highlighter/dist/esm/languages/prism/sql";
import yaml from "react-syntax-highlighter/dist/esm/languages/prism/yaml";
import { classNames } from "@powerpipe/utils/styles";
import { PrismLight as SyntaxHighlighter } from "react-syntax-highlighter";
import { ThemeNames } from "@powerpipe/hooks/useTheme";
Expand All @@ -15,11 +16,12 @@ import {
SyntaxHighlighter.registerLanguage("hcl", hcl);
SyntaxHighlighter.registerLanguage("json", json);
SyntaxHighlighter.registerLanguage("sql", sql);
SyntaxHighlighter.registerLanguage("yaml", yaml);

type CodeBlockProps = {
children: string;
copyToClipboard?: boolean;
language?: "hcl" | "json" | "sql";
language?: "hcl" | "json" | "sql" | "yaml";
style?: any;
};

Expand Down
17 changes: 9 additions & 8 deletions ui/dashboard/src/components/CopyToClipboard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import copy from "copy-to-clipboard";
import { classNames } from "@powerpipe/utils/styles";
import {
CopyToClipboardIcon,
CopyToClipboardSuccessIcon,
} from "@powerpipe/constants/icons";
import {
createContext,
useCallback,
useContext,
useEffect,
useState,
} from "react";
import Icon from "@powerpipe/components/Icon";

type ICopyToClipboardContext = {
doCopy: boolean;
Expand Down Expand Up @@ -78,13 +75,17 @@ const CopyToClipboard = ({
return (
<>
{!copySuccess && (
<CopyToClipboardIcon
className={classNames("h-6 w-6 cursor-pointer", className)}
onClick={handleCopy}
<Icon
icon="content_copy"
className={classNames("h-5 w-5 cursor-pointer", className)}
onClick={(e) => handleCopy(e)}
/>
)}
{copySuccess && (
<CopyToClipboardSuccessIcon className="h-6 w-6 text-ok" />
<Icon
icon="materialsymbols-solid:content_copy"
className={classNames("h-5 w-5 text-ok", className)}
/>
)}
</>
);
Expand Down
2 changes: 1 addition & 1 deletion ui/dashboard/src/components/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import useDashboardIcons from "@powerpipe/hooks/useDashboardIcons";
type IconProps = {
className?: string;
icon: string;
onClick?: () => void;
onClick?: (e: any) => void;
style?: any;
title?: string;
};
Expand Down
Loading

0 comments on commit ca1e74f

Please sign in to comment.