Skip to content

feat: add optional endpoint basepath in endpoint editor#472

Draft
NomadXD wants to merge 1 commit into
openchoreo:mainfrom
NomadXD:main
Draft

feat: add optional endpoint basepath in endpoint editor#472
NomadXD wants to merge 1 commit into
openchoreo:mainfrom
NomadXD:main

Conversation

@NomadXD

@NomadXD NomadXD commented Mar 21, 2026

Copy link
Copy Markdown
Contributor

Purpose

This PR adds the optional endpoint basepath to the endpoint editor.

Screenshot 2026-03-21 at 13 16 51

related to openchoreo/openchoreo#3778

Signed-off-by: Lahiru De Silva <lahirude@wso2.com>
@coderabbitai

coderabbitai Bot commented Mar 21, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The changes add optional base path support to endpoint definitions. A new basePath field was added to the WorkloadEndpoint interface, and the EndpointEditor component was updated to display and edit this field in both read-only and edit modes.

Changes

Cohort / File(s) Summary
Endpoint Base Path Support
plugins/openchoreo-common/src/types/bff-types.ts
Added optional basePath?: string property to the WorkloadEndpoint interface.
Endpoint Base Path UI
plugins/openchoreo-react/src/components/EndpointEditor/EndpointEditor.tsx
Updated read-only display to show basePath after port with · separator. Added "Base Path" TextField in edit mode with placeholder and helper text, bound to the new field via onChange handler.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A basePath hops into the endpoint scene,
Making API routes crisp and clean,
Edit it, display it with style,
Our endpoints just got more versatile! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is minimal and lacks most required template sections including Goals, Approach, User stories, Release notes, Documentation, Training, Certification, Marketing, Automation tests, Security checks, and other critical sections. Complete the PR description using the repository's template. Include Goals, Approach details, User stories, Release notes, Documentation links, Automation test coverage, and Security checks. Add details about testing performed and any impacts on related systems.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding an optional basepath field to the endpoint editor component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
plugins/openchoreo-react/src/components/EndpointEditor/EndpointEditor.tsx (1)

444-450: Normalize basePath input before storing it.

Current handler persists raw input; whitespace and non-slash-prefixed values can be saved as-is. Consider trimming and normalizing to a leading /.

♻️ Proposed refinement
-                onChange={e =>
-                  onChange('basePath', e.target.value || undefined)
-                }
+                onChange={e => {
+                  const raw = e.target.value.trim();
+                  if (!raw) {
+                    onChange('basePath', undefined);
+                    return;
+                  }
+                  onChange('basePath', raw.startsWith('/') ? raw : `/${raw}`);
+                }}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@plugins/openchoreo-react/src/components/EndpointEditor/EndpointEditor.tsx`
around lines 444 - 450, The Base Path TextField currently saves raw input;
update the handler in EndpointEditor (the TextField using
value={endpoint.basePath || ''} and onChange('basePath', ...)) to trim
whitespace, treat an empty string as undefined, and normalize the path to start
with a single leading slash (e.g., remove extra leading slashes then prepend one
if missing) before calling onChange('basePath', ...); reference
endpoint.basePath and the onChange invocation to locate and replace the current
inline handler.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@plugins/openchoreo-react/src/components/EndpointEditor/EndpointEditor.tsx`:
- Around line 444-450: The Base Path TextField currently saves raw input; update
the handler in EndpointEditor (the TextField using value={endpoint.basePath ||
''} and onChange('basePath', ...)) to trim whitespace, treat an empty string as
undefined, and normalize the path to start with a single leading slash (e.g.,
remove extra leading slashes then prepend one if missing) before calling
onChange('basePath', ...); reference endpoint.basePath and the onChange
invocation to locate and replace the current inline handler.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 919296b7-ea55-42e1-ab99-187965528d64

📥 Commits

Reviewing files that changed from the base of the PR and between a523aaf and d68dd5e.

📒 Files selected for processing (2)
  • plugins/openchoreo-common/src/types/bff-types.ts
  • plugins/openchoreo-react/src/components/EndpointEditor/EndpointEditor.tsx

@LakshanSS LakshanSS marked this pull request as draft March 23, 2026 09:24
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