From 8d4e3f45dfb9e31df001a8b25175beac7c1d99c6 Mon Sep 17 00:00:00 2001
From: Stas Vilchik <stas.vilchik@sonarsource.com>
Date: Tue, 26 Sep 2017 15:09:37 +0200
Subject: revert SONAR-9708 Display incremental analysis badge in UI

---
 .../app/components/nav/component/ComponentNav.tsx  |  5 +---
 .../components/nav/component/ComponentNavMeta.tsx  | 10 --------
 .../components/nav/component/IncrementalBadge.tsx  | 30 ----------------------
 .../nav/component/__tests__/ComponentNav-test.tsx  | 11 ++------
 .../component/__tests__/ComponentNavMeta-test.tsx  | 15 +----------
 .../__snapshots__/ComponentNav-test.tsx.snap       |  1 -
 .../background-tasks/components/TaskComponent.tsx  |  4 +--
 .../apps/background-tasks/components/TaskType.tsx  |  4 +--
 .../components/__tests__/TaskType-test.tsx         |  1 -
 .../__tests__/__snapshots__/TaskType-test.tsx.snap | 11 --------
 .../src/main/js/apps/background-tasks/types.ts     |  1 -
 11 files changed, 7 insertions(+), 86 deletions(-)
 delete mode 100644 server/sonar-web/src/main/js/app/components/nav/component/IncrementalBadge.tsx

(limited to 'server')

diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx
index 5b9a509fdd8..27c39fa2a97 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNav.tsx
@@ -38,7 +38,6 @@ interface Props {
 }
 
 interface State {
-  incremental?: boolean;
   isFailed?: boolean;
   isInProgress?: boolean;
   isPending?: boolean;
@@ -65,8 +64,7 @@ export default class ComponentNav extends React.PureComponent<Props, State> {
         this.setState({
           isPending: r.queue.some((task: any) => task.status === STATUSES.PENDING),
           isInProgress: r.queue.some((task: any) => task.status === STATUSES.IN_PROGRESS),
-          isFailed: r.current && r.current.status === STATUSES.FAILED,
-          incremental: r.current && r.current.incremental
+          isFailed: r.current && r.current.status === STATUSES.FAILED
         });
       }
     });
