Skip to content

fix: hide Endpoints tab in Workload Editor for CronJob/Job types#443

Merged
kaviththiranga merged 2 commits intoopenchoreo:mainfrom
kaviththiranga:fix-endpoints-for-jobs
Mar 19, 2026
Merged

fix: hide Endpoints tab in Workload Editor for CronJob/Job types#443
kaviththiranga merged 2 commits intoopenchoreo:mainfrom
kaviththiranga:fix-endpoints-for-jobs

Conversation

@kaviththiranga
Copy link
Contributor

@kaviththiranga kaviththiranga commented Mar 18, 2026

CronJob and Job workloads don't expose network endpoints, so the
Endpoints tab is now hidden in form mode. A non-blocking warning
is shown in YAML mode when endpoints are present for these types.

Resolves: openchoreo/openchoreo#2838

Screenshot 2026-03-19 at 04 53 59 Screenshot 2026-03-19 at 04 55 12

Summary by CodeRabbit

  • Bug Fixes

    • Endpoints tab is now hidden for batch workloads (CronJob/Job types).
    • Validation warns when endpoints are present in batch workload YAML mode.
  • UX Improvements

    • Shows a warning alert in YAML mode if endpoints are configured for batch workloads.
    • Automatically switches to a valid sub-tab if the current tab becomes invalid after hiding endpoints.

  CronJob and Job workloads don't expose network endpoints, so the
  Endpoints tab is now hidden in form mode. A non-blocking warning
  is shown in YAML mode when endpoints are present for these types.

  Resolves: openchoreo/openchoreo#2838

Signed-off-by: Kavith Lokuhewage <kaviththiranga@gmail.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 91f16906-9841-4d43-8ca2-b3e0e0436a53

📥 Commits

Reviewing files that changed from the base of the PR and between fee39c8 and 8a0dfc1.

📒 Files selected for processing (1)
  • plugins/openchoreo/src/components/Environments/Workload/WorkloadEditor/WorkloadEditor.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugins/openchoreo/src/components/Environments/Workload/WorkloadEditor/WorkloadEditor.tsx

📝 Walkthrough

Walkthrough

Adds an optional componentTypeName prop (sourced from entity.metadata.annotations) to the WorkloadEditor and uses it to conditionally hide the Endpoints tab for batch workload types; also adds YAML-mode validation warning for endpoints when that tab is hidden.

Changes

Cohort / File(s) Summary
Workload Configuration
plugins/openchoreo/src/components/Environments/Workload/WorkloadConfigPage.tsx
Passes componentTypeName={entity.metadata.annotations?.[CHOREO_ANNOTATIONS.COMPONENT_TYPE]} into WorkloadEditor.
Workload Editor
plugins/openchoreo/src/components/Environments/Workload/WorkloadEditor.tsx
Adds componentTypeName?: string prop; derives hideEndpoints for cronjob/job; filters navigation to remove endpoints tab; adds yamlWarning state and warning rendering for YAML mode when spec.endpoints exists; guards active-tab transitions.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #2838: Implements hiding the Endpoints tab for CronJob/Job component types by introducing component-type-aware tab visibility.

Possibly related PRs

Suggested reviewers

  • sameerajayasoma
  • jhivandb

Poem

🐇 I hopped into the editor light,
Found endpoints hiding out of sight,
For jobs and crons that run then sleep,
No open ports — just dreams to keep,
I nibble code and dance with delight.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description provides purpose, approach with screenshots, and a link to the resolved issue, but omits most template sections like goals, user stories, release notes, and testing details. Complete the description template by adding Goals, User Stories, Release Notes, Documentation, and Automation Tests sections to provide comprehensive context.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly and concisely describes the main change: hiding the Endpoints tab for CronJob/Job workload types.
Linked Issues check ✅ Passed The implementation fully addresses issue #2838 by hiding the Endpoints tab for CronJob/Job types and displaying a warning in YAML mode when endpoints exist for these workload types.
Out of Scope Changes check ✅ Passed All changes are scoped to the stated objective: adding componentTypeName prop, hiding endpoints tab, and warning in YAML mode. Tab navigation history handling is a necessary implementation detail.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@plugins/openchoreo/src/components/Environments/Workload/WorkloadEditor/WorkloadEditor.tsx`:
- Around line 583-591: The effect that normalizes invalid workload sub-tabs
(useEffect referencing WORKLOAD_SUB_TABS, activeTab, workloadNavItems,
setActiveTab) currently just calls setActiveTab('container') which results in a
new history entry; instead update the URL using a history replace so the bad
query param is replaced not pushed. Locate the block where
setActiveTab('container') is invoked and perform a URL update via your router's
replace API (e.g., history.replace(...) or navigate(..., { replace: true })) to
set ?tab=container, then call setActiveTab('container') (or derive activeTab
from the URL) so the back button does not return to the invalid tab entry.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9c2584ab-8a85-4bb4-a831-19b15c0305bf

📥 Commits

Reviewing files that changed from the base of the PR and between b1f88a7 and fee39c8.

📒 Files selected for processing (2)
  • plugins/openchoreo/src/components/Environments/Workload/WorkloadConfigPage.tsx
  • plugins/openchoreo/src/components/Environments/Workload/WorkloadEditor/WorkloadEditor.tsx

yashodgayashan
yashodgayashan previously approved these changes Mar 19, 2026
stefinie123
stefinie123 previously approved these changes Mar 19, 2026
  Both workload and component sub-tab guards now use setActiveTab(tab, true)
  to replace the URL instead of pushing, preventing a back-button loop when
  redirecting away from an invalid tab (e.g. ?tab=endpoints on a CronJob).

  Resolves: openchoreo/openchoreo#2838

Signed-off-by: Kavith Lokuhewage <kaviththiranga@gmail.com>
@kaviththiranga kaviththiranga merged commit 4942cb1 into openchoreo:main Mar 19, 2026
6 checks passed
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.

Hide Endpoints tab in Workload Editor for CronJob and Job component types

3 participants