Skip to content

Conversation

@sjd78
Copy link
Member

@sjd78 sjd78 commented Jul 8, 2025

Changes needed to

  • URL endpoints
  • URL endpoint default filters (issues = insights.effort>0)
  • Model field renames s/issue/insight
  • Implicit filters for affected applications query

Refactoring:

  • Update rest.ts
  • Extract and clean up analysis related rest functions

Resolves: #2444
Part of: https://issues.redhat.com/browse/MTA-5459

Summary by CodeRabbit

  • Refactor

    • Updated terminology in the user interface from "Issues" to "Insights" across analysis reports and related components.
    • Adjusted identifiers and property names to match the new "Insight" terminology for improved consistency.
    • Reorganized and streamlined API client modules for better maintainability and clarity.
    • Moved analysis-related API functions to a dedicated module.
  • Bug Fixes

    • Removed duplicate imports in the issues table component.
  • Chores

    • Removed deprecated and unused code related to fetching issues.
    • Updated internal references to align with new API endpoints and naming conventions.

Changes needed to
  - URL endpoints
  - URL endpoint default filters (issues = insights.effort>0)
  - Model field renames `s/issue/insight`
  - Implicit filters for affected applications query

Refactoring:
  - Update `rest.ts`
  - Extract and clean up analysis related rest functions

Signed-off-by: Scott J Dickerson <[email protected]>
@sjd78 sjd78 requested review from ibolton336 and rszwajko as code owners July 8, 2025 20:07
@coderabbitai
Copy link

coderabbitai bot commented Jul 8, 2025

Walkthrough

The changes update the frontend codebase to support a conceptual shift from "Issues" to "Insights" in the analysis data model and API. This involves renaming properties, updating API endpoints, refactoring REST and query functions, and reorganizing related code to align with backend changes for insights support.

Changes

File(s) Change Summary
client/src/app/api/models.ts Renamed properties from issue/issueId to insight/insightId in analysis report interfaces and comments.
client/src/app/api/rest.ts Refactored and reorganized REST API client: updated endpoints, removed deprecated issue functions, added helpers, and grouped exports.
client/src/app/api/rest/analysis.ts New module: Implements API functions for fetching analysis reports, replacing issue terminology with insight.
client/src/app/pages/applications/components/import-applications-form/import-applications-form.tsx Updated import and usage of API endpoint constant for file upload.
client/src/app/pages/issues/affected-applications/affected-applications.tsx Updated property access from issue to insight in filters and prop passing.
client/src/app/pages/issues/issue-detail-drawer/file-incidents-detail-modal/file-all-incidents-table.tsx Changed incident fetch parameter from issueId to insightId.
client/src/app/pages/issues/issue-detail-drawer/file-incidents-detail-modal/file-incidents-detail-modal.tsx Changed incident fetch parameter from issueId to insightId.
client/src/app/pages/issues/issues-table.tsx Removed duplicate import of useFetchApplications.
client/src/app/queries/issues.ts Removed useFetchIssues hook and its related import.

Sequence Diagram(s)

sequenceDiagram
    participant UI
    participant REST_Client
    participant Backend

    UI->>REST_Client: Fetch App Reports (now with insights)
    REST_Client->>Backend: GET /analysis/app-reports (insight-based)
    Backend-->>REST_Client: Paginated App Reports (with insights)
    REST_Client-->>UI: App Reports Data

    UI->>REST_Client: Fetch File Reports (insightId)
    REST_Client->>Backend: GET /analysis/file-reports?insightId=...
    Backend-->>REST_Client: File Reports (insight-based)
    REST_Client-->>UI: File Reports Data

    UI->>REST_Client: Fetch Incidents (insightId)
    REST_Client->>Backend: GET /analysis/incidents?insightId=...
    Backend-->>REST_Client: Incident Data
    REST_Client-->>UI: Incident Data
Loading

Assessment against linked issues

