Skip to content

frontend: Migrate to Headlamp common components and theme tokens#36

Open
NAME-ASHWANIYADAV wants to merge 2 commits into
agones-dev:mainfrom
NAME-ASHWANIYADAV:refactor/headlamp-common-components
Open

frontend: Migrate to Headlamp common components and theme tokens#36
NAME-ASHWANIYADAV wants to merge 2 commits into
agones-dev:mainfrom
NAME-ASHWANIYADAV:refactor/headlamp-common-components

Conversation

@NAME-ASHWANIYADAV

Copy link
Copy Markdown
Contributor

This PR addresses the UI feedback from @ashu8912 by migrating hand-rolled Material UI tables to Headlamp's built-in common components, bringing a consistent UX, free features (search, sort, pagination), and better dark mode support.

🛠️ Changes Made

1. List Views-> ResourceListView

Replaced manual <Table> implementations with ResourceListView for:

  • FleetAutoscaler List
  • GameServer List
  • Fleet List
    Gains: Built-in search, sorting, pagination, column chooser, URL state, and loading states.
    (Note: Dropped the inline row-click preview panel for Fleets/GameServers as ResourceListView does not support row selection natively, matching Headlamp's standard list UX).

2. Data Tables -> SimpleTable

Replaced read-only data tables with SimpleTable using column configurations:

  • GameServer Pod Preview
  • GameServer Detail: Ports section & Counters/Lists section
  • GameServerTable (used in Fleet preview)
    Separates "what the data is" from "how it looks" using typed data arrays.

3. Key/Value Tables -> NameValueTable

Replaced 2-column detail tables with NameValueTable:

  • GameServer Detail: Configuration section
  • FleetAutoscaler Detail: Explainer section (Uses the hide prop for conditional "Scaling Limit/Blocked" rows instead of inline JSX).

4. Theme Tokens & Dark Mode Fixes

Replaced hardcoded hex colors with theme palette tokens:

  • UtilBar: #f44336/#ff9800/#4caf50error.main/warning.main/success.main
  • ReplicaBar: grey.200 -> action.hover (Fixes the broken grey track in dark mode).

🧹 Cleanup

  • Deleted unused tableStyles.ts.
  • Net negative lines of code (-128 lines) despite adding more features!
  • All CI checks (TypeScript, Lint, Prettier, Tests) are passing.

Signed-off-by: ashwani yadav <22ashwaniyadav@gmail.com>
@lacroixthomas

Copy link
Copy Markdown
Contributor

Ready for review ? I am doing stuff for Agones, but can have a look 😄

@NAME-ASHWANIYADAV

Copy link
Copy Markdown
Contributor Author

@lacroixthomas Yes, it's good to go! Thanks for taking the time to look into it

@lacroixthomas lacroixthomas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There might also be these 3 files that are not used anymore ? 🤔

./src/components/PreviewPanel.tsx
./src/views/fleets/GameServersPreview.tsx
./src/views/gameserver/PodPreview.tsx

Might need to be double checked though

Comment thread src/views/gameservers/Detail.tsx Outdated
Comment on lines +42 to +46
{ label: 'Name', getter: (p: any) => p.name },
{ label: 'Host Port', getter: (p: any) => p.hostPort ?? '—' },
{ label: 'Container Port', getter: (p: any) => p.containerPort ?? '—' },
{ label: 'Protocol', getter: (p: any) => p.protocol },
{ label: 'Policy', getter: (p: any) => p.portPolicy },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: do you reckon this could be an actual type instead of any ? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have extracted a named MergedPort interface in gameserver.ts (the return type of GameServer.mergedPorts) and typed all five getters with it

Signed-off-by: ashwani yadav <22ashwaniyadav@gmail.com>
@NAME-ASHWANIYADAV

Copy link
Copy Markdown
Contributor Author

There might also be these 3 files that are not used anymore ? 🤔

./src/components/PreviewPanel.tsx ./src/views/fleets/GameServersPreview.tsx ./src/views/gameserver/PodPreview.tsx

Might need to be double checked though

I have verified all three - after dropping the row-click preview panels in the list-view migration, nothing imports PreviewPanel.tsx, GameServersPreview.tsx, or PodPreview.tsx anymore, so I've removed them.
GameServerTable.tsx is still used by the Fleet detail view, so that one stays

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