From bb62fc4a728e45537f828a7f90f994db48df1a6e Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Mon, 17 Feb 2020 14:57:10 +0100 Subject: [PATCH] SONAR-12829 Fix error message when encountering a license issue --- .../components/nav/component/ComponentNavLicenseNotif.tsx | 8 ++++++-- .../__snapshots__/ComponentNavLicenseNotif-test.tsx.snap | 2 +- .../src/main/resources/org/sonar/l10n/core.properties | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx index 951a2af3dba..3c97fa52d3e 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavLicenseNotif.tsx @@ -20,9 +20,10 @@ import * as React from 'react'; import { Link } from 'react-router'; import { Alert } from 'sonar-ui-common/components/ui/Alert'; -import { translate } from 'sonar-ui-common/helpers/l10n'; +import { translate, translateWithParameters } from 'sonar-ui-common/helpers/l10n'; import { isValidLicense } from '../../../../api/marketplace'; import { withAppState } from '../../../../components/hoc/withAppState'; +import { ComponentQualifier } from '../../../../types/component'; interface Props { appState: Pick; @@ -74,7 +75,10 @@ export class ComponentNavLicenseNotif extends React.PureComponent if (isValidLicense && currentTask.errorType !== 'LICENSING_LOC') { return ( - {translate('component_navigation.status.last_blocked_due_to_bad_license')} + {translateWithParameters( + 'component_navigation.status.last_blocked_due_to_bad_license_X', + translate('qualifier', currentTask.componentQualifier || ComponentQualifier.Project) + )} ); } diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavLicenseNotif-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavLicenseNotif-test.tsx.snap index daa3a7095c0..2dd678f30a4 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavLicenseNotif-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavLicenseNotif-test.tsx.snap @@ -5,7 +5,7 @@ exports[`renders a different message if the license is valid 1`] = ` display="banner" variant="error" > - component_navigation.status.last_blocked_due_to_bad_license + component_navigation.status.last_blocked_due_to_bad_license_X.qualifier.TRK `; diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index bd24ebf14c0..b91d3063d2b 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -2587,7 +2587,7 @@ component_navigation.status.in_progress=A background task is in progress. component_navigation.status.in_progress_X=The {type} is in progress. component_navigation.status.in_progress.admin=A background task is in progress. More details available on the {url} page. component_navigation.status.in_progress_X.admin=The {type} is in progress. More details available on the {url} page. -component_navigation.status.last_blocked_due_to_bad_license=Last analysis blocked due to an invalid license, which has since been corrected. Please reanalyze this project. +component_navigation.status.last_blocked_due_to_bad_license_X=Last analysis blocked due to an invalid license, which has since been corrected. Please reanalyze this {0}. component_navigation.last_analysis_had_warnings=Last analysis had {warnings} component_navigation.x_warnings={warningsCount} {warningsCount, plural, one {warning} other {warnings}} -- 2.39.5