]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-7191 add "Reset" button
authorStas Vilchik <vilchiks@gmail.com>
Thu, 18 Feb 2016 16:15:47 +0000 (17:15 +0100)
committerStas Vilchik <vilchiks@gmail.com>
Thu, 18 Feb 2016 16:22:01 +0000 (17:22 +0100)
server/sonar-web/src/main/js/apps/background-tasks/components/Search.js
server/sonar-web/src/main/js/apps/background-tasks/containers/SearchContainer.js

index 74344b23cf409ed9718a7079ec2909df933100f0..961d56b3ebd093144d48004934e6ef693a4f120d 100644 (file)
@@ -64,6 +64,11 @@ export default React.createClass({
     this.props.onRefresh();
   },
 
+  handleReset(e) {
+    e.preventDefault();
+    this.props.onReset();
+  },
+
   render() {
     return (
         <section className="big-spacer-top big-spacer-bottom">
@@ -113,6 +118,13 @@ export default React.createClass({
                   disabled={this.props.fetching}>
                 {translate('reload')}
               </button>
+              {' '}
+              <button
+                  ref="resetButton"
+                  onClick={this.handleReset}
+                  disabled={this.props.fetching}>
+                {translate('reset_verb')}
+              </button>
             </li>
           </ul>
         </section>
index fbf24e4477ab7bcb579f9aedc6d5a64e40489b8c..4b21e10ac9f50f9eb27ce956163af9e01b988040 100644 (file)
@@ -21,7 +21,7 @@ import { connect } from 'react-redux';
 
 import Search from '../components/Search';
 import { filterTasks, search } from '../store/actions';
-import { STATUSES, CURRENTS } from '../constants';
+import { STATUSES, CURRENTS, DEFAULT_FILTERS } from '../constants';
 
 function mapStateToProps (state) {
   return {
@@ -47,6 +47,7 @@ function updateStatusQuery (status) {
 function mapDispatchToProps (dispatch) {
   return {
     onRefresh: () => dispatch(filterTasks()),
+    onReset: () => dispatch(filterTasks(DEFAULT_FILTERS)),
     onStatusChange: (status) => dispatch(filterTasks(updateStatusQuery(status))),
     onTypeChange: (taskType) => dispatch(filterTasks({ taskType })),
     onCurrentsChange: (currents) => dispatch(filterTasks({ currents })),