]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7553 use api/ce/activity_status to get number of pending and failing tasks 904/head
authorStas Vilchik <vilchiks@gmail.com>
Tue, 19 Apr 2016 07:58:02 +0000 (09:58 +0200)
committerTeryk Bellahsene <teryk.bellahsene@sonarsource.com>
Wed, 20 Apr 2016 23:23:38 +0000 (01:23 +0200)
server/sonar-web/src/main/js/api/ce.js
server/sonar-web/src/main/js/apps/background-tasks/store/actions.js

index e46eb236026668c1279a9fbec7cc0c2c309534d5..66c6b3dc8abf51ca39a4c1ac8f8f64e07383076e 100644 (file)
@@ -30,6 +30,15 @@ export function getActivity (data) {
   return $.get(url, data);
 }
 
+export function getStatus (componentId) {
+  const url = window.baseUrl + '/api/ce/activity_status';
+  const data = {};
+  if (componentId) {
+    Object.assign(data, { componentId });
+  }
+  return getJSON(url, data);
+}
+
 export function getTask (id) {
   const url = window.baseUrl + '/api/ce/task';
   return getJSON(url, { id }).then(r => r.task);
index 0a7ef85b2778cd320aa6be531c10962078cc3166..095f659f0ca5bdf606b72fec12202517a3e00791 100644 (file)
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
 import _ from 'underscore';
-import { getTypes, getActivity, cancelAllTasks, cancelTask as cancelTaskAPI } from '../../../api/ce';
+import { getTypes, getActivity, getStatus, cancelAllTasks, cancelTask as cancelTaskAPI } from '../../../api/ce';
 
 import { STATUSES, ALL_TYPES, CURRENTS, DEBOUNCE_DELAY } from '../constants';
 
-const PAGE_SIZE = 1000;
-
 export const INIT = 'INIT';
 export const REQUEST_TASKS = 'REQUEST_TASKS';
 export const RECEIVE_TASKS = 'RECEIVE_TASKS';
@@ -151,16 +149,16 @@ function fetchTasks (filters) {
     dispatch(requestTasks(filters));
 
     return Promise.all([
-      getActivity(parameters)
+      getActivity(parameters),
+      getStatus(parameters.componentId)
     ]).then(responses => {
-      const [activity] = responses;
+      const [activity, status] = responses;
       const tasks = activity.tasks;
 
       dispatch(receiveTasks(tasks));
 
-      // FIXME request real numbers
-      const pendingCount = 0;
-      const failingCount = 0;
+      const pendingCount = status.pending;
+      const failingCount = status.failing;
 
       dispatch(receiveStats({ pendingCount, failingCount }));
     });