]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13399 Deactivate project card when issue is indexing.
authorMathieu Suen <mathieu.suen@sonarsource.com>
Wed, 17 Jun 2020 06:53:10 +0000 (08:53 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 26 Jun 2020 20:04:58 +0000 (20:04 +0000)
server/sonar-web/src/main/js/api/components.ts
server/sonar-web/src/main/js/apps/projects/components/ProjectCard.tsx
server/sonar-web/src/main/js/apps/projects/components/__tests__/ProjectCard-test.tsx
server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectCard-test.tsx.snap
server/sonar-web/src/main/js/apps/projects/styles.css
server/sonar-web/src/main/js/apps/projects/types.ts

index 2b7ddb744927006668c0a173b73cad397e7d9385..86cd1968ce1c6b3d02b69da6c55f11ba46c37a3b 100644 (file)
@@ -216,6 +216,7 @@ export interface Component {
   tags: string[];
   visibility: T.Visibility;
   leakPeriodDate?: string;
+  needIssueSync?: boolean;
 }
 
 export interface Facet {
index b4a318602e5a45329c2e29f40be7537cbd679ede..a5b7f1407e74287679c4f6ed959ab2500017d070 100644 (file)
@@ -73,7 +73,11 @@ function renderHeader(props: Props) {
         />
       )}
       <h2 className="project-card-name">
-        <Link to={getProjectUrl(project.key)}>{project.name}</Link>
+        {props.project.needIssueSync ? (
+          props.project.name
+        ) : (
+          <Link to={getProjectUrl(project.key)}>{props.project.name}</Link>
+        )}
       </h2>
       {project.analysisDate && <ProjectCardQualityGate status={project.measures['alert_status']} />}
       <div className="project-card-header-right">
@@ -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 (
     <div
-      className="boxed-group project-card big-padded display-flex-column display-flex-space-between"
-      data-key={project.key}
+      className={classNames(
+        'boxed-group project-card big-padded display-flex-column display-flex-space-between',
+        {
+          'need-issue-sync': needIssueSync
+        }
+      )}
+      data-key={key}
       style={{ height }}>
       <div>
         {renderHeader(props)}
index 2425c5b5d7554dcc218715754a95137779ee7e5e..96ce0408ee0ad160c98190c18d47a37a37e9603f 100644 (file)
@@ -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)
index cc5f4dce330f018d6560fccf578c6fde8225e4c4..e81880178186f7a1a533b3f2f4f3566dbc7a8ee9 100644 (file)
@@ -233,6 +233,62 @@ exports[`should display configure analysis button for logged in user 1`] = `
 </div>
 `;
 
+exports[`should display correclty when project need issue synch 1`] = `
+<div
+  className="boxed-group project-card big-padded display-flex-column display-flex-space-between need-issue-sync"
+  data-key="foo"
+  style={
+    Object {
+      "height": 100,
+    }
+  }
+>
+  <div>
+    <div
+      className="project-card-header"
+    >
+      <h2
+        className="project-card-name"
+      >
+        Foo
+      </h2>
+      <ProjectCardQualityGate
+        status="OK"
+      />
+      <div
+        className="project-card-header-right"
+      >
+        <PrivacyBadgeContainer
+          className="spacer-left"
+          qualifier="TRK"
+          visibility="public"
+        />
+      </div>
+    </div>
+    <div
+      className="display-flex-center project-card-dates spacer-top"
+    >
+      <DateTimeFormatter
+        date="2017-01-01"
+      >
+        <Component />
+      </DateTimeFormatter>
+    </div>
+  </div>
+  <ProjectCardOverallMeasures
+    componentQualifier="TRK"
+    measures={
+      Object {
+        "alert_status": "OK",
+        "new_bugs": "12",
+        "reliability_rating": "1.0",
+        "sqale_rating": "1.0",
+      }
+    }
+  />
+</div>
+`;
+
 exports[`should display not analyzed yet 1`] = `
 <div
   className="boxed-group project-card big-padded display-flex-column display-flex-space-between"
index 7cd2e2a6216a313d91e2e5da61a956d1153a834e..32f24fed98738edb920315d3b6a3eb57949bb8f6 100644 (file)
   padding: calc(4 * var(--gridSize)) 0;
   text-align: center;
 }
+
+.need-issue-sync .rating,
+.need-issue-sync .size-rating,
+.need-issue-sync .duplications-rating:after,
+.need-issue-sync .level {
+  background-color: lightgray;
+}
+
+.need-issue-sync .project-card-dates path,
+.need-issue-sync .project-card-measure path,
+.need-issue-sync .project-card-leak-measures path {
+  fill: lightgray !important;
+}
+
+.need-issue-sync .duplications-rating {
+  border-color: lightgray;
+}
+
+.need-issue-sync * {
+  color: #adadad;
+}
+
+.need-issue-sync .project-card-header .icon-outline.is-filled path {
+  color: rgb(237, 125, 32);
+}
+
+.need-issue-sync .rating,
+.need-issue-sync .size-rating {
+  color: white !important;
+}
index 566e8496b1dcff6c27846f4ae9927d7ff36ae0c1..1afbee949b5ef269e6d52ba87be3ebb4df9e43ef 100644 (file)
@@ -31,6 +31,7 @@ export interface Project {
   qualifier: ComponentQualifier;
   tags: string[];
   visibility: T.Visibility;
+  needIssueSync?: boolean;
 }
 
 export interface Facet {