Surface entity lifecycle status control (apps + components)#87
Open
bburda wants to merge 11 commits into
Open
Conversation
Add EntityStatusControl consuming the gateway 0.6.0 lifecycle API
(GET/PUT /{apps,components}/{id}/status). Renders current readiness as
a badge and exposes the five lifecycle transitions (start, restart,
force-restart, shutdown, force-shutdown) as action buttons. A 501 from
the gateway (no lifecycle provider configured) is surfaced as a disabled
"not available" state instead of an error.
Add getStatus/setStatus dispatch helpers in api-dispatch.ts (narrowed to
the apps/components entity types that expose the lifecycle collection)
plus LifecycleAction/LifecycleStatus types. Mount the control on the app
header (AppsPanel) and the component header (EntityDetailPanel).
There was a problem hiding this comment.
Pull request overview
Adds a new UI control to surface gateway 0.6.0 lifecycle status/transition actions for apps and components, wiring it into the existing entity detail views via the typed OpenAPI client dispatch layer.
Changes:
- Added lifecycle status/action type definitions and API dispatch helpers (
getStatus/setStatus) for apps/components. - Introduced
EntityStatusControlUI component + Vitest coverage for status rendering and action handling (incl. 501 “not available”). - Integrated the control into Apps and Component detail UIs and documented the feature in the README.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
src/lib/types.ts |
Adds lifecycle action/status union types for gateway 0.6.0 lifecycle API. |
src/lib/api-dispatch.ts |
Adds app/component-only lifecycle status GET and transition PUT dispatch helpers. |
src/components/EntityStatusControl.tsx |
New UI control showing readiness badge + lifecycle transition buttons with 501 handling. |
src/components/EntityStatusControl.test.tsx |
New tests validating rendering, action calls, refresh behavior, and 501 handling. |
src/components/EntityDetailPanel.tsx |
Renders lifecycle control for components in the detail header. |
src/components/AppsPanel.tsx |
Renders lifecycle control for apps in the app header area. |
README.md |
Documents the new lifecycle status control feature. |
Comment on lines
+65
to
+69
| const [currentStatus, setCurrentStatus] = useState<LifecycleStatus | null>(toLifecycleStatus(status)); | ||
| const [pendingAction, setPendingAction] = useState<LifecycleAction | null>(null); | ||
| const [notAvailable, setNotAvailable] = useState(false); | ||
| const [error, setError] = useState<string | null>(null); | ||
|
|
Comment on lines
+141
to
+144
| {/* Lifecycle status control (gateway 0.6.0 lifecycle API) */} | ||
| <div className="mt-4"> | ||
| <EntityStatusControl entityType="apps" entityId={appId} /> | ||
| </div> |
Comment on lines
+81
to
+85
| /** | ||
| * Lifecycle readiness value reported by GET /{entity}/{id}/status and carried | ||
| * on AppDetail/ComponentDetail. | ||
| */ | ||
| export type LifecycleStatus = 'ready' | 'notReady'; |
Comment on lines
+76
to
+83
| if (result.response.status === 501) { | ||
| setNotAvailable(true); | ||
| return; | ||
| } | ||
| if (result.data && typeof result.data.status === 'string') { | ||
| const next = toLifecycleStatus(result.data.status); | ||
| if (next) setCurrentStatus(next); | ||
| } |
| {/* Lifecycle status control (gateway 0.6.0 lifecycle API) */} | ||
| {isComponent && ( | ||
| <div className="mt-4"> | ||
| <EntityStatusControl entityType="components" entityId={entityId} /> |
Prefer an entity's description (e.g. a component's host OS string 'Ubuntu 24.04.4 LTS on x86_64') over the raw name/hostname for the tree node label and the component detail header. The hostname/id stays discoverable via the tree node tooltip and the detail path. Falls back to the name when there is no description.
2f5f6eb to
35c2b5d
Compare
…tus prop
The EntityStatusControl reads readiness from the shared store keyed by
entity, so the declared status prop was dead. Remove it and clarify the
status doc comment to reference the GET /apps/{id} and GET /components/{id}
responses. Also clear the local error on entity change so a failed
transition on one entity cannot linger after the selection switches.
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.
Summary
Add an
EntityStatusControlto the Apps and Components entity detail, consuming the gateway 0.6.0 lifecycle status API. It shows the live readiness status (ready / notReady) and offers the transition actions (start / restart / force-restart / shutdown / force-shutdown) via the typed client. The501"no lifecycle provider configured" case is surfaced as a disabled not-available state. Lifecycle status exists only for apps and components (not areas/functions).Issue
Type
Testing
In a worktree branched from
origin/main(post-0.6.0-migration):npm run lint(eslint) - cleannpm run typecheck(tsc --noEmit) - cleannpm test -- --run(vitest) - 421 passed (18 files, incl. 7 newEntityStatusControltests)npm run build- succeedsChecklist
npm run lint)npm run build)