From ca293f9df25b5b1429e8a698875287b34287c940 Mon Sep 17 00:00:00 2001
From: Josh Callender <1569818+saponifi3d@users.noreply.github.com>
Date: Wed, 19 Nov 2025 22:33:18 -0800
Subject: [PATCH] add a dropdown of tags that we've seen in the past.
---
.../components/actionFilters/taggedEvent.tsx | 45 ++++++++++++++++---
1 file changed, 40 insertions(+), 5 deletions(-)
diff --git a/static/app/views/automations/components/actionFilters/taggedEvent.tsx b/static/app/views/automations/components/actionFilters/taggedEvent.tsx
index 3ab0dcdd6a8014..4a0ef61cc2eac8 100644
--- a/static/app/views/automations/components/actionFilters/taggedEvent.tsx
+++ b/static/app/views/automations/components/actionFilters/taggedEvent.tsx
@@ -1,8 +1,12 @@
+import {useFetchOrganizationTags} from 'sentry/actionCreators/tags';
+import LoadingIndicator from 'sentry/components/loadingIndicator';
import {AutomationBuilderInput} from 'sentry/components/workflowEngine/form/automationBuilderInput';
import {AutomationBuilderSelect} from 'sentry/components/workflowEngine/form/automationBuilderSelect';
import {t, tct} from 'sentry/locale';
import type {SelectValue} from 'sentry/types/core';
import type {DataCondition} from 'sentry/types/workflowEngine/dataConditions';
+import useOrganization from 'sentry/utils/useOrganization';
+import {Dataset} from 'sentry/views/alerts/rules/metric/types';
import {
MATCH_CHOICES,
type MatchType,
@@ -33,16 +37,47 @@ function KeyField() {
const {condition, condition_id, onUpdate} = useDataConditionNodeContext();
const {removeError} = useAutomationBuilderErrorContext();
+ // Select all the tags for an organization to generate a list of the most likely tags
+ const organization = useOrganization();
+ const {data: tagOptions, isLoading} = useFetchOrganizationTags(
+ {
+ orgSlug: organization.slug,
+ projectIds: ['-1'],
+ dataset: Dataset.ERRORS,
+ useCache: true,
+ enabled: true,
+ keepPreviousData: true,
+ },
+ {}
+ );
+
+ if (!tagOptions || isLoading) {
+ return ;
+ }
+
+ const tags = tagOptions.sort((a, b) => a.key.localeCompare(b.key));
+ if (
+ condition.comparison.key &&
+ !tags.some(tag => tag.key === condition.comparison.key)
+ ) {
+ tags.unshift(condition.comparison);
+ }
+
return (
- ) => {
- onUpdate({comparison: {...condition.comparison, key: e.target.value}});
+ value={condition.comparison.key}
+ options={Object.values(tags).map(tag => ({
+ value: tag.key,
+ label: tag.key,
+ }))}
+ onChange={(e: SelectValue) => {
+ onUpdate({comparison: {...condition.comparison, key: e.value}});
removeError(condition.id);
}}
- aria-label={t('Tag')}
/>
);
}