return (
<StyledConditionButton className="sw-px-3 sw-py-2 sw-rounded-1 sw-body-sm" to={url}>
- <Badge className="sw-mr-2" variant="deleted">
+ <Badge className="sw-mr-2 sw-px-1" variant="deleted">
{translate('overview.measures.failed_badge')}
</Badge>
<SpanDanger>
* 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';
const { failed, children, metric, icon, value, url, label, ...rest } = props;
return (
- <Card
- className="sw-h-fit sw-p-8 sw-rounded-2 sw-flex sw-justify-between sw-items-center sw-text-base"
- {...rest}
- >
- <div className="sw-flex sw-flex-col sw-gap-1 sw-justify-between">
- <div className="sw-flex sw-items-center sw-gap-2 sw-font-semibold">
- {value ? (
- <ContentLink
- aria-label={translateWithParameters(
- 'overview.see_more_details_on_x_of_y',
- value,
- localizeMetric(metric),
- )}
- className="it__overview-measures-value sw-text-lg"
- to={url}
- >
- {value}
- </ContentLink>
- ) : (
- <StyledNoValue> — </StyledNoValue>
- )}
- {translate(label)}
- {failed && (
- <Badge className="sw-mt-1/2" variant="deleted">
- {translate('overview.measures.failed_badge')}
- </Badge>
- )}
- </div>
- {children && <div className="sw-flex sw-flex-col">{children}</div>}
+ <StyledCard className="sw-h-fit sw-p-6 sw-rounded-2 sw-text-base" {...rest}>
+ <ColorBold className="sw-body-sm-highlight">{translate(label)}</ColorBold>
+ {failed && (
+ <Badge className="sw-mt-1/2 sw-px-1 sw-ml-2" variant="deleted">
+ {translate('overview.measures.failed_badge')}
+ </Badge>
+ )}
+ <div className="sw-flex sw-items-center sw-mt-1 sw-justify-between sw-font-semibold">
+ {value ? (
+ <ContentLink
+ aria-label={translateWithParameters(
+ 'overview.see_more_details_on_x_of_y',
+ value,
+ localizeMetric(metric),
+ )}
+ className="it__overview-measures-value sw-text-lg"
+ to={url}
+ >
+ {value}
+ </ContentLink>
+ ) : (
+ <ColorBold> — </ColorBold>
+ )}
+ {icon}
</div>
-
- {icon && <div>{icon}</div>}
- </Card>
+ {children && <div className="sw-flex sw-flex-col">{children}</div>}
+ </StyledCard>
);
}
-const StyledNoValue = styled.span`
+const StyledCard = styled(Card)`
+ border: ${themeBorder('default')};
+`;
+
+const ColorBold = styled.span`
color: ${themeColor('pageTitle')};
`;
data-guiding-id={conditionFailed ? guidingKeyOnError : undefined}
{...rest}
>
- {requireLabel &&
- (conditionFailed ? (
- <TextError className="sw-mt-2 sw-font-regular" text={requireLabel} />
- ) : (
- <LightLabel className="sw-mt-2">{requireLabel}</LightLabel>
- ))}
+ <span className="sw-body-xs sw-mt-3">
+ {requireLabel &&
+ (conditionFailed ? (
+ <TextError className="sw-font-regular" text={requireLabel} />
+ ) : (
+ <LightLabel>{requireLabel}</LightLabel>
+ ))}
+ </span>
</MeasuresCard>
);
}
conditions={conditions}
conditionMetric={MetricKey.new_duplicated_lines_density}
newLinesMetric={MetricKey.new_lines}
- afterMergeMetric={MetricKey.duplicated_lines_density}
+ afterMergeMetric={MetricKey.coverage}
measures={measures}
/>
</div>
icon={renderIcon(measurementType, value)}
>
<>
- {requireLabel &&
- (conditionFailed ? (
- <TextError className="sw-mt-2 sw-font-regular" text={requireLabel} />
- ) : (
- <LightLabel className="sw-mt-2">{requireLabel}</LightLabel>
- ))}
+ <span className="sw-body-xs sw-mt-3">
+ {requireLabel &&
+ (conditionFailed ? (
+ <TextError className="sw-font-regular" text={requireLabel} />
+ ) : (
+ <LightLabel>{requireLabel}</LightLabel>
+ ))}
+ </span>
- <LightLabel className="sw-flex sw-items-center sw-gap-1 sw-mt-4">
- <FormattedMessage
- defaultMessage={translate(newLinesLabel)}
- id={newLinesLabel}
- values={{
- link: (
- <ContentLink
- aria-label={translateWithParameters(
- 'overview.see_more_details_on_x_y',
- newLinesValue ?? '0',
- localizeMetric(newLinesMetric),
- )}
- className="sw-body-md-highlight sw-text-lg"
- to={newLinesUrl}
- >
- {formatMeasure(newLinesValue ?? '0', MetricType.ShortInteger)}
- </ContentLink>
- ),
- }}
- />
- </LightLabel>
-
- {afterMergeValue && (
- <LightLabel className="sw-mt-2">
+ <div className="sw-flex sw-justify-between sw-items-center sw-mt-1">
+ <LightLabel className="sw-flex sw-items-center sw-gap-1 ">
<FormattedMessage
- defaultMessage={translate('overview.quality_gate.x_estimated_after_merge')}
- id="overview.quality_gate.x_estimated_after_merge"
+ defaultMessage={translate(newLinesLabel)}
+ id={newLinesLabel}
values={{
- value: <strong>{formatMeasure(afterMergeValue, MetricType.Percent)}</strong>,
+ link: (
+ <ContentLink
+ aria-label={translateWithParameters(
+ 'overview.see_more_details_on_x_y',
+ newLinesValue ?? '0',
+ localizeMetric(newLinesMetric),
+ )}
+ className="sw-body-md-highlight sw-text-lg"
+ to={newLinesUrl}
+ >
+ {formatMeasure(newLinesValue ?? '0', MetricType.ShortInteger)}
+ </ContentLink>
+ ),
}}
/>
</LightLabel>
- )}
+ <LightLabel className="sw-mt-[1px]">
+ {afterMergeValue && (
+ <FormattedMessage
+ defaultMessage={translate('overview.quality_gate.x_estimated_after_merge')}
+ id="overview.quality_gate.x_estimated_after_merge"
+ values={{
+ value: <strong>{formatMeasure(afterMergeValue, MetricType.Percent)}</strong>,
+ }}
+ />
+ )}
+ </LightLabel>
+ </div>
</>
</MeasuresCard>
);
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();
});
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