Skip to content

Commit

Permalink
Address More Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskerr committed Jan 6, 2024
1 parent 5db8144 commit 56a5646
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function QueryTree(props: {
const tree = useRef<TreeApi<Query | Group>>()
const [{isOver}, drop] = useQueryImportOnDrop()
const initialOpenState = useSelector(Appearance.getQueriesOpenState)
selectQuery.useListener((id) => tree.current.select(id))
selectQuery.useListener((id) => tree.current?.select(id))

return (
<>
Expand Down
4 changes: 2 additions & 2 deletions apps/zui/src/app/menus/header-context-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ export const headerContextMenu = createMenu(
const dispatch = ctx.api.dispatch
return [
{
label: "Sort Ascending",
label: "Sort Asc",
enabled: !when.isSortedAsc,
click: () => {
dispatch(appendQuerySortBy(column.path, "asc"))
submitSearch()
},
},
{
label: "Sort Descending",
label: "Sort Desc",
enabled: !when.isSortedDesc,
click: () => {
dispatch(appendQuerySortBy(column.path, "desc"))
Expand Down
2 changes: 2 additions & 0 deletions apps/zui/src/domain/session/handlers/navigation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export const openVirusTotal = createHandler(
const value = select(Selection.getValue)
if (value instanceof zed.Primitive && !value.isUnset()) {
invoke("openLinkOp", virusTotal.url(value.toString()))
} else {
console.error("Could not open this value with virus total")
}
}
)
46 changes: 32 additions & 14 deletions packages/zui-player/tests/right-click-menus.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getPath } from 'zui-test-data';

play('right-click-menus', (app, test) => {
test.beforeAll(async () => {
await app.dropFile(getPath('zillow.csv'));
await app.dropFile(getPath('small-zeek.zng'));
await app.click('button', 'Load');
await app.attached(/Successfully/);
await app.click('button', 'Query Pool');
Expand All @@ -12,43 +12,61 @@ play('right-click-menus', (app, test) => {
test('Inspector node menu', async () => {
await app.click('button', 'Inspector');
await app.click('button', 'Expand Rows');
await app.rightClick(/Days on Zillow/);
await app.rightClick(/_path/);
await app.click(/Filter == Value/);
await app.attached(/this\["Days on Zillow"\]==55\./);
await app.rightClick(/"Auction"/);
await app.attached(/_path=="capture_loss"/);
await app.rightClick(/acks/);
await app.click(/Count By Field/);
await app.attached(/count\(\) by this\["Listing description"\]/);
await app.attached(/| count\(\) by acks/);
});

test('table cell menu', async () => {
await app.query('fuse');
await app.click('button', 'Table');
await app.rightClick(/zillow\.com/);
await app.rightClick('gridcell', 'files');
await app.click(/Count By Field/);
await app.attached(/count\(\) by this\["Property URL"\]/);
await app.attached(/count\(\) by _path/);
});

test('sort asc', async () => {
await app.query('fuse');
await app.click('button', 'Table');
await app.rightClick(/zillow\.com/);
await app.rightClick('gridcell', 'conn');
await app.click(/Sort Asc/);
await app.attached(/sort this\["Property URL"\]/);
await app.attached(/sort _path/);
});

test('sort desc', async () => {
await app.query('fuse');
await app.click('button', 'Inspector');
await app.rightClick(/zillow\.com/);
await app.click('button', 'Collapse Rows');
await app.rightClick(/files/);
await app.click(/Sort Desc/);
await app.attached(/sort -r this\["Property URL"\]/);
await app.attached(/sort -r _path/);
});

test('table header menu', async () => {
test('hide table column', async () => {
await app.query('fuse');
await app.click('button', 'Table');
await app.click('button', 'Property URL Header Menu');
await app.click('button', 'ts Header Menu');
await app.click(/Hide Column/);
await app.detached('columnheader', 'Property URL');
await app.detached('columnheader', 'ts');
});

test('virus total', async () => {
await app.query('cut id.orig_h');
await app.click('button', 'Inspector');
await app.click('button', 'Expand Rows');
await app.rightClick(/192.168.1.110/);
await app.click('listitem', 'Virus Total');
});

test('who is', async () => {
await app.query('cut id.orig_h');
await app.click('button', 'Inspector');
await app.click('button', 'Expand Rows');
await app.rightClick(/192.168.1.110/);
await app.click('listitem', 'Whois Lookup');
await app.attached(/Whois Result/);
});
});

0 comments on commit 56a5646

Please sign in to comment.