40 | {this.renderErrorMessage()}
41 | {this.renderProgressMessage()}
42 |
43 | {projects &&
44 |
48 | }
49 |
50 | }
51 |
52 | renderErrorMessage = () =>
53 | this.state.error &&
7 |
8 | {pipeline.commit ? pipeline.commit.author : '-'}
9 | {pipeline.commit ? `'${pipeline.commit.title}'` : '-'}
10 |
11 |
12 |
13 | on {pipeline.ref}
14 |
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/src/client/jobs.tsx:
--------------------------------------------------------------------------------
1 | import groupBy from 'lodash/groupBy'
2 | import mapValues from 'lodash/mapValues'
3 | import orderBy from 'lodash/orderBy'
4 | import partition from 'lodash/partition'
5 | import React from 'react'
6 | import toPairs from 'lodash/toPairs'
7 | import type {Job, JobStatus} from './gitlab-types'
8 |
9 | const NON_BREAKING_SPACE = '\xa0'
10 |
11 | const JOB_STATES_IN_INTEREST_ORDER: JobStatus[] = [
12 | 'failed',
13 | 'running',
14 | 'created',
15 | 'pending',
16 | 'success',
17 | 'skipped'
18 | ]
19 |
20 | export function Jobs({jobs, maxNonFailedJobsVisible}: {jobs: Job[], maxNonFailedJobsVisible: number}) {
21 | const [failedJobs, nonFailedJobs] = partition(jobs, {status: 'failed'})
22 | const filteredJobs = sortByOriginalOrder(
23 | failedJobs.concat(
24 | orderBy(nonFailedJobs, ({status}) => JOB_STATES_IN_INTEREST_ORDER.indexOf(status))
25 | .slice(0, Math.max(0, maxNonFailedJobsVisible - failedJobs.length))
26 | ),
27 | jobs
28 | )
29 |
30 | const hiddenJobs = jobs.filter(job => filteredJobs.indexOf(job) === -1)
31 | const hiddenCountsByStatus = mapValues(
32 | groupBy(hiddenJobs, 'status'),
33 | jobsForStatus => jobsForStatus.length
34 | )
35 |
36 | const hiddenJobsText = orderBy(toPairs(hiddenCountsByStatus), ([status]) => status)
37 | .map(([status, count]) => `${count}${NON_BREAKING_SPACE}${status}`)
38 | .join(', ')
39 |
40 | return