]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9708 apply feedback (#2362)
authorStas Vilchik <stas.vilchik@sonarsource.com>
Wed, 16 Aug 2017 11:01:06 +0000 (13:01 +0200)
committerGitHub <noreply@github.com>
Wed, 16 Aug 2017 11:01:06 +0000 (13:01 +0200)
server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js
server/sonar-web/src/main/js/apps/background-tasks/components/Task.js
server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.js
server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.js [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.js.snap [new file with mode: 0644]
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index cda4776cf7cc40c8a7177cc9c73fb30e38b3a507..9fa9496d36718ba92427464f312788467786de51 100644 (file)
@@ -246,7 +246,6 @@ class BackgroundTasksApp extends React.PureComponent {
         <Tasks
           loading={loading}
           component={component}
-          types={types}
           tasks={tasks}
           onCancelTask={this.handleCancelTask.bind(this)}
           onFilterTask={this.handleFilterTask.bind(this)}
index a12bea92a49810ea27e786d9ce48631762cf0c93..7f49e254a416fa5c199c4e2c69866ebf3f436a28 100644 (file)
@@ -33,20 +33,19 @@ export default class Task extends React.PureComponent {
     index: PropTypes.number.isRequired,
     tasks: PropTypes.array.isRequired,
     component: PropTypes.object,
-    types: PropTypes.array.isRequired,
     onCancelTask: PropTypes.func.isRequired,
     onFilterTask: PropTypes.func.isRequired
   };
 
   render() {
-    const { task, index, tasks, component, types, onCancelTask, onFilterTask } = this.props;
+    const { task, index, tasks, component, onCancelTask, onFilterTask } = this.props;
 
     const prevTask = index > 0 ? tasks[index - 1] : null;
 
     return (
       <tr>
         <TaskStatus task={task} />
-        <TaskComponent task={task} types={types} />
+        <TaskComponent task={task} />
         <TaskId task={task} />
         <TaskDay task={task} prevTask={prevTask} />
         <TaskDate date={task.submittedAt} baseDate={task.submittedAt} format="LTS" />
index 839f2c7b0e2e7f62096c341e29e4f79e6e252dc4..1123a8de95697e3fa36803c95248cb21b3e88acc 100644 (file)
@@ -27,13 +27,12 @@ import Organization from '../../../components/shared/Organization';
 
 /*::
 type Props = {
-  task: Task,
-  types: Array<string>
+  task: Task
 };
 */
 
 export default function TaskComponent(props /*: Props */) {
-  const { task, types } = props;
+  const { task } = props;
 
   if (!task.componentKey) {
     return (
@@ -41,7 +40,7 @@ export default function TaskComponent(props /*: Props */) {
         <span className="note">
           {task.id}
         </span>
-        {types.length > 1 && <TaskType task={task} />}
+        <TaskType task={task} />
       </td>
     );
   }
@@ -58,7 +57,7 @@ export default function TaskComponent(props /*: Props */) {
         {task.componentName}
       </Link>
 
-      {types.length > 1 && <TaskType task={task} />}
+      <TaskType task={task} />
     </td>
   );
 }
index 8eb3e2c68bfd584377e1066b22372ba2d27e6c7e..fef3f83eea7888b76cd96261327ea765d9abbaa5 100644 (file)
@@ -27,7 +27,6 @@ import { translate } from '../../../helpers/l10n';
 type Props = {
   tasks: Array<*>,
   component: Object,
-  types: Array<*>,
   loading: boolean,
   onCancelTask: Function,
   onFilterTask: Function
@@ -43,7 +42,7 @@ export default class Tasks extends React.PureComponent {
   /*:: state: State; */
 
   render() {
-    const { tasks, component, types, loading, onCancelTask, onFilterTask } = this.props;
+    const { tasks, component, loading, onCancelTask, onFilterTask } = this.props;
 
     const className = classNames('data zebra zebra-hover background-tasks', {
       'new-loading': loading
@@ -86,7 +85,6 @@ export default class Tasks extends React.PureComponent {
               index={index}
               tasks={tasks}
               component={component}
-              types={types}
               onCancelTask={onCancelTask}
               onFilterTask={onFilterTask}
             />
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.js b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.js
new file mode 100644 (file)
index 0000000..b1c54c7
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+/* @flow */
+import React from 'react';
+import { shallow } from 'enzyme';
+import TaskComponent from '../TaskComponent';
+
+it('renders', () => {
+  const task = {
+    componentKey: 'foo',
+    componentName: 'foo',
+    componentQualifier: 'TRK',
+    id: 'bar',
+    organization: 'org',
+    type: 'REPORT'
+  };
+  expect(shallow(<TaskComponent task={task} />)).toMatchSnapshot();
+  expect(shallow(<TaskComponent task={{ ...task, componentKey: undefined }} />)).toMatchSnapshot();
+});
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.js.snap b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.js.snap
new file mode 100644 (file)
index 0000000..703c9f2
--- /dev/null
@@ -0,0 +1,64 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`renders 1`] = `
+<td>
+  <span
+    className="little-spacer-right"
+  >
+    <QualifierIcon
+      qualifier="TRK"
+    />
+  </span>
+  <Connect(Organization)
+    organizationKey="org"
+  />
+  <Link
+    onlyActiveOnIndex={false}
+    style={Object {}}
+    to={
+      Object {
+        "pathname": "/dashboard",
+        "query": Object {
+          "id": "foo",
+        },
+      }
+    }
+  >
+    foo
+  </Link>
+  <TaskType
+    task={
+      Object {
+        "componentKey": "foo",
+        "componentName": "foo",
+        "componentQualifier": "TRK",
+        "id": "bar",
+        "organization": "org",
+        "type": "REPORT",
+      }
+    }
+  />
+</td>
+`;
+
+exports[`renders 2`] = `
+<td>
+  <span
+    className="note"
+  >
+    bar
+  </span>
+  <TaskType
+    task={
+      Object {
+        "componentKey": undefined,
+        "componentName": "foo",
+        "componentQualifier": "TRK",
+        "id": "bar",
+        "organization": "org",
+        "type": "REPORT",
+      }
+    }
+  />
+</td>
+`;
index f45218ea69ba7c8d3edff246f82c43a704b2baff..0d10ae67275ce427aa1eeb644ce569d56e22f4f3 100644 (file)
@@ -82,7 +82,7 @@ identifier_abbreviated=Id
 inactive=Inactive
 including_abbreviated=incl.
 incremental=Incremental
-incrementa.project_tooltip=Overall project status could be incomplete: incremental mode was used in the last analysis, so only changed files were examined.
+incremental.project_tooltip=Overall project status could be incomplete: incremental mode was used in the last analysis, so only changed files were examined.
 info=Info
 issue=Issue
 issues=Issues