Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions static/app/components/events/autofix/v3/autofixEvidence.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {LinkButton} from '@sentry/scraps/button';
import {IconCompass} from 'sentry/icons/iconCompass';
import {IconFile} from 'sentry/icons/iconFile';
import {IconGithub} from 'sentry/icons/iconGithub';
import {IconGitlab} from 'sentry/icons/iconGitlab';
import {IconIssues} from 'sentry/icons/iconIssues';
import {IconPlay} from 'sentry/icons/iconPlay';
import {IconProfiling} from 'sentry/icons/iconProfiling';
Expand Down Expand Up @@ -309,16 +310,23 @@ function getCodeSearchEvidenceProps({
return null;
}

function getScmIcon(provider: string | undefined): ReactNode {
if (provider === 'integrations:gitlab') {
return <IconGitlab />;
}
return <IconGithub />;

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

for old explorer runs we won;t have provider so im keeping github as the default

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

RepoProviderIcon might be a good import for here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

perfect thanks

}

function getGitSearchEvidenceProps({
toolLink,
}: GetEvidencePropsPayload): EvidenceButtonProps | null {
const {repo_name, commit_url, sha, commits_url, start_date, end_date, file_path} =
const {repo_name, commit_url, sha, commits_url, start_date, end_date, file_path, provider} =
toolLink?.params ?? {};

if (typeof commit_url === 'string' && typeof sha === 'string') {
return {
href: commit_url,
icon: <IconGithub />, // TODO: support other SCMs
icon: getScmIcon(provider),
label: t('Commit: %s', truncateText(getShortCommitHash(sha))),
tooltip: sha,
};
Expand All @@ -334,7 +342,7 @@ function getGitSearchEvidenceProps({
typeof file_path === 'string' ? extractFileName(file_path) : undefined;
return {
href: commits_url,
icon: <IconGithub />, // TODO: support other SCMs
icon: getScmIcon(provider),
label: t('Commits: %s', fileName ? truncateText(fileName) : repo_name),
tooltip: (
<Fragment>
Comment thread
sentry[bot] marked this conversation as resolved.
Expand Down
Loading