Skip to content

Add support for marking new capability in templates catalog#1722

Merged
rmn-snpk merged 2 commits intomainfrom
feat/add-new-tag-on-category
Dec 4, 2025
Merged

Add support for marking new capability in templates catalog#1722
rmn-snpk merged 2 commits intomainfrom
feat/add-new-tag-on-category

Conversation

@rmn-snpk
Copy link
Copy Markdown

@rmn-snpk rmn-snpk commented Dec 3, 2025

Fixes OPS-3187.

image

Summary by CodeRabbit

  • New Features
    • Introduced visual "New" badges in the flow template filter sidebar to help users identify newly introduced domains. The "Policy & Governance" domain is now clearly marked as new, improving discoverability of recent additions and making it easier to spot newly available filtering options when browsing and selecting flow templates.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 3, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

This change introduces a newDomains prop that threads through React components to mark specific domains with a "New" badge in the template filter sidebar. The prop flows from the dialog content through the wrapper component to the filter sidebar, where designated domains receive a visual indicator.

Changes

Cohort / File(s) Summary
Prop Threading through Wrappers
packages/react-ui/src/app/features/templates/components/public-flow-template-filter-sidebar-wrapper.tsx, packages/react-ui/src/app/features/templates/components/select-flow-template-dialog-content.tsx
Added newDomains?: string[] prop to FlowTemplateFilterSidebarProps, threaded through the public wrapper component, and passed with value ['Policy & Governance'] in the dialog content usage.
Badge Rendering Implementation
packages/ui-components/src/components/flow-template/flow-template-filter-sidebar.tsx
Added isNew?: boolean prop to FlowTemplateFilterItem with conditional "New" badge rendering. Updated FlowTemplateFilterSidebar to accept newDomains?: string[], mark matching domain items with isNew=true, and added relative positioning to item container for badge layout. Imported Badge component.

Sequence Diagram

sequenceDiagram
    participant SelectFlowTemplateDialogContent
    participant PublicFlowTemplateFilterSidebarWrapper
    participant FlowTemplateFilterSidebar
    participant FlowTemplateFilterItem
    participant Badge
    
    SelectFlowTemplateDialogContent->>PublicFlowTemplateFilterSidebarWrapper: Pass newDomains=['Policy & Governance']
    PublicFlowTemplateFilterSidebarWrapper->>FlowTemplateFilterSidebar: Pass newDomains prop
    FlowTemplateFilterSidebar->>FlowTemplateFilterSidebar: For each domain, check if in newDomains
    alt Domain in newDomains
        FlowTemplateFilterSidebar->>FlowTemplateFilterItem: Pass isNew=true
        FlowTemplateFilterItem->>Badge: Render 'New' badge
    else Domain not in newDomains
        FlowTemplateFilterSidebar->>FlowTemplateFilterItem: Pass isNew=false (default)
    end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • The changes follow a consistent, repetitive pattern of prop threading across three files
  • Logic is straightforward: array membership check to set a boolean flag
  • Conditional badge rendering is simple and idiomatic React
  • No complex state management, side effects, or control-flow changes involved

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description is vague and incomplete. While a screenshot is provided and CodeRabbit summary describes the feature, critical information is missing or unfilled. Complete the 'Fixes #<issue_number>' section with the actual issue number, provide detailed explanation of changes in Additional Notes section, and check relevant Testing Checklist items with supporting evidence.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add support for marking new capability in templates catalog' clearly describes the main change—adding a new badge/flag to mark new domains in the templates filter sidebar.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/add-new-tag-on-category

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

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Dec 3, 2025

@rmn-snpk
Copy link
Copy Markdown
Author

rmn-snpk commented Dec 3, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 3, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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 (2)
packages/react-ui/src/app/features/templates/components/select-flow-template-dialog-content.tsx (1)

143-154: Avoid hard‑coding the “new domains” list inline

newDomains={['Policy & Governance']} works, but it’s brittle if you ever:

  • add more “new” capabilities, or
  • change the domain identifier/label.

Consider centralizing this list in a shared constant or configuration (e.g., NEW_DOMAIN_TAGS), or deriving it from backend/feature‑flagged data so you don’t have to touch this component whenever the catalog changes.

