frontend: migrate /schema-registry pages to new UI Registry components#2356
frontend: migrate /schema-registry pages to new UI Registry components#2356
Conversation
Purely a component change, the logic should remain the same.
And now matches edit-mode.
To the new UI registry components
Rewrite modals.tsx from imperative openModal() pattern to declarative controlled Dialog components. Replace Modal/Alert/Box/Button from @redpanda-data/ui with registry equivalents.
Replace legacy @redpanda-data/ui components with registry equivalents and sonner toasts. DataTable kept as-is for separate migration.
ab25ee5 to
c220fa8
Compare
Replace all @redpanda-data/ui components with registry equivalents. Migrate toasts to sonner, Tabs to compound pattern, CodeBlock to DynamicCodeBlock, LegacyButton to Button+Tooltip. This also includes the update of the DynamicCodeBlock component which fixes the lack of syntax highlighting.
Replace legacy DataTable with useReactTable, composed Table/TableHeader/TableBody, and DataTablePagination. Zero @redpanda-data/ui imports remain in schemas directory.
c220fa8 to
5e1818f
Compare
| <div className="mt-6 flex items-center gap-4"> | ||
| <Button | ||
| data-testid="edit-compatibility-save-btn" | ||
| disabled={api.userData?.canManageSchemaRegistry === false} |
There was a problem hiding this comment.
I think we should aim for always showing a tooltip why a button is disabled instead of silently disabling it. If there is no support for this in UI registry I think we should add it WDYT? @eblairmckee @malinskibeniamin
I used to work in a way that we guarded this with TS. If you provided disabled, you had to provide a disabledTooltip property.
There was a problem hiding this comment.
I agree, maybe not necessarily having a property but just wrapping any disabled button in a Tooltip
There was a problem hiding this comment.
Done in 4221074, I was wrapping the buttons on tooltips in the other pages but missed that here.
| const { data: schemaCompatibility, refetch: refetchCompatibility } = useSchemaCompatibilityQuery(); | ||
| const deleteSchemaMutation = useDeleteSchemaSubjectMutation(); | ||
| const [deleteTarget, setDeleteTarget] = useState<{ kind: 'soft' | 'permanent'; name: string } | null>(null); | ||
| const [sorting, setSorting] = useState<SortingState>([]); |
There was a problem hiding this comment.
Should we move these to URL? We have mechanisms already to have sorting & pagination in the URL.
Run yes | bunx @fumadocs/cli add --dir https://redpanda-ui-registry.netlify.app/r combobox
afca77b to
2d0922b
Compare
This PR includes the changes to migrate all pages in the
/schema-registryroute to the new UI registry components. The biggest changes are the Edit Compatibility page and the new Data Table component used in the List subject page.Examples
New Edit Compat page
Before

After

New Data Table
Before

After (now it includes pagination)

New codeblock component used in details page
Before

After
