]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7423 Remove displaying of duration of task in progress
authorStas Vilchik <vilchiks@gmail.com>
Wed, 30 Mar 2016 12:03:22 +0000 (14:03 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Wed, 30 Mar 2016 12:03:22 +0000 (14:03 +0200)
server/sonar-web/src/main/js/apps/background-tasks/components/Stats.js
server/sonar-web/src/main/js/apps/background-tasks/containers/StatsContainer.js
server/sonar-web/src/main/js/apps/background-tasks/store/actions.js
server/sonar-web/src/main/js/apps/background-tasks/store/reducers.js
server/sonar-web/tests/apps/background-tasks-test.js

index 2fc18a7bd75130fb946cc9bfaedcd9c65066cd26..450a5098671559a8c5c444c2aba0442fc671a848 100644 (file)
  */
 import React, { Component } from 'react';
 
-import { formatDuration } from './../helpers';
 import { translate } from '../../../helpers/l10n';
 
-
 export default class Stats extends Component {
   handleCancelAllPending (e) {
     e.preventDefault();
@@ -34,27 +32,6 @@ export default class Stats extends Component {
     this.props.onShowFailing();
   }
 
-  renderInProgressDuration () {
-    if (!this.props.inProgressDuration) {
-      return null;
-    }
-    return (
-        <span
-            className="huge-spacer-left"
-            title={translate('background_tasks.in_progress_duration')}
-            data-toggle="tooltip">
-          <i
-              className="spinner spacer-right"
-              style={{ verticalAlign: 'text-top' }}/>
-          <span
-              ref="inProgressDuration"
-              className="emphasised-measure">
-            {formatDuration(this.props.inProgressDuration)}
-          </span>
-        </span>
-    );
-  }
-
   renderPending () {
     if (this.props.pendingCount == null) {
       return null;
@@ -130,7 +107,6 @@ export default class Stats extends Component {
           <span className="huge-spacer-left">
             {this.renderFailures()}
           </span>
-          {this.renderInProgressDuration()}
         </section>
 
     );
index 86fa2952825e9e7432432db74707c9ac027944b9..510295faf54a15b361b7d024efaaf66e60edc161 100644 (file)
@@ -27,7 +27,6 @@ function mapStateToProps (state) {
   return {
     pendingCount: state.pendingCount,
     failingCount: state.failingCount,
-    inProgressDuration: state.inProgressDuration,
     component: state.component
   };
 }
index 1e59fd84dbcf5d5eb823f9b9aab7f0ed0e937fac..b3d54560da2dadc256aa70307e236eb60777754f 100644 (file)
@@ -63,12 +63,11 @@ export function updateQuery (query) {
   };
 }
 
-export function receiveStats ({ pendingCount, failingCount, inProgressDuration }) {
+export function receiveStats ({ pendingCount, failingCount }) {
   return {
     type: RECEIVE_STATS,
     pendingCount,
-    failingCount,
-    inProgressDuration
+    failingCount
   };
 }
 
@@ -141,10 +140,6 @@ function mapFiltersToParameters (filters = {}) {
   return parameters;
 }
 
-function getInProgressDuration (tasks) {
-  return tasks.length ? tasks[0].executionTimeMs : null;
-}
-
 function fetchTasks (filters) {
   return (dispatch, getState) => {
     const { component } = getState();
@@ -161,20 +156,18 @@ function fetchTasks (filters) {
     return Promise.all([
       getActivity(parameters),
       getActivity({ ps: 1, onlyCurrents: true, status: STATUSES.FAILED }),
-      getActivity({ ps: 1, status: STATUSES.PENDING }),
-      getActivity({ ps: 1, status: STATUSES.IN_PROGRESS })
+      getActivity({ ps: 1, status: STATUSES.PENDING })
     ]).then(responses => {
-      const [activity, failingActivity, pendingActivity, inProgressActivity] = responses;
+      const [activity, failingActivity, pendingActivity] = responses;
       const tasks = activity.tasks;
       const total = activity.paging.total;
 
       dispatch(receiveTasks(tasks, total));
 
       const pendingCount = pendingActivity.paging.total;
-      const inProgressDuration = getInProgressDuration(inProgressActivity.tasks);
       const failingCount = failingActivity.paging.total;
 
-      dispatch(receiveStats({ pendingCount, failingCount, inProgressDuration }));
+      dispatch(receiveStats({ pendingCount, failingCount }));
     });
   };
 }
index 3774f5aebda5c15746ded96602452449773fa80f..44cb08af7fd77f06a6ff0a68fc10ec4dc2604020 100644 (file)
@@ -40,8 +40,7 @@ export const initialState = {
 
   // stats
   pendingCount: 0,
-  failingCount: 0,
-  inProgressDuration: null
+  failingCount: 0
 };
 
 function updateTask (tasks, newTask) {
@@ -82,8 +81,7 @@ export default function (state = initialState, action) {
       return {
         ...state,
         pendingCount: action.pendingCount,
-        failingCount: action.failingCount,
-        inProgressDuration: action.inProgressDuration
+        failingCount: action.failingCount
       };
     case CANCEL_ALL_PENDING:
       return {
index 7e3a605f9eea5732c0fe121fe341137ce3f501e7..a684e26631cac183f152a9d54275b8c70954d100 100644 (file)
@@ -152,26 +152,6 @@ describe('Background Tasks', function () {
         expect(spy).to.have.been.called;
       });
     });
-
-    describe('In Progress Duration', () => {
-      it('should show duration', () => {
-        let result = TestUtils.renderIntoDocument(<Stats inProgressDuration="173"/>),
-            inProgressDuration = result.refs.inProgressDuration;
-        expect(inProgressDuration.textContent).to.include('173ms');
-      });
-
-      it('should format duration', () => {
-        let result = TestUtils.renderIntoDocument(<Stats inProgressDuration="1073"/>),
-            inProgressDuration = result.refs.inProgressDuration;
-        expect(inProgressDuration.textContent).to.include('1s');
-      });
-
-      it('should not show duration', () => {
-        let result = TestUtils.renderIntoDocument(<Stats/>),
-            inProgressDuration = result.refs.inProgressDuration;
-        expect(inProgressDuration).to.not.be.ok;
-      });
-    });
   });
 
   describe('Helpers', () => {