From 7dec8953ddce0cb7445740d3c5df0d426cfee354 Mon Sep 17 00:00:00 2001 From: Sarath Nair <91882341+sarath-nair-sonarsource@users.noreply.github.com> Date: Fri, 23 Aug 2024 10:43:56 +0200 Subject: SONAR-22853 Correctly navigate user in case of sync failure (#11591) --- .../app/components/AlmSynchronisationWarning.tsx | 47 ++++++++++++---------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'server/sonar-web/src/main/js/app/components/AlmSynchronisationWarning.tsx') diff --git a/server/sonar-web/src/main/js/app/components/AlmSynchronisationWarning.tsx b/server/sonar-web/src/main/js/app/components/AlmSynchronisationWarning.tsx index be2ee41fbd7..c7b7663fa7c 100644 --- a/server/sonar-web/src/main/js/app/components/AlmSynchronisationWarning.tsx +++ b/server/sonar-web/src/main/js/app/components/AlmSynchronisationWarning.tsx @@ -25,20 +25,23 @@ import { CheckIcon, FlagMessage, FlagWarningIcon, themeColor } from 'design-syst import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import { translate, translateWithParameters } from '../../helpers/l10n'; +import { AlmKeys } from '../../types/alm-settings'; import { AlmSyncStatus } from '../../types/provisioning'; import { TaskStatuses } from '../../types/tasks'; interface SynchronisationWarningProps { data: AlmSyncStatus; + provisionedBy: AlmKeys.GitHub | AlmKeys.GitLab; short?: boolean; } interface LastSyncProps { info: AlmSyncStatus['lastSync']; + provisionedBy: AlmKeys.GitHub | AlmKeys.GitLab; short?: boolean; } -function LastSyncAlert({ info, short }: Readonly) { +function LastSyncAlert({ info, provisionedBy, short }: Readonly) { if (info === undefined) { return null; } @@ -62,21 +65,24 @@ function LastSyncAlert({ info, short }: Readonly) { {warningMessage ? ( - {translate('settings.authentication.github.synchronization_details_link')} + + {translate('settings.authentication.synchronization_details_link')} ), }} /> ) : ( translateWithParameters( - 'settings.authentication.github.synchronization_successful', + 'settings.authentication.synchronization_successful', formattedDate, ) )} @@ -86,14 +92,15 @@ function LastSyncAlert({ info, short }: Readonly) {
- {translate('settings.authentication.github.synchronization_details_link')} + + {translate('settings.authentication.synchronization_details_link')} ), }} @@ -114,7 +121,7 @@ function LastSyncAlert({ info, short }: Readonly) { {status === TaskStatuses.Success ? ( <> {translateWithParameters( - 'settings.authentication.github.synchronization_successful', + 'settings.authentication.synchronization_successful', formattedDate, )} @@ -126,7 +133,7 @@ function LastSyncAlert({ info, short }: Readonly) {
{translateWithParameters( - 'settings.authentication.github.synchronization_failed', + 'settings.authentication.synchronization_failed', formattedDate, )}
@@ -146,16 +153,14 @@ function LastSyncAlert({ info, short }: Readonly) { ); } -export default function AlmSynchronisationWarning({ - data, - short, -}: Readonly) { +export default function AlmSynchronisationWarning(props: Readonly) { + const { data, provisionedBy, short } = props; const loadingLabel = data.nextSync && translate( data.nextSync.status === TaskStatuses.Pending - ? 'settings.authentication.github.synchronization_pending' - : 'settings.authentication.github.synchronization_in_progress', + ? 'settings.authentication.synchronization_pending' + : 'settings.authentication.synchronization_in_progress', ); return ( @@ -168,7 +173,7 @@ export default function AlmSynchronisationWarning({
)} - + ); } -- cgit v1.2.3