Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces the forjedio/inertia-table (PHP) + @forjedio/inertia-table-react (React) packages and migrates existing list views from the custom DataTable approach to backend-declared Table classes rendered via a shared VitoTable component, with realtime refresh handled via a global table hook.
Changes:
- Add backend Table definitions for Servers, Sites, and Hosted Domains and update controllers to return
InertiaTableData. - Add
VitoTableReact component plus global setup (vito-table-setup.ts) for realtime refresh + icon registration. - Migrate the Servers/Sites/Hosted Domains pages to use
VitoTableand remove the old column-definition modules.
Reviewed changes
Copilot reviewed 21 out of 23 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| resources/js/vito-table-setup.ts | Registers table icons and a realtime table hook that debounces Inertia refresh on socket events. |
| resources/js/components/vito-table.tsx | New shared table renderer built on shadcn/ui and useTable() from the inertia-table React package. |
| resources/js/pages/servers/index.tsx | Migrates Servers listing to VitoTable with inline actions. |
| resources/js/pages/sites/index.tsx | Migrates Sites listing to VitoTable with inline warnings + action button rendering. |
| resources/js/pages/hosted-domains/index.tsx | Migrates Hosted Domains listing to VitoTable with inline certificate/actions UI. |
| resources/js/app.tsx | Imports vito-table-setup during client boot. |
| package.json | Adds @forjedio/inertia-table-react. |
| package-lock.json | Locks the new JS dependency and updates lock metadata. |
| composer.json | Adds forjedio/inertia-table. |
| composer.lock | Locks the new PHP dependency. |
| app/Tables/ServerTable.php | Adds server table definition (columns/search/realtime). |
| app/Tables/SiteTable.php | Adds site table definition including warnings computed server-side. |
| app/Tables/HostedDomainTable.php | Adds hosted domain table definition including icons and SSL-related computed/display fields. |
| app/Http/Controllers/ServerController.php | Switches Servers index to ServerTable. |
| app/Http/Controllers/SiteController.php | Switches Sites index to SiteTable (including server-scoped view). |
| app/Http/Controllers/HostedDomainController.php | Switches Hosted Domains index to HostedDomainTable. |
| app/Enums/ServerStatus.php | Adds HasTableDisplay implementation marker. |
| app/Enums/SiteStatus.php | Adds HasTableDisplay implementation marker. |
| app/Enums/HostedDomainStatus.php | Adds HasTableDisplay implementation marker. |
| app/Enums/SslMethod.php | Adds HasTableDisplay and modifies display text/color mapping. |
| resources/js/pages/servers/components/columns.tsx | Removed (no longer needed with backend-driven tables). |
| resources/js/pages/sites/components/columns.tsx | Removed (no longer needed with backend-driven tables). |
| resources/js/pages/hosted-domains/components/columns.tsx | Removed (no longer needed with backend-driven tables). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
|
@saeedvaziry bumped the version, updated the link |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Inertia Table - Initial Setup
Summary
Introduces the
forjedio/inertia-tablepackage to replace the customDataTablecomponent with a backend-driven, declarative table system. Table columns, search, sorting, and pagination are now defined in PHPTableclasses, with the frontend rendering handled by a sharedVitoTablecomponent built on shadcn/ui.This PR migrates three tables as the initial rollout: Servers, Sites, and Hosted Domains.
Key Changes
Backend
app/Tables/) define columns, search fields, sorting, eager loading, and realtime settings in one place:ServerTable- Servers list with name, IP, status columns. Searchable by name and IP.SiteTable- Sites list with conditional server column (when viewing all sites vs server-scoped). Searchable by domain. SupportsforServer()fluent setter.HostedDomainTable- Domains list with type icons, SSL method enum, certificate details, expiry badge, and status. Custom ordering (primary domains first).HasTableDisplay(SiteStatus,ServerStatus,HostedDomainStatus,SslMethod) enabling automatic badge rendering with colors.->simplePaginate().Frontend
VitoTablecomponent (resources/js/components/vito-table.tsx) - Headless rendering usinguseTable()hook with shadcn/ui table primitives. Supportsactions,cellRenderers,onRowClick, andmodalprops. Badge displays are intercepted and rendered with the project's shadcnBadgecomponent.vito-table-setup.ts- Registers global table hooks (realtime) and icons (lucide) at app boot.servers/components/columns.tsx,sites/components/columns.tsx,hosted-domains/components/columns.tsxare no longer needed. Custom cell rendering (actions, certificate details) is now inline in index pages.Tables Migrated
Realtime Updates
Table data is generated server-side in PHP (column values, enum colors, computed fields like warnings and SSL expiry). Because of this, raw WebSocket event payloads cannot be used to update individual rows in-place - they lack the computed display values that the Table class produces.
Instead, a global
registerTableHooklistens for socket events matching the table'srealtimesetting (e.g.,server.updated,site.created). When an event is received, it callsrefresh()which triggers an Inertia partial reload - fetching fresh table data from the server. This ensures all computed fields (enum badges, warnings, SSL expiry, icons) are always consistent.The reload is debounced at 900ms to prevent multiple rapid socket events (e.g., bulk status changes) from triggering redundant server requests. Only the last event in a burst triggers the reload.
This approach trades a server round-trip per update for guaranteed data consistency. A future enhancement to the
forjedio/inertia-table-reactpackage could expose asetDatafunction in the hook context, enabling in-place row updates where appropriate.Files Created
app/Tables/ServerTable.phpapp/Tables/SiteTable.phpapp/Tables/HostedDomainTable.phpresources/js/components/vito-table.tsxresources/js/vito-table-setup.tsFiles Modified
app/Enums/SiteStatus.php- AddedHasTableDisplayapp/Enums/ServerStatus.php- AddedHasTableDisplayapp/Enums/HostedDomainStatus.php- AddedHasTableDisplayapp/Enums/SslMethod.php- AddedHasTableDisplay, updatedgetColor()andgetText()app/Http/Controllers/ServerController.php- UsesServerTableapp/Http/Controllers/SiteController.php- UsesSiteTableapp/Http/Controllers/HostedDomainController.php- UsesHostedDomainTableresources/js/pages/servers/index.tsx- UsesVitoTableresources/js/pages/sites/index.tsx- UsesVitoTableresources/js/pages/hosted-domains/index.tsx- UsesVitoTablewith inline cellRenderers and actionsresources/js/app.tsx- Importsvito-table-setupFiles Removed
resources/js/pages/servers/components/columns.tsxresources/js/pages/sites/components/columns.tsxresources/js/pages/hosted-domains/components/columns.tsx