Skip to content

chore: integrate podtemplate/details endpoint into frontend - #1278

Open
andyatmiami wants to merge 1 commit into
kubeflow:notebooks-v2from
andyatmiami:feat/frontend-details-endpoint-migration
Open

chore: integrate podtemplate/details endpoint into frontend#1278
andyatmiami wants to merge 1 commit into
kubeflow:notebooks-v2from
andyatmiami:feat/frontend-details-endpoint-migration

Conversation

@andyatmiami

Copy link
Copy Markdown
Contributor

Migrate the workspace details drawer to fetch volumes, labels, and annotations from the dedicated GET /workspaces/{ns}/{name}/podtemplate/details endpoint (PR #1119) instead of reading them from the list-item payload. This prepares the frontend for PR #1253, which removes pendingRestart, podTemplate.podMetadata, and podTemplate.volumes from the list response.

New hook — useWorkspaceDetails:

  • Follows the established useFetchState pattern (useCallback → useFetchState)
  • Fetches DetailsWorkspaceDetails on-demand when a workspace is selected
  • Returns [data, loaded, error, refresh] matching the standard tuple

Overview tab — labels from details endpoint:

  • WorkspaceDetailsOverview now receives details/detailsLoaded props
  • Labels read from details?.podMetadata.labels instead of the list item
  • Shows a Spinner while the details request is in-flight

Resources tab — volumes from details endpoint:

  • WorkspaceResources now receives details/detailsLoaded props
  • Home volume and data volumes read from details?.volumes instead of the list item, with Spinner placeholders during loading

Activity tab — pendingRestart computed from redirect chains:

Start/Stop modals — drop pendingRestart guard:

  • workspacePendingUpdate condition simplified from workspace?.pendingRestart && (redirectChain checks) to !!workspace && (redirectChain checks)
  • The !!workspace guard provides explicit null narrowing for TypeScript

Mock builders — backward-compatible refactoring:

  • buildMockWorkspaceUpdateFromWorkspace accepts optional podMetadata and volumes args, falling back to list-item fields when not provided, so existing callers are unaffected
  • New buildMockWorkspaceDetails builder for the details endpoint response
  • mockNotebookApis details mock derives data from the workspace list item for consistency with other mock endpoints

Cypress tests — details endpoint intercepts:

  • Add interceptApi type overload for the podtemplate/details route
  • Add details endpoint intercepts in setupWorkspaceActionTest and the multi-workspace drawer switching test to prevent unhandled requests

@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from andyatmiami. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow Bot added area/v2 area - version - kubeflow notebooks v2 size/L labels Jul 24, 2026
Migrate the workspace details drawer to fetch volumes, labels, and
annotations from the dedicated GET /workspaces/{ns}/{name}/podtemplate/details
endpoint (PR kubeflow#1119) instead of reading them from the list-item payload.
This prepares the frontend for PR kubeflow#1253, which removes pendingRestart,
podTemplate.podMetadata, and podTemplate.volumes from the list response.

New hook — useWorkspaceDetails:
- Follows the established useFetchState pattern (useCallback → useFetchState)
- Fetches DetailsWorkspaceDetails on-demand when a workspace is selected
- Returns [data, loaded, error, refresh] matching the standard tuple

Overview tab — labels from details endpoint:
- WorkspaceDetailsOverview now receives details/detailsLoaded props
- Labels read from details?.podMetadata.labels instead of the list item
- Shows a Spinner while the details request is in-flight

Resources tab — volumes from details endpoint:
- WorkspaceResources now receives details/detailsLoaded props
- Home volume and data volumes read from details?.volumes instead of
  the list item, with Spinner placeholders during loading

Activity tab — pendingRestart computed from redirect chains:
- Removes direct use of workspace.pendingRestart (will be dropped by kubeflow#1253)
- Derives the same boolean from redirectChain length on podConfig and
  imageConfig, which is semantically equivalent

Start/Stop modals — drop pendingRestart guard:
- workspacePendingUpdate condition simplified from
  `workspace?.pendingRestart && (redirectChain checks)` to
  `!!workspace && (redirectChain checks)`
- The !!workspace guard provides explicit null narrowing for TypeScript

Mock builders — backward-compatible refactoring:
- buildMockWorkspaceUpdateFromWorkspace accepts optional podMetadata
  and volumes args, falling back to list-item fields when not provided,
  so existing callers are unaffected
- New buildMockWorkspaceDetails builder for the details endpoint response
- mockNotebookApis details mock derives data from the workspace list
  item for consistency with other mock endpoints

Cypress tests — details endpoint intercepts:
- Add interceptApi type overload for the podtemplate/details route
- Add details endpoint intercepts in setupWorkspaceActionTest and the
  multi-workspace drawer switching test to prevent unhandled requests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Andy Stoneberg <astonebe@redhat.com>
@andyatmiami
andyatmiami force-pushed the feat/frontend-details-endpoint-migration branch from 65cd845 to 3c5e7b9 Compare July 27, 2026 16:58
@andyatmiami
andyatmiami marked this pull request as ready for review July 27, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/frontend area - related to frontend components area/v2 area - version - kubeflow notebooks v2 size/L

Projects

Status: Needs Triage

Development

Successfully merging this pull request may close these issues.

1 participant