From 9ac2512ad01b64c6c7d2af6b4600f6ee0b3729af Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Wed, 30 Mar 2016 14:03:22 +0200 Subject: [PATCH] SONAR-7423 Remove displaying of duration of task in progress --- .../apps/background-tasks/components/Stats.js | 24 ------------------- .../containers/StatsContainer.js | 1 - .../js/apps/background-tasks/store/actions.js | 17 ++++--------- .../apps/background-tasks/store/reducers.js | 6 ++--- .../tests/apps/background-tasks-test.js | 20 ---------------- 5 files changed, 7 insertions(+), 61 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/Stats.js b/server/sonar-web/src/main/js/apps/background-tasks/components/Stats.js index 2fc18a7bd75..450a5098671 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/Stats.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/Stats.js @@ -19,10 +19,8 @@ */ 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 ( - - - - {formatDuration(this.props.inProgressDuration)} - - - ); - } - renderPending () { if (this.props.pendingCount == null) { return null; @@ -130,7 +107,6 @@ export default class Stats extends Component { {this.renderFailures()} - {this.renderInProgressDuration()} ); diff --git a/server/sonar-web/src/main/js/apps/background-tasks/containers/StatsContainer.js b/server/sonar-web/src/main/js/apps/background-tasks/containers/StatsContainer.js index 86fa2952825..510295faf54 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/containers/StatsContainer.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/containers/StatsContainer.js @@ -27,7 +27,6 @@ function mapStateToProps (state) { return { pendingCount: state.pendingCount, failingCount: state.failingCount, - inProgressDuration: state.inProgressDuration, component: state.component }; } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/store/actions.js b/server/sonar-web/src/main/js/apps/background-tasks/store/actions.js index 1e59fd84dbc..b3d54560da2 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/store/actions.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/store/actions.js @@ -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 })); }); }; } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/store/reducers.js b/server/sonar-web/src/main/js/apps/background-tasks/store/reducers.js index 3774f5aebda..44cb08af7fd 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/store/reducers.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/store/reducers.js @@ -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 { diff --git a/server/sonar-web/tests/apps/background-tasks-test.js b/server/sonar-web/tests/apps/background-tasks-test.js index 7e3a605f9ee..a684e26631c 100644 --- a/server/sonar-web/tests/apps/background-tasks-test.js +++ b/server/sonar-web/tests/apps/background-tasks-test.js @@ -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(), - inProgressDuration = result.refs.inProgressDuration; - expect(inProgressDuration.textContent).to.include('173ms'); - }); - - it('should format duration', () => { - let result = TestUtils.renderIntoDocument(), - inProgressDuration = result.refs.inProgressDuration; - expect(inProgressDuration.textContent).to.include('1s'); - }); - - it('should not show duration', () => { - let result = TestUtils.renderIntoDocument(), - inProgressDuration = result.refs.inProgressDuration; - expect(inProgressDuration).to.not.be.ok; - }); - }); }); describe('Helpers', () => { -- 2.39.5