Skip to content

feat: properties in insights modal#2967

Merged
moshloop merged 1 commit intomainfrom
feat/insights-properties
Mar 27, 2026
Merged

feat: properties in insights modal#2967
moshloop merged 1 commit intomainfrom
feat/insights-properties

Conversation

@adityathebe
Copy link
Member

@adityathebe adityathebe commented Mar 26, 2026

related: flanksource/config-db#2036

image image image image

Summary by CodeRabbit

  • New Features

    • Config analysis now surfaces structured property data as interactive badges with visual scaling and optional external-link indicators.
    • Analysis details include observed timestamp visibility when viewing a single insight.
  • Improvements

    • Source now renders as clickable external links when available.
    • Improved null-value handling for severity and message; message and badge sections render conditionally for cleaner display.

@vercel
Copy link

vercel bot commented Mar 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
aws-preview Ready Ready Preview Mar 26, 2026 11:31am
flanksource-ui Ready Ready Preview Mar 26, 2026 11:31am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 26, 2026

Walkthrough

API requests and types were expanded to include properties on config analysis objects. The Config Insights modal was updated to render properties badges, adjusted description rendering and sanitization, and minor modal/JSX refinements.

Changes

Cohort / File(s) Summary
Config Analysis API & Types
src/api/services/configs.ts, src/api/types/configs.ts
API queries now include properties (and last_observed for by-ID). ConfigAnalysis type extended with `properties?: Property[]
Config Insights UI
src/components/Configs/Insights/ConfigAnalysisLink/ConfigInsightsDetailsModal.tsx
Added inline badge UI for properties entries (type === "badge"), value/max → scaled display, optional external-link icons; refactored description items with useMemo, improved severity/source/message fallbacks and sanitization, adjusted Modal onClose and conditional rendering.
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: properties in insights modal' accurately reflects the main change: adding properties display to the insights modal component.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/insights-properties
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/insights-properties

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
Contributor

@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)
src/api/services/configs.ts (1)

670-684: Keep getConfigInsights response type aligned with selected fields.

Line 684 selects properties, but the Pick<ConfigAnalysis, ...> type omits it, so callers can’t safely access that field from this API helper.

Diff suggestion
       Pick<
         ConfigAnalysis,
         | "id"
         | "analyzer"
         | "config"
         | "severity"
         | "analysis_type"
         | "message"
         | "sanitizedMessageTxt"
         | "sanitizedMessageHTML"
         | "first_observed"
+        | "properties"
       >[]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/api/services/configs.ts` around lines 670 - 684, The response type
generic passed to ConfigDB.get does not include the selected "properties" field,
causing a type mismatch; update the Pick<ConfigAnalysis, ...> used in the
ConfigDB.get call (used by getConfigInsights) to include "properties" (or adjust
the selection to remove properties) so the TypeScript return type matches the
actual selected fields; locate the ConfigDB.get<Pick<ConfigAnalysis, ...>>()
invocation and add "properties" to the Pick (or remove the properties selection)
to resolve the inconsistency.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/components/Configs/Insights/ConfigAnalysisLink/ConfigInsightsDetailsModal.tsx`:
- Around line 22-28: The normalization code in ConfigInsightsDetailsModal that
computes scaled = (Number(property.value) / Number(property.max)) * 10 should
guard against invalid divisors (property.max === 0 or non-numeric) to avoid
Infinity/NaN; update the logic around the property.value/property.max check (the
block that sets scaled, formatted, and displayText) to first coerce max to a
Number and verify Number.isFinite(maxNum) && maxNum > 0 before doing the
division, and if that check fails set displayText to a safe fallback (e.g.,
'N/A' or an empty string) instead of showing Infinity/NaN. Ensure you reference
the same variables (property.value, property.max, scaled, formatted,
displayText) so the fix replaces the current normalization path.

---

Nitpick comments:
In `@src/api/services/configs.ts`:
- Around line 670-684: The response type generic passed to ConfigDB.get does not
include the selected "properties" field, causing a type mismatch; update the
Pick<ConfigAnalysis, ...> used in the ConfigDB.get call (used by
getConfigInsights) to include "properties" (or adjust the selection to remove
properties) so the TypeScript return type matches the actual selected fields;
locate the ConfigDB.get<Pick<ConfigAnalysis, ...>>() invocation and add
"properties" to the Pick (or remove the properties selection) to resolve the
inconsistency.
🪄 Autofix (Beta)

❌ Autofix failed (check again to retry)

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

Run ID: 191ad80f-5105-4a0e-9769-039a11cd5619

📥 Commits

Reviewing files that changed from the base of the PR and between 42763c2 and 9c4fee1.

📒 Files selected for processing (3)
  • src/api/services/configs.ts
  • src/api/types/configs.ts
  • src/components/Configs/Insights/ConfigAnalysisLink/ConfigInsightsDetailsModal.tsx

Copy link
Contributor

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@src/components/Configs/Insights/ConfigAnalysisLink/ConfigInsightsDetailsModal.tsx`:
- Around line 76-78: The key for the AnalysisBadge in the badges.map callback
can collide when multiple property.name values are identical; update the key
generation in the map to ensure uniqueness by combining property.name with the
index (or a unique id if available) — e.g. change the key expression used in the
badges.map(...) that renders <AnalysisBadge ...> from property.name ?? idx to a
deterministic unique string such as `${property.name}-${idx}` or `${property.id
?? property.name}-${idx}` so React keys are always unique.
🪄 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

Run ID: 91a1f972-9cf9-4f88-be61-93d60264ec51

📥 Commits

Reviewing files that changed from the base of the PR and between 9c4fee1 and f1d1253.

📒 Files selected for processing (3)
  • src/api/services/configs.ts
  • src/api/types/configs.ts
  • src/components/Configs/Insights/ConfigAnalysisLink/ConfigInsightsDetailsModal.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/api/services/configs.ts

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 27, 2026

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Autofix skipped. No unresolved CodeRabbit review comments with fix instructions found.

@moshloop moshloop merged commit 75baffa into main Mar 27, 2026
14 of 16 checks passed
@moshloop moshloop deleted the feat/insights-properties branch March 27, 2026 08:23
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