@@ -111,7 +109,6 @@ export default class ComponentNav extends React.PureComponent<Props, State> {
         <ComponentNavMeta
           branch={this.props.currentBranch}
           component={this.props.component}
-          incremental={this.state.incremental}
           isInProgress={this.state.isInProgress}
           isFailed={this.state.isFailed}
           isPending={this.state.isPending}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx
index c5721aa4e24..ea33a7af4f8 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavMeta.tsx
@@ -18,7 +18,6 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import * as React from 'react';
-import IncrementalBadge from './IncrementalBadge';
 import BranchStatus from '../../../../components/common/BranchStatus';
 import { Branch, Component } from '../../../types';
 import Tooltip from '../../../../components/controls/Tooltip';
@@ -30,7 +29,6 @@ import { isShortLivingBranch } from '../../../../helpers/branches';
 interface Props {
   branch?: Branch;
   component: Component;
-  incremental?: boolean;
   isInProgress?: boolean;
   isFailed?: boolean;
   isPending?: boolean;
@@ -103,14 +101,6 @@ export default function ComponentNavMeta(props: Props) {
     metaList.push(<li key="version">Version {props.component.version}</li>);
   }
 
-  if (props.incremental) {
-    metaList.push(
-      <li key="incremental">
-        <IncrementalBadge />
-      </li>
-    );
-  }
-
   return (
     <div className="navbar-context-meta">
       <ul className="list-inline">{metaList}</ul>
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/IncrementalBadge.tsx b/server/sonar-web/src/main/js/app/components/nav/component/IncrementalBadge.tsx
deleted file mode 100644
index 25f9121e592..00000000000
--- a/server/sonar-web/src/main/js/app/components/nav/component/IncrementalBadge.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * SonarQube
- * Copyright (C) 2009-2017 SonarSource SA
- * mailto:info AT sonarsource DOT com
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- */
-import * as React from 'react';
-import Tooltip from '../../../../components/controls/Tooltip';
-import { translate } from '../../../../helpers/l10n';
-
-export default function IncrementalBadge() {
-  return (
-    <Tooltip overlay={translate('incremental.project_tooltip')}>
-      <div className="outline-badge">{translate('incremental')}</div>
-    </Tooltip>
-  );
-}
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx
index f63e785ca5a..945ceed22ad 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNav-test.tsx
@@ -67,14 +67,7 @@ it('loads status', () => {
 });
 
 it('renders', () => {
-  const wrapper = shallow(
-    <ComponentNav branches={[]} component={component} location={{}} />
-  );
-  wrapper.setState({
-    incremental: true,
-    isFailed: true,
-    isInProgress: true,
-    isPending: true
-  });
+  const wrapper = shallow(<ComponentNav branches={[]} component={component} location={{}} />);
+  wrapper.setState({ isFailed: true, isInProgress: true, isPending: true });
   expect(wrapper).toMatchSnapshot();
 });
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMeta-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMeta-test.tsx
index 1e1d412852c..331c7c034e7 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMeta-test.tsx
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavMeta-test.tsx
@@ -20,7 +20,7 @@
 import * as React from 'react';
 import { shallow } from 'enzyme';
 import ComponentNavMeta from '../ComponentNavMeta';
-import { Branch, BranchType, ShortLivingBranch, LongLivingBranch } from '../../../../types';
+import { BranchType, ShortLivingBranch, LongLivingBranch } from '../../../../types';
 
 const component = {
   analysisDate: '2017-01-02T00:00:00.000Z',
@@ -32,19 +32,6 @@ const component = {
   version: '0.0.1'
 };
 
-it('renders incremental badge', () => {
-  check(true);
-  check(false);
-
-  function check(incremental: boolean) {
-    expect(
-      shallow(
-        <ComponentNavMeta branch={{} as Branch} component={component} incremental={incremental} />
-      ).find('IncrementalBadge')
-    ).toHaveLength(incremental ? 1 : 0);
-  }
-});
-
 it('renders status of short-living branch', () => {
   const branch: ShortLivingBranch = {
     isMain: false,
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNav-test.tsx.snap b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNav-test.tsx.snap
index a4317c09cec..b110b9a507a 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNav-test.tsx.snap
+++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNav-test.tsx.snap
@@ -50,7 +50,6 @@ exports[`renders 1`] = `
         "qualifier": "TRK",
       }
     }
-    incremental={true}
     isFailed={true}
     isInProgress={true}
     isPending={true}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
index 72a38a1bf50..5e9fcca412b 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.tsx
@@ -34,7 +34,7 @@ export default function TaskComponent({ task }: Props) {
     return (
       <td>
         <span className="note">{task.id}</span>
-        <TaskType incremental={task.incremental} type={task.type} />
+        <TaskType type={task.type} />
       </td>
     );
   }
@@ -62,7 +62,7 @@ export default function TaskComponent({ task }: Props) {
         </Link>
       )}
 
-      <TaskType incremental={task.incremental} type={task.type} />
+      <TaskType type={task.type} />
     </td>
   );
 }
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.tsx
index 456abbdf210..17f4a23a286 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.tsx
@@ -21,16 +21,14 @@ import * as React from 'react';
 import { translate } from '../../../helpers/l10n';
 
 interface Props {
-  incremental?: boolean;
   type: string;
 }
 
-export default function TaskType({ incremental, type }: Props) {
+export default function TaskType({ type }: Props) {
   return (
     <span className="display-inline-block note">
       {'['}
       {translate('background_task.type', type)}
-      {incremental && ` - ${translate('incremental')}`}
       {']'}
     </span>
   );
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskType-test.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskType-test.tsx
index 1c0e961622f..89bf27debb8 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskType-test.tsx
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskType-test.tsx
@@ -23,5 +23,4 @@ import TaskType from '../TaskType';
 
 it('renders', () => {
   expect(shallow(<TaskType type="REPORT" />)).toMatchSnapshot();
-  expect(shallow(<TaskType incremental={true} type="REPORT" />)).toMatchSnapshot();
 });
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.tsx.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.tsx.snap
index df6e0ffa00b..67fa0621b7e 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskType-test.tsx.snap
@@ -9,14 +9,3 @@ exports[`renders 1`] = `
   ]
 </span>
 `;
-
-exports[`renders 2`] = `
-<span
-  className="display-inline-block note"
->
-  [
-  background_task.type.REPORT
-   - incremental
-  ]
-</span>
-`;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/types.ts b/server/sonar-web/src/main/js/apps/background-tasks/types.ts
index a149d2f7d2e..6a81a1d824f 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/types.ts
+++ b/server/sonar-web/src/main/js/apps/background-tasks/types.ts
@@ -28,7 +28,6 @@ export interface Task {
   executedAt?: string;
   executionTimeMs?: number;
   hasScannerContext?: boolean;
-  incremental?: boolean;
   id: string;
   organization?: string;
   startedAt?: string;
-- 
cgit v1.2.3