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

Export to Clipboard & Pool #2985

Merged
merged 59 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
73fcbff
Improve brimcap error handling
nwt Jan 7, 2024
defaca2
Merge remote-tracking branch 'origin/main' into improve-brimcap-errors
jameskerr Jan 10, 2024
4cc0cf2
WIP
jameskerr Jan 19, 2024
979065a
Fix Analyze
jameskerr Jan 20, 2024
890d079
Refactor Brimcap Loader
jameskerr Jan 20, 2024
7c71b85
Add unit test for quick-load bad pcap
jameskerr Jan 22, 2024
ad68bde
Increase timeoutfor this test on CI
jameskerr Jan 22, 2024
23af3d0
Keep errorToString simpler
jameskerr Jan 22, 2024
c475ffa
WIP
jameskerr Jan 22, 2024
72aac73
Clipboard and Pool Export Comming Soon
jameskerr Jan 22, 2024
f6c952f
Merge remote-tracking branch 'origin/main' into export-feature
jameskerr Jan 23, 2024
ea7ad53
Clean forms
jameskerr Jan 23, 2024
09fc8e6
Export Modal Looking Better
jameskerr Jan 24, 2024
302ad18
Disable When Not on Query Session
jameskerr Jan 24, 2024
758176b
Submit Handler
jameskerr Jan 24, 2024
4ffdd71
Rename DefaultLoader to FileLoader
jameskerr Jan 24, 2024
4631ef8
Export to Pool Looking Good
jameskerr Jan 24, 2024
c698a71
Clean Up Forms Everywhere
jameskerr Jan 24, 2024
892e786
Merge remote-tracking branch 'origin/main' into export-feature
jameskerr Jan 26, 2024
b7faebc
Add Utilities
jameskerr Jan 27, 2024
0d4ec56
DRY Pool Form
jameskerr Jan 27, 2024
8c14dba
Merge remote-tracking branch 'origin/main' into export-feature
jameskerr Jan 29, 2024
49e4ae3
Fixed Pool Forms Everywhere
jameskerr Jan 30, 2024
1dd769b
Modal Exits Better
jameskerr Jan 31, 2024
a6ca320
Use Dialog
jameskerr Feb 1, 2024
248ff66
Modal Popover Working So Well
jameskerr Feb 8, 2024
d8d6473
Popover Modal
jameskerr Feb 8, 2024
0379e75
Merge remote-tracking branch 'origin/main' into export-feature
jameskerr Feb 8, 2024
68bf10c
Full Modal Works
jameskerr Feb 9, 2024
f241d51
New Pool Modal Converted
jameskerr Feb 9, 2024
5f3c254
New Lake Modal
jameskerr Feb 9, 2024
c248ec6
Modal Fixes
jameskerr Feb 9, 2024
322320a
Who Is Modal Converted
jameskerr Feb 9, 2024
7182aa6
Font Fixes
jameskerr Feb 9, 2024
eb1c3e3
Fix Linter
jameskerr Feb 9, 2024
06eef2c
Set the lake Id in the tests
jameskerr Feb 9, 2024
7b7c5e8
Remove Console
jameskerr Feb 9, 2024
cfa046f
Add pcap
jameskerr Feb 9, 2024
5c5e960
Fix Test
jameskerr Feb 10, 2024
8ec8444
Customize Pool Form
jameskerr Feb 10, 2024
4c2a7d1
Working on e2e tests
jameskerr Feb 10, 2024
da8abbc
E2E Test Fixes
jameskerr Feb 12, 2024
d59bdeb
Add Total Row Count
jameskerr Feb 12, 2024
aed151c
Added export cancel
jameskerr Feb 13, 2024
0580fd8
Fix dialog look in darkmode
jameskerr Feb 13, 2024
bc60704
Add copy to clipboard and export to pool test
jameskerr Feb 13, 2024
bda6cec
Fix Visual Bugs
jameskerr Feb 14, 2024
ab8c511
Opt Out of Memory Form
jameskerr Feb 14, 2024
b9ce5a6
Fix About Window
jameskerr Feb 14, 2024
91e74ba
Conditional Requires
jameskerr Feb 15, 2024
26bc432
Add different submti combos keys
jameskerr Feb 15, 2024
cbdbb52
Add Keyboard Shortcuts
jameskerr Feb 15, 2024
ce09d59
Use the loads.create path and fix abort
jameskerr Feb 15, 2024
0d1f302
Lint
jameskerr Feb 15, 2024
54d632e
Add Control Key for Windows
jameskerr Feb 15, 2024
62d6303
Merge remote-tracking branch 'origin/main' into export-feature
jameskerr Feb 20, 2024
895906e
Only set a select if the value existed.
jameskerr Feb 20, 2024
548487e
Add Indeterminate Loader
jameskerr Feb 20, 2024
1098379
Fix Confirm
jameskerr Feb 21, 2024
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
2 changes: 1 addition & 1 deletion apps/zui/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async function start() {
const renderer = sub("yarn", `start:renderer`)
await Promise.all([
main.waitForOutput(/watching for changes/),
renderer.waitForOutput(/compiled client and server successfully/),
renderer.waitForOutput(/started server on/),
])
log("Launching...")
sub("yarn", `start:electron ${electronArgs}`).p.on("exit", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const BG = styled.div`

const Text = styled.p`
font-family: var(--mono-font);
font-size: var(--step--1);
font-weight: 500;
white-space: nowrap;
overflow: hidden;
Expand Down
2 changes: 1 addition & 1 deletion apps/zui/src/app/features/sidebar/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const BG = styled.div`
&[aria-selected="true"] {
border-radius: 0;
outline: none;
box-shadow: var(--shadow-small);
box-shadow: var(--shadow-s);
background: var(--selected-bg);

svg {
Expand Down
34 changes: 7 additions & 27 deletions apps/zui/src/app/features/sidebar/lake-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,32 +21,12 @@ const LakeNameGroup = styled.div`
border-radius: 6px;
min-width: 0;
position: relative;

transition: all var(--dur-s);
&:hover {
background: var(--sidebar-item-hover);
background: var(--emphasis-bg);
}
&:active {
background: var(--sidebar-item-active);
box-shadow: var(--sidebar-item-active-shadow);
}
`

const NameColumn = styled.div`
overflow: hidden;
label {
display: block;
font-size: 15px;
font-weight: bold;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}

label:last-child {
font-size: 12px;
font-weight: normal;
font-family: var(--mono-font);
opacity: 0.5;
background: var(--emphasis-bg-more);
}
`

Expand Down Expand Up @@ -85,10 +65,10 @@ export default function LakePicker() {

return (
<LakeNameGroup onClick={() => dispatch(showLakeSelectMenu())}>
<NameColumn>
<label>{`${current?.name}`}</label>
<label>{`${current?.getAddress()}`}</label>
</NameColumn>
<div className="overflow:hidden">
<p className="overflow:ellipsis weight:bold">{`${current?.name}`}</p>
<p className="overflow:ellipsis font:mono font-size:-2 color:fg-less">{`${current?.getAddress()}`}</p>
</div>
</LakeNameGroup>
)
}
8 changes: 0 additions & 8 deletions apps/zui/src/app/features/sidebar/queries-section/empty.tsx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function QueriesSection() {
</Content>
<Toolbar>
<ToolbarTabs
name="querySource"
options={[
{
label: "Local",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import {FillFlexParent} from "src/components/fill-flex-parent"
import QueryItem from "./query-item"
import {selectQuery} from "src/app/events/select-query-event"
import Appearance from "src/js/state/Appearance"
import {Empty} from "./empty"
import {TREE_ITEM_HEIGHT} from "../item"
import {showMenu} from "src/core/menu"
import EmptySection from "src/js/components/common/EmptySection"

type Props = {
source: "local" | "remote"
Expand All @@ -41,7 +41,9 @@ function LocalQueriesTree({searchTerm}: Props) {
if (queries.length) {
return <QueryTree queries={queries} searchTerm={searchTerm} type="local" />
} else {
return <Empty message="Local queries you've saved will be listed here." />
return (
<EmptySection message="Local queries you've saved will be listed here." />
)
}
}

Expand All @@ -54,7 +56,9 @@ function RemoteQueriesTree({searchTerm}) {
if (queries.length) {
return <QueryTree queries={queries} searchTerm={searchTerm} type="remote" />
} else {
return <Empty message="Remove queries from the lake will be listed here." />
return (
<EmptySection message="Remote queries from the lake will be listed here." />
)
}
}

Expand Down
16 changes: 9 additions & 7 deletions apps/zui/src/app/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,51 +8,53 @@ import {IconName} from "../../components/icon"
*/

export const root: Route = {
name: "root",
path: "/",
title: "Zui",
}

export const poolShow: Route = {
name: "poolShow",
title: "<pool>",
path: `/pools/:poolId`,
icon: "pool",
}

export const query: Route = {
name: "querySession",
title: "<query>",
path: `/queries/:queryId`,
icon: "query",
}

export const queryVersion: Route = {
name: "querySession",
title: "<query>",
path: `${query.path}/versions/:version`,
icon: "query",
}
export const lakeReleaseNotes: Route = {
export const releaseNotes: Route = {
name: "releaseNotes",
title: "Release Notes",
path: `/release-notes`,
icon: "doc_plain",
}

export const releaseNotes: Route = {
title: "Release Notes",
path: "/release-notes",
}

export const welcome: Route = {
name: "welcome",
title: "Welcome to Zui",
path: "/welcome",
icon: "zui",
}

type Route = {
name: string
title: string
path: string
icon?: IconName
}

export const allRoutes: Route[] = [
lakeReleaseNotes,
poolShow,
query,
queryVersion,
Expand Down
4 changes: 0 additions & 4 deletions apps/zui/src/app/routes/app-wrapper/app-modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@ import {Tooltip} from "src/components/tooltip"
import ErrorNotice from "src/js/components/ErrorNotice"
import HTMLContextMenu from "src/js/components/HTMLContextMenu"
import {Modals} from "src/js/components/Modals"
import {PreferencesModal} from "src/views/preferences-modal"
import {LoadPane} from "src/views/load-pane"

export function AppModals() {
return (
<>
<ErrorNotice />
<PreferencesModal />
<Modals />
<HTMLContextMenu />
<Toaster />
<Tooltip />
<LoadPane />
</>
)
}
2 changes: 1 addition & 1 deletion apps/zui/src/app/routes/app-wrapper/main-area.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const BG = styled.main`
margin: 10px;
margin-top: 0;
border-radius: 6px;
box-shadow: var(--shadow-small);
box-shadow: var(--shadow-s);
border: 1px solid var(--border-color);

@media (prefers-color-scheme: light) {
Expand Down
7 changes: 7 additions & 0 deletions apps/zui/src/components/case.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export function Case(props: {if: boolean; true: any; false: any}) {
if (props.if) {
return props.true
} else {
return props.false
}
}
40 changes: 20 additions & 20 deletions apps/zui/src/components/dialog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import {HTMLAttributes, MouseEventHandler} from "react"
import {MouseEventHandler, forwardRef} from "react"
import {useOpener} from "./use-opener"
import {useOutsideClick} from "./use-outside-click"
import useCallbackRef from "src/js/components/hooks/useCallbackRef"
import {omit} from "lodash"
import {call} from "src/util/call"
import {useFixedPosition} from "src/util/hooks/use-fixed-position"
import mergeRefs from "src/app/core/utils/merge-refs"
import useListener from "src/js/components/hooks/useListener"
import {call} from "src/util/call"

export type DialogProps = {
isOpen: boolean
onClose?: () => void
onCancel?: () => void
onClose?: (e: any) => any
onCancel?: (e: any) => any
modal?: boolean
onOutsideClick?: (e: globalThis.MouseEvent) => void
onClick?: MouseEventHandler<HTMLDialogElement>
Expand All @@ -20,7 +22,7 @@ export type DialogProps = {
dialogPoint?: string
dialogMargin?: string
keepOnScreen?: boolean
} & HTMLAttributes<HTMLDialogElement>
}

const nonHTMLProps: (keyof DialogProps)[] = [
"isOpen",
Expand All @@ -34,10 +36,12 @@ const nonHTMLProps: (keyof DialogProps)[] = [
"keepOnScreen",
]

export function Dialog(props: DialogProps) {
export const Dialog = forwardRef(function Dialog(props: DialogProps, ref) {
const [node, setNode] = useCallbackRef<HTMLDialogElement>()
useOpener(node, props) // Make sure we open it before positioning it
useOutsideClick(node, props)

// Get this out of here
const style = useFixedPosition({
anchor: props.anchor,
anchorPoint: props.anchorPoint,
Expand All @@ -46,27 +50,23 @@ export function Dialog(props: DialogProps) {
targetMargin: props.dialogMargin,
})

function onClose(e) {
e.preventDefault()
call(props.onClose)
}
// When you click escape, "cancel" is fired, then close
useListener(node, "cancel", (e) => {
call(props.onCancel, e)
})

function onCancel(e) {
e.preventDefault()
call(props.onCancel)
call(props.onClose)
}
// When you call .close() "close" fires
useListener(node, "close", (e) => {
call(props.onClose, e)
})

return (
<dialog
// @ts-ignore
onClose={onClose}
onCancel={onCancel}
ref={setNode}
ref={mergeRefs(setNode, ref)}
style={{...style, position: "fixed"}}
{...omit(props, ...nonHTMLProps)}
>
{props.children}
</dialog>
)
}
})
28 changes: 19 additions & 9 deletions apps/zui/src/components/drag-anchor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,37 @@ type Props = {
export default class DragAnchor extends React.Component<Props> {
private startX: number
private startY: number
private cleanup = () => {}

componentWillUnmount() {
this.up()
}

down = (e: React.MouseEvent) => {
const body = document.body
const el = e.currentTarget
this.startX = e.clientX
this.startY = e.clientY
const body = document.body
body.style.cursor = this.getCursor()
body.style.userSelect = "none"
body.classList.add("is-dragging")
el.classList.add("is-dragging")
document.addEventListener("mousemove", this.move)
document.addEventListener("mouseup", this.up)

this.cleanup = () => {
document.removeEventListener("mousemove", this.move)
document.removeEventListener("mouseup", this.up)
if (body) {
body.style.cursor = ""
body.style.userSelect = ""
body.classList.remove("is-dragging")
}
if (el) {
el.classList.remove("is-dragging")
}
}

call(this.props.onStart, e)
}

Expand All @@ -106,14 +123,7 @@ export default class DragAnchor extends React.Component<Props> {
}

up = () => {
const body = document.body
if (body) {
body.style.cursor = ""
body.style.userSelect = ""
body.classList.remove("is-dragging")
document.removeEventListener("mousemove", this.move)
document.removeEventListener("mouseup", this.up)
}
this.cleanup()
call(this.props.onEnd)
}

Expand Down
Loading
Loading