feat: add optional endpoint basepath in endpoint editor#472
feat: add optional endpoint basepath in endpoint editor#472NomadXD wants to merge 1 commit intoopenchoreo:mainfrom
Conversation
Signed-off-by: Lahiru De Silva <lahirude@wso2.com>
📝 WalkthroughWalkthroughThe changes add optional base path support to endpoint definitions. A new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 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. ✨ 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 Tip You can disable the changed files summary in the walkthrough.Disable the |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
plugins/openchoreo-react/src/components/EndpointEditor/EndpointEditor.tsx (1)
444-450: NormalizebasePathinput 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
📒 Files selected for processing (2)
plugins/openchoreo-common/src/types/bff-types.tsplugins/openchoreo-react/src/components/EndpointEditor/EndpointEditor.tsx
Purpose
This PR adds the optional endpoint basepath to the endpoint editor.
related to #473