ソースを参照

SONAR-21556 Metrcis can not be <= 0 or >= 100%

tags/10.4.0.87286
David Cho-Lerat 4ヶ月前
コミット
547f8dc44f
1個のファイルの変更18行の追加2行の削除
  1. 18
    2
      server/sonar-web/src/main/js/apps/overview/utils.tsx

+ 18
- 2
server/sonar-web/src/main/js/apps/overview/utils.tsx ファイルの表示

@@ -26,7 +26,7 @@ import { formatMeasure } from '../../helpers/measures';
import { parseAsString } from '../../helpers/query';
import { SoftwareQuality } from '../../types/clean-code-taxonomy';
import { IssueType } from '../../types/issues';
import { MetricKey } from '../../types/metrics';
import { MetricKey, MetricType } from '../../types/metrics';
import { AnalysisMeasuresVariations, MeasureHistory } from '../../types/project-activity';
import { QualityGateStatusConditionEnhanced } from '../../types/quality-gates';
import { Dict, RawQuery } from '../../types/types';
@@ -257,17 +257,33 @@ export function getConditionRequiredLabel(
intl: IntlShape,
failed = false,
) {
let operator = condition.op === 'GT' ? '≤' : '≥';

if (operator === '≤' && condition.error === '0') {
operator = '=';
}

if (
operator === '≥' &&
condition.error === '100' &&
condition.measure.metric.type === MetricType.Percent
) {
operator = '=';
}

const conditionEl = (
<>
{condition.op === 'GT' ? '≤' : '≥'}{' '}
{operator}{' '}
{formatMeasure(condition.error, condition.measure.metric.type, {
decimals: 2,
omitExtraDecimalZeros: true,
})}
</>
);

return intl.formatMessage(
{ id: 'overview.quality_gate.required_x' },

{
requirement: failed ? <b>{conditionEl}</b> : conditionEl,
},

読み込み中…
キャンセル
保存