зеркало из 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()
|
return_type = filter_params.get("return_type", "dict").lower()
|
||||||
|
|
||||||
|
nosuccess = filter_params.get("nosuccess", False)
|
||||||
|
|
||||||
jobs = JobFilter(
|
jobs = JobFilter(
|
||||||
{k: v for (k, v) in filter_params.items()},
|
{k: v for (k, v) in filter_params.items()},
|
||||||
queryset=Job.objects.filter(job_type_id=job.job_type_id, repository=repository)
|
queryset=Job.objects.filter(job_type_id=job.job_type_id, repository=repository)
|
||||||
.exclude(id=job.id)
|
.exclude(id=job.id)
|
||||||
|
.exclude(result=('success' if nosuccess is not False else None))
|
||||||
.select_related(*self._default_select_related),
|
.select_related(*self._default_select_related),
|
||||||
).qs
|
).qs
|
||||||
|
|
||||||
|
|
|
@ -23,19 +23,12 @@ class SimilarJobsTab extends React.Component {
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
similarJobs: [],
|
similarJobs: [],
|
||||||
filterBuildPlatformId: true,
|
filterNoSuccessfulJobs: false,
|
||||||
filterOptionCollectionHash: true,
|
|
||||||
page: 1,
|
page: 1,
|
||||||
selectedSimilarJob: null,
|
selectedSimilarJob: null,
|
||||||
hasNextPage: false,
|
hasNextPage: false,
|
||||||
isLoading: true,
|
isLoading: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
// map between state fields and job fields
|
|
||||||
this.filterMap = {
|
|
||||||
filterBuildPlatformId: 'build_platform_id',
|
|
||||||
filterOptionCollectionHash: 'option_collection_hash',
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
@ -51,12 +44,9 @@ class SimilarJobsTab extends React.Component {
|
||||||
offset: (page - 1) * this.pageSize,
|
offset: (page - 1) * this.pageSize,
|
||||||
};
|
};
|
||||||
|
|
||||||
['filterBuildPlatformId', 'filterOptionCollectionHash'].forEach((key) => {
|
if (this.state.filterNoSuccessfulJobs) {
|
||||||
if (this.state[key]) {
|
options.nosuccess = '';
|
||||||
const field = this.filterMap[key];
|
}
|
||||||
options[field] = selectedJobFull[field];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data: newSimilarJobs,
|
data: newSimilarJobs,
|
||||||
|
@ -157,8 +147,7 @@ class SimilarJobsTab extends React.Component {
|
||||||
similarJobs,
|
similarJobs,
|
||||||
selectedSimilarJob,
|
selectedSimilarJob,
|
||||||
hasNextPage,
|
hasNextPage,
|
||||||
filterOptionCollectionHash,
|
filterNoSuccessfulJobs,
|
||||||
filterBuildPlatformId,
|
|
||||||
isLoading,
|
isLoading,
|
||||||
} = this.state;
|
} = this.state;
|
||||||
const selectedSimilarJobId = selectedSimilarJob
|
const selectedSimilarJobId = selectedSimilarJob
|
||||||
|
@ -238,19 +227,11 @@ class SimilarJobsTab extends React.Component {
|
||||||
<form className="form form-inline">
|
<form className="form form-inline">
|
||||||
<div className="checkbox">
|
<div className="checkbox">
|
||||||
<input
|
<input
|
||||||
onChange={() => this.toggleFilter('filterBuildPlatformId')}
|
onChange={() => this.toggleFilter('filterNoSuccessfulJobs')}
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={filterBuildPlatformId}
|
checked={filterNoSuccessfulJobs}
|
||||||
/>
|
/>
|
||||||
<small>Same platform</small>
|
<small>Exclude successful jobs</small>
|
||||||
</div>
|
|
||||||
<div className="checkbox">
|
|
||||||
<input
|
|
||||||
onChange={() => this.toggleFilter('filterOptionCollectionHash')}
|
|
||||||
type="checkbox"
|
|
||||||
checked={filterOptionCollectionHash}
|
|
||||||
/>
|
|
||||||
<small>Same options</small>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<div className="similar_job_detail">
|
<div className="similar_job_detail">
|
||||||
|
|
Загрузка…
Ссылка в новой задаче