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

Merged
merged 2 commits into from
Jul 21, 2025
Merged

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
cursor[bot]

This comment was marked as outdated.

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]);
}

Copy link
Member

@malwilley malwilley left a comment

Choose a reason for hiding this comment

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

Looks good!

If you want to add test coverage, there is already one here for filtering by type:

it('can filter by type', async function () {

@leedongwei
Copy link
Member Author

Updated with a test and style nits.

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 Resolution Failure

The replacement of the custom getDetectorFilterKeyDefinition with the generic getFieldDefinition breaks field definition resolution for detector-specific filter keys. The original function was specifically designed to process DETECTOR_FILTER_KEYS and extract properties like description, valueType, keywords, and values to form correct field definitions. The generic getFieldDefinition lacks this specialized knowledge, which can impair search functionality, including autocomplete, validation, and keyword aliases for detector-specific keys such as 'name', 'type', and 'assignee'.

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 👎

@leedongwei leedongwei merged commit 181ca83 into master Jul 21, 2025
46 checks passed
@leedongwei leedongwei deleted the dlee-/aci-426-fe branch July 21, 2025 22:22
@leedongwei
Copy link
Member Author

Oops, I didn't know that "auto merge" would go in even when I re-requested review.

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.

3 participants