Skip to content

SANDBOX-1769 | feature: disable integrations in the UI#59

Open
MikelAlejoBR wants to merge 3 commits intocodeready-toolchain:masterfrom
MikelAlejoBR:SANDBOX-1769-feature-enable-integrations-ui
Open

SANDBOX-1769 | feature: disable integrations in the UI#59
MikelAlejoBR wants to merge 3 commits intocodeready-toolchain:masterfrom
MikelAlejoBR:SANDBOX-1769-feature-enable-integrations-ui

Conversation

@MikelAlejoBR
Copy link
Copy Markdown
Contributor

@MikelAlejoBR MikelAlejoBR commented Apr 20, 2026

There are times when we want to disable certain faulty integrations in the UI, so that we can prevent customers from accessing them and having a bad experience.

These changes read the new "disabledIntegrations" from the registration service to hide the integrations that are disabled.

Assisted-by: Cursor with claude-4.6-opus-max-thinking

Jira ticket

[SANDBOX-1769]

Summary by CodeRabbit

  • New Features

    • Administrators can disable specific integrations via configuration; disabled integrations are hidden from the product catalog so end users only see enabled offerings.
    • Catalog rendering now waits for UI configuration and will not show entries until disabled-integrations info is available.
  • Tests

    • Added tests covering integration-filtering and catalog rendering under various configuration states.

There are times when we want to disable certain faulty integrations in
the UI, so that we can prevent customers from accessing them and having
a bad experience.

These changes read the new "disabledIntegrations" from the registration
service to hide the integrations that are disabled.

Assisted-by: Cursor with claude-4.6-opus-max-thinking

SANDBOX-1769
@openshift-ci openshift-ci bot requested review from metlos and mfrancisc April 20, 2026 14:43
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 20, 2026

Warning

Rate limit exceeded

@MikelAlejoBR has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 48 minutes and 52 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 48 minutes and 52 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5aa168fd-61d8-467d-90c8-727ba1793945

📥 Commits

Reviewing files that changed from the base of the PR and between 4d51a10 and bb2d900.

📒 Files selected for processing (1)
  • plugins/sandbox/src/components/SandboxCatalog/SandboxCatalogGrid.tsx

Walkthrough

Adds propagation and consumption of an optional disabledIntegrations?: string[] UI config field: backend type updated, provider fetches and exposes it (with error handling), catalog grid filters products and returns null while loading, and tests updated to cover these behaviors.

Changes

Cohort / File(s) Summary
API Types
plugins/sandbox/src/api/RegistrationBackendClient.tsx
Extended exported UIConfig with optional disabledIntegrations?: string[].
API Tests
plugins/sandbox/src/api/__tests__/RegistrationBackendClient.test.tsx
Added test for getUIConfig returning disabledIntegrations; updated empty-config test to assert disabledIntegrations is undefined.
Context & Hooks
plugins/sandbox/src/hooks/useSandboxContext.tsx
Added disabledIntegrations?: string[] to SandboxContextType; SandboxProvider now fetches disabledIntegrations from getUIConfig(), normalizes to empty array on missing/invalid values, sets state in try/catch and logs errors.
Component Logic
plugins/sandbox/src/components/SandboxCatalog/SandboxCatalogGrid.tsx
Reads disabledIntegrations from context; memoizes enabledProducts by excluding disabled IDs; initializes useGreenCorners from enabled list; returns null while disabledIntegrations is undefined; renders cards from enabledProducts.
Component Tests
plugins/sandbox/src/components/SandboxCatalog/__tests__/SandboxCatalogGrid.test.tsx
Mocks useSandboxContext (defaulting disabledIntegrations to []); added tests for: loading state (undefined → no cards), partial disabling (omit specific product cards), and all-disabled (zero cards).

Sequence Diagram

sequenceDiagram
    participant Backend as Backend Service
    participant Provider as SandboxProvider
    participant Context as SandboxContext
    participant Grid as SandboxCatalogGrid

    Backend->>Provider: getUIConfig()
    rect rgba(200,200,255,0.5)
    Provider->>Provider: parse response\nextract disabledIntegrations\nnormalize or set []
    end
    Provider->>Context: update context value (disabledIntegrations)
    Grid->>Context: useSandboxContext() → read disabledIntegrations
    rect rgba(200,255,200,0.5)
    Grid->>Grid: useMemo filter productData\ncreate enabledProducts
    Grid->>Grid: render enabledProducts (or return null if loading)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main change: adding a feature to disable integrations in the UI, with a ticket reference.
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.

Copy link
Copy Markdown

@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: 2

🤖 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/sandbox/src/components/SandboxCatalog/SandboxCatalogGrid.tsx`:
- Around line 27-34: enabledProducts is set to [] while loading
(disabledIntegrations === undefined) which causes
useGreenCorners(enabledProducts) to get an empty list and its effect to
overwrite the triedProducts cookie; change the call so that when
disabledIntegrations is undefined you pass the full productData into
useGreenCorners (i.e., compute enabledProducts = disabledIntegrations ===
undefined ? productData : productData.filter(p =>
!disabledIntegrations.includes(p.id))) so useGreenCorners receives the real
product list during loading and does not clear persisted state; update
references to enabledProducts and the useMemo keying if needed to include
productData and disabledIntegrations.

In `@plugins/sandbox/src/hooks/useSandboxContext.tsx`:
- Around line 239-243: Normalize the external uiConfig.disabledIntegrations
before calling setDisabledIntegrations: call registerApi.getUIConfig(), then
compute const safeDisabled = Array.isArray(uiConfig.disabledIntegrations) ?
uiConfig.disabledIntegrations : []; and pass safeDisabled to
setDisabledIntegrations so non-array or malformed values never reach the grid;
keep existing handling for workatoWebHookURL and use uiConfig as before.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e6f2d361-ec63-4103-8e47-a9fd084d86b0

📥 Commits

Reviewing files that changed from the base of the PR and between 4a95807 and aa367fe.

📒 Files selected for processing (5)
  • plugins/sandbox/src/api/RegistrationBackendClient.tsx
  • plugins/sandbox/src/api/__tests__/RegistrationBackendClient.test.tsx
  • plugins/sandbox/src/components/SandboxCatalog/SandboxCatalogGrid.tsx
  • plugins/sandbox/src/components/SandboxCatalog/__tests__/SandboxCatalogGrid.test.tsx
  • plugins/sandbox/src/hooks/useSandboxContext.tsx

Comment thread plugins/sandbox/src/hooks/useSandboxContext.tsx Outdated
These changes prevent wiping the "green corner" cookie which stored the
users' active trials by accident introduced by the new changes, and it
also introduces a type check to make sure that we guard the UI from any
unexpected array structures that might come from the back end.

SANDBOX-1769
SANDBOX-1769
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 20, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexeykazakov, MikelAlejoBR

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [MikelAlejoBR,alexeykazakov]

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants