feat(ui-agent-workspace): added agent workspace list view#1093
feat(ui-agent-workspace): added agent workspace list view#1093MarsKubeX merged 1 commit intokortex-hub:mainfrom
Conversation
Signed-off-by: Marcel Bertagnini <mbertagn@redhat.com>
📝 WalkthroughWalkthroughAdds a new "Agent Workspaces" page to the application with navigation enum values, type definitions, UI components (card and list), a Svelte store for workspace data, routing configuration, and navigation registry entry to enable users to view agent workspaces. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.svelte (1)
20-23: Use a responsive column layout.
grid-cols-3locks this page to three columns, so cards will get cramped or overflow when the desktop window is narrowed.♻️ Suggested tweak
- <div class="grid grid-cols-3 gap-4 p-5 w-full h-fit"> + <div class="grid grid-cols-1 gap-4 p-5 w-full h-fit md:grid-cols-2 xl:grid-cols-3">🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.svelte` around lines 20 - 23, The layout uses a fixed three-column grid which breaks at narrower widths; update the container in AgentWorkspaceList.svelte (the div rendering {`#each` $agentWorkspaces as workspace (workspace.id)} and AgentWorkspaceCard) to use responsive grid column classes so the number of columns adapts to viewport size (for example: single column on small screens, two on medium, three on large). Replace the static "grid-cols-3" style with responsive variants like "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3" (or your project's equivalent breakpoints) and ensure existing gap/padding classes remain intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/renderer/src/stores/agent-workspaces.ts`:
- Around line 24-35: The store currently initializes agentWorkspaces as an empty
array which makes UI treat "loading" as "empty"; change the store type to
Writable<AgentWorkspaceSummary[] | undefined> and initialize it with
writable(undefined), keep fetchAgentWorkspaces() and its
agentWorkspaces.set(data) behavior the same, and ensure the startup listener
(window.addEventListener('system-ready', ...)) still calls
fetchAgentWorkspaces(). Update consumers (notably AgentWorkspaceList.svelte) to
treat undefined as loading and [] as a genuine empty result so the empty-screen
no longer flashes during initial load.
---
Nitpick comments:
In `@packages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.svelte`:
- Around line 20-23: The layout uses a fixed three-column grid which breaks at
narrower widths; update the container in AgentWorkspaceList.svelte (the div
rendering {`#each` $agentWorkspaces as workspace (workspace.id)} and
AgentWorkspaceCard) to use responsive grid column classes so the number of
columns adapts to viewport size (for example: single column on small screens,
two on medium, three on large). Replace the static "grid-cols-3" style with
responsive variants like "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3" (or your
project's equivalent breakpoints) and ensure existing gap/padding classes remain
intact.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 41543299-eb74-4339-a2af-ee600f3fe67f
📒 Files selected for processing (13)
packages/api/src/navigation-page.tspackages/api/src/navigation-request.tspackages/renderer/src/App.sveltepackages/renderer/src/lib/agent-workspaces/AgentWorkspaceCard.spec.tspackages/renderer/src/lib/agent-workspaces/AgentWorkspaceCard.sveltepackages/renderer/src/lib/agent-workspaces/AgentWorkspaceEmptyScreen.sveltepackages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.spec.tspackages/renderer/src/lib/agent-workspaces/AgentWorkspaceList.sveltepackages/renderer/src/navigation.spec.tspackages/renderer/src/navigation.tspackages/renderer/src/stores/agent-workspaces.tspackages/renderer/src/stores/navigation/navigation-registry-agent-workspaces.svelte.tspackages/renderer/src/stores/navigation/navigation-registry.ts
| export const agentWorkspaces: Writable<AgentWorkspaceSummary[]> = writable([]); | ||
|
|
||
| export async function fetchAgentWorkspaces(): Promise<void> { | ||
| const data = await window.listAgentWorkspaces(); | ||
| agentWorkspaces.set(data); | ||
| } | ||
|
|
||
| window.addEventListener('system-ready', () => { | ||
| fetchAgentWorkspaces().catch((error: unknown) => { | ||
| console.error('Failed to fetch agent workspaces', error); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Don't conflate "loading" with "empty".
This store starts at [] and is populated asynchronously, while AgentWorkspaceList.svelte shows its empty screen whenever the array is empty. Users with real workspaces will briefly see "No agent workspaces" until the first fetch resolves.
💡 Minimal direction
-export const agentWorkspaces: Writable<AgentWorkspaceSummary[]> = writable([]);
+export const agentWorkspaces: Writable<AgentWorkspaceSummary[] | undefined> = writable(undefined);Then have AgentWorkspaceList.svelte treat undefined as "loading" and [] as a real empty result.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/renderer/src/stores/agent-workspaces.ts` around lines 24 - 35, The
store currently initializes agentWorkspaces as an empty array which makes UI
treat "loading" as "empty"; change the store type to
Writable<AgentWorkspaceSummary[] | undefined> and initialize it with
writable(undefined), keep fetchAgentWorkspaces() and its
agentWorkspaces.set(data) behavior the same, and ensure the startup listener
(window.addEventListener('system-ready', ...)) still calls
fetchAgentWorkspaces(). Update consumers (notably AgentWorkspaceList.svelte) to
treat undefined as loading and [] as a genuine empty result so the empty-screen
no longer flashes during initial load.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
| </script> | ||
|
|
||
| <NavPage searchEnabled={false} title="Agent Workspaces"> | ||
| {#snippet additionalActions()} |
There was a problem hiding this comment.
WDYT about adding the search in here?
There was a problem hiding this comment.
I think it's a good idea, but I prefer to handle the search feat in another PR.
Added agent workspace list view with the current attributes for workspaces list from the CLI. Agent workspaces are mocked in
agent-workspace-mock-data.tsPart of #1040
Basic unit tests provided.