]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7548 Display type of background tasks
authorStas Vilchik <vilchiks@gmail.com>
Mon, 18 Apr 2016 12:07:05 +0000 (14:07 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 18 Apr 2016 12:07:05 +0000 (14:07 +0200)
server/sonar-web/src/main/js/apps/background-tasks/components/Search.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/TaskType.js [new file with mode: 0644]
server/sonar-web/src/main/js/apps/background-tasks/components/Tasks.js
server/sonar-web/src/main/js/apps/background-tasks/containers/TasksContainer.js

index 6a66f8b22b99d2a6289dc68e56cabecce471b2c1..fda9220cfffa1c3f570c014fdb379a658c00c03e 100644 (file)
@@ -81,7 +81,7 @@ export default React.createClass({
                   value={this.props.status}
                   onChange={this.props.onStatusChange}/>
             </li>
-            {this.props.types.length > 1 && !this.props.component && (
+            {this.props.types.length > 1 && (
                 <li>
                   <h6 className="bt-search-form-label">
                     Type
index ad384d1252949995df0f86ae3b200474ced252ca..87ce4286d0b22004f116abb4f5fab175925751fe 100644 (file)
@@ -28,7 +28,7 @@ import TaskCancelButton from './TaskCancelButton';
 import TaskLogsLink from './TaskLogsLink';
 import { STATUSES } from './../constants';
 
-export default function Task ({ task, index, tasks, component, onCancelTask, onFilterTask }) {
+export default function Task ({ task, index, tasks, component, types, onCancelTask, onFilterTask }) {
   function handleFilterTask (task, e) {
     e.preventDefault();
     onFilterTask(task);
@@ -39,7 +39,7 @@ export default function Task ({ task, index, tasks, component, onCancelTask, onF
   return (
       <tr>
         <TaskStatus task={task}/>
-        <TaskComponent task={task}/>
+        <TaskComponent task={task} types={types}/>
         <TaskDay task={task} prevTask={prevTask}/>
         <TaskDate date={task.submittedAt} baseDate={task.submittedAt} format="LTS"/>
         <TaskDate date={task.startedAt} baseDate={task.submittedAt} format="LTS"/>
index e6a0ca329f8d41aeb032d3a5291e586bd33678f9..ddced30d774cc2517b849d09cb7c1fa570c80686 100644 (file)
  */
 import React from 'react';
 
+import TaskType from './TaskType';
 import { getComponentUrl } from '../../../helpers/urls';
 import QualifierIcon from '../../../components/shared/qualifier-icon';
 
-export default function TaskComponent ({ task }) {
+const TaskComponent = ({ task, types }) => {
   if (!task.componentKey) {
     return (
         <td>
           <span className="note">{task.id}</span>
+          {types.length > 1 && (
+              <TaskType task={task}/>
+          )}
         </td>
     );
   }
@@ -39,6 +43,11 @@ export default function TaskComponent ({ task }) {
           </span>
           <span>{task.componentName}</span>
         </a>
+        {types.length > 1 && (
+            <TaskType task={task}/>
+        )}
       </td>
   );
-}
+};
+
+export default TaskComponent;
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.js b/server/sonar-web/src/main/js/apps/background-tasks/components/TaskType.js
new file mode 100644 (file)
index 0000000..3877801
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact 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 React from 'react';
+
+import { translate } from '../../../helpers/l10n';
+
+const TaskType = ({ task }) => {
+  return (
+      <span className="note spacer-left">
+        {'['}
+        {translate('background_task.type', task.type)}
+        {']'}
+      </span>
+  );
+};
+
+export default TaskType;
index 6d3b225eb87d2d051c3eb4670409886246a935ec..c086e2a110d81c0f2a3f3261fbad081116a4d7ce 100644 (file)
@@ -22,7 +22,7 @@ import React from 'react';
 import Task from './Task';
 import { translate } from '../../../helpers/l10n';
 
-export default function Tasks ({ tasks, component, onCancelTask, onFilterTask }) {
+export default function Tasks ({ tasks, component, types, onCancelTask, onFilterTask }) {
   return (
       <table className="data zebra zebra-hover background-tasks">
         <thead>
@@ -45,6 +45,7 @@ export default function Tasks ({ tasks, component, onCancelTask, onFilterTask })
                   index={index}
                   tasks={tasks}
                   component={component}
+                  types={types}
                   onCancelTask={onCancelTask}
                   onFilterTask={onFilterTask}/>
           ))}
index 890782913a0719c8002ca66c5e2be3514f92cc9a..783b304934eca774f3dec85f46e1fdba89269b51 100644 (file)
@@ -27,7 +27,8 @@ function mapStateToProps (state) {
   return {
     fetching: state.fetching,
     tasks: state.tasks,
-    component: state.component
+    component: state.component,
+    types: state.types
   };
 }