Skip to content

Conversation

@sjd78
Copy link
Member

@sjd78 sjd78 commented Aug 30, 2025

Resolves: https://issues.redhat.com/browse/MTA-5899

When viewing an application's details in the detail drawer, we want to show a link to the insights page for that application. This follows the pattern for issues and dependencies.

Screenshot:
image

Summary by CodeRabbit

  • New Features
    • Added an Insights link in the Application Details drawer (between Issues and Dependencies) to open insights for the selected application.
    • Preserves any existing Insights filters when navigating from application details, keeping user context intact.
    • Enables direct per-application access to insights for faster investigation and analysis.

@coderabbitai
Copy link

coderabbitai bot commented Aug 30, 2025

Walkthrough

Adds an "Insights" navigation link to the Application Details drawer and introduces getInsightsSingleAppSelectedLocation to build a single-app Insights LocationDescriptor that preserves insights:filters from the current location's query.

Changes

Cohort / File(s) Summary
UI: Application Details Navigation
client/src/app/pages/applications/application-detail-drawer/tab-details-content.tsx
Inserts an "Insights" Link into the details tab navigation (after Issues, before Dependencies) and uses getInsightsSingleAppSelectedLocation to compute the link target.
Insights Helpers
client/src/app/pages/insights/helpers.ts
Adds export const getInsightsSingleAppSelectedLocation(applicationId: number, fromLocation?: Location): LocationDescriptor that returns a LocationDescriptor for the single-app insights path and preserves insights:filters if present; updates imports to include LocationDescriptor.

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant AppDetails as Application Details Drawer
  participant Helper as insights/helpers
  participant Router
  participant Insights as Insights (Single-App)

  User->>AppDetails: Click "Insights" link
  AppDetails->>Helper: getInsightsSingleAppSelectedLocation(appId, currentLocation)
  Note over Helper: Build LocationDescriptor\n- pathname: /insights/app/:id\n- search: ?insights:filters=... (if present)
  Helper-->>AppDetails: LocationDescriptor
  AppDetails->>Router: navigate(LocationDescriptor)
  Router->>Insights: Render single-app insights (with preserved filters)
  Insights-->>User: Display insights
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • ibolton336
  • rszwajko

Poem

I hop to links with careful paws,
I carry filters, follow laws.
One app's insight — a gentle trail,
I weave the query through the vale.
Click once, and watch the results unveil. 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit 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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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 nachandr August 30, 2025 00:16
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: 2

🧹 Nitpick comments (1)
client/src/app/pages/insights/helpers.ts (1)

1-1: Prefer react-router’s To type over history’s LocationDescriptor.

Keeps the helper aligned with Link’s “to” type and avoids coupling to history internals.

