fix(search_jobs): progress reporting (#64287)

Relates to #64186

With this PR we only show `83 out of 120 tasks` if the search job is
currently processing. In all other states, we don't show this stat. This
is a consequence of the janitor job I recently added, because after
aggregation, this data is not available anymore. User's can still
inspect the logs and download results to get a detailed view of which
revisions were searched.

I also remove an unnecessary dependency of the download links on the job
state.

## Test plan:

I ran a search job locally and confirmed that the progress message is
only visible while the job is processing and that logs and downloads are
always available.

## Changelog
- Show detailed progress only while job is in status "processing"
- Remove dependency of download links on job state
This commit is contained in:
Stefan Hengl 2024-08-06 11:16:04 +02:00 committed by GitHub
parent 38633daef0
commit 155975259a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 15 deletions

View File

@ -351,7 +351,7 @@ const SearchJob: FC<SearchJobProps> = props => {
</span>
<span className={styles.jobQuery}>
{job.state !== SearchJobState.COMPLETED && (
{job.state === SearchJobState.PROCESSING && (
<Text className="m-0 text-muted">
{repoStats.completed} out of {repoStats.total} tasks
</Text>

View File

@ -76,25 +76,19 @@ func (r *searchJobResolver) FinishedAt(ctx context.Context) *gqlutil.DateTime {
}
func (r *searchJobResolver) URL(ctx context.Context) (*string, error) {
if r.Job.State == types.JobStateCompleted {
exportPath, err := url.JoinPath(conf.Get().ExternalURL, fmt.Sprintf("/.api/search/export/%d.jsonl", r.Job.ID))
if err != nil {
return nil, err
}
return pointers.Ptr(exportPath), nil
exportPath, err := url.JoinPath(conf.Get().ExternalURL, fmt.Sprintf("/.api/search/export/%d.jsonl", r.Job.ID))
if err != nil {
return nil, err
}
return nil, nil
return pointers.Ptr(exportPath), nil
}
func (r *searchJobResolver) LogURL(ctx context.Context) (*string, error) {
if r.Job.State == types.JobStateCompleted {
exportPath, err := url.JoinPath(conf.Get().ExternalURL, fmt.Sprintf("/.api/search/export/%d.log", r.Job.ID))
if err != nil {
return nil, err
}
return pointers.Ptr(exportPath), nil
exportPath, err := url.JoinPath(conf.Get().ExternalURL, fmt.Sprintf("/.api/search/export/%d.log", r.Job.ID))
if err != nil {
return nil, err
}
return nil, nil
return pointers.Ptr(exportPath), nil
}
func (r *searchJobResolver) RepoStats(ctx context.Context) (graphqlbackend.SearchJobStatsResolver, error) {