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

)} )}


{!allComponentsHaveSoftwareQualityMeasures && ( {!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"> <div className="sw-flex sw-justify-between">

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

].forEach((measure) => { ].forEach((measure) => {
expect(ui.measureBtn(measure).get()).toBeInTheDocument(); 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 () => { it('should correctly render a list view', async () => {

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

import { CodeScope } from '../../../helpers/urls'; import { CodeScope } from '../../../helpers/urls';
import { ApplicationPeriod } from '../../../types/application'; import { ApplicationPeriod } from '../../../types/application';
import { Branch } from '../../../types/branch-like'; 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 { Analysis, GraphType, MeasureHistory } from '../../../types/project-activity';
import { QualityGateStatus } from '../../../types/quality-gates'; import { QualityGateStatus } from '../../../types/quality-gates';
import { Component, MeasureEnhanced, Metric, Period, QualityGate } from '../../../types/types'; import { Component, MeasureEnhanced, Metric, Period, QualityGate } from '../../../types/types';
}, [loadingStatus, hasNewCodeMeasures]); }, [loadingStatus, hasNewCodeMeasures]);


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


return ( return (

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



await user.click(await ui.overallCodeButton.find()); 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();
}, },
); );
}); });
renderBranchOverview({ component }); renderBranchOverview({ component });
await user.click(await ui.overallCodeButton.find()); 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

import * as React from 'react'; import * as React from 'react';
import { FormattedMessage, useIntl } from 'react-intl'; import { FormattedMessage, useIntl } from 'react-intl';
import DocumentationLink from '../common/DocumentationLink'; import DocumentationLink from '../common/DocumentationLink';
import { ComponentQualifier } from '../../types/component';


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


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


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


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

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

overview.project.software_impact.has_rating=Software Quality {softwareQuality} has rating {rating} 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.TRK=Run new analysis to compute the missing data.
overview.run_analysis_to_compute.APP=Analyse all projects 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=Coverage on
overview.coverage_on_X_lines=Coverage on {count} Lines to cover overview.coverage_on_X_lines=Coverage on {count} Lines to cover

Loading…
Cancel
Save