diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-02-22 13:59:01 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-02-22 13:59:01 +0100 |
commit | 29b299ef9d5e1657dbdaff9634de1d616b2617a4 (patch) | |
tree | b9caaccde2d73475695cc9e60e45ae8ce1cc71d0 /server | |
parent | ef39ea00c5822b114d728f73d92eed6635437b98 (diff) | |
download | sonarqube-29b299ef9d5e1657dbdaff9634de1d616b2617a4.tar.gz sonarqube-29b299ef9d5e1657dbdaff9634de1d616b2617a4.zip |
SONAR-7191 apply feedback
Diffstat (limited to 'server')
6 files changed, 26 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/CurrentsFilter.js b/server/sonar-web/src/main/js/apps/background-tasks/components/CurrentsFilter.js index bcbfd7f92d7..2468594bbd9 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/CurrentsFilter.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/CurrentsFilter.js @@ -28,6 +28,13 @@ export default function CurrentsFilter ({ value, onChange }) { onChange(newValue); } + function handleLabelClick (e) { + const newValue = value === CURRENTS.ALL ? CURRENTS.ONLY_CURRENTS : CURRENTS.ALL; + + e.preventDefault(); + onChange(newValue); + } + const checked = value === CURRENTS.ONLY_CURRENTS; return ( @@ -36,7 +43,9 @@ export default function CurrentsFilter ({ value, onChange }) { initiallyChecked={checked} onCheck={handleChange}/> - <label>Yes</label> + <label + onClick={handleLabelClick} + style={{ cursor: 'pointer' }}>Yes</label> </div> ); } diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.js b/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.js index 14a7495099b..c156d0fb1c6 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.js @@ -26,6 +26,7 @@ import { translate } from '../../../helpers/l10n'; export default function StatusFilter ({ value, onChange }) { const options = [ { value: STATUSES.ALL, label: translate('background_task.status.ALL') }, + { value: STATUSES.ALL_EXCEPT_PENDING, label: translate('background_task.status.ALL_EXCEPT_PENDING') }, { value: STATUSES.PENDING, label: translate('background_task.status.PENDING') }, { value: STATUSES.IN_PROGRESS, label: translate('background_task.status.IN_PROGRESS') }, { value: STATUSES.SUCCESS, label: translate('background_task.status.SUCCESS') }, @@ -37,7 +38,7 @@ export default function StatusFilter ({ value, onChange }) { <Select value={value} onChange={option => onChange(option.value)} - className="input-small" + className="input-medium" options={options} clearable={false} searchable={false}/> diff --git a/server/sonar-web/src/main/js/apps/background-tasks/constants.js b/server/sonar-web/src/main/js/apps/background-tasks/constants.js index be338fb7168..d58eb9032b5 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/constants.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/constants.js @@ -19,6 +19,7 @@ */ export const STATUSES = { ALL: '__ALL__', + ALL_EXCEPT_PENDING: '__ALL_EXCEPT_PENDING__', PENDING: 'PENDING', IN_PROGRESS: 'IN_PROGRESS', SUCCESS: 'SUCCESS', @@ -43,7 +44,7 @@ export const DATE = { }; export const DEFAULT_FILTERS = { - status: STATUSES.ALL, + status: STATUSES.ALL_EXCEPT_PENDING, taskType: ALL_TYPES, currents: CURRENTS.ALL, date: {}, diff --git a/server/sonar-web/src/main/js/apps/background-tasks/containers/SearchContainer.js b/server/sonar-web/src/main/js/apps/background-tasks/containers/SearchContainer.js index 4b21e10ac9f..5518f3f17ec 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/containers/SearchContainer.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/containers/SearchContainer.js @@ -50,7 +50,7 @@ function mapDispatchToProps (dispatch) { onReset: () => dispatch(filterTasks(DEFAULT_FILTERS)), onStatusChange: (status) => dispatch(filterTasks(updateStatusQuery(status))), onTypeChange: (taskType) => dispatch(filterTasks({ taskType })), - onCurrentsChange: (currents) => dispatch(filterTasks({ currents })), + onCurrentsChange: (currents) => dispatch(filterTasks({ currents, status: STATUSES.ALL_EXCEPT_PENDING })), onDateChange: (date) => dispatch(filterTasks({ date })), onSearch: (query) => dispatch(search(query)) }; 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 6dcd93afa4d..1e59fd84dbc 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 @@ -95,9 +95,7 @@ export function finishCancelTaskAction (task) { function mapFiltersToParameters (filters = {}) { const parameters = {}; - if (filters.status !== STATUSES.ALL) { - parameters.status = filters.status; - } else { + if (filters.status === STATUSES.ALL) { parameters.status = [ STATUSES.PENDING, STATUSES.IN_PROGRESS, @@ -105,6 +103,15 @@ function mapFiltersToParameters (filters = {}) { STATUSES.FAILED, STATUSES.CANCELED ].join(); + } else if (filters.status === STATUSES.ALL_EXCEPT_PENDING) { + parameters.status = [ + STATUSES.IN_PROGRESS, + STATUSES.SUCCESS, + STATUSES.FAILED, + STATUSES.CANCELED + ].join(); + } else { + parameters.status = filters.status; } if (filters.taskType !== ALL_TYPES) { diff --git a/server/sonar-web/tests/apps/background-tasks-test.js b/server/sonar-web/tests/apps/background-tasks-test.js index 63b61f4dd20..7e3a605f9ee 100644 --- a/server/sonar-web/tests/apps/background-tasks-test.js +++ b/server/sonar-web/tests/apps/background-tasks-test.js @@ -19,7 +19,7 @@ describe('Background Tasks', function () { describe('Constants', () => { it('should have STATUSES', () => { expect(STATUSES).to.be.a('object'); - expect(Object.keys(STATUSES).length).to.equal(6); + expect(Object.keys(STATUSES).length).to.equal(7); }); it('should have CURRENTS', () => { |