packages/ui-components/src/components/flow-template/flow-template-filter-sidebar.tsx (1)

108-109: Consider keying newDomains by stable ids instead of display strings

Using isNew={newDomains.includes(domain)} is simple and works as long as:

  • domain values are stable, and
  • they’re not localized or otherwise user‑visible labels that might change.

If domains ever become localized or their labels change, this string comparison will be brittle. At that point, you’ll likely want newDomains to contain stable ids/slugs (e.g., policy-governance) and derive display names separately.

For now the behavior is correct and safe thanks to newDomains = [] as a default, but consider this adjustment if the domain model evolves.

Also applies to: 126-127, 191-200

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d79539f and e79a3b6.

📒 Files selected for processing (3)
  • packages/react-ui/src/app/features/templates/components/public-flow-template-filter-sidebar-wrapper.tsx (3 hunks)
  • packages/react-ui/src/app/features/templates/components/select-flow-template-dialog-content.tsx (1 hunks)
  • packages/ui-components/src/components/flow-template/flow-template-filter-sidebar.tsx (7 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

**/*.{ts,tsx,js,jsx}: Indentation: 2 spaces for TypeScript/JavaScript
Braces required for all control blocks, even single-line
One space between keywords and parentheses: if (condition) {
Use camelCase for variables and functions
Use PascalCase for classes and types
Use UPPER_SNAKE_CASE for constants
Use lowercase with hyphens for file names (e.g., user-profile.ts)
Prefer const over let or var in TypeScript/JavaScript
Prefer arrow functions for callbacks and functional components in TypeScript/JavaScript

Files:

  • packages/ui-components/src/components/flow-template/flow-template-filter-sidebar.tsx
  • packages/react-ui/src/app/features/templates/components/select-flow-template-dialog-content.tsx
  • packages/react-ui/src/app/features/templates/components/public-flow-template-filter-sidebar-wrapper.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

**/*.{ts,tsx}: Use types and interfaces where appropriate in TypeScript
Use explicit return types for exported functions in TypeScript

Files:

  • packages/ui-components/src/components/flow-template/flow-template-filter-sidebar.tsx
  • packages/react-ui/src/app/features/templates/components/select-flow-template-dialog-content.tsx
  • packages/react-ui/src/app/features/templates/components/public-flow-template-filter-sidebar-wrapper.tsx
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/coding-guidelines.mdc)

**/*.{tsx,ts}: Frontend tech stack must strictly use: React 18, Zustand, react-query v5, shadcn, and Axios with qs package for query strings
Follow best practices for React hooks
Prefer small, composable components and extract helper functions where possible
Use cn utility to group tailwind classnames in React components

Files:

  • packages/ui-components/src/components/flow-template/flow-template-filter-sidebar.tsx
  • packages/react-ui/src/app/features/templates/components/select-flow-template-dialog-content.tsx
  • packages/react-ui/src/app/features/templates/components/public-flow-template-filter-sidebar-wrapper.tsx
🧠 Learnings (1)
📚 Learning: 2025-11-25T10:22:44.853Z
Learnt from: CR
Repo: openops-cloud/openops PR: 0
File: .cursor/rules/coding-guidelines.mdc:0-0
Timestamp: 2025-11-25T10:22:44.853Z
Learning: Applies to **/*.{tsx,ts} : Use `cn` utility to group tailwind classnames in React components

Applied to files:

  • packages/ui-components/src/components/flow-template/flow-template-filter-sidebar.tsx
🔇 Additional comments (2)
packages/ui-components/src/components/flow-template/flow-template-filter-sidebar.tsx (1)

5-66: New badge implementation in FlowTemplateFilterItem looks solid

The isNew prop with a default of false, the added relative class on the container, and the conditional Badge rendering give you a clean, non‑breaking way to surface “New” items without affecting existing callers. This keeps the API backwards‑compatible and uses cn to extend classes consistently (based on learnings, using cn for Tailwind classnames is our convention).

packages/react-ui/src/app/features/templates/components/public-flow-template-filter-sidebar-wrapper.tsx (1)

14-24: Prop threading for newDomains is clean and backwards‑compatible

Extending FlowTemplateFilterSidebarProps with optional newDomains and defaulting it to [] in the wrapper keeps existing callers working while exposing the new capability cleanly to FlowTemplateFilterSidebar.

