Skip to content
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

feat: add autofix #503

Merged
merged 6 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from 5 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
6 changes: 6 additions & 0 deletions .changeset/sweet-melons-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@monokle/components": minor
"@monokle/validation": minor
---

add autofixes
18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ const ProblemRenderer: React.FC<IProps> = props => {
[selectedProblem, node.problem, groupByFilterValue]
);

const absent = node.problem.baselineState === 'absent';
const hasFix = node.problem.fixes && node.problem.fixes.length > 0;

const isUnderReview = useMemo(() => {
return Boolean(
typeof suppressionBindings?.isUnderReview == 'function' && suppressionBindings.isUnderReview(node.problem)
Expand All @@ -51,7 +54,7 @@ const ProblemRenderer: React.FC<IProps> = props => {
return (
<Row
$isSelected={isSelected}
$isSuppressed={suppressed}
$isSuppressed={suppressed || absent}
$isUnderReview={isUnderReview}
$secondary={groupByFilterValue === 'group-by-rule'}
onClick={onClick}
Expand Down Expand Up @@ -97,9 +100,8 @@ const ProblemRenderer: React.FC<IProps> = props => {
</Tooltip>

<ProblemIcon level={node.problem.level ?? 'error'} style={{fontSize: '8px', marginRight: '-8px'}} />

<ProblemText $isSuppressed={suppressed}>{node.problem.message.text}</ProblemText>

<ProblemText $isSuppressed={suppressed || absent}>{node.problem.message.text}</ProblemText>
{suppressed ? '(suppressed)' : ''}
{node.problem.taxa?.length ? (
<TagsContainer>
{node.problem.taxa.map(framework => (
Expand All @@ -119,11 +121,15 @@ const ProblemRenderer: React.FC<IProps> = props => {
)}

<ActionsContainer onClick={e => e.stopPropagation()}>
{onAutofixHandler && (
{onAutofixHandler && hasFix && !absent ? (
<Tooltip mouseEnterDelay={TOOLTIP_DELAY} title="Autofix">
<Icon name="magic-wand" onClick={() => onAutofixHandler(node.problem)} />
<Icon
style={{color: isSelected ? Colors.blackPure : Colors.blue7}}
name="magic-wand"
onClick={() => onAutofixHandler(node.problem)}
/>
</Tooltip>
)}
) : null}

{showSuppressionCTA ? (
<Tooltip
Expand Down
Loading
Loading