Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(error-tracking): refine issue listing filters (#89193)

Hugues Pouillot4f7f0fcae56f
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 9738d1f6a6ef..94b55df426e2 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6385,11 +6385,11 @@ snapshots:
scenes-app-errortracking--list-page--light:
hash: v1.k794b7964.ec828bd049bcf02367910abb18539201ef5f6447b602a75891a64d45d743c4f5.RAArjfFKQhB64bx3ypvlJdCR3svO5Yify4gANdrDJ94
scenes-app-errortracking--list-page-with-ingestion-warning--dark:
- hash: v1.k794b7964.d022a01bda75a3dd24df2d9c8761a89ae164cfc56be95324d5e7c64c10d0b430.oHc4Ikowbu-9SRbRqkbNwIiLvrqTrwPTVdRddjhGNQ0
+ hash: v1.k794b7964.a2671ce13fc32c39579ab419634c7c77d034372dd473ee24ee05e26bcfe8be56.Z2FlqVo9HNn0jHgCPaFQ-UdDH75h9_Wm3HUPk-VSav4
scenes-app-errortracking--list-page-with-ingestion-warning--light:
hash: v1.k794b7964.fc094917ab619f645401504337c6eed08254baf12433126b71a74241c499ad98.zuuZ0RWxU2OZDmwDZY1Usfd9fyV_qZq8t_romWDeQqA
scenes-app-errortracking--list-page-with-source-maps-banner--dark:
- hash: v1.k794b7964.f549cf65c050beb24872b7e7ce7c53049d3853569db398f0ec0bb1e90af3cf54.LR6FysBFkExdTu3nAltZsd3gH8J3knaUNz-MiGs6iTo
+ hash: v1.k794b7964.b4b51ded4a19da613650179d957e7ecce0fd6a3600cde4137322b5f44bf0ab99.ILobhTAx6Pev1QH9aJBVB7402wksWls0nqrzQXEc1dk
scenes-app-errortracking--list-page-with-source-maps-banner--light:
hash: v1.k794b7964.1f1efabaa301aa1fb6df35608b4f0ceb04758b16bd0cb5c5b683d38e9372209d.v4lJX3wKzX7RGn4ckCTmgnfmWGaWaokyfojnXS0_Dlo
scenes-app-errortracking-linkedreports--fix-proposed--dark:
diff --git a/products/error_tracking/frontend/components/Assignee/QuillAssigneeDropdown.tsx b/products/error_tracking/frontend/components/Assignee/QuillAssigneeDropdown.tsx
index 4e2f466fd5f9..555d0bbeb613 100644
--- a/products/error_tracking/frontend/components/Assignee/QuillAssigneeDropdown.tsx
+++ b/products/error_tracking/frontend/components/Assignee/QuillAssigneeDropdown.tsx
@@ -40,7 +40,10 @@ interface AssigneeOptionGroup {
}
export interface QuillAssigneeDropdownProps {
+ ariaLabel: string
assignee: ErrorTrackingIssueAssignee | null
+ clearActionLabel: string
+ currentUserActionLabel: string
onChange: (assignee: ErrorTrackingIssueAssignee | null) => void
open: boolean
onOpenChange: (open: boolean) => void
@@ -56,7 +59,10 @@ function optionLabel(assignee: NonNullable<Assignee>): string {
}
export function QuillAssigneeDropdown({
+ ariaLabel,
assignee,
+ clearActionLabel,
+ currentUserActionLabel,
onChange,
open,
onOpenChange,
@@ -156,7 +162,7 @@ export function QuillAssigneeDropdown({
}
}}
>
- <ComboboxTrigger ref={triggerRef} render={trigger} aria-label="Assignee" />
+ <ComboboxTrigger ref={triggerRef} render={trigger} aria-label={ariaLabel} />
<ComboboxContent
anchor={triggerRef}
align="start"
@@ -234,7 +240,7 @@ export function QuillAssigneeDropdown({
assignee={{ type: 'user', id: me.user.id, user: me.user }}
size="xsmall"
/>
- Assign to me
+ {currentUserActionLabel}
</Button>
) : null}
{assignee ? (
@@ -246,7 +252,7 @@ export function QuillAssigneeDropdown({
onClick={() => onChange(null)}
>
<IconX className="size-3" />
- Remove assignee
+ {clearActionLabel}
</Button>
) : null}
</div>
diff --git a/products/error_tracking/frontend/components/Assignee/QuillAssigneeSelect.tsx b/products/error_tracking/frontend/components/Assignee/QuillAssigneeSelect.tsx
index a0dee1eb44c9..8b2e92b258c8 100644
--- a/products/error_tracking/frontend/components/Assignee/QuillAssigneeSelect.tsx
+++ b/products/error_tracking/frontend/components/Assignee/QuillAssigneeSelect.tsx
@@ -7,13 +7,19 @@ import { Assignee, assigneeSelectLogic } from './assigneeSelectLogic'
import { QuillAssigneeDropdown } from './QuillAssigneeDropdown'
export const QuillAssigneeSelect = ({
+ ariaLabel = 'Assignee',
assignee,
- onChange,
children,
+ clearActionLabel = 'Remove assignee',
+ currentUserActionLabel = 'Assign to me',
+ onChange,
}: {
+ ariaLabel?: string
assignee: ErrorTrackingIssue['assignee']
- onChange: (assignee: ErrorTrackingIssue['assignee']) => void
children: (assignee: Assignee, isOpen: boolean) => JSX.Element
+ clearActionLabel?: string
+ currentUserActionLabel?: string
+ onChange: (assignee: ErrorTrackingIssue['assignee']) => void
}): JSX.Element => {
const { ensureAssigneeTypesLoaded } = useActions(assigneeSelectLogic)
const { resolveAssignee } = useValues(assigneeSelectLogic)
@@ -31,7 +37,10 @@ export const QuillAssigneeSelect = ({
return (
<QuillAssigneeDropdown
+ ariaLabel={ariaLabel}
assignee={assignee}
+ clearActionLabel={clearActionLabel}
+ currentUserActionLabel={currentUserActionLabel}
onChange={_onChange}
open={showPopover}
onOpenChange={setShowPopover}
diff --git a/products/error_tracking/frontend/components/InternalAccountsToggle.tsx b/products/error_tracking/frontend/components/InternalAccountsToggle.tsx
index d1e2f5d586cb..4fb31e01df08 100644
--- a/products/error_tracking/frontend/components/InternalAccountsToggle.tsx
+++ b/products/error_tracking/frontend/components/InternalAccountsToggle.tsx
@@ -1,9 +1,17 @@
import { useActions, useValues } from 'kea'
import { IconBuilding, IconExternal } from '@posthog/icons'
-import { LemonMenu, LemonSwitch } from '@posthog/lemon-ui'
-import { Button } from 'lib/ui/quill'
+import { LinkPrimitive } from 'lib/lemon-ui/Link/Link'
+import {
+ Button,
+ DropdownMenu,
+ DropdownMenuCheckboxItem,
+ DropdownMenuContent,
+ DropdownMenuItem,
+ DropdownMenuSeparator,
+ DropdownMenuTrigger,
+} from 'lib/ui/quill'
import { filterTestAccountsDefaultsLogic } from 'scenes/settings/environment/filterTestAccountDefaultsLogic'
import { teamLogic } from 'scenes/teamLogic'
import { urls } from 'scenes/urls'
@@ -11,16 +19,10 @@ import { urls } from 'scenes/urls'
export interface InternalAccountsToggleProps {
filterTestAccounts: boolean
onChange: (filterTestAccounts: boolean) => void
- /** Ties the label to the switch. Override when two instances can render on one page. */
- id?: string
}
/** Error tracking's internal-user exclusion toggle, with a shortcut to configure the filters. */
-export const InternalAccountsToggle = ({
- filterTestAccounts,
- onChange,
- id = 'error-tracking-test-account-filter',
-}: InternalAccountsToggleProps): JSX.Element => {
+export const InternalAccountsToggle = ({ filterTestAccounts, onChange }: InternalAccountsToggleProps): JSX.Element => {
const { currentTeam } = useValues(teamLogic)
const { setLocalDefault } = useActions(filterTestAccountsDefaultsLogic)
const hasFilters = (currentTeam?.test_account_filters || []).length > 0
@@ -28,45 +30,18 @@ export const InternalAccountsToggle = ({
const isFiltering = hasFilters && filterTestAccounts
return (
- <LemonMenu
- placement="bottom-end"
- closeOnClickInside={false}
- items={[
- {
- custom: true,
- label: () => (
- <LemonSwitch
- id={id}
- className="min-h-8"
- size="small"
- fullWidth
- checked={isFiltering}
- disabledReason={disabledReason}
- onChange={(checked) => {
- onChange(checked)
- setLocalDefault(checked)
- }}
- label="Exclude internal users"
- labelClassName="text-sm"
- data-attr="error-tracking-exclude-internal-users"
- />
- ),
- },
- {
- label: 'Configure internal user filters',
- to: urls.settings('environment-customization', 'internal-user-filtering'),
- targetBlank: true,
- sideIcon: <IconExternal />,
- },
- ]}
- >
- <Button
- variant="default"
- size="icon"
- aria-label="Internal user filters"
- aria-pressed={isFiltering}
- title="Internal user filters"
- data-attr="error-tracking-internal-user-filters"
+ <DropdownMenu>
+ <DropdownMenuTrigger
+ render={
+ <Button
+ variant="default"
+ size="icon"
+ aria-label="Internal user filters"
+ aria-pressed={isFiltering}
+ title="Internal user filters"
+ data-attr="error-tracking-internal-user-filters"
+ />
+ }
>
<span
className={
@@ -76,11 +51,45 @@ export const InternalAccountsToggle = ({
}
>
<IconBuilding className={isFiltering ? 'size-4 text-[var(--primary)]' : 'size-4'} />
- {isFiltering && (
+ {isFiltering ? (
<span className="absolute h-px w-5 -rotate-45 rounded-full bg-current" aria-hidden />
- )}
+ ) : null}
</span>
- </Button>
- </LemonMenu>
+ </DropdownMenuTrigger>
+ <DropdownMenuContent align="end" className="w-56">
+ <DropdownMenuCheckboxItem
+ checked={isFiltering}
+ disabled={!hasFilters}
+ closeOnClick={false}
+ title={disabledReason}
+ data-attr="error-tracking-exclude-internal-users"
+ onCheckedChange={(checked: boolean) => {
+ onChange(checked)
+ setLocalDefault(checked)
+ }}
+ >
+ Exclude internal users
+ </DropdownMenuCheckboxItem>
+ <DropdownMenuSeparator />
+ <DropdownMenuItem
+ render={
+ <Button
+ variant="default"
+ className="w-full font-normal"
+ left
+ render={
+ <LinkPrimitive
+ to={urls.settings('environment-customization', 'internal-user-filtering')}
+ target="_blank"
+ />
+ }
+ />
+ }
+ >
+ <IconExternal />
+ Configure internal user filters
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
)
}
diff --git a/products/error_tracking/frontend/components/IssueFilters/Assignee.tsx b/products/error_tracking/frontend/components/IssueFilters/Assignee.tsx
new file mode 100644
index 000000000000..8c4714829157
--- /dev/null
+++ b/products/error_tracking/frontend/components/IssueFilters/Assignee.tsx
@@ -0,0 +1,30 @@
+import { useActions, useValues } from 'kea'
+
+import { Button, SelectTriggerIcon } from 'lib/ui/quill'
+
+import { AssigneeIconDisplay, AssigneeLabelDisplay } from '../Assignee/AssigneeDisplay'
+import { QuillAssigneeSelect } from '../Assignee/QuillAssigneeSelect'
+import { issueQueryOptionsLogic } from '../IssueQueryOptions/issueQueryOptionsLogic'
+
+export function AssigneeFilter(): JSX.Element {
+ const { assignee } = useValues(issueQueryOptionsLogic)
+ const { setAssignee } = useActions(issueQueryOptionsLogic)
+
+ return (
+ <QuillAssigneeSelect
+ ariaLabel="Assignee filter"
+ assignee={assignee ?? null}
+ clearActionLabel="Clear assignee filter"
+ currentUserActionLabel="Assigned to me"
+ onChange={setAssignee}
+ >
+ {(displayAssignee) => (
+ <Button variant="outline" size="default">
+ <AssigneeIconDisplay assignee={displayAssignee} size="xsmall" />
+ <AssigneeLabelDisplay assignee={displayAssignee} size="xsmall" placeholder="Any assignee" />
+ <SelectTriggerIcon />
+ </Button>
+ )}
+ </QuillAssigneeSelect>
+ )
+}
diff --git a/products/error_tracking/frontend/components/IssueFilters/Severity.tsx b/products/error_tracking/frontend/components/IssueFilters/Severity.tsx
new file mode 100644
index 000000000000..d0311a1f3cfd
--- /dev/null
+++ b/products/error_tracking/frontend/components/IssueFilters/Severity.tsx
@@ -0,0 +1,58 @@
+import { useActions, useValues } from 'kea'
+
+import {
+ Select,
+ SelectContent,
+ SelectGroup,
+ SelectGroupLabel,
+ SelectItem,
+ SelectTrigger,
+ SelectValue,
+} from 'lib/ui/quill'
+
+import { issueQueryOptionsLogic } from '../IssueQueryOptions/issueQueryOptionsLogic'
+import { ISSUE_SEVERITY_OPTIONS, IssueSeverityTag, type IssueSeverity } from '../IssueSeverityTag'
+
+const ALL_SEVERITIES_VALUE = 'all'
+
+type SeverityFilterValue = IssueSeverity | typeof ALL_SEVERITIES_VALUE
+
+function SeverityFilterLabel({ severity }: { severity: IssueSeverity | null }): JSX.Element {
+ return <IssueSeverityTag severity={severity} label={severity ? undefined : 'Any severity'} />
+}
+
+export function SeverityFilter(): JSX.Element {
+ const { severity } = useValues(issueQueryOptionsLogic)
+ const { setSeverity } = useActions(issueQueryOptionsLogic)
+ const value: SeverityFilterValue = severity ?? ALL_SEVERITIES_VALUE
+
+ return (
+ <Select
+ value={value}
+ onValueChange={(nextValue: SeverityFilterValue | null) => {
+ if (nextValue) {
+ setSeverity(nextValue === ALL_SEVERITIES_VALUE ? null : nextValue)
+ }
+ }}
+ >
+ <SelectTrigger size="default" aria-label="Severity filter" data-attr="error-tracking-severity-filter">
+ <SelectValue>
+ <SeverityFilterLabel severity={severity} />
+ </SelectValue>
+ </SelectTrigger>
+ <SelectContent align="start" alignItemWithTrigger={false}>
+ <SelectGroup>
+ <SelectGroupLabel className="py-1">Severity</SelectGroupLabel>
+ <SelectItem value={ALL_SEVERITIES_VALUE}>
+ <SeverityFilterLabel severity={null} />
+ </SelectItem>
+ {ISSUE_SEVERITY_OPTIONS.map((option) => (
+ <SelectItem key={option.value} value={option.value}>
+ <SeverityFilterLabel severity={option.value} />
+ </SelectItem>
+ ))}
+ </SelectGroup>
+ </SelectContent>
+ </Select>
+ )
+}
diff --git a/products/error_tracking/frontend/components/IssueFilters/index.tsx b/products/error_tracking/frontend/components/IssueFilters/index.tsx
index 1d0ecb51daa1..3220eaeecf4b 100644
--- a/products/error_tracking/frontend/components/IssueFilters/index.tsx
+++ b/products/error_tracking/frontend/components/IssueFilters/index.tsx
@@ -1,9 +1,10 @@
-import { AssigneeFilter } from '../Assignee/ErrorTrackingAssigneeSelectButton'
+import { AssigneeFilter } from './Assignee'
import { DateRangeFilter } from './DateRange'
import { FilterGroup } from './FilterGroup'
import { InternalAccountsFilter } from './InternalAccounts'
import { ErrorFiltersRoot } from './Root'
import { IssueSearchInput } from './Search'
+import { SeverityFilter } from './Severity'
import { StatusFilter } from './Status'
export const ErrorFilters = {
@@ -12,6 +13,7 @@ export const ErrorFilters = {
FilterGroup: FilterGroup,
Assignee: AssigneeFilter,
Status: StatusFilter,
+ Severity: SeverityFilter,
InternalAccounts: InternalAccountsFilter,
Search: IssueSearchInput,
}
diff --git a/products/error_tracking/frontend/components/IssueQueryOptions/issueQueryOptionsLogic.test.ts b/products/error_tracking/frontend/components/IssueQueryOptions/issueQueryOptionsLogic.test.ts
index 63fe5e61c8b2..cbaa6bcef32b 100644
--- a/products/error_tracking/frontend/components/IssueQueryOptions/issueQueryOptionsLogic.test.ts
+++ b/products/error_tracking/frontend/components/IssueQueryOptions/issueQueryOptionsLogic.test.ts
@@ -8,6 +8,7 @@ const LOGIC_KEY = 'test'
const PERSISTED_KEY_PREFIX = `products.error_tracking.components.IssueQueryOptions.issueQueryOptionsLogic.${LOGIC_KEY}`
const PERSISTED_STATUS_KEY = `${PERSISTED_KEY_PREFIX}.status`
const PERSISTED_ASSIGNEE_KEY = `${PERSISTED_KEY_PREFIX}.assignee`
+const PERSISTED_SEVERITY_KEY = `${PERSISTED_KEY_PREFIX}.severity`
describe('issueQueryOptionsLogic', () => {
beforeEach(() => {
@@ -65,6 +66,24 @@ describe('issueQueryOptionsLogic', () => {
expect(logic.values.status).toBe('resolved')
})
+ it('applies a valid severity from the URL and clears an invalid one', () => {
+ const logic = mountLogic()
+ router.actions.push('/error_tracking', { severity: 'critical' })
+ expect(logic.values.severity).toBe('critical')
+
+ router.actions.push('/error_tracking', { severity: 'unknown' })
+ expect(logic.values.severity).toBeNull()
+ })
+
+ it('clears a persisted severity when the URL omits the filter', () => {
+ localStorage.setItem(PERSISTED_SEVERITY_KEY, JSON.stringify('critical'))
+ const logic = mountLogic()
+
+ router.actions.push('/error_tracking')
+
+ expect(logic.values.severity).toBeNull()
+ })
+
// A malformed assignee reaches the query, which the backend rejects with a 400. It renders as
// unset, and it's persisted, so the whole issues page keeps failing until it's manually cleared.
const MALFORMED_ASSIGNEES = [
diff --git a/products/error_tracking/frontend/components/IssueQueryOptions/issueQueryOptionsLogic.ts b/products/error_tracking/frontend/components/IssueQueryOptions/issueQueryOptionsLogic.ts
index 083423a0ee33..755e2cac9802 100644
--- a/products/error_tracking/frontend/components/IssueQueryOptions/issueQueryOptionsLogic.ts
+++ b/products/error_tracking/frontend/components/IssueQueryOptions/issueQueryOptionsLogic.ts
@@ -6,7 +6,11 @@ import posthog from 'posthog-js'
import { isUUIDLike } from 'lib/utils/guards'
import { Params } from 'scenes/sceneTypes'
-import { ErrorTrackingIssue, ErrorTrackingQuery } from '~/queries/schema/schema-general'
+import {
+ ErrorTrackingIssue,
+ ErrorTrackingQuery,
+ ErrorTrackingQueryIssueSeverity,
+} from '~/queries/schema/schema-general'
import type {
ErrorTrackingIssueAssignee,
@@ -18,6 +22,7 @@ export type ErrorTrackingQueryOrderBy = ErrorTrackingQuery['orderBy']
export type ErrorTrackingQueryOrderDirection = ErrorTrackingQuery['orderDirection']
export type ErrorTrackingQueryAssignee = ErrorTrackingQuery['assignee']
export type ErrorTrackingQueryStatus = ErrorTrackingQuery['status']
+export type ErrorTrackingQuerySeverity = ErrorTrackingQueryIssueSeverity | null
export const ORDER_BY_OPTIONS: Record<ErrorTrackingQueryOrderBy, string> = {
last_seen: 'Last seen',
@@ -38,6 +43,7 @@ export function isValidOrderBy(orderBy: unknown): orderBy is ErrorTrackingQueryO
const DEFAULT_ORDER_DIRECTION = 'DESC'
const DEFAULT_ASSIGNEE = null
const DEFAULT_STATUS = 'active'
+const DEFAULT_SEVERITY = null
// Like isValidOrderBy, but the assignee is an object, so it can be malformed in more ways: a bare
// string, a missing or null id, a type outside user/role, or a resolved {id, type, user} object.
@@ -77,6 +83,17 @@ export function isValidStatus(status: unknown): status is FilterableStatus {
return typeof status === 'string' && Object.hasOwn(VALID_STATUSES, status)
}
+const VALID_SEVERITIES: Record<ErrorTrackingQueryIssueSeverity, true> = {
+ low: true,
+ medium: true,
+ high: true,
+ critical: true,
+}
+
+export function isValidSeverity(severity: unknown): severity is ErrorTrackingQueryIssueSeverity {
+ return typeof severity === 'string' && Object.hasOwn(VALID_SEVERITIES, severity)
+}
+
export interface IssueQueryOptionsLogicProps {
logicKey: string
}
@@ -86,6 +103,7 @@ export interface issueQueryOptionsLogicValues {
assignee: ErrorTrackingQueryAssignee | null
orderBy: ErrorTrackingQueryOrderBy
orderDirection: ErrorTrackingQueryOrderDirection
+ severity: ErrorTrackingQuerySeverity
status: ErrorTrackingQueryStatus
}
@@ -100,6 +118,9 @@ export interface issueQueryOptionsLogicActions {
setOrderDirection: (orderDirection: ErrorTrackingQueryOrderDirection) => {
orderDirection: 'ASC' | 'DESC' | undefined
}
+ setSeverity: (severity: ErrorTrackingQuerySeverity) => {
+ severity: ErrorTrackingQuerySeverity
+ }
setStatus: (status: ErrorTrackingQueryStatus) => {
status: ErrorTrackingQueryStatus | undefined
}
@@ -126,6 +147,7 @@ export const issueQueryOptionsLogic = kea<issueQueryOptionsLogicType>([
setOrderBy: (orderBy: ErrorTrackingQueryOrderBy) => ({ orderBy }),
setOrderDirection: (orderDirection: ErrorTrackingQueryOrderDirection) => ({ orderDirection }),
setAssignee: (assignee: ErrorTrackingIssue['assignee']) => ({ assignee }),
+ setSeverity: (severity: ErrorTrackingQuerySeverity) => ({ severity }),
setStatus: (status: ErrorTrackingQueryStatus) => ({ status }),
}),
@@ -158,6 +180,13 @@ export const issueQueryOptionsLogic = kea<issueQueryOptionsLogicType>([
setStatus: (_, { status }) => (isValidStatus(status) ? status : DEFAULT_STATUS),
},
],
+ severity: [
+ DEFAULT_SEVERITY as ErrorTrackingQuerySeverity,
+ { persist: true },
+ {
+ setSeverity: (_, { severity }) => (isValidSeverity(severity) ? severity : DEFAULT_SEVERITY),
+ },
+ ],
}),
listeners(({ values }) => ({
@@ -187,6 +216,7 @@ export const issueQueryOptionsLogic = kea<issueQueryOptionsLogicType>([
return syncSearchParams(router, (params: Params) => {
updateSearchParams(params, 'assignee', values.assignee, DEFAULT_ASSIGNEE)
updateSearchParams(params, 'status', values.status, DEFAULT_STATUS)
+ updateSearchParams(params, 'severity', values.severity, DEFAULT_SEVERITY)
updateSearchParams(params, 'orderBy', values.orderBy, DEFAULT_ORDER_BY)
updateSearchParams(params, 'orderDirection', values.orderDirection, DEFAULT_ORDER_DIRECTION)
return params
@@ -196,6 +226,7 @@ export const issueQueryOptionsLogic = kea<issueQueryOptionsLogicType>([
return {
setOrderBy: () => buildURL(),
setStatus: () => buildURL(),
+ setSeverity: () => buildURL(),
setAssignee: () => buildURL(),
setOrderDirection: () => buildURL(),
}
@@ -219,6 +250,10 @@ export const issueQueryOptionsLogic = kea<issueQueryOptionsLogicType>([
if ('assignee' in params && !equal(params.assignee, values.assignee)) {
actions.setAssignee(params.assignee)
}
+ const severity = isValidSeverity(params.severity) ? params.severity : DEFAULT_SEVERITY
+ if (!equal(severity, values.severity)) {
+ actions.setSeverity(severity)
+ }
if (params.orderDirection && !equal(params.orderDirection, values.orderDirection)) {
actions.setOrderDirection(params.orderDirection)
}
@@ -237,6 +272,9 @@ export const issueQueryOptionsLogic = kea<issueQueryOptionsLogicType>([
if (!isValidStatus(values.status)) {
actions.setStatus(DEFAULT_STATUS)
}
+ if (values.severity !== null && !isValidSeverity(values.severity)) {
+ actions.setSeverity(DEFAULT_SEVERITY)
+ }
const sanitizedAssignee = sanitizeAssignee(values.assignee)
if (!equal(values.assignee, sanitizedAssignee)) {
actions.setAssignee(sanitizedAssignee)
diff --git a/products/error_tracking/frontend/components/IssueSeverityTag.tsx b/products/error_tracking/frontend/components/IssueSeverityTag.tsx
index 2aa741af40a1..d90b31de5574 100644
--- a/products/error_tracking/frontend/components/IssueSeverityTag.tsx
+++ b/products/error_tracking/frontend/components/IssueSeverityTag.tsx
@@ -52,11 +52,17 @@ function issueSeverityIcon(severity: IssueSeverity | null | undefined): JSX.Elem
)
}
-export function IssueSeverityTag({ severity }: { severity: IssueSeverity | null | undefined }): JSX.Element {
+export function IssueSeverityTag({
+ severity,
+ label,
+}: {
+ severity: IssueSeverity | null | undefined
+ label?: string
+}): JSX.Element {
return (
<span className={clsx('inline-flex items-center gap-1 text-xs font-medium', issueSeverityColor(severity))}>
{issueSeverityIcon(severity)}
- {issueSeverityLabel(severity)}
+ {label ?? issueSeverityLabel(severity)}
</span>
)
}
diff --git a/products/error_tracking/frontend/components/IssueStatusButton.tsx b/products/error_tracking/frontend/components/IssueStatusButton.tsx
index 94e3df37b56c..8f368d25fe24 100644
--- a/products/error_tracking/frontend/components/IssueStatusButton.tsx
+++ b/products/error_tracking/frontend/components/IssueStatusButton.tsx
@@ -29,7 +29,12 @@ export const IssueStatusButton = ({
<Tooltip>
<TooltipTrigger
render={
- <Button variant="primary" onClick={handleResolve} data-attr="error-tracking-resolve">
+ <Button
+ variant="primary"
+ className="[translate:0_0]"
+ onClick={handleResolve}
+ data-attr="error-tracking-resolve"
+ >
{status === 'active' ? 'Resolve' : 'Reopen'}
</Button>
}
diff --git a/products/error_tracking/frontend/queries.test.ts b/products/error_tracking/frontend/queries.test.ts
index 14fd2b30c2a0..00ae58251adb 100644
--- a/products/error_tracking/frontend/queries.test.ts
+++ b/products/error_tracking/frontend/queries.test.ts
@@ -1,6 +1,11 @@
-import { ProductKey } from '~/queries/schema/schema-general'
+import { ErrorTrackingQuery, ProductKey } from '~/queries/schema/schema-general'
-import { FilterLogicalOperator } from '../../../frontend/src/types'
+import {
+ EventPropertyFilter,
+ FilterLogicalOperator,
+ PropertyFilterType,
+ PropertyOperator,
+} from '../../../frontend/src/types'
import { errorTrackingIssueBreakdownQuery, errorTrackingIssueEventsQuery, errorTrackingQuery } from './queries'
describe('queries', () => {
@@ -28,6 +33,50 @@ describe('queries', () => {
expect(actual).toMatchSnapshot()
})
})
+
+ it('adds severity without changing an OR property filter', () => {
+ const browserFilter: EventPropertyFilter = {
+ type: PropertyFilterType.Event,
+ key: '$browser',
+ operator: PropertyOperator.Exact,
+ value: ['Chrome'],
+ }
+ const osFilter: EventPropertyFilter = {
+ type: PropertyFilterType.Event,
+ key: '$os',
+ operator: PropertyOperator.Exact,
+ value: ['Mac OS X'],
+ }
+ const actual = errorTrackingQuery({
+ orderBy: 'last_seen',
+ dateRange: { date_from: '-7d', date_to: null },
+ filterTestAccounts: true,
+ filterGroup: {
+ type: FilterLogicalOperator.And,
+ values: [{ type: FilterLogicalOperator.Or, values: [browserFilter, osFilter] }],
+ },
+ severity: 'high',
+ columns: ['error'],
+ })
+
+ expect((actual.source as ErrorTrackingQuery).filterGroup).toEqual({
+ type: FilterLogicalOperator.And,
+ values: [
+ {
+ type: FilterLogicalOperator.And,
+ values: [
+ { type: FilterLogicalOperator.Or, values: [browserFilter, osFilter] },
+ {
+ type: PropertyFilterType.ErrorTrackingIssue,
+ key: 'severity',
+ operator: PropertyOperator.Exact,
+ value: ['high'],
+ },
+ ],
+ },
+ ],
+ })
+ })
})
describe('error tracking query tags', () => {
diff --git a/products/error_tracking/frontend/queries.ts b/products/error_tracking/frontend/queries.ts
index 4d1a575ad81e..31ea1dd87e60 100644
--- a/products/error_tracking/frontend/queries.ts
+++ b/products/error_tracking/frontend/queries.ts
@@ -1,3 +1,5 @@
+import { isUniversalGroupFilterLike } from 'lib/components/UniversalFilters/utils'
+
import {
DataTableNode,
DateRange,
@@ -7,6 +9,7 @@ import {
ErrorTrackingIssueCorrelationQuery,
ErrorTrackingPendingFingerprintIssueStateUpdate,
ErrorTrackingQuery,
+ ErrorTrackingQueryIssueSeverity,
EventsQuery,
InsightVizNode,
NodeKind,
@@ -17,8 +20,11 @@ import {
AnyPropertyFilter,
BaseMathType,
ChartDisplayType,
+ ErrorTrackingIssueFilter,
+ FilterLogicalOperator,
PropertyFilterType,
PropertyGroupFilter,
+ PropertyOperator,
UniversalFiltersGroup,
} from '~/types'
@@ -29,9 +35,48 @@ import {
SEARCHABLE_EXCEPTION_PROPERTIES,
} from './utils'
+function withIssueSeverityFilter(
+ filterGroup: UniversalFiltersGroup,
+ severity: ErrorTrackingQueryIssueSeverity | null | undefined
+): UniversalFiltersGroup {
+ if (!severity) {
+ return filterGroup
+ }
+
+ const severityFilter: ErrorTrackingIssueFilter = {
+ key: 'severity',
+ type: PropertyFilterType.ErrorTrackingIssue,
+ operator: PropertyOperator.Exact,
+ value: [severity],
+ }
+ const firstValue = filterGroup.values[0]
+ const firstGroup: UniversalFiltersGroup = isUniversalGroupFilterLike(firstValue)
+ ? firstValue
+ : {
+ type: FilterLogicalOperator.And,
+ values: firstValue ? [firstValue] : [],
+ }
+ const nextValues =
+ firstGroup.type === FilterLogicalOperator.Or && firstGroup.values.length > 0
+ ? [firstGroup, severityFilter]
+ : [...firstGroup.values, severityFilter]
+
+ return {
+ ...filterGroup,
+ values: [
+ {
+ type: FilterLogicalOperator.And,
+ values: nextValues,
+ },
+ ...filterGroup.values.slice(1),
+ ],
+ }
+}
+
export const errorTrackingQuery = ({
orderBy,
status,
+ severity,
dateRange,
assignee,
filterTestAccounts,
@@ -60,6 +105,7 @@ export const errorTrackingQuery = ({
| 'groupTypeIndex'
> & {
filterGroup: UniversalFiltersGroup
+ severity?: ErrorTrackingQueryIssueSeverity | null
columns: string[]
volumeResolution?: number
pendingFingerprintIssueStateUpdates?: ErrorTrackingPendingFingerprintIssueStateUpdate[]
@@ -73,7 +119,7 @@ export const errorTrackingQuery = ({
dateRange,
assignee,
volumeResolution,
- filterGroup: filterGroup as PropertyGroupFilter,
+ filterGroup: withIssueSeverityFilter(filterGroup, severity) as PropertyGroupFilter,
filterTestAccounts: filterTestAccounts,
searchQuery: searchQuery,
limit: limit,
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingScene/errorTrackingSceneLogic.ts b/products/error_tracking/frontend/scenes/ErrorTrackingScene/errorTrackingSceneLogic.ts
index 0cd87a50ec64..2bdd57c07cc3 100644
--- a/products/error_tracking/frontend/scenes/ErrorTrackingScene/errorTrackingSceneLogic.ts
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingScene/errorTrackingSceneLogic.ts
@@ -27,6 +27,7 @@ import type {
ErrorTrackingQueryAssignee,
ErrorTrackingQueryOrderBy,
ErrorTrackingQueryOrderDirection,
+ ErrorTrackingQuerySeverity,
ErrorTrackingQueryStatus,
} from '../../components/IssueQueryOptions/issueQueryOptionsLogic'
import { bulkSelectLogic } from '../../logics/bulkSelectLogic'
@@ -55,6 +56,7 @@ export interface errorTrackingSceneLogicValues {
assignee: ErrorTrackingQueryAssignee | null // issueQueryOptionsLogic
orderBy: ErrorTrackingQueryOrderBy // issueQueryOptionsLogic
orderDirection: ErrorTrackingQueryOrderDirection // issueQueryOptionsLogic
+ severity: ErrorTrackingQuerySeverity // issueQueryOptionsLogic
status: ErrorTrackingQueryStatus // issueQueryOptionsLogic
currentPendingUpdates: ErrorTrackingPendingFingerprintIssueStateUpdate[] // pendingFingerprintIssueStateUpdateLogic
selectedSettingId: SettingId | null // settingsLogic
@@ -119,6 +121,7 @@ export interface errorTrackingSceneLogicMeta {
mergedFilterGroup: UniversalFiltersGroup,
searchQuery: string,
orderDirection: 'ASC' | 'DESC' | undefined,
+ severity: ErrorTrackingQuerySeverity,
currentPendingUpdates: ErrorTrackingPendingFingerprintIssueStateUpdate[]
) => DataTableNode
}
@@ -143,7 +146,7 @@ export const errorTrackingSceneLogic = kea<errorTrackingSceneLogicType>([
issueFiltersLogic({ logicKey: ERROR_TRACKING_SCENE_LOGIC_KEY }),
['dateRange', 'filterTestAccounts', 'filterGroup', 'mergedFilterGroup', 'searchQuery'],
issueQueryOptionsLogic({ logicKey: ERROR_TRACKING_SCENE_LOGIC_KEY }),
- ['assignee', 'orderBy', 'orderDirection', 'status'],
+ ['assignee', 'orderBy', 'orderDirection', 'severity', 'status'],
settingsLogic({
logicKey: ERROR_TRACKING_LOGIC_KEY,
sectionId: 'environment-error-tracking-configuration',
@@ -189,6 +192,7 @@ export const errorTrackingSceneLogic = kea<errorTrackingSceneLogicType>([
s.mergedFilterGroup,
s.searchQuery,
s.orderDirection,
+ s.severity,
s.currentPendingUpdates,
],
(
@@ -202,6 +206,7 @@ export const errorTrackingSceneLogic = kea<errorTrackingSceneLogicType>([
mergedFilterGroup: UniversalFiltersGroup,
searchQuery: string,
orderDirection: import('../../components/IssueQueryOptions/issueQueryOptionsLogic').ErrorTrackingQueryOrderDirection,
+ severity: import('../../components/IssueQueryOptions/issueQueryOptionsLogic').ErrorTrackingQuerySeverity,
currentPendingUpdates: import('~/queries/schema').ErrorTrackingPendingFingerprintIssueStateUpdate[]
): DataTableNode => {
return errorTrackingQuery({
@@ -215,6 +220,7 @@ export const errorTrackingSceneLogic = kea<errorTrackingSceneLogicType>([
searchQuery,
columns: ['error', 'volume', 'occurrences', 'sessions', 'users'],
orderDirection,
+ severity,
pendingFingerprintIssueStateUpdates: currentPendingUpdates,
})
},
diff --git a/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/issues/IssuesFilters.tsx b/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/issues/IssuesFilters.tsx
index 4f18341efd30..5825f3865afb 100644
--- a/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/issues/IssuesFilters.tsx
+++ b/products/error_tracking/frontend/scenes/ErrorTrackingScene/tabs/issues/IssuesFilters.tsx
@@ -1,4 +1,4 @@
-import { Separator } from 'lib/ui/quill'
+import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { ErrorFilters } from 'products/error_tracking/frontend/components/IssueFilters'
import { ErrorTrackingQuickFilters } from 'products/error_tracking/frontend/components/IssueFilters/QuickFilters'
@@ -8,21 +8,23 @@ import {
} from 'products/error_tracking/frontend/components/IssueQueryOptions/IssueQueryOptions'
export function IssuesFilters(): JSX.Element {
+ const hasSeverityRules = useFeatureFlag('ERROR_TRACKING_SEVERITY_RULES')
+
return (
<ErrorFilters.Root>
<div className="flex flex-col gap-2">
- <div className="flex flex-wrap items-center gap-2">
- <div className="flex shrink-0 items-center gap-2">
+ <div className="flex items-start gap-2">
+ <div className="flex min-w-0 flex-1 flex-wrap items-center gap-2">
<ReloadIssuesButton />
<ErrorFilters.DateRange />
- </div>
- <ErrorFilters.Status />
- <ErrorFilters.Assignee />
- <Separator orientation="vertical" className="h-6" />
- <ErrorTrackingQuickFilters />
- <div className="ml-auto shrink-0">
+ <ErrorFilters.Status />
+ {hasSeverityRules ? <ErrorFilters.Severity /> : null}
+ <ErrorFilters.Assignee />
<ErrorFilters.InternalAccounts />
</div>
+ <div className="ml-auto flex shrink-0 items-center gap-2">
+ <ErrorTrackingQuickFilters />
+ </div>
</div>
<div className="flex w-full flex-wrap items-center gap-2">
<ErrorFilters.Search />