Skip to content

Add Schema-view vertex type hiding#1931

Open
danielvanza wants to merge 3 commits into
aws:mainfrom
danielvanza:add-schema-view-type-hiding
Open

Add Schema-view vertex type hiding#1931
danielvanza wants to merge 3 commits into
aws:mainfrom
danielvanza:add-schema-view-type-hiding

Conversation

@danielvanza

Copy link
Copy Markdown

Summary

  • The Schema view rendered every discovered vertex type with no way to exclude noisy ones — e.g. a database's own generic base label (Gremlin's default Vertex label) showing up as a node type on every schema graph.
  • Adds a per-connection, persisted store of hidden vertex types (hiddenSchemaTypesAtom + useHiddenSchemaTypes()), mirroring the existing schema-atom pattern, and an eye toggle on each row of the Styles panel's Nodes tab when opened from the Schema view.
  • Hiding a type also drops its schema-graph edges, since they lose an endpoint — no separate edge-hiding logic needed.
  • Hidden types stay listed (dimmed) so they can be restored, and the hidden set is scoped to the Schema view only: the main Graph view, canvas filtering, and discovery are untouched. The Styles panel is shared between the Graph and Schema views, so the toggle is gated behind an opt-in prop passed only from the Schema view's sidebar, and the toggle itself lives in a Schema-view-only wrapper around the shared row rather than inside it.
  • Also includes a small, related fix: createVertex() used to take the first label in a multi-labeled vertex's type list as its primary (styling/display) type. Gremlin/TinkerPop's default base label, vertex, commonly appears first alongside a more specific label (e.g. ["vertex", "sqsqueue"]), which meant such nodes were styled and named after the meaningless generic label instead of their specific one. This makes hiding the generic type from the Schema view more useful, since the same generic label no longer clobbers a node's display name/style on the main canvas.

Test plan

  • pnpm checks (types, lint, format)
  • pnpm test — all green except one pre-existing, unrelated flaky test on main (safeSessionStorage.test.ts, confirmed failing on a clean checkout of main as well)
  • New unit tests: hidden-types atom (toggle, per-connection isolation, empty-set cleanup), Schema graph data filtering (nodes and their edges), sidebar toggle wiring, and a regression test confirming the main Graph view's Styles panel never shows the toggle
  • Manual verification: toggling a type off in the Schema view's Nodes tab removes it (and its connections) from the schema graph only; the row stays listed, dimmed, and restores the type when toggled back on; hidden state persists per connection across reload

createVertex() used to take types[0] as the primary type driving styling
and naming. Gremlin/TinkerPop's default base label, "vertex", commonly
appears first alongside a more specific label (e.g. ["vertex",
"sqsqueue"]), which meant multi-labeled nodes were styled and named after
the meaningless generic label instead of their specific one. Skip the
generic label (case-insensitively) when a more specific label is present,
falling back to it only when it's the sole label.
The Schema view rendered every discovered vertex type with no way to
exclude noisy ones, e.g. a database's own generic base label showing up
as a node type on every schema graph. Add a per-connection hidden-types
store (mirroring the existing schema atom) and an eye toggle on each row
of the Styles panel's Nodes tab when opened from the Schema view; hiding
a type also drops its schema-graph edges since they lose an endpoint.
Hidden types stay listed, dimmed, so they can be restored, and the hidden
set is scoped to the Schema view only — the main Graph view, canvas
filtering, and discovery are untouched.

The Styles panel is now shared between the Graph and Schema views, so the
toggle is gated behind a showVertexVisibilityToggle prop passed only from
the Schema view's sidebar.
VertexStyleRow is also rendered by the main Graph view's Styles panel,
so a showVisibilityToggle prop and an unconditional useHiddenSchemaTypes()
subscription inside it coupled the shared row to a Schema-view-only
feature. Wrap it from the outside instead (SchemaVertexStyleRow in
VertexStyles.tsx), leaving VertexStyleRow itself untouched.

Also tighten two new tests to assert full expected values with
toStrictEqual instead of toContain/toEqual, per docs/agents/testing.md.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants