|
@@ -4,8 +4,6 @@ import styled from '@emotion/styled';
|
|
|
import type {LocationDescriptor} from 'history';
|
|
|
import keyBy from 'lodash/keyBy';
|
|
|
|
|
|
-import type {Tag} from 'sentry/actionCreators/events';
|
|
|
-import type {GroupTagResponseItem} from 'sentry/actionCreators/group';
|
|
|
import GuideAnchor from 'sentry/components/assistant/guideAnchor';
|
|
|
import LoadingError from 'sentry/components/loadingError';
|
|
|
import Placeholder from 'sentry/components/placeholder';
|
|
@@ -19,7 +17,10 @@ import {appendTagCondition} from 'sentry/utils/queryString';
|
|
|
import {useLocation} from 'sentry/utils/useLocation';
|
|
|
import useOrganization from 'sentry/utils/useOrganization';
|
|
|
import {formatVersion} from 'sentry/utils/versions/formatVersion';
|
|
|
-import {useGroupTagsReadable} from 'sentry/views/issueDetails/groupTags/useGroupTags';
|
|
|
+import {
|
|
|
+ type GroupTag,
|
|
|
+ useGroupTagsReadable,
|
|
|
+} from 'sentry/views/issueDetails/groupTags/useGroupTags';
|
|
|
|
|
|
import TagFacetsDistributionMeter from './tagFacetsDistributionMeter';
|
|
|
|
|
@@ -44,9 +45,9 @@ export const BACKEND_TAGS = [
|
|
|
|
|
|
export const DEFAULT_TAGS = ['transaction', 'environment', 'release'];
|
|
|
|
|
|
-export function TAGS_FORMATTER(tagsData: Record<string, GroupTagResponseItem>) {
|
|
|
+export function TAGS_FORMATTER(tagsData: Record<string, GroupTag>) {
|
|
|
// For "release" tag keys, format the release tag value to be more readable (ie removing version prefix)
|
|
|
- const transformedTagsData = {};
|
|
|
+ const transformedTagsData: Record<string, GroupTag> = {};
|
|
|
Object.keys(tagsData).forEach(tagKey => {
|
|
|
if (tagKey === 'release') {
|
|
|
transformedTagsData[tagKey] = {
|
|
@@ -76,32 +77,12 @@ export function TAGS_FORMATTER(tagsData: Record<string, GroupTagResponseItem>) {
|
|
|
return transformedTagsData;
|
|
|
}
|
|
|
|
|
|
-export function sumTagFacetsForTopValues(tag: Tag) {
|
|
|
- return {
|
|
|
- ...tag,
|
|
|
- name: tag.key,
|
|
|
- totalValues: tag.topValues.reduce((acc, {count}) => acc + count, 0),
|
|
|
- topValues: tag.topValues.map(({name, count}) => ({
|
|
|
- key: tag.key,
|
|
|
- name,
|
|
|
- value: name,
|
|
|
- count,
|
|
|
-
|
|
|
- // These values aren't displayed in the sidebar
|
|
|
- firstSeen: '',
|
|
|
- lastSeen: '',
|
|
|
- })),
|
|
|
- };
|
|
|
-}
|
|
|
-
|
|
|
type Props = {
|
|
|
environments: string[];
|
|
|
groupId: string;
|
|
|
project: Project;
|
|
|
tagKeys: string[];
|
|
|
- tagFormatter?: (
|
|
|
- tagsData: Record<string, GroupTagResponseItem>
|
|
|
- ) => Record<string, GroupTagResponseItem>;
|
|
|
+ tagFormatter?: (tagsData: Record<string, GroupTag>) => Record<string, GroupTag>;
|
|
|
};
|
|
|
|
|
|
export default function TagFacets({
|
|
@@ -118,16 +99,15 @@ export default function TagFacets({
|
|
|
environment: environments,
|
|
|
});
|
|
|
|
|
|
- const tagsData = useMemo(() => {
|
|
|
+ const tagsData = useMemo((): Record<string, GroupTag> => {
|
|
|
if (!data) {
|
|
|
return {};
|
|
|
}
|
|
|
|
|
|
const keyed = keyBy(data, 'key');
|
|
|
- const formatted =
|
|
|
- tagFormatter?.(keyed as Record<string, GroupTagResponseItem>) ?? keyed;
|
|
|
+ const formatted = tagFormatter?.(keyed) ?? keyed;
|
|
|
|
|
|
- return formatted as Record<string, GroupTagResponseItem>;
|
|
|
+ return formatted;
|
|
|
}, [data, tagFormatter]);
|
|
|
|
|
|
// filter out replayId since we no longer want to
|
|
@@ -228,7 +208,7 @@ function TagFacetsDistributionMeterWrapper({
|
|
|
organization: Organization;
|
|
|
project: Project;
|
|
|
tagKeys: string[];
|
|
|
- tagsData: Record<string, GroupTagResponseItem>;
|
|
|
+ tagsData: Record<string, GroupTag>;
|
|
|
expandFirstTag?: boolean;
|
|
|
}) {
|
|
|
const location = useLocation();
|