Skip to content

feat(aci): UI to filter monitors by assignee #95930

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

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

Conversation

leedongwei
Copy link
Member

Step 1

Screenshot 2025-07-14 at 4 09 47 PM

Step 2

Screenshot 2025-07-14 at 4 10 01 PM

Step 3

Screenshot 2025-07-14 at 4 10 18 PM

@leedongwei leedongwei requested a review from a team as a code owner July 18, 2025 20:32
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jul 18, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Detector Filter Key Definition Regression

The fieldDefinitionGetter in DetectorSearch was incorrectly changed from the custom getDetectorFilterKeyDefinition to the generic getFieldDefinition. The original function was specifically designed to create FieldDefinition objects for DETECTOR_FILTER_KEYS (e.g., 'name', 'type', 'assignee') by extracting their specific properties. The generic getFieldDefinition lacks knowledge of these detector-specific keys, preventing the SearchQueryBuilder from properly recognizing and handling them, thus breaking search functionality for detector-specific filters.

static/app/views/detectors/components/detectorSearch.tsx#L21-L22

searchSource="detectors-list"
fieldDefinitionGetter={getFieldDefinition}

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

Copy link
Contributor

@saponifi3d saponifi3d left a comment

Choose a reason for hiding this comment

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

nice! mind adding a few tests as well?

Comment on lines +7 to +40
export function useDetectorFilterKeys(): TagCollection {
const assignedValues = useAssignedSearchValues();

return useMemo(() => {
return Object.fromEntries(
Object.keys(DETECTOR_FILTER_KEYS).map(key => {
const {values} = DETECTOR_FILTER_KEYS[key] ?? {};

// Special handling for assignee field to provide user/team values
if (key === 'assignee') {
return [
key,
{
key,
name: key,
predefined: true,
values: assignedValues,
},
];
}

return [
key,
{
key,
name: key,
predefined: values !== undefined,
values,
},
];
})
);
}, [assignedValues]);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: felt like it was a little more concise using entries rather than keys and then inlining the checks for isAssignee.

export function useDetectorFilterKeys(): TagCollection {
  const assignedValues = useAssignedSearchValues();

  return useMemo(() => {
    return Object.fromEntries(
      Object.entries(DETECTOR_FILTER_KEYS).map(([key, config]) => {
        const { values } = config ?? {};
        const isAssignee = key === 'assignee';
        
        return [key, {
          key,
          name: key,
          predefined: isAssignee || values !== undefined,
          values: isAssignee ? assignedValues : values,
        }];
      })
    );
  }, [assignedValues]);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Frontend Automatically applied to PRs that change frontend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants