зеркало из https://github.com/mozilla/treeherder.git
Bug 1723971 - exclude success from similar jobs (#7232)
* allow to exclude successful tasks from 'Similar Jobs' list of recent runs
This commit is contained in:
Родитель
2ec62a65d0
Коммит
463ac49265
|
@ -452,10 +452,13 @@ class JobsProjectViewSet(viewsets.ViewSet):
|
|||
|
||||
return_type = filter_params.get("return_type", "dict").lower()
|
||||
|
||||
nosuccess = filter_params.get("nosuccess", False)
|
||||
|
||||
jobs = JobFilter(
|
||||
{k: v for (k, v) in filter_params.items()},
|
||||
queryset=Job.objects.filter(job_type_id=job.job_type_id, repository=repository)
|
||||
.exclude(id=job.id)
|
||||
.exclude(result=('success' if nosuccess is not False else None))
|
||||
.select_related(*self._default_select_related),
|
||||
).qs
|
||||
|
||||
|
|
|
@ -23,19 +23,12 @@ class SimilarJobsTab extends React.Component {
|
|||
|
||||
this.state = {
|
||||
similarJobs: [],
|
||||
filterBuildPlatformId: true,
|
||||
filterOptionCollectionHash: true,
|
||||
filterNoSuccessfulJobs: false,
|
||||
page: 1,
|
||||
selectedSimilarJob: null,
|
||||
hasNextPage: false,
|
||||
isLoading: true,
|
||||
};
|
||||
|
||||
// map between state fields and job fields
|
||||
this.filterMap = {
|
||||
filterBuildPlatformId: 'build_platform_id',
|
||||
filterOptionCollectionHash: 'option_collection_hash',
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
|
@ -51,12 +44,9 @@ class SimilarJobsTab extends React.Component {
|
|||
offset: (page - 1) * this.pageSize,
|
||||
};
|
||||
|
||||
['filterBuildPlatformId', 'filterOptionCollectionHash'].forEach((key) => {
|
||||
if (this.state[key]) {
|
||||
const field = this.filterMap[key];
|
||||
options[field] = selectedJobFull[field];
|
||||
}
|
||||
});
|
||||
if (this.state.filterNoSuccessfulJobs) {
|
||||
options.nosuccess = '';
|
||||
}
|
||||
|
||||
const {
|
||||
data: newSimilarJobs,
|
||||
|
@ -157,8 +147,7 @@ class SimilarJobsTab extends React.Component {
|
|||
similarJobs,
|
||||
selectedSimilarJob,
|
||||
hasNextPage,
|
||||
filterOptionCollectionHash,
|
||||
filterBuildPlatformId,
|
||||
filterNoSuccessfulJobs,
|
||||
isLoading,
|
||||
} = this.state;
|
||||
const selectedSimilarJobId = selectedSimilarJob
|
||||
|
@ -238,19 +227,11 @@ class SimilarJobsTab extends React.Component {
|
|||
<form className="form form-inline">
|
||||
<div className="checkbox">
|
||||
<input
|
||||
onChange={() => this.toggleFilter('filterBuildPlatformId')}
|
||||
onChange={() => this.toggleFilter('filterNoSuccessfulJobs')}
|
||||
type="checkbox"
|
||||
checked={filterBuildPlatformId}
|
||||
checked={filterNoSuccessfulJobs}
|
||||
/>
|
||||
<small>Same platform</small>
|
||||
</div>
|
||||
<div className="checkbox">
|
||||
<input
|
||||
onChange={() => this.toggleFilter('filterOptionCollectionHash')}
|
||||
type="checkbox"
|
||||
checked={filterOptionCollectionHash}
|
||||
/>
|
||||
<small>Same options</small>
|
||||
<small>Exclude successful jobs</small>
|
||||
</div>
|
||||
</form>
|
||||
<div className="similar_job_detail">
|
||||
|
|
Загрузка…
Ссылка в новой задаче