-import { Location, LocationDescriptor } from "history";
+import type { Location } from "history";
+import type { To } from "react-router-dom";
@@
-export const getInsightsSingleAppSelectedLocation = (
+export const getInsightsSingleAppSelectedLocation = (
   applicationId: number,
   fromLocation?: Location
-): LocationDescriptor => {
+): To => {

Ensure the consuming code compiles after this change.

Also applies to: 186-205

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a89124f and b670c5c.

📒 Files selected for processing (2)
  • client/src/app/pages/applications/application-detail-drawer/tab-details-content.tsx (2 hunks)
  • client/src/app/pages/insights/helpers.ts (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
client/src/app/pages/applications/application-detail-drawer/tab-details-content.tsx (1)
client/src/app/pages/insights/helpers.ts (1)
  • getInsightsSingleAppSelectedLocation (187-205)
client/src/app/pages/insights/helpers.ts (1)
client/src/app/Paths.ts (1)
  • Paths (84-84)
⏰ 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 (3)
client/src/app/pages/insights/helpers.ts (1)

186-205: Confirm the target route expects 'filters' (not 'insights:filters').

This helper emits ?filters=.... If the single-app Insights view expects a namespaced key, update accordingly.

client/src/app/pages/applications/application-detail-drawer/tab-details-content.tsx (2)

41-41: Import looks good.

Import path is correct and localizes the helper clearly.


79-83: Order and labeling LGTM.

Placing Insights between Issues and Dependencies matches the stated UX.

@sjd78 sjd78 force-pushed the insights-drawer-link branch from b670c5c to 7596c08 Compare September 2, 2025 18:09
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: 0

♻️ Duplicate comments (2)
client/src/app/pages/insights/helpers.ts (2)

186-189: Clarify wording: explicitly call out “Insights filters.”

Align comment with intent and existing terminology.

-// When linking to the insights page for a single application, we want to be able to preserve any
-// filters on the all insights page that may be given.  Linking from outside insights does not
-// need to preserve any filters.
+// When linking to the Insights page for a single application, preserve any Insights filters from the All Insights page if present.
+// Links from outside Insights don't need to preserve filters.

193-206: Prefix search with '?' and preserve empty filters explicitly.

  • Ensure search begins with ? for consistency with history/Link.
  • Use .has() to differentiate “missing” vs “present but empty” filters and preserve the latter.
-  const existingFiltersParam =
-    fromLocation &&
-    new URLSearchParams(fromLocation.search).get(
-      `${TablePersistenceKeyPrefix.insights}:filters`
-    );
+  const params = new URLSearchParams(fromLocation?.search ?? "");
+  const hasExistingFilters = params.has(
+    `${TablePersistenceKeyPrefix.insights}:filters`
+  );
+  const existingFiltersParam =
+    params.get(`${TablePersistenceKeyPrefix.insights}:filters`) ?? "";
@@
-    search: existingFiltersParam
-      ? new URLSearchParams({ filters: existingFiltersParam }).toString()
-      : undefined,
+    search: hasExistingFilters
+      ? `?${new URLSearchParams({ filters: existingFiltersParam }).toString()}`
+      : undefined,
🧹 Nitpick comments (1)
client/src/app/pages/insights/helpers.ts (1)

1-1: Use type-only import for History types.

These are used as types only; prefer import type to avoid potential runtime import.

-import { Location, LocationDescriptor } from "history";
+import type { Location, LocationDescriptor } from "history";
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b670c5c and 7596c08.

📒 Files selected for processing (2)
  • client/src/app/pages/applications/application-detail-drawer/tab-details-content.tsx (2 hunks)
  • client/src/app/pages/insights/helpers.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • client/src/app/pages/applications/application-detail-drawer/tab-details-content.tsx
🧰 Additional context used
🧬 Code graph analysis (1)
client/src/app/pages/insights/helpers.ts (1)
client/src/app/Paths.ts (1)
  • Paths (84-84)
⏰ 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

@sjd78 sjd78 force-pushed the insights-drawer-link branch from 7596c08 to a6c794f Compare September 3, 2025 03:18
@sjd78 sjd78 requested a review from mguetta1 September 3, 2025 03:19
Resolves: https://issues.redhat.com/browse/MTA-5899

When viewing an application's details in the detail drawer, we
want to show a link to the insights page for that application.
This follows the pattern for issues and dependencies.

Signed-off-by: Scott J Dickerson <[email protected]>
Signed-off-by: Scott J Dickerson <[email protected]>
@sjd78 sjd78 force-pushed the insights-drawer-link branch from a6c794f to b24a070 Compare September 3, 2025 03:56
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

♻️ Duplicate comments (1)
client/src/app/pages/insights/helpers.ts (1)

203-205: Prefix ? in Location.search when present.

Ensure search starts with ? so Link/history receive a proper query string. This mirrors a prior suggestion.

-    search: existingFiltersParam
-      ? new URLSearchParams({ filters: existingFiltersParam }).toString()
-      : undefined,
+    search: existingFiltersParam
+      ? `?${new URLSearchParams({ filters: existingFiltersParam }).toString()}`
+      : undefined,
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a6c794f and b24a070.

📒 Files selected for processing (2)
  • client/src/app/pages/applications/application-detail-drawer/tab-details-content.tsx (2 hunks)
  • client/src/app/pages/insights/helpers.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • client/src/app/pages/applications/application-detail-drawer/tab-details-content.tsx
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: sjd78
PR: konveyor/tackle2-ui#2586
File: client/src/app/pages/applications/application-detail-drawer/tab-details-content.tsx:79-83
Timestamp: 2025-09-02T18:12:27.604Z
Learning: When navigating from application detail drawer to insights page in tackle2-ui, filters should not be preserved - users should start with a clean insights view rather than carrying over search filters from the previous page.
📚 Learning: 2025-09-02T18:12:27.604Z
Learnt from: sjd78
PR: konveyor/tackle2-ui#2586
File: client/src/app/pages/applications/application-detail-drawer/tab-details-content.tsx:79-83
Timestamp: 2025-09-02T18:12:27.604Z
Learning: When navigating from application detail drawer to insights page in tackle2-ui, filters should not be preserved - users should start with a clean insights view rather than carrying over search filters from the previous page.

Applied to files:

  • client/src/app/pages/insights/helpers.ts
⏰ 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 (1)
client/src/app/pages/insights/helpers.ts (1)

1-1: No change required: [email protected] is in use, so LocationDescriptor remains valid.

</Link>
</ListItem>
<ListItem>
<Link to={getInsightsSingleAppSelectedLocation(application.id)}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

the other links use ?. when retrieving the property

Copy link
Member Author

Choose a reason for hiding this comment

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

Various recent refactors had application drop | undefined | null in the type, so dropping the ?. to just . is ok and I probably didn't catch all the uses.

@sjd78 sjd78 merged commit 17b4074 into konveyor:main Sep 3, 2025
11 checks passed
@sjd78 sjd78 deleted the insights-drawer-link branch September 3, 2025 14:12
sshveta pushed a commit to sshveta/tackle2-ui that referenced this pull request Oct 31, 2025
Resolves: https://issues.redhat.com/browse/MTA-5899

When viewing an application's details in the detail drawer, we want to
show a link to the insights page for that application. This follows the
pattern for issues and dependencies.

## Summary by CodeRabbit

* **New Features**
  * Added an Insights link in the Application Details drawer (between
    Issues and Dependencies) to open insights for the selected application.
  * Preserves any existing Insights filters when navigating from
    application details, keeping user context intact.
  * Enables direct per-application access to insights for faster
    investigation and analysis.

---------

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.

2 participants