Adapt the xDS web UI to the YAML-over-HTTP resource API - #1338
Conversation
Motivation: The web UI, however, still spoke JSON. Modifications: - Web UI, talk YAML to the API. Result: - The xDS web UI reads, edits and saves resources as YAML end-to-end against the HTTP API.
📝 WalkthroughWalkthroughThe webapp and xDS services now use YAML resource handling. Editors gain sticky action bars and YAML validation, API requests use YAML payloads, raw YAML responses are preserved, sample data uses YAML, and successful delete operations return HTTP 204. ChangesWebapp xDS YAML and editor flow
xDS service response and bootstrap contracts
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Editor as ResourceEditor
participant Bar as EditorActionBar
participant API as xdsApiSlice
participant Service as xDS service
Editor->>Bar: render YAML editor actions
Editor->>API: submit YAML resource body
API->>Service: PUT application/yaml
Service-->>API: resource response
API-->>Editor: updated resource state
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
webapp/src/dogma/features/xds/K8sAggregatorStatus.tsx (1)
29-51: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winParse failure is indistinguishable from a genuinely empty/synced result.
On
jsYaml.loadfailure this returns{ localities: 0, endpoints: 0 }, which the caller renders as"Synced · 0 localities · 0 endpoints"— misleading, since a parse failure is a different condition than "synced with zero endpoints."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@webapp/src/dogma/features/xds/K8sAggregatorStatus.tsx` around lines 29 - 51, The countEndpoints function must distinguish YAML parse failures from valid empty results instead of returning zero counts for both. Update its return contract and the caller’s rendering logic to represent parse failure explicitly, while preserving zero counts for successfully parsed content with no endpoints.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@webapp/src/dogma/features/xds/K8sAggregatorEditor.tsx`:
- Around line 174-190: The YAML parse failure handling must surface errors
instead of producing misleading empty success states. In
webapp/src/dogma/features/xds/K8sAggregatorEditor.tsx lines 174-190, update
parseToFormData and its call site to notify the user and prevent resetting the
form to emptyWatcher after jsYaml.load fails. In
webapp/src/dogma/features/xds/K8sAggregatorStatus.tsx lines 29-51, update
countEndpoints and its rendering path to propagate a distinct parse-failed state
and display an error instead of “Synced · 0 localities · 0 endpoints”.
In `@webapp/src/dogma/features/xds/xdsApiSlice.ts`:
- Around line 114-128: Restore legacy .json fallback handling across fetchYaml
and the related ID helper functions: when the YAML request cannot resolve the
resource, retry using the corresponding .json path before returning the error.
Preserve the knownPath optimization and ensure all affected helpers consistently
use the fallback behavior.
In `@webapp/src/dogma/features/xds/XdsTypes.ts`:
- Around line 60-62: Update resourceName to strip both legacy .json and existing
.yaml suffixes from path before constructing the groups/${group} resource name,
preserving the current behavior for paths without either suffix.
---
Outside diff comments:
In `@webapp/src/dogma/features/xds/K8sAggregatorStatus.tsx`:
- Around line 29-51: The countEndpoints function must distinguish YAML parse
failures from valid empty results instead of returning zero counts for both.
Update its return contract and the caller’s rendering logic to represent parse
failure explicitly, while preserving zero counts for successfully parsed content
with no endpoints.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 78f81656-dceb-4021-b0e3-248e86a37a1d
⛔ Files ignored due to path filters (1)
webapp/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (27)
webapp/e2e/xds-resource-edit.spec.tswebapp/package.jsonwebapp/src/dogma/common/components/JsonEditor.tsxwebapp/src/dogma/features/api/baseQuery.tswebapp/src/dogma/features/services/ErrorMessageParser.tswebapp/src/dogma/features/xds/EditorActionBar.tsxwebapp/src/dogma/features/xds/K8sAggregatorEditor.tsxwebapp/src/dogma/features/xds/K8sAggregatorStatus.tsxwebapp/src/dogma/features/xds/ResourceEditor.tsxwebapp/src/dogma/features/xds/XdsTypes.tswebapp/src/dogma/features/xds/xdsApiSlice.tswebapp/src/dogma/features/xds/xdsReferences.tswebapp/tests/dogma/features/xds/K8sAggregatorEditor.test.tsxwebapp/tests/dogma/features/xds/ResourceEditor.test.tsxxds/src/main/java/com/linecorp/centraldogma/xds/group/v1/XdsGroupService.javaxds/src/main/java/com/linecorp/centraldogma/xds/internal/XdsEndpointReadService.javaxds/src/main/java/com/linecorp/centraldogma/xds/internal/XdsResourceManager.javaxds/src/test/java/com/linecorp/centraldogma/xds/XdsTestServer.javaxds/src/test/java/com/linecorp/centraldogma/xds/cluster/v1/XdsClusterServiceTest.javaxds/src/test/java/com/linecorp/centraldogma/xds/endpoint/v1/XdsEndpointServiceTest.javaxds/src/test/java/com/linecorp/centraldogma/xds/group/v1/XdsGroupServiceTest.javaxds/src/test/java/com/linecorp/centraldogma/xds/internal/XdsGroupDeletePermissionTest.javaxds/src/test/java/com/linecorp/centraldogma/xds/internal/XdsLegacyJsonCompatibilityTest.javaxds/src/test/java/com/linecorp/centraldogma/xds/internal/XdsYamlCompatibilityTest.javaxds/src/test/java/com/linecorp/centraldogma/xds/k8s/v1/XdsKubernetesServiceTest.javaxds/src/test/java/com/linecorp/centraldogma/xds/listener/v1/XdsListenerServiceTest.javaxds/src/test/java/com/linecorp/centraldogma/xds/route/v1/XdsRouteServiceTest.java
Motivation:
The web UI still spoke JSON.
Modifications:
Result: