Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add table row view. Closes #636. #638

Merged
merged 9 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading