Skip to content

AGENT-1160: ABI - add finalizing page#2894

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift-assisted:masterfrom
rawagner:final_page
Apr 7, 2025
Merged

AGENT-1160: ABI - add finalizing page#2894
openshift-merge-bot[bot] merged 1 commit intoopenshift-assisted:masterfrom
rawagner:final_page

Conversation

@rawagner
Copy link
Copy Markdown
Member

@rawagner rawagner commented Apr 3, 2025

Screenshot From 2025-04-03 14-45-05

Summary by CodeRabbit

  • New Features

    • Enhanced the cluster interface with a dynamic finalization screen during installation, offering progress feedback, troubleshooting options, and a direct link to the web console.
  • Documentation

    • Introduced updated messages to guide users on verifying console access and understanding installation status.
  • Chores

    • Removed an outdated node reboot modal and its styling to streamline the cluster management experience.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 3, 2025
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 3, 2025

@rawagner: This pull request references AGENT-1160 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.19.0" version, but no target version was set.

Details

In response to this:

Screenshot From 2025-04-03 14-45-05

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 openshift-ci bot requested review from celdrake and jgyselov April 3, 2025 12:48
@openshift-ci openshift-ci bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 3, 2025
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 7, 2025
@openshift-ci
Copy link
Copy Markdown

openshift-ci bot commented Apr 7, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ElayAharoni, rawagner

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:

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

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2025

Walkthrough

This pull request introduces a new custom hook, useFinalizerPage, in the cluster page component to manage logic for displaying either a finalizer or standard UI based on cluster status. A new SingleClusterFinalizerPage component has been added to present a dedicated finalizer UI. Several new translation entries have been added to provide detailed messaging for the cluster installation process. Additionally, an export for the troubleshooting button has been added, while outdated reboot modal files (both CSS and TSX) and commented-out references have been removed.

Changes

File(s) Change Summary
apps/assisted-disconnected-ui/src/components/ClusterPage.tsx
apps/assisted-disconnected-ui/src/components/SingleClusterFinalizerPage.tsx
Introduced useFinalizerPage hook in ClusterPage to manage finalizer logic and conditionally render either SingleClusterFinalizerPage (new component for finalizing a cluster) or the existing SingleClusterPage.
libs/locales/lib/en/translation.json Added new translation entries for messages regarding the webconsole URL, cluster installation progress, and related instructions.
libs/ui-lib/lib/common/components/clusterDetail/index.ts Exported TroubleshootingOpenshiftConsoleButton from the ConsoleModal module to enhance component accessibility.
libs/ui-lib/lib/ocm/components/clusterDetail/RebootNodeZeroModal.{css,tsx} Removed the CSS file and TSX component related to the reboot modal, eliminating the UI and logic for rebooting a node.
libs/ui-lib/lib/ocm/components/clusters/ClusterPage.tsx Removed commented-out code referencing the deprecated RebootNodeZeroModal within the feature support provider.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ClusterPage
  participant useFinalizerPage
  participant API
  participant UI

  User->>ClusterPage: Request cluster page
  ClusterPage->>useFinalizerPage: Invoke hook to manage finalizer logic
  useFinalizerPage->>API: Fetch console URL if status is 'installing' or 'installing-pending-user-action'
  API-->>useFinalizerPage: Return console URL
  alt Check polling error and bootstrap host
    useFinalizerPage->>useFinalizerPage: Determine bootstrap progress stage
  end
  useFinalizerPage-->>ClusterPage: Provide cluster state and consoleUrl
  alt Finalizer conditions met
    ClusterPage->>UI: Render SingleClusterFinalizerPage
  else
    ClusterPage->>UI: Render SingleClusterPage
  end
Loading

Poem

I'm a rabbit in the codeland, hopping through each byte,
New hooks and pages make our UI so bright.
Finalizer pages now gracefully appear,
While translations whisper guidance clear.
With exports refined and old modals gone,
I hop with joy – coding magic lives on!
🐰✨

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/assisted-disconnected-ui/src/components/SingleClusterFinalizerPage.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "@openshift-assisted/eslint-config" to extend from. Please check that the name of the config is correct.

The config "@openshift-assisted/eslint-config" was referenced from the config file in "/apps/assisted-disconnected-ui/.eslintrc.cjs".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

libs/ui-lib/lib/common/components/clusterDetail/index.ts

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "@openshift-assisted/eslint-config" to extend from. Please check that the name of the config is correct.

The config "@openshift-assisted/eslint-config" was referenced from the config file in "/libs/ui-lib/.eslintrc.cjs".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

apps/assisted-disconnected-ui/src/components/ClusterPage.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the config "@openshift-assisted/eslint-config" to extend from. Please check that the name of the config is correct.

The config "@openshift-assisted/eslint-config" was referenced from the config file in "/apps/assisted-disconnected-ui/.eslintrc.cjs".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 7, 2025

@rawagner: This pull request references AGENT-1160 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the sub-task to target the "4.19.0" version, but no target version was set.

Details

In response to this:

Screenshot From 2025-04-03 14-45-05

Summary by CodeRabbit

  • New Features

  • Enhanced the cluster interface with a dynamic finalization screen during installation, offering progress feedback, troubleshooting options, and a direct link to the web console.

  • Documentation

  • Introduced updated messages to guide users on verifying console access and understanding installation status.

  • Chores

  • Removed an outdated node reboot modal and its styling to streamline the cluster management experience.

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.

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: 0

🧹 Nitpick comments (1)
apps/assisted-disconnected-ui/src/components/ClusterPage.tsx (1)

40-52: Consider refactoring complex bootstrap host state logic

The logic for checking bootstrap host state is quite complex and nested. This could be extracted into a separate utility function for better readability and testability.

- if (!clusterRef.current && cluster && uiState === ResourceUIState.POLLING_ERROR) {
-   const boostrapHost = cluster.hosts?.find((h) => h.bootstrap);
-   if (boostrapHost) {
-     const stages = getHostProgressStages(boostrapHost);
-     const rebootIdx = stages.findIndex((s) => s === 'Rebooting');
-     const currentStage = boostrapHost.progress?.currentStage;
-     // Show finalizing page as soon as we fail to poll and bootstrap is Rebooting or state before
-     if (!!currentStage && stages.slice(rebootIdx - 2, stages.length).includes(currentStage)) {
-       clusterRef.current = cluster;
-     }
-   }
- }
+ if (shouldShowFinalizingPage(clusterRef, cluster, uiState)) {
+   clusterRef.current = cluster;
+ }

Add this function above the hook:

const shouldShowFinalizingPage = (
  clusterRef: React.MutableRefObject<Cluster | undefined>,
  cluster: Cluster | undefined,
  uiState: ResourceUIState
): boolean => {
  if (clusterRef.current || !cluster || uiState !== ResourceUIState.POLLING_ERROR) {
    return false;
  }

  const boostrapHost = cluster.hosts?.find((h) => h.bootstrap);
  if (!boostrapHost) {
    return false;
  }

  const stages = getHostProgressStages(boostrapHost);
  const rebootIdx = stages.findIndex((s) => s === 'Rebooting');
  const currentStage = boostrapHost.progress?.currentStage;
  
  // Show finalizing page as soon as we fail to poll and bootstrap is Rebooting or state before
  return !!currentStage && stages.slice(rebootIdx - 2, stages.length).includes(currentStage);
};
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d45acb9 and 80af994.

📒 Files selected for processing (7)
  • apps/assisted-disconnected-ui/src/components/ClusterPage.tsx (1 hunks)
  • apps/assisted-disconnected-ui/src/components/SingleClusterFinalizerPage.tsx (1 hunks)
  • libs/locales/lib/en/translation.json (3 hunks)
  • libs/ui-lib/lib/common/components/clusterDetail/index.ts (1 hunks)
  • libs/ui-lib/lib/ocm/components/clusterDetail/RebootNodeZeroModal.css (0 hunks)
  • libs/ui-lib/lib/ocm/components/clusterDetail/RebootNodeZeroModal.tsx (0 hunks)
  • libs/ui-lib/lib/ocm/components/clusters/ClusterPage.tsx (0 hunks)
