console icon indicating copy to clipboard operation
console copied to clipboard

OCPBUGS-66891: "Install" button on operator detail page should be disabled when the operator is in installing status

Open krishagarwal278 opened this issue 1 month ago โ€ข 8 comments

After

https://github.com/user-attachments/assets/5b2d996e-1fde-49cc-b848-81f2b9a371b8

krishagarwal278 avatar Dec 11 '25 11:12 krishagarwal278

@krishagarwal278: This pull request references Jira Issue OCPBUGS-66891, which is invalid:

  • expected the bug to target the "4.21.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

Before

image

After

image

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

openshift-ci-robot avatar Dec 11 '25 11:12 openshift-ci-robot

Walkthrough

Replaces Link CTAs with Button CTAs supporting disabled/loading states, adds operator installation-state detection to drive CTA behavior, and propagates a new disabled flag through the catalog CTA type, useCtaLink hook, modal rendering, and operator catalog item generation.

Changes

Cohort / File(s) Summary
Operator hub UI
frontend/packages/operator-lifecycle-manager/src/components/operator-hub/operator-hub-items.tsx
Replaced Link/CSS import with PatternFly Spinner; switched overlay install action from Link to Button (rendered as anchor via component+href). Added memoized isOperatorInstalling (based on detailsItem.subscription and CSV phase) to set isLoading/isDisabled, show spinner, and adjusted related logging and table string formatting.
Catalog CTA type
frontend/packages/console-dynamic-plugin-sdk/src/extensions/catalog.ts
Added optional disabled?: boolean to cta in CatalogItem<T> to represent disabled CTA state in catalog extensions.
Catalog details modal UI
frontend/packages/console-shared/src/components/catalog/details/CatalogDetailsModal.tsx
CTA rendering switched from plain Link to PatternFly Button that wraps a Link via component prop; consumes the new disabled return value from useCtaLink and applies isDisabled. Import set updated to include Button.
Catalog CTA hook
frontend/packages/console-shared/src/components/catalog/hooks/useCtaLink.ts
Hook signature expanded to accept cta.disabled?: boolean and to return [to, label, disabled] (previously [to, label]). Propagates disabled through early returns, handles missing href, and preserves URL construction while stripping catalog-specific query params.
Operator catalog items hook
frontend/packages/operator-lifecycle-manager/src/hooks/useOperatorCatalogItems.tsx
Primary CTA label and state reflect installation progress: label toggles to "Installing" and CTA becomes disabled when installing; uninstall CTA unchanged. No exported signature change.

Estimated code review effort

๐ŸŽฏ 4 (Complex) | โฑ๏ธ ~40 minutes

โœจ Finishing touches
  • [ ] ๐Ÿ“ Generate docstrings
๐Ÿงช Generate unit tests (beta)
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

๐Ÿ“œ Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

๐Ÿ“ฅ Commits

Reviewing files that changed from the base of the PR and between 5e51bfbb9e3a38998f1ef8812acb76ecf46a5730 and b0e593a74e6d61499a061c4c007e63bc3ee9a00c.

๐Ÿ“’ Files selected for processing (4)
  • frontend/packages/console-dynamic-plugin-sdk/src/extensions/catalog.ts
  • frontend/packages/console-shared/src/components/catalog/details/CatalogDetailsModal.tsx
  • frontend/packages/console-shared/src/components/catalog/hooks/useCtaLink.ts
  • frontend/packages/operator-lifecycle-manager/src/hooks/useOperatorCatalogItems.tsx
๐Ÿšง Files skipped from review as they are similar to previous changes (2)
  • frontend/packages/console-dynamic-plugin-sdk/src/extensions/catalog.ts
  • frontend/packages/console-shared/src/components/catalog/details/CatalogDetailsModal.tsx
๐Ÿงฐ Additional context used
๐Ÿ““ Path-based instructions (1)
**

โš™๏ธ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • frontend/packages/operator-lifecycle-manager/src/hooks/useOperatorCatalogItems.tsx
  • frontend/packages/console-shared/src/components/catalog/hooks/useCtaLink.ts
๐Ÿงฌ Code graph analysis (2)
frontend/packages/operator-lifecycle-manager/src/hooks/useOperatorCatalogItems.tsx (1)
frontend/__mocks__/i18next.ts (1)
  • t (8-14)
frontend/packages/console-shared/src/components/catalog/hooks/useCtaLink.ts (1)
frontend/packages/console-shared/src/components/catalog/hooks/index.ts (1)
  • useCtaLink (2-2)
๐Ÿ”‡ Additional comments (2)
frontend/packages/console-shared/src/components/catalog/hooks/useCtaLink.ts (1)

4-30: LGTM! Clean extension of the CTA API.

The hook correctly extends the return type to include a disabled flag with appropriate default handling. All return paths properly propagate the disabled state, and the URL construction logic remains intact.

frontend/packages/operator-lifecycle-manager/src/hooks/useOperatorCatalogItems.tsx (1)

238-250: CTA configuration correctly reflects installation state.

The logic properly toggles the label between "Install" and "Installing" and disables the CTA during installation. The implementation aligns with the PR objective to prevent multiple installation attempts.

Note: The correctness of this implementation depends on the isInstalling flag accurately representing active installation (see previous comment on lines 198-202).


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

coderabbitai[bot] avatar Dec 11 '25 11:12 coderabbitai[bot]

/jira refresh

krishagarwal278 avatar Dec 11 '25 11:12 krishagarwal278

@krishagarwal278: This pull request references Jira Issue OCPBUGS-66891, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.21.0) matches configured target version for branch (4.21.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact: /cc @yapei

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

openshift-ci-robot avatar Dec 11 '25 11:12 openshift-ci-robot

@krishagarwal278: This pull request references Jira Issue OCPBUGS-66891, which is invalid:

  • expected the bug to target either version "4.22." or "openshift-4.22.", but it targets "4.21.0" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

After

https://github.com/user-attachments/assets/5b2d996e-1fde-49cc-b848-81f2b9a371b8

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

openshift-ci-robot avatar Dec 12 '25 14:12 openshift-ci-robot

@krishagarwal278 Checked on cluster with the pr code, the 'Install' button is not disabled when operator is installing.

https://github.com/user-attachments/assets/56c6455e-714c-4e2e-b818-2eb7ae626281

There is a status notice 'Installing' on the right, I think we could disable the 'Install' button at the same time when this 'Installing' notice appears.

yanpzhan avatar Dec 15 '25 03:12 yanpzhan

/retest

krishagarwal278 avatar Dec 22 '25 11:12 krishagarwal278

hi @yanpzhan if you click on that button, there's a installation page. The button is disabled there. But if you think it's better to disable on the modal itself, i can also do that ๐Ÿ‘๐Ÿป

krishagarwal278 avatar Dec 22 '25 11:12 krishagarwal278

hi @yanpzhan if you click on that button, there's a installation page. The button is disabled there. But if you think it's better to disable on the modal itself, i can also do that ๐Ÿ‘๐Ÿป

Yeah, it's better to disable on the modal itself.

yanpzhan avatar Dec 22 '25 14:12 yanpzhan

Hi @yanpzhan, as you suggested, the install button is now disabled on the modal itself ๐Ÿ‘๐Ÿป

Screenshot 2025-12-23 at 1 57 59โ€ฏAM Screenshot 2025-12-23 at 1 58 01โ€ฏAM

krishagarwal278 avatar Dec 22 '25 20:12 krishagarwal278

/retest

krishagarwal278 avatar Dec 23 '25 14:12 krishagarwal278

/retest

krishagarwal278 avatar Dec 23 '25 15:12 krishagarwal278

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: krishagarwal278 Once this PR has been reviewed and has the lgtm label, please ask for approval from jhadvig. For more information see the Code Review Process.

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

Needs approval from an approver in each of these files:

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

openshift-ci[bot] avatar Dec 23 '25 19:12 openshift-ci[bot]

@krishagarwal278: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/images b0e593a74e6d61499a061c4c007e63bc3ee9a00c link true /test images
ci/prow/frontend b0e593a74e6d61499a061c4c007e63bc3ee9a00c link true /test frontend
ci/prow/analyze b0e593a74e6d61499a061c4c007e63bc3ee9a00c link true /test analyze
ci/prow/okd-scos-images b0e593a74e6d61499a061c4c007e63bc3ee9a00c link true /test okd-scos-images
ci/prow/e2e-gcp-console b0e593a74e6d61499a061c4c007e63bc3ee9a00c link true /test e2e-gcp-console

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

openshift-ci[bot] avatar Dec 23 '25 19:12 openshift-ci[bot]