From: stanislavh Date: Thu, 14 Dec 2023 15:15:09 +0000 (+0100) Subject: SONAR-21259 Update QG overview measure cards design X-Git-Tag: 10.4.0.87286~312 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6c2e24cdf98f3f64540486b6028e43d4f3deef88;p=sonarqube.git SONAR-21259 Update QG overview measure cards design --- diff --git a/server/sonar-web/src/main/js/apps/overview/components/BranchQualityGateConditions.tsx b/server/sonar-web/src/main/js/apps/overview/components/BranchQualityGateConditions.tsx index 957a43f72b1..5520b9d4489 100644 --- a/server/sonar-web/src/main/js/apps/overview/components/BranchQualityGateConditions.tsx +++ b/server/sonar-web/src/main/js/apps/overview/components/BranchQualityGateConditions.tsx @@ -80,7 +80,7 @@ function FailedQGCondition( return ( - + {translate('overview.measures.failed_badge')} diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCard.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCard.tsx index ae195fceafd..8b451ab348e 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCard.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCard.tsx @@ -18,7 +18,7 @@ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ import styled from '@emotion/styled'; -import { Badge, Card, ContentLink, themeColor } from 'design-system'; +import { Badge, Card, ContentLink, themeBorder, themeColor } from 'design-system'; import * as React from 'react'; import { To } from 'react-router-dom'; import { translate, translateWithParameters } from '../../../helpers/l10n'; @@ -40,42 +40,40 @@ export default function MeasuresCard( const { failed, children, metric, icon, value, url, label, ...rest } = props; return ( - -
-
- {value ? ( - - {value} - - ) : ( - — - )} - {translate(label)} - {failed && ( - - {translate('overview.measures.failed_badge')} - - )} -
- {children &&
{children}
} + + {translate(label)} + {failed && ( + + {translate('overview.measures.failed_badge')} + + )} +
+ {value ? ( + + {value} + + ) : ( + — + )} + {icon}
- - {icon &&
{icon}
} - + {children &&
{children}
} +
); } -const StyledNoValue = styled.span` +const StyledCard = styled(Card)` + border: ${themeBorder('default')}; +`; + +const ColorBold = styled.span` color: ${themeColor('pageTitle')}; `; diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCardNumber.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCardNumber.tsx index 7f905c97b9e..6ab310bb289 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCardNumber.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCardNumber.tsx @@ -70,12 +70,14 @@ export default function MeasuresCardNumber( data-guiding-id={conditionFailed ? guidingKeyOnError : undefined} {...rest} > - {requireLabel && - (conditionFailed ? ( - - ) : ( - {requireLabel} - ))} + + {requireLabel && + (conditionFailed ? ( + + ) : ( + {requireLabel} + ))} + ); } diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCardPanel.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCardPanel.tsx index 5f116e4c822..68eb13cebb3 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCardPanel.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCardPanel.tsx @@ -116,7 +116,7 @@ export default function MeasuresCardPanel(props: React.PropsWithChildren) conditions={conditions} conditionMetric={MetricKey.new_duplicated_lines_density} newLinesMetric={MetricKey.new_lines} - afterMergeMetric={MetricKey.duplicated_lines_density} + afterMergeMetric={MetricKey.coverage} measures={measures} />
diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCardPercent.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCardPercent.tsx index a7a9a16172a..8998e9e32a3 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCardPercent.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/MeasuresCardPercent.tsx @@ -113,46 +113,49 @@ export default function MeasuresCardPercent( icon={renderIcon(measurementType, value)} > <> - {requireLabel && - (conditionFailed ? ( - - ) : ( - {requireLabel} - ))} + + {requireLabel && + (conditionFailed ? ( + + ) : ( + {requireLabel} + ))} + - - - {formatMeasure(newLinesValue ?? '0', MetricType.ShortInteger)} - - ), - }} - /> - - - {afterMergeValue && ( - +
+ {formatMeasure(afterMergeValue, MetricType.Percent)}, + link: ( + + {formatMeasure(newLinesValue ?? '0', MetricType.ShortInteger)} + + ), }} /> - )} + + {afterMergeValue && ( + {formatMeasure(afterMergeValue, MetricType.Percent)}, + }} + /> + )} + +
); diff --git a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-it.tsx b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-it.tsx index 2755d3b3abf..f1c6157a6e0 100644 --- a/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-it.tsx +++ b/server/sonar-web/src/main/js/apps/overview/pullRequests/__tests__/PullRequestOverview-it.tsx @@ -180,12 +180,12 @@ it('should render correctly for a failed QG', async () => { expect( byRole('link', { - name: 'overview.measures.failed_badge overview.failed_condition.x_required 10.0% duplicated_lines ≤ 1.0%', + name: 'overview.measures.failed_badge overview.failed_condition.x_required 10.0% duplicated_lines≤ 1.0%', }).get(), ).toBeInTheDocument(); expect( byRole('link', { - name: 'overview.measures.failed_badge overview.failed_condition.x_required 10 new_bugs ≤ 3', + name: 'overview.measures.failed_badge overview.failed_condition.x_required 10 new_bugs≤ 3', }).get(), ).toBeInTheDocument(); }); diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 577e4ae1554..d7af0cf37d2 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -3831,8 +3831,8 @@ overview.quality_gate.show_project_conditions_x=Show failed conditions for proje overview.quality_gate.hide_project_conditions_x=Hide failed conditions for project {0} overview.quality_gate.coverage=Coverage overview.quality_gate.duplications=Duplications -overview.quality_gate.on_x_new_lines_to_cover=On {link} New Lines to cover -overview.quality_gate.on_x_new_lines=On {link} New Lines +overview.quality_gate.on_x_new_lines_to_cover=On {link} New Lines to cover. +overview.quality_gate.on_x_new_lines=On {link} New Lines. overview.quality_gate.x_estimated_after_merge={value} Estimated after merge overview.quality_gate.require_fixing={count, plural, one {requires} other {require}} fixing overview.quality_gate.require_reviewing={count, plural, one {requires} other {require}} reviewing