Objective Addressed Explanation
Update rest API functions to use insights terminology and endpoints (#2444)
Update API models to use insights instead of issues (#2444)
Update query functions to support insights (#2444)
Verify and update page functionality to reflect insights changes (#2444)

Poem

The issues have hopped and changed their name,
Now "insights" guide us in this clever game.
Endpoints aligned, models redefined,
The codebase is tidy, robust, and kind!
🐰✨ With every refactor, we leap ahead,
Insights, not issues, are leading instead!

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.

npm error Exit handler never called!
npm error This is an error with npm itself. Please report this error at:
npm error https://github.com/npm/cli/issues
npm error A complete log of this run can be found in: /.npm/_logs/2025-07-08T20_09_01_187Z-debug-0.log

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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.

@sjd78 sjd78 requested a review from jortel July 8, 2025 20:07
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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9b6a5d6 and a22dc93.

📒 Files selected for processing (9)
  • client/src/app/api/models.ts (3 hunks)
  • client/src/app/api/rest.ts (20 hunks)
  • client/src/app/api/rest/analysis.ts (1 hunks)
  • client/src/app/pages/applications/components/import-applications-form/import-applications-form.tsx (2 hunks)
  • client/src/app/pages/issues/affected-applications/affected-applications.tsx (2 hunks)
  • client/src/app/pages/issues/issue-detail-drawer/file-incidents-detail-modal/file-all-incidents-table.tsx (1 hunks)
  • client/src/app/pages/issues/issue-detail-drawer/file-incidents-detail-modal/file-incidents-detail-modal.tsx (1 hunks)
  • client/src/app/pages/issues/issues-table.tsx (1 hunks)
  • client/src/app/queries/issues.ts (0 hunks)
💤 Files with no reviewable changes (1)
  • client/src/app/queries/issues.ts
🧰 Additional context used
🧬 Code Graph Analysis (3)
client/src/app/pages/issues/issue-detail-drawer/file-incidents-detail-modal/file-incidents-detail-modal.tsx (1)
client/src/app/queries/issues.ts (1)
  • useFetchIncidents (142-159)
client/src/app/pages/applications/components/import-applications-form/import-applications-form.tsx (1)
client/src/app/api/rest.ts (1)
  • APP_IMPORTS_SUMMARY_UPLOAD (62-62)
client/src/app/api/rest/analysis.ts (2)
client/src/app/api/models.ts (7)
  • HubRequestParams (23-33)
  • BaseAnalysisRuleReport (638-640)
  • AnalysisAppReport (621-635)
  • BaseAnalysisIssueReport (643-646)
  • AnalysisIssue (615-617)
  • AnalysisFileReport (660-665)
  • AnalysisIncident (667-674)
client/src/app/api/rest.ts (1)
  • getHubPaginatedResult (109-121)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: unit-test
  • GitHub Check: build-and-upload-for-global-ci
🔇 Additional comments (19)
client/src/app/pages/issues/issues-table.tsx (1)

36-38: LGTM - Import cleanup looks good.

The removal of the duplicate import statement for useFetchApplications improves code organization and aligns with the broader refactoring effort mentioned in the PR objectives.

client/src/app/pages/issues/issue-detail-drawer/file-incidents-detail-modal/file-all-incidents-table.tsx (1)

48-48: LGTM - Property name change aligns with API refactoring.

The change from fileReport.issueId to fileReport.insightId correctly reflects the terminology shift from "issues" to "insights" as described in the PR objectives. This maintains consistency with the updated data model.

client/src/app/pages/applications/components/import-applications-form/import-applications-form.tsx (2)

17-17: LGTM - API endpoint constant updated correctly.

The import statement correctly reflects the renamed constant from UPLOAD_FILE to APP_IMPORTS_SUMMARY_UPLOAD, which aligns with the REST API reorganization mentioned in the PR objectives.


60-60: LGTM - Endpoint usage updated consistently.

The axios POST request correctly uses the new APP_IMPORTS_SUMMARY_UPLOAD constant, maintaining consistency with the import change and the API reorganization effort.

client/src/app/pages/issues/issue-detail-drawer/file-incidents-detail-modal/file-incidents-detail-modal.tsx (1)

43-43: LGTM - Property name change aligns with data model updates.

The change from fileReport.issueId to fileReport.insightId correctly reflects the updated data model where the AnalysisFileReport interface property has been renamed. This maintains consistency with the broader "issues" to "insights" refactoring effort.

client/src/app/pages/issues/affected-applications/affected-applications.tsx (3)

84-84: LGTM - Filter field updated to use insight terminology.

The change from issue.ruleset to insight.ruleset correctly reflects the updated data model where the issue property has been renamed to insight. This maintains consistency with the broader API refactoring effort.


89-89: LGTM - Filter field updated consistently.

The change from issue.rule to insight.rule maintains consistency with the previous filter field change and aligns with the updated data model terminology.


241-241: LGTM - Component prop updated to use insight terminology.

The change from activeItem?.issue.id to activeItem?.insight.id correctly updates the issueId prop passed to the IssueDetailDrawer component, maintaining consistency with the broader refactoring from "issue" to "insight" terminology.

client/src/app/api/models.ts (2)

619-635: LGTM! Terminology correctly updated from "issue" to "insight"

The interface changes properly reflect the conceptual shift from "issues" to "insights" in the data model.


661-661: Property name correctly updated to match new terminology

The rename from issueId to insightId maintains consistency with the overall refactoring effort.

client/src/app/api/rest/analysis.ts (2)

1-13: Good modularization of analysis-related API functions

The extraction of analysis functions into a dedicated module improves code organization and maintainability.


14-22: Endpoint URLs correctly updated with insights terminology and filters

The URL constants properly reflect the shift to "insights" and include the effort>0 filter as specified in the PR objectives.

client/src/app/api/rest.ts (7)

48-50: New model imports correctly added

The addition of AnalysisDependency and AnalysisAppDependency imports aligns with the new analysis-related functionality.


103-103: Good use of barrel export for analysis module

Exporting all analysis-related functions from the dedicated module maintains backward compatibility while improving code organization.


105-122: Well-implemented generic pagination helper

The getHubPaginatedResult function provides a clean, reusable pattern for handling paginated API responses. Good defensive programming with the fallback to 0 for missing headers.


88-90: Clarify the TODO comments for tracker endpoints

The TODO comments suggest these constants might be incomplete. Please clarify if these need to be prefixed with a base path.


125-166: Well-structured application dependencies API functions

The new dependency-related functions follow consistent patterns and properly utilize the generic pagination helper.


302-308: Useful batch update helper for applications

The updateAllApplications function provides a convenient way to handle multiple application updates with proper error handling.


556-556: Good explicit return type specification

Making the Promise<void> return type explicit improves type safety and code clarity.

@sjd78 sjd78 merged commit 38d13e1 into konveyor:main Jul 8, 2025
15 of 16 checks passed
@sjd78 sjd78 deleted the insights_issues_api branch July 8, 2025 21:19
@sjd78 sjd78 added this to the v0.8.0 milestone Jul 29, 2025
sshveta pushed a commit to sshveta/tackle2-ui that referenced this pull request Oct 31, 2025
Changes needed to
  - URL endpoints
  - URL endpoint default filters (issues = insights.effort>0)
  - Model field renames `s/issue/insight`
  - Implicit filters for affected applications query

Refactoring:
  - Update `rest.ts`
  - Extract and clean up analysis related rest functions

Resolves: konveyor#2444
Part of: https://issues.redhat.com/browse/MTA-5459

Signed-off-by: Scott J Dickerson <[email protected]>
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.

Insights support - API enablement work

2 participants