* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import {
Card,
CoverageIndicator,
<ToggleButton onChange={(key) => selectTab(key)} options={tabs} value={tab} />
{failingConditions > 0 && (
<LightLabel className="sw-body-sm-highlight sw-ml-8">
- {translateWithParameters('overview.X_conditions_failed', failingConditions)}
+ {failingConditions === 1
+ ? translate('overview.1_condition_failed')
+ : translateWithParameters('overview.X_conditions_failed', failingConditions)}
</LightLabel>
)}
</div>
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
+
import { Accordion, BasicSeparator, TextMuted } from 'design-system';
import * as React from 'react';
-import { translateWithParameters } from '../../../helpers/l10n';
+import { translate, translateWithParameters } from '../../../helpers/l10n';
import { isDiffMetric } from '../../../helpers/measures';
import { BranchLike } from '../../../types/branch-like';
import { isApplication } from '../../../types/component';
? translateWithParameters('overview.quality_gate.show_project_conditions_x', qgStatus.name)
: translateWithParameters('overview.quality_gate.hide_project_conditions_x', qgStatus.name);
+ const newCodeText =
+ newCodeFailedConditions.length === 1
+ ? translate('quality_gates.conditions.new_code_1')
+ : translateWithParameters(
+ 'quality_gates.conditions.new_code_x',
+ newCodeFailedConditions.length.toString()
+ );
+
+ const overallText =
+ overallFailedConditions.length === 1
+ ? translate('quality_gates.conditions.overall_code_1')
+ : translateWithParameters(
+ 'quality_gates.conditions.overall_code_x',
+ overallFailedConditions.length.toString()
+ );
+
const renderFailedConditions = () => {
return (
<>
<>
{showSectionTitles && (
<>
- <p className="sw-px-2 sw-py-3">
- {translateWithParameters(
- 'quality_gates.conditions.new_code_x',
- newCodeFailedConditions.length.toString()
- )}
- </p>
+ <p className="sw-px-2 sw-py-3">{newCodeText}</p>
+
<BasicSeparator />
</>
)}
+
<QualityGateConditions
component={qgStatus}
branchLike={qgStatus.branchLike}
<>
{showSectionTitles && (
<>
- <p className="sw-px-2 sw-py-3">
- {translateWithParameters(
- 'quality_gates.conditions.overall_code_x',
- overallFailedConditions.length.toString()
- )}
- </p>
+ <p className="sw-px-2 sw-py-3">{overallText}</p>
+
<BasicSeparator />
</>
)}
+
<QualityGateConditions
component={qgStatus}
branchLike={qgStatus.branchLike}
header={
<div className="sw-flex sw-flex-col sw-text-sm">
<span className="sw-body-sm-highlight">{qgStatus.name}</span>
+
{collapsed && newCodeFailedConditions.length > 0 && (
- <TextMuted
- text={translateWithParameters(
- 'quality_gates.conditions.new_code_x',
- newCodeFailedConditions.length
- )}
- />
+ <TextMuted text={newCodeText} />
)}
+
{collapsed && overallFailedConditions.length > 0 && (
- <TextMuted
- text={translateWithParameters(
- 'quality_gates.conditions.overall_code_x',
- overallFailedConditions.length
- )}
- />
+ <TextMuted text={overallText} />
)}
</div>
}
>
<BasicSeparator />
+
{renderFailedConditions()}
</Accordion>
<BasicSeparator />
quality_gates.conditions.new_code=On New Code
quality_gates.conditions.new_code.long=Conditions on New Code
quality_gates.conditions.new_code.description=Conditions on New Code apply to all branches and to Pull Requests.
-quality_gates.conditions.new_code_x={0} condition(s) failed on new code
+quality_gates.conditions.new_code_1=1 condition failed on new code
+quality_gates.conditions.new_code_x={0} conditions failed on new code
quality_gates.conditions.overall_code=On Overall Code
quality_gates.conditions.overall_code.long=Conditions on Overall Code
quality_gates.conditions.overall_code.description=Conditions on Overall Code apply to branches only.
-quality_gates.conditions.overall_code_x={0} condition(s) failed on overall code
+quality_gates.conditions.overall_code_1=1 condition failed on overall code
+quality_gates.conditions.overall_code_x={0} conditions failed on overall code
quality_gates.conditions.operator=Operator
quality_gates.conditions.warning=Warning
quality_gates.conditions.warning.tooltip=Warning status is deprecated and will disappear with the next update of the Quality Gate.
# OVERVIEW
#
#------------------------------------------------------------------------------
-overview.X_conditions_failed={0} failed condition(s)
+overview.1_condition_failed=1 failed condition
+overview.X_conditions_failed={0} failed conditions
overview.fix_failed_conditions_with_sonarlint=Fix issues before they fail your Quality Gate with {link} in your IDE. Power up with connected mode!
overview.quality_gate.status=Quality Gate Status
overview.quality_gate=Quality Gate