Browse Source

SONAR-21799 Fix Banner about old software qualities for Portfolio

tags/10.5.0.89998
Viktor Vorona 1 month ago
parent
commit
d55d444d17

+ 5
- 1
server/sonar-web/src/main/js/apps/code/components/CodeAppRenderer.tsx View File

@@ -141,7 +141,11 @@ export default function CodeAppRenderer(props: Readonly<Props>) {
)}

{!allComponentsHaveSoftwareQualityMeasures && (
<AnalysisMissingInfoMessage qualifier={component.qualifier} className="sw-mb-4" />
<AnalysisMissingInfoMessage
qualifier={component.qualifier}
hide={isPortfolio}
className="sw-mb-4"
/>
)}

<div className="sw-flex sw-justify-between">

+ 1
- 1
server/sonar-web/src/main/js/apps/component-measures/__tests__/ComponentMeasures-it.tsx View File

@@ -125,7 +125,7 @@ describe('rendering', () => {
].forEach((measure) => {
expect(ui.measureBtn(measure).get()).toBeInTheDocument();
});
expect(screen.getByText('overview.missing_project_data.TRK')).toBeInTheDocument();
expect(screen.getByText('overview.missing_project_dataTRK')).toBeInTheDocument();
});

it('should correctly render a list view', async () => {

+ 6
- 2
server/sonar-web/src/main/js/apps/overview/branches/BranchOverviewRenderer.tsx View File

@@ -33,7 +33,7 @@ import { areCCTMeasuresComputed, isDiffMetric } from '../../../helpers/measures'
import { CodeScope } from '../../../helpers/urls';
import { ApplicationPeriod } from '../../../types/application';
import { Branch } from '../../../types/branch-like';
import { ComponentQualifier } from '../../../types/component';
import { ComponentQualifier, isPortfolioLike } from '../../../types/component';
import { Analysis, GraphType, MeasureHistory } from '../../../types/project-activity';
import { QualityGateStatus } from '../../../types/quality-gates';
import { Component, MeasureEnhanced, Metric, Period, QualityGate } from '../../../types/types';
@@ -118,7 +118,11 @@ export default function BranchOverviewRenderer(props: BranchOverviewRendererProp
}, [loadingStatus, hasNewCodeMeasures]);

const analysisMissingInfo = isMissingMeasures && (
<AnalysisMissingInfoMessage qualifier={component.qualifier} className="sw-mt-6" />
<AnalysisMissingInfoMessage
qualifier={component.qualifier}
hide={isPortfolioLike(component.qualifier)}
className="sw-mt-6"
/>
);

return (

+ 2
- 2
server/sonar-web/src/main/js/apps/overview/branches/__tests__/BranchOverview-it.tsx View File

@@ -439,7 +439,7 @@ describe('project overview', () => {

await user.click(await ui.overallCodeButton.find());

expect(await screen.findByText('overview.missing_project_data.TRK')).toBeInTheDocument();
expect(await screen.findByText('overview.missing_project_dataTRK')).toBeInTheDocument();
},
);
});
@@ -580,7 +580,7 @@ describe('application overview', () => {
renderBranchOverview({ component });
await user.click(await ui.overallCodeButton.find());

expect(await screen.findByText('overview.missing_project_data.APP')).toBeInTheDocument();
expect(await screen.findByText('overview.missing_project_dataAPP')).toBeInTheDocument();
},
);
});

+ 6
- 4
server/sonar-web/src/main/js/components/shared/AnalysisMissingInfoMessage.tsx View File

@@ -21,32 +21,34 @@ import { FlagMessage } from 'design-system';
import * as React from 'react';
import { FormattedMessage, useIntl } from 'react-intl';
import DocumentationLink from '../common/DocumentationLink';
import { ComponentQualifier } from '../../types/component';

interface AnalysisMissingInfoMessageProps {
hide?: boolean;
qualifier: string;
className?: string;
}

export default function AnalysisMissingInfoMessage({
hide,
qualifier,
className,
}: Readonly<AnalysisMissingInfoMessageProps>) {
const intl = useIntl();

if (qualifier === ComponentQualifier.Portfolio) {
if (hide) {
return null;
}

return (
<FlagMessage variant="info" className={className}>
<FormattedMessage
id={`overview.missing_project_data.${qualifier}`}
id="overview.missing_project_data"
tagName="div"
values={{
qualifier,
learn_more: (
<DocumentationLink
className="sw-ml-2 sw-whitespace-nowrap"
className="sw-whitespace-nowrap"
to="/user-guide/clean-code/code-analysis/"
>
{intl.formatMessage({ id: 'learn_more' })}

+ 1
- 2
sonar-core/src/main/resources/org/sonar/l10n/core.properties View File

@@ -3980,8 +3980,7 @@ overview.project.next_steps.links.set_up_ci=set up analysis in your favorite CI
overview.project.software_impact.has_rating=Software Quality {softwareQuality} has rating {rating}
overview.run_analysis_to_compute.TRK=Run new analysis to compute the missing data.
overview.run_analysis_to_compute.APP=Analyse all projects to compute the missing data.
overview.missing_project_data.APP=The way Security, Reliability, and Maintainability are calculated has changed. These values may change after all projects in this application have been analyzed again. {learn_more}
overview.missing_project_data.TRK=The way Security, Reliability, and Maintainability are calculated has changed. These values may change after the next analysis. {learn_more}
overview.missing_project_data=The way Security, Reliability, and Maintainability are calculated has changed. These values may change after {qualifier, select, TRK {the next analysis} other {all projects in this {qualifier, select, APP {application} other {portfolio}} have been analyzed again}}. {learn_more}

overview.coverage_on=Coverage on
overview.coverage_on_X_lines=Coverage on {count} Lines to cover

Loading…
Cancel
Save