return $.post(url, { id }).then(getTask.bind(null, id));
}
+export function cancelAllTasks () {
+ let url = baseUrl + '/api/ce/cancel_all';
+ return $.post(url);
+}
+
export function getTasksForComponent(componentId) {
let url = baseUrl + '/api/ce/project';
return $.get(url, { componentId });
import _ from 'underscore';
import React from 'react';
-import {getQueue, getActivity, cancelTask} from '../../api/ce';
+import {getQueue, getActivity, cancelTask, cancelAllTasks} from '../../api/ce';
import {STATUSES, CURRENTS} from './constants';
import Header from './header';
import Stats from './stats';
activity: [],
activityTotal: 0,
activityPage: 1,
- pendingCount: 0,
statusFilter: STATUSES.ALL,
currentsFilter: CURRENTS.ALL
};
});
},
+ cancelPending() {
+ cancelAllTasks().then(this.requestData);
+ },
+
render() {
return (
<div className="page">
<Header/>
- <Stats {...this.state} showFailures={this.showFailures}/>
+ <Stats {...this.state} cancelPending={this.cancelPending} showFailures={this.showFailures}/>
<Search {...this.state} onStatusChange={this.onStatusChange} onCurrentsChange={this.onCurrentsChange}/>
<Tasks tasks={[].concat(this.state.queue, this.state.activity)} onTaskCanceled={this.onTaskCanceled}/>
<ListFooter count={this.state.queue.length + this.state.activity.length}
import React from 'react';
export default React.createClass({
+ onPendingCanceled(e) {
+ e.preventDefault();
+ this.props.cancelPending();
+ },
+
onFailuresClick(e) {
e.preventDefault();
this.props.showFailures();
);
},
+ renderPending() {
+ if (this.props.pendingCount == null) {
+ return null;
+ }
+ if (this.props.pendingCount > 0) {
+ return (
+ <span>
+ <span className="emphasised-measure">{this.props.pendingCount}</span> pending
+ <a onClick={this.onPendingCanceled} className="icon-delete spacer-left" title="Cancel Pending Tasks"
+ data-toggle="tooltip" href="#"></a>
+ </span>
+ );
+ } else {
+ return <span><span className="emphasised-measure">{this.props.pendingCount}</span> pending</span>;
+ }
+ },
+
renderFailures() {
if (this.props.failuresCount == null) {
return null;
return (
<section className="big-spacer-top big-spacer-bottom">
<span>
- <span className="emphasised-measure">{this.props.pendingCount}</span> pending
+ {this.renderPending()}
</span>
<span className="huge-spacer-left">
{this.renderFailures()}