From b6dfe48e0221b5fb90d66e93f0063b47e20530ae Mon Sep 17 00:00:00 2001 From: Mathieu Suen Date: Wed, 17 Jun 2020 08:53:10 +0200 Subject: [PATCH] SONAR-13399 Deactivate project card when issue is indexing. --- .../sonar-web/src/main/js/api/components.ts | 1 + .../apps/projects/components/ProjectCard.tsx | 16 +++++- .../components/__tests__/ProjectCard-test.tsx | 4 ++ .../__snapshots__/ProjectCard-test.tsx.snap | 56 +++++++++++++++++++ .../src/main/js/apps/projects/styles.css | 30 ++++++++++ .../src/main/js/apps/projects/types.ts | 1 + 6 files changed, 105 insertions(+), 3 deletions(-) diff --git a/server/sonar-web/src/main/js/api/components.ts b/server/sonar-web/src/main/js/api/components.ts index 2b7ddb74492..86cd1968ce1 100644 --- a/server/sonar-web/src/main/js/api/components.ts +++ b/server/sonar-web/src/main/js/api/components.ts @@ -216,6 +216,7 @@ export interface Component { tags: string[]; visibility: T.Visibility; leakPeriodDate?: string; + needIssueSync?: boolean; } export interface Facet { diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCard.tsx index b4a318602e5..a5b7f1407e7 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCard.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCard.tsx @@ -73,7 +73,11 @@ function renderHeader(props: Props) { /> )}

- {project.name} + {props.project.needIssueSync ? ( + props.project.name + ) : ( + {props.project.name} + )}

{project.analysisDate && }
@@ -172,13 +176,19 @@ function renderMeasures(props: Props, dates: Dates | undefined) { export default function ProjectCard(props: Props) { const { height, project, type } = props; + const { needIssueSync, key } = project; const dates = getDates(project, type); return (
{renderHeader(props)} diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCard-test.tsx b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCard-test.tsx index 2425c5b5d75..96ce0408ee0 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCard-test.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCard-test.tsx @@ -51,6 +51,10 @@ const PROJECT: Project = { const USER_LOGGED_OUT = mockCurrentUser(); const USER_LOGGED_IN = mockLoggedInUser(); +it('should display correclty when project need issue synch', () => { + expect(shallowRender({ ...PROJECT, needIssueSync: true })).toMatchSnapshot(); +}); + it('should display analysis date (and not leak period) when defined', () => { expect( shallowRender(PROJECT) diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCard-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCard-test.tsx.snap index cc5f4dce330..e8188017818 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCard-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCard-test.tsx.snap @@ -233,6 +233,62 @@ exports[`should display configure analysis button for logged in user 1`] = `
`; +exports[`should display correclty when project need issue synch 1`] = ` +
+
+
+

+ Foo +

+ +
+ +
+
+
+ + + +
+
+ +
+`; + exports[`should display not analyzed yet 1`] = `