aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-08-16 13:01:06 +0200
committerGitHub <noreply@github.com>2017-08-16 13:01:06 +0200
commit664eb7854d14ac3b45bae30cfc7d9243bf7ddb2a (patch)
tree7b01b8287028a10e0be099728032cf0a3c516c7e /server/sonar-web/src/main
parent550501dc6dbc11dd29751dd8892e56c14d052805 (diff)
downloadsonarqube-664eb7854d14ac3b45bae30cfc7d9243bf7ddb2a.tar.gz
sonarqube-664eb7854d14ac3b45bae30cfc7d9243bf7ddb2a.zip
SONAR-9708 apply feedback (#2362)
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js1
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Task.js5
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.js9
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js4
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.js36
-rw-r--r--server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.js.snap64
6 files changed, 107 insertions, 12 deletions
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js
index cda4776cf7c..9fa9496d367 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js
@@ -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)}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Task.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Task.js
index a12bea92a49..7f49e254a41 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/Task.js
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Task.js
@@ -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" />
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.js b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.js
index 839f2c7b0e2..1123a8de956 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.js
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskComponent.js
@@ -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>
);
}
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js
index 8eb3e2c68bf..fef3f83eea7 100644
--- a/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js
@@ -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
index 00000000000..b1c54c7f158
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/TaskComponent-test.js
@@ -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
index 00000000000..703c9f27eea
--- /dev/null
+++ b/server/sonar-web/src/main/js/apps/background-tasks/components/__tests__/__snapshots__/TaskComponent-test.js.snap
@@ -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>
+`;