};
},
+ filterQueueForComponent(queue) {
+ if (this.props.options.componentId) {
+ return queue.filter(task => {
+ return task.componentId === this.props.options.componentId
+ });
+ } else {
+ return queue;
+ }
+ },
+
componentDidMount() {
this.requestData();
},
+ getComponentFilter() {
+ if (this.props.options.componentId) {
+ return { componentId: this.props.options.componentId };
+ } else {
+ return {};
+ }
+ },
+
getCurrentFilters() {
let filters = {};
if (this.state.statusFilter !== STATUSES.ALL) {
requestQueue() {
if (!Object.keys(this.getCurrentFilters()).length) {
getQueue().done(queue => {
+ let tasks = this.filterQueueForComponent(queue.tasks);
this.setState({
- queue: this.orderTasks(queue.tasks),
- pendingCount: this.countPending(queue.tasks),
- inProgressDuration: this.getInProgressDuration(queue.tasks)
+ queue: this.orderTasks(tasks),
+ pendingCount: this.countPending(tasks),
+ inProgressDuration: this.getInProgressDuration(tasks)
});
});
} else {
},
requestActivity() {
- let filters = _.extend(this.getCurrentFilters(), { p: this.state.activityPage, ps: PAGE_SIZE });
+ let filters = _.extend(
+ this.getCurrentFilters(),
+ this.getComponentFilter(),
+ { p: this.state.activityPage, ps: PAGE_SIZE });
getActivity(filters).done(activity => {
let newActivity = activity.paging.pageIndex === 1 ?
activity.tasks : [].concat(this.state.activity, activity.tasks);
},
requestFailures() {
- let filters = { ps: 1, onlyCurrents: true, status: STATUSES.FAILED };
+ let filters = _.extend(
+ this.getComponentFilter(),
+ { ps: 1, onlyCurrents: true, status: STATUSES.FAILED });
getActivity(filters).done(failures => {
this.setState({ failuresCount: failures.paging.total });
});
{this.renderLinksLink()}
{this.renderPermissionsLink()}
{this.renderHistoryLink()}
+ {this.renderBackgroundTasksLink()}
{this.renderUpdateKeyLink()}
{this.renderDeletionLink()}
{this.renderExtensions()}
return this.renderLink(url, window.t('project_history.page'), '/project/history');
},
+ renderBackgroundTasksLink() {
+ // TODO check permissions
+ const url = `/project/background_tasks?id=${encodeURIComponent(this.props.component.key)}`;
+ return this.renderLink(url, 'Background Tasks', '/project/background_tasks');
+ },
+
renderUpdateKeyLink() {
if (!this.props.conf.showUpdateKey) {
return null;