Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(weave): combine op filter into filter panel #3816

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gtarpenning
Copy link
Member

@gtarpenning gtarpenning commented Feb 28, 2025

Description

TODO:

  • fix all the gross hacks that are making this somewhat work
  • debounce the filter additions, very non-performant currently
  • fix the styling so that the default (op and in the future date) rows match the programatic filters
Screenshot 2025-02-27 at 4 28 15 PM

Testing

filter-ops-3

Summary by CodeRabbit

  • New Features
    • Enhanced filtering capabilities allow users to filter operations by version with an improved user interface, including intuitive selection fields and tooltips.
  • Refactor
    • Consolidated operation filtering controls into the main filter panel for a streamlined filter management experience.
    • Improved disabled state handling and tag display for a more refined interaction.

@circle-job-mirror
Copy link

circle-job-mirror bot commented Feb 28, 2025

Copy link
Contributor

coderabbitai bot commented Feb 28, 2025

Walkthrough

The changes integrate enhanced operation filtering into the Browse3 filter components. New properties are added to the filtering props of both the FilterBar and FilterPanel components (such as frozenFilter, filter, setFilter, selectedOpVersionOption, and opVersionOptions), along with a new callback and UI elements for operation selection. Additionally, the FilterTagItem and SelectField components receive minor updates for styling and disabled-state handling, and the standalone OpSelector is removed from CallsTable to consolidate filtering functionality within FilterPanel.

Changes

File(s) Change Summary
…/filters/FilterBar.tsx, …/filters/FilterPanel.tsx Updated props types to include new filtering properties (frozenFilter, filter, setFilter, selectedOpVersionOption, opVersionOptions). Added a callback and UI for operation filtering.
…/filters/FilterTagItem.tsx, …/filters/SelectField.tsx Added optional className prop (in FilterTagItem) and isDisabled prop (in SelectField); updated logic for tooltip display and disabled state handling.
…/pages/CallsPage/CallsTable.tsx Removed the standalone OpSelector component and related imports, integrating operation filtering directly via FilterPanel props.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant CT as CallsTable
    participant FP as FilterPanel
    participant FB as FilterBar
    participant UI as UI Elements

    U->>CT: Initiates filter interaction
    CT->>FP: Pass filtering props (including new operation filters)
    FP->>FB: Forward filter configuration
    U->>FB: Selects an operation filter option
    FB->>FB: Triggers handleOperationChange
    FB->>FP: Updates filter state via setFilter callback
    FP->>CT: Reflects updated filtering settings
Loading

Possibly related PRs

Poem

I'm a rabbit in the codefields, hopping with glee,
New filters and callbacks for all to see.
Operation choices neatly laid out in the UI,
With each prop update, bugs quietly say goodbye.
Hop along, dear coders — our code's as swift as can be! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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 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.

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.

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

🧹 Nitpick comments (6)
weave-js/src/components/PagePanelComponents/Home/Browse3/filters/FilterTagItem.tsx (2)

50-54: Consider using a more specific type for label.

While the functionality is correct, label is typed as any which reduces type safety. Consider using a more specific type like React.ReactNode.

-  let label: any = `${field} ${operator}`;
+  let label: React.ReactNode = `${field} ${operator}`;

92-115: Consider extracting removeAction conditional logic for better readability.

While the implementation is functionally correct, the conditional logic for the removeAction could be extracted to a variable for improved readability.

+  const removeActionElement = disableRemove ? (
+    <></>
+  ) : (
+    <RemoveAction
+      onClick={(e: any) => {
+        e.stopPropagation();
+        onRemoveFilter(item.id);
+      }}
+    />
+  );

  return (
    <div
      className={`flex items-center gap-1 rounded bg-moon-100 px-2 py-1 ${className}`}>
      <FilterTag
        label={
          <>
            {label}
            <div className="ml-4">{value}</div>
          </>
        }
-        removeAction={
-          disableRemove ? (
-            <></>
-          ) : (
-            <RemoveAction
-              onClick={(e: any) => {
-                e.stopPropagation();
-                onRemoveFilter(item.id);
-              }}
-            />
-          )
-        }
+        removeAction={removeActionElement}
      />
    </div>
  );