No changes needed here.

Also applies to: 47-58, 164-181

@linear
Copy link
Copy Markdown

linear Bot commented Dec 3, 2025

@rmn-snpk rmn-snpk marked this pull request as ready for review December 3, 2025 12:50
Copilot AI review requested due to automatic review settings December 3, 2025 12:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds visual "New" badges to flow template filter options in the templates catalog, specifically marking the "Policy & Governance" domain as a newly introduced capability to improve discoverability for users.

Key changes:

  • Introduced isNew prop to FlowTemplateFilterItem component to conditionally render a "New" badge
  • Added newDomains prop throughout the component hierarchy to support marking specific domains as new
  • Hard-coded "Policy & Governance" as the first new domain in the implementation

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
flow-template-filter-sidebar.tsx Added isNew prop to filter items and rendered "New" badge UI component with styling
select-flow-template-dialog-content.tsx Passed hard-coded array with "Policy & Governance" as a new domain to the filter sidebar
public-flow-template-filter-sidebar-wrapper.tsx Added newDomains prop to component signature and forwarded it to the filter sidebar

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Dec 3, 2025

Greptile Overview

Greptile Summary

This PR adds visual "New" badges to the flow template filter sidebar to highlight newly introduced domains. The implementation threads a newDomains prop through the component hierarchy, from SelectFlowTemplateDialogContent down to FlowTemplateFilterItem, where a Badge component is conditionally rendered.

Key Changes:

  • Added optional newDomains prop (string array) to filter sidebar components
  • Hardcoded ['Policy & Governance'] as the initial new domain in the template selection dialog
  • Implemented visual Badge with "New" label using existing Badge component with secondary variant
  • Badge positioned with -mx-2.5 negative margin and compact styling (text-[10px], px-0.5)

The implementation is straightforward and follows existing patterns in the codebase. The hardcoded domain list in select-flow-template-dialog-content.tsx:153 is acceptable for this feature's initial rollout.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are purely presentational, adding a visual badge to UI elements. The implementation uses optional props with safe defaults, follows existing code patterns, integrates with established UI components (Badge, translation), and has no logical complexity or side effects. The hardcoded domain name matches the recently added domain icon mapping.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
packages/react-ui/src/app/features/templates/components/public-flow-template-filter-sidebar-wrapper.tsx 5/5 Added optional newDomains prop and passed it through to child component
packages/react-ui/src/app/features/templates/components/select-flow-template-dialog-content.tsx 5/5 Hardcoded 'Policy & Governance' as new domain in template selection dialog
packages/ui-components/src/components/flow-template/flow-template-filter-sidebar.tsx 5/5 Added visual "New" badge to filter items when marked as new

Sequence Diagram

sequenceDiagram
    participant User
    participant SelectFlowTemplateDialogContent
    participant PublicFlowTemplateFilterSidebarWrapper
    participant FlowTemplateFilterSidebar
    participant FlowTemplateFilterItem
    
    User->>SelectFlowTemplateDialogContent: Opens template catalog
    SelectFlowTemplateDialogContent->>PublicFlowTemplateFilterSidebarWrapper: Passes newDomains=['Policy & Governance']
    PublicFlowTemplateFilterSidebarWrapper->>FlowTemplateFilterSidebar: Forwards newDomains prop
    FlowTemplateFilterSidebar->>FlowTemplateFilterSidebar: Renders domain filters
    loop For each domain
        FlowTemplateFilterSidebar->>FlowTemplateFilterItem: Renders with isNew=newDomains.includes(domain)
        alt Domain is in newDomains array
            FlowTemplateFilterItem->>FlowTemplateFilterItem: Shows "New" Badge
        end
    end
    FlowTemplateFilterItem->>User: Displays domain with "New" badge if applicable
Loading

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

3 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@alexandrudanpop
Copy link
Copy Markdown
Contributor

hey @rSnapkoOpenOps can you please add a screenshot or a story for it

@rmn-snpk rmn-snpk merged commit 093eaba into main Dec 4, 2025
24 checks passed
@rmn-snpk rmn-snpk deleted the feat/add-new-tag-on-category branch December 4, 2025 14:01
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.

3 participants