diff options
author | Stas Vilchik <vilchiks@gmail.com> | 2016-11-21 09:58:34 +0100 |
---|---|---|
committer | Stas Vilchik <vilchiks@gmail.com> | 2016-11-28 13:39:04 +0100 |
commit | bd96be1c6c971381952dff396e0e10ae9233a6b7 (patch) | |
tree | 4b98849c1b5d16dc0cd33094fac25577e0e9b709 /server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js | |
parent | 7f7bb7cdb743413ad2180f7936f252dee671ace2 (diff) | |
download | sonarqube-bd96be1c6c971381952dff396e0e10ae9233a6b7.tar.gz sonarqube-bd96be1c6c971381952dff396e0e10ae9233a6b7.zip |
add flow type checker (#1209)
Diffstat (limited to 'server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js index 11ed4513129..5beee99c9af 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/BackgroundTasksApp.js @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + /* @flow */ import React from 'react'; import shallowCompare from 'react-addons-shallow-compare'; import debounce from 'lodash/debounce'; @@ -30,6 +31,7 @@ import Search from '../components/Search'; import Tasks from '../components/Tasks'; import { getTypes, getActivity, getStatus, cancelAllTasks, cancelTask as cancelTaskAPI } from '../../../api/ce'; import { updateTask, mapFiltersToParameters } from '../utils'; +import { Task } from '../types'; import '../background-tasks.css'; export default class BackgroundTasksApp extends React.Component { @@ -42,7 +44,7 @@ export default class BackgroundTasksApp extends React.Component { location: RouterPropTypes.location.isRequired }; - state = { + state: any = { loading: true, tasks: [], @@ -67,11 +69,11 @@ export default class BackgroundTasksApp extends React.Component { }); } - shouldComponentUpdate (nextProps, nextState) { + shouldComponentUpdate (nextProps: any, nextState: any) { return shallowCompare(this, nextProps, nextState); } - componentDidUpdate (prevProps) { + componentDidUpdate (prevProps: any) { if (prevProps.component !== this.props.component || prevProps.location !== this.props.location) { this.loadTasksDebounced(); @@ -82,6 +84,9 @@ export default class BackgroundTasksApp extends React.Component { this.mounted = false; } + loadTasksDebounced: any; + mounted: boolean; + loadTasks () { this.setState({ loading: true }); @@ -93,7 +98,7 @@ export default class BackgroundTasksApp extends React.Component { const query = this.props.location.query.query || DEFAULT_FILTERS.query; const filters = { status, taskType, currents, minSubmittedAt, maxExecutedAt, query }; - const parameters = mapFiltersToParameters(filters); + const parameters: any = mapFiltersToParameters(filters); if (this.props.component) { parameters.componentId = this.props.component.id; @@ -120,7 +125,7 @@ export default class BackgroundTasksApp extends React.Component { }); } - handleFilterUpdate (nextState) { + handleFilterUpdate (nextState: any) { const nextQuery = { ...this.props.location.query, ...nextState }; // remove defaults @@ -136,7 +141,7 @@ export default class BackgroundTasksApp extends React.Component { }); } - handleCancelTask (task) { + handleCancelTask (task: Task) { this.setState({ loading: true }); cancelTaskAPI(task.id).then(nextTask => { @@ -147,7 +152,7 @@ export default class BackgroundTasksApp extends React.Component { }); } - handleFilterTask (task) { + handleFilterTask (task: Task) { this.handleFilterUpdate({ query: task.componentKey }); } |