💤 Files with no reviewable changes (3)
  • libs/ui-lib/lib/ocm/components/clusterDetail/RebootNodeZeroModal.css
  • libs/ui-lib/lib/ocm/components/clusters/ClusterPage.tsx
  • libs/ui-lib/lib/ocm/components/clusterDetail/RebootNodeZeroModal.tsx
🧰 Additional context used
🧬 Code Definitions (2)
apps/assisted-disconnected-ui/src/components/SingleClusterFinalizerPage.tsx (3)
libs/types/assisted-installer-service.d.ts (1)
  • Cluster (110-398)
libs/ui-lib/lib/common/hooks/index.ts (1)
  • useTranslation (3-3)
libs/ui-lib/lib/common/components/clusterDetail/index.ts (1)
  • TroubleshootingOpenshiftConsoleButton (6-6)
apps/assisted-disconnected-ui/src/components/ClusterPage.tsx (4)
libs/types/assisted-installer-service.d.ts (1)
  • Cluster (110-398)
libs/ui-lib/lib/ocm/services/apis/index.ts (1)
  • ClustersAPI (5-5)
libs/ui-lib/lib/common/index.ts (1)
  • ResourceUIState (13-13)
libs/ui-lib/lib/common/components/hosts/utils.ts (1)
  • getHostProgressStages (110-110)
🔇 Additional comments (14)
libs/ui-lib/lib/common/components/clusterDetail/index.ts (1)

6-6: Appropriate export for new component usage

The export of TroubleshootingOpenshiftConsoleButton from the ConsoleModal module makes sense since it will be used in the newly added SingleClusterFinalizerPage component. This enhances the module's public API with a clear purpose.

apps/assisted-disconnected-ui/src/components/SingleClusterFinalizerPage.tsx (6)

1-16: Clean import structure

Imports are properly organized with related modules grouped together. The component makes use of PatternFly UI elements and correctly imports the newly exported TroubleshootingOpenshiftConsoleButton.


17-23: Well-structured component interface

The component has a clear interface with proper TypeScript typing. It accepts a required cluster prop and an optional consoleUrl prop, making its usage requirements explicit.


24-42: Good use of internationalization and clear user instructions

The component properly uses the translation hook and provides clear, informative messages to guide users during the cluster installation process. The multi-line explanation is well-formatted with line breaks for better readability.


43-54: Appropriate conditional rendering and security

The component appropriately checks if a console URL exists before rendering the button. The use of isInline for the button enhances the UI layout. Opening links in a new tab with the noopener attribute addresses potential security concerns.


53-54: Good integration with existing components

The TroubleshootingOpenshiftConsoleButton is correctly integrated, passing through the necessary props for proper functionality.


55-61: Clean component export

The component is properly exported as the default export, allowing for clean imports in parent components.

apps/assisted-disconnected-ui/src/components/ClusterPage.tsx (4)

1-8: Improved import organization

The imports have been updated to include the necessary components and utilities for the new functionality. Using named imports helps with code readability.


14-15: Clear Redux selector definition

The selector function is defined at the module level which is a good practice for performance optimization, preventing unnecessary re-creation of the function on each render.


16-39: Well-designed hook for finalization stage detection

The useFinalizerPage hook is well-structured with a clear purpose - determining when to show the finalization page and fetching the console URL. The async function is properly defined with error handling, and the effect has appropriate dependencies.


56-65: Elegant conditional rendering using hook data

The ClusterPage component has been updated to conditionally render either the new finalizer page or the regular cluster page based on the hook results. This separation of concerns makes the component clean and maintainable.

libs/locales/lib/en/translation.json (3)

30-30: Clear instruction for credential file location

This translation entry provides users with important information about finding the webconsole URL in the credentials file if they close the browser window.


164-164: Actionable guidance for webconsole verification

This translation properly instructs users to check if the webconsole is running by clicking the URL below.


177-177: Clear status message

This translation provides a straightforward status message informing users that the installation is still in progress.

@openshift-merge-bot openshift-merge-bot bot merged commit 9130081 into openshift-assisted:master Apr 7, 2025
11 checks passed
ammont82 pushed a commit to ammont82/assisted-installer-ui that referenced this pull request Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants