activityTotal: 0,
activityPage: 1,
pendingCount: 0,
- failuresCount: 0,
statusFilter: STATUSES.ALL,
currentsFilter: CURRENTS.ALL
};
requestData() {
this.requestQueue();
this.requestActivity();
+ this.requestFailures();
},
requestQueue() {
});
},
+ requestFailures() {
+ let filters = { ps: 1, onlyCurrents: true, status: STATUSES.FAILED };
+ getActivity(filters).done(failures => {
+ this.setState({ failuresCount: failures.paging.total });
+ });
+ },
+
countPending(tasks) {
return _.where(tasks, { status: STATUSES.PENDING }).length;
},
this.setState({ activityPage: this.state.activityPage + 1 }, this.requestActivity);
},
+ showFailures() {
+ this.setState({
+ statusFilter: STATUSES.FAILED,
+ currentsFilter: CURRENTS.ONLY_CURRENTS,
+ activityPage: 1
+ },
+ this.requestActivity);
+ },
+
onTaskCanceled(task) {
cancelTask(task.id).done(data => {
_.extend(task, data.task);
return (
<div className="page">
<Header/>
- <Stats {...this.state}/>
+ <Stats {...this.state} 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({
+ onFailuresClick(e) {
+ e.preventDefault();
+ this.props.showFailures();
+ },
+
renderInProgressDuration() {
if (!this.props.inProgressDuration) {
return null;
);
},
+ renderFailures() {
+ if (this.props.failuresCount == null) {
+ return null;
+ }
+ if (this.props.failuresCount > 0) {
+ return <span><a onClick={this.onFailuresClick} className="emphasised-measure" href="#">{this.props.failuresCount}</a> failures</span>;
+ } else {
+ return <span><span className="emphasised-measure">{this.props.failuresCount}</span> failures</span>;
+ }
+ },
+
render() {
return (
<section className="big-spacer-top big-spacer-bottom">
<span className="emphasised-measure">{this.props.pendingCount}</span> pending
</span>
<span className="huge-spacer-left">
- <span className="emphasised-measure">{this.props.failuresCount}</span> failures
+ {this.renderFailures()}
</span>
{this.renderInProgressDuration()}
</section>
import React from 'react';
import {getProjectUrl} from '../../helpers/Url';
import QualifierIcon from '../../components/shared/qualifier-icon';
+import PendingIcon from '../../components/shared/pending-icon';
import {STATUSES} from './constants';
export default React.createClass({
renderTaskStatus(task) {
let inner;
switch (task.status) {
+ case STATUSES.PENDING:
+ inner = <PendingIcon/>;
+ break;
case STATUSES.IN_PROGRESS:
inner = <i className="spinner"/>;
break;
if (task.status === STATUSES.PENDING) {
return (
<td className="thin">
- <button onClick={this.onTaskCanceled.bind(this, task)}>Cancel</button>
+ <a onClick={this.onTaskCanceled.bind(this, task)} className="icon-delete" title="Cancel Task"
+ data-toggle="tooltip" href="#"></a>
</td>
);
} else {