weave-js/src/components/PagePanelComponents/Home/Browse3/filters/SelectField.tsx (1)

73-73: Overriding innerIsDisabled to true.
Consider adding a clear comment to explain why you force-disable the field when no valid option is found, ensuring future maintainers understand this logic.

weave-js/src/components/PagePanelComponents/Home/Browse3/filters/FilterBar.tsx (3)

238-245: Handling default-operation in onRemoveFilter.
Resetting opVersionRefs to an empty array is a clear approach. Double-check that related UI elements also update to reflect this reset if triggered.

Also applies to: 252-252


279-300: handleOperationChange for op selection.
Implementation is straightforward. Consider adding a minor inline explanation to clarify the logic behind omitting opVersionRefs for "all traces or calls."


496-509: Fallback filter row if none are present.
Providing a preset row is user-friendly. Ensure that any newly added filter triggers the correct re-renders.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8e1e98 and cf8c24a.

📒 Files selected for processing (5)
  • weave-js/src/components/PagePanelComponents/Home/Browse3/filters/FilterBar.tsx (11 hunks)
  • weave-js/src/components/PagePanelComponents/Home/Browse3/filters/FilterPanel.tsx (2 hunks)
  • weave-js/src/components/PagePanelComponents/Home/Browse3/filters/FilterTagItem.tsx (4 hunks)
  • weave-js/src/components/PagePanelComponents/Home/Browse3/filters/SelectField.tsx (3 hunks)
  • weave-js/src/components/PagePanelComponents/Home/Browse3/pages/CallsPage/CallsTable.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{js,jsx,ts,tsx}`: Focus on architectural and logical i...

**/*.{js,jsx,ts,tsx}: Focus on architectural and logical issues rather than style (assuming ESLint is in place).
Flag potential memory leaks and performance bottlenecks.
Check for proper error handling and async/await usage.
Avoid strict enforcement of try/catch blocks - accept Promise chains, early returns, and other clear error handling patterns. These are acceptable as long as they maintain clarity and predictability.
Ensure proper type usage in TypeScript files.
Look for security vulnerabilities in data handling.
Don't comment on formatting if prettier is configured.
Verify proper React hooks usage and component lifecycle.
Check for proper state management patterns.

  • weave-js/src/components/PagePanelComponents/Home/Browse3/filters/SelectField.tsx
  • weave-js/src/components/PagePanelComponents/Home/Browse3/filters/FilterTagItem.tsx
  • weave-js/src/components/PagePanelComponents/Home/Browse3/filters/FilterPanel.tsx
  • weave-js/src/components/PagePanelComponents/Home/Browse3/pages/CallsPage/CallsTable.tsx
  • weave-js/src/components/PagePanelComponents/Home/Browse3/filters/FilterBar.tsx
⏰ Context from checks skipped due to timeout of 90000ms (153)
  • GitHub Check: WeaveJS Lint and Compile
  • GitHub Check: Trace nox tests (3, 13, llamaindex)
  • GitHub Check: Trace nox tests (3, 13, trace_server)
  • GitHub Check: Trace nox tests (3, 13, trace)
  • GitHub Check: Trace nox tests (3, 12, scorers)
  • GitHub Check: Trace nox tests (3, 12, llamaindex)
  • GitHub Check: Trace nox tests (3, 12, litellm)
  • GitHub Check: Trace nox tests (3, 12, trace_server)
  • GitHub Check: Trace nox tests (3, 12, trace)
  • GitHub Check: Trace nox tests (3, 11, scorers)
  • GitHub Check: Trace nox tests (3, 11, llamaindex)
  • GitHub Check: Trace nox tests (3, 11, trace_server)
  • GitHub Check: Trace nox tests (3, 11, trace)
  • GitHub Check: Trace nox tests (3, 10, scorers)
  • GitHub Check: Trace nox tests (3, 10, trace)
  • GitHub Check: Trace nox tests (3, 9, scorers)
  • GitHub Check: WeaveJS Lint and Compile
  • GitHub Check: Trace nox tests (3, 13, llamaindex)
  • GitHub Check: Trace nox tests (3, 13, trace_server)
  • GitHub Check: Trace nox tests (3, 13, trace)
  • GitHub Check: Trace nox tests (3, 12, scorers)
  • GitHub Check: Trace nox tests (3, 12, llamaindex)
  • GitHub Check: Trace nox tests (3, 12, litellm)
  • GitHub Check: Trace nox tests (3, 12, trace_server)
  • GitHub Check: Trace nox tests (3, 12, trace)
  • GitHub Check: Trace nox tests (3, 11, scorers)
  • GitHub Check: Trace nox tests (3, 11, llamaindex)
  • GitHub Check: Trace nox tests (3, 11, trace_server)
  • GitHub Check: Trace nox tests (3, 11, trace)
  • GitHub Check: Trace nox tests (3, 10, scorers)
  • GitHub Check: Trace nox tests (3, 10, trace)
  • GitHub Check: Trace nox tests (3, 9, scorers)
  • GitHub Check: WeaveJS Lint and Compile
  • GitHub Check: Trace nox tests (3, 13, llamaindex)
  • GitHub Check: Trace nox tests (3, 13, trace_server)
  • GitHub Check: Trace nox tests (3, 13, trace)
  • GitHub Check: Trace nox tests (3, 12, scorers)
  • GitHub Check: Trace nox tests (3, 12, llamaindex)
  • GitHub Check: Trace nox tests (3, 12, litellm)
  • GitHub Check: Trace nox tests (3, 12, trace_server)
  • GitHub Check: Trace nox tests (3, 12, trace)
  • GitHub Check: Trace nox tests (3, 11, scorers)
  • GitHub Check: Trace nox tests (3, 11, llamaindex)
  • GitHub Check: Trace nox tests (3, 11, trace_server)
  • GitHub Check: Trace nox tests (3, 11, trace)
  • GitHub Check: Trace nox tests (3, 10, scorers)
  • GitHub Check: Trace nox tests (3, 10, trace)
  • GitHub Check: Trace nox tests (3, 9, scorers)
  • GitHub Check: WeaveJS Lint and Compile
  • GitHub Check: Trace nox tests (3, 13, llamaindex)
  • GitHub Check: Trace nox tests (3, 13, trace_server)
  • GitHub Check: Trace nox tests (3, 13, trace)
  • GitHub Check: Trace nox tests (3, 12, scorers)
  • GitHub Check: Trace nox tests (3, 12, llamaindex)
  • GitHub Check: Trace nox tests (3, 12, litellm)
  • GitHub Check: Trace nox tests (3, 12, trace_server)
  • GitHub Check: Trace nox tests (3, 12, trace)
  • GitHub Check: Trace nox tests (3, 11, scorers)
  • GitHub Check: Trace nox tests (3, 11, llamaindex)
  • GitHub Check: Trace nox tests (3, 11, trace_server)
  • GitHub Check: Trace nox tests (3, 11, trace)
  • GitHub Check: Trace nox tests (3, 10, scorers)
  • GitHub Check: Trace nox tests (3, 10, trace)
  • GitHub Check: Trace nox tests (3, 9, scorers)
  • GitHub Check: WeaveJS Lint and Compile
  • GitHub Check: Trace nox tests (3, 13, llamaindex)
  • GitHub Check: Trace nox tests (3, 13, trace_server)
  • GitHub Check: Trace nox tests (3, 13, trace)
  • GitHub Check: Trace nox tests (3, 12, scorers)
  • GitHub Check: Trace nox tests (3, 12, llamaindex)
  • GitHub Check: Trace nox tests (3, 12, litellm)
  • GitHub Check: Trace nox tests (3, 12, trace_server)
  • GitHub Check: Trace nox tests (3, 12, trace)
  • GitHub Check: Trace nox tests (3, 11, scorers)
  • GitHub Check: Trace nox tests (3, 11, llamaindex)
  • GitHub Check: Trace nox tests (3, 11, trace_server)
  • GitHub Check: Trace nox tests (3, 11, trace)
  • GitHub Check: Trace nox tests (3, 10, scorers)
  • GitHub Check: Trace nox tests (3, 10, trace)
  • GitHub Check: Trace nox tests (3, 9, scorers)
  • GitHub Check: WeaveJS Lint and Compile
  • GitHub Check: Trace nox tests (3, 13, llamaindex)
  • GitHub Check: Trace nox tests (3, 13, trace_server)
  • GitHub Check: Trace nox tests (3, 13, trace)
  • GitHub Check: Trace nox tests (3, 12, scorers)
  • GitHub Check: Trace nox tests (3, 12, llamaindex)
  • GitHub Check: Trace nox tests (3, 12, litellm)
  • GitHub Check: Trace nox tests (3, 12, trace_server)
  • GitHub Check: Trace nox tests (3, 12, trace)
  • GitHub Check: Trace nox tests (3, 11, scorers)
  • GitHub Check: Trace nox tests (3, 11, llamaindex)
  • GitHub Check: Trace nox tests (3, 11, trace_server)
  • GitHub Check: Trace nox tests (3, 11, trace)
  • GitHub Check: Trace nox tests (3, 10, scorers)
  • GitHub Check: Trace nox tests (3, 10, trace)
  • GitHub Check: Trace nox tests (3, 9, scorers)
  • GitHub Check: WeaveJS Lint and Compile
  • GitHub Check: Trace nox tests (3, 13, llamaindex)
  • GitHub Check: Trace nox tests (3, 13, trace_server)
  • GitHub Check: Trace nox tests (3, 13, trace)
  • GitHub Check: Trace nox tests (3, 12, scorers)
  • GitHub Check: Trace nox tests (3, 12, llamaindex)
  • GitHub Check: Trace nox tests (3, 12, litellm)
  • GitHub Check: Trace nox tests (3, 12, trace_server)
  • GitHub Check: Trace nox tests (3, 12, trace)
  • GitHub Check: Trace nox tests (3, 11, scorers)
  • GitHub Check: Trace nox tests (3, 11, trace_server)
  • GitHub Check: Trace nox tests (3, 11, trace)
  • GitHub Check: Trace nox tests (3, 10, scorers)
  • GitHub Check: Trace nox tests (3, 10, trace)
  • GitHub Check: Trace nox tests (3, 9, scorers)
  • GitHub Check: WeaveJS Lint and Compile
  • GitHub Check: Trace nox tests (3, 13, llamaindex)
  • GitHub Check: Trace nox tests (3, 13, trace_server)
  • GitHub Check: Trace nox tests (3, 13, trace)
  • GitHub Check: Trace nox tests (3, 12, scorers)
  • GitHub Check: Trace nox tests (3, 12, llamaindex)
  • GitHub Check: Trace nox tests (3, 12, trace_server)
  • GitHub Check: Trace nox tests (3, 12, trace)
  • GitHub Check: Trace nox tests (3, 11, scorers)
  • GitHub Check: Trace nox tests (3, 11, trace_server)
  • GitHub Check: Trace nox tests (3, 11, trace)
  • GitHub Check: Trace nox tests (3, 10, scorers)
  • GitHub Check: Trace nox tests (3, 10, trace)
  • GitHub Check: Trace nox tests (3, 9, scorers)
  • GitHub Check: WeaveJS Lint and Compile
  • GitHub Check: Trace nox tests (3, 13, llamaindex)
  • GitHub Check: Trace nox tests (3, 13, trace_server)
  • GitHub Check: Trace nox tests (3, 13, trace)
  • GitHub Check: Trace nox tests (3, 12, scorers)
  • GitHub Check: Trace nox tests (3, 12, llamaindex)
  • GitHub Check: Trace nox tests (3, 12, trace_server)
  • GitHub Check: Trace nox tests (3, 12, trace)
  • GitHub Check: Trace nox tests (3, 11, scorers)
  • GitHub Check: Trace nox tests (3, 11, trace_server)
  • GitHub Check: Trace nox tests (3, 11, trace)
  • GitHub Check: Trace nox tests (3, 10, scorers)
  • GitHub Check: Trace nox tests (3, 10, trace)
  • GitHub Check: Trace nox tests (3, 9, scorers)
  • GitHub Check: WeaveJS Lint and Compile
  • GitHub Check: Trace nox tests (3, 13, llamaindex)
  • GitHub Check: Trace nox tests (3, 13, trace_server)
  • GitHub Check: Trace nox tests (3, 13, trace)
  • GitHub Check: Trace nox tests (3, 12, scorers)
  • GitHub Check: Trace nox tests (3, 12, llamaindex)
  • GitHub Check: Trace nox tests (3, 12, trace_server)
  • GitHub Check: Trace nox tests (3, 12, trace)
  • GitHub Check: Trace nox tests (3, 11, scorers)
  • GitHub Check: Trace nox tests (3, 11, trace_server)
  • GitHub Check: Trace nox tests (3, 11, trace)
  • GitHub Check: Trace nox tests (3, 10, scorers)
  • GitHub Check: Trace nox tests (3, 10, trace)
  • GitHub Check: Trace nox tests (3, 9, scorers)
🔇 Additional comments (21)
weave-js/src/components/PagePanelComponents/Home/Browse3/filters/FilterTagItem.tsx (4)

5-8: New imports support enhanced op filtering functionality.

The added imports for Icon, Tooltip, ALL_TRACES_OR_CALLS_REF_KEY, and opNiceName properly support the new operation filtering capabilities being integrated into the filter panel.

Also applies to: 14-15


30-34: Adding optional className prop enhances component flexibility.

The addition of an optional className prop follows TypeScript best practices and allows for custom styling to be applied from parent components.


43-47: Component signature properly handles the new className prop.

The updated component signature correctly destructures the new prop with a sensible default empty string value.


60-82: Implementation for operation filtering looks good.

The special handling for the 'default-operation' filter item is well implemented:

  • Uses tooltips to display operation information
  • Properly parses operation names
  • Disables removal for "All ops" filter
  • Uses appropriate icon for visual clarity

The conditional logic is clear and handles all cases appropriately.

weave-js/src/components/PagePanelComponents/Home/Browse3/filters/SelectField.tsx (4)

30-30: Add optional isDisabled prop.
This design is straightforward and enhances the component’s flexibility.


62-62: Prop destructuring looks good.
No issues identified; destructuring the optional isDisabled prop is appropriate here.


68-68: Use of local variable innerIsDisabled.
This approach is clean for toggling the disabled state. Just be mindful of scenarios where the parent might expect synchronous updates.


95-95: Prop usage for Select is consistent.
Passing innerIsDisabled to maintain the correct disabled state is well done.

weave-js/src/components/PagePanelComponents/Home/Browse3/filters/FilterPanel.tsx (2)

11-12: New imports introduced.
These imports for WFHighLevelCallFilter and OpVersionSchema align with the expanded filtering functionality.


23-36: Extended FilterPanelProps to handle op filtering.
Declaring additional props for new filter states (frozenFilter, filter, setFilter, etc.) ensures consistent usage throughout. The definitions look correct; no issues found.

weave-js/src/components/PagePanelComponents/Home/Browse3/pages/CallsPage/CallsTable.tsx (3)

9-9: Imported new components from @mui/material.
This change is minor and has no apparent impact on functionality.


77-77: Importing CallSchema.
This is a straightforward import. No concerns identified.


753-757: Passing new filter props to FilterPanel.
Linking the table’s filters with the panel is consistent with the design. Ensure that parent and child keep props in sync, but this looks good.

weave-js/src/components/PagePanelComponents/Home/Browse3/filters/FilterBar.tsx (8)

5-7: Imports for new op filtering utilities and styled components.
These imports are organized and reflect the new filtering logic. No issues found.

Also applies to: 13-13, 19-23


47-60: Extended FilterBarProps for operation filtering.
Adding frozenFilter, filter, setFilter, selectedOpVersionOption, and opVersionOptions broadens the filter’s scope and keeps the design clean.


79-84: Destructuring newly added props.
Destructuring in the component signature captures the new filtering props. Looks consistent with the rest of the code.


314-397: renderOperationFilter to set operation row UI.
The approach is well-structured, using Autocomplete to pick from opVersionOptions. The usage of disabled fields to display “field” and “operator” is a clear, user-friendly design. No issues detected.


399-411: Building operationItem for default op filter handling.
This array logic ensures a consistent fallback if no references are present. The design is succinct.


426-426: Combining operationItem with existing filters.
Appending operationItem at the front is a clean approach to ensure default filters are always shown first.


470-480: Default filters section block.
Clearly separates default from custom filters, improving UI. This structure is well-organized and easy to follow.


481-483: "AND" label for custom filters.
This small label helps clarify the logic chaining. No issues noted.

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.

1 participant