Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit 90c277c

Browse files
authored
ranking: Improve site-admin UI (#52458)
1 parent e1a948f commit 90c277c

File tree

1 file changed

+40
-32
lines changed

1 file changed

+40
-32
lines changed

client/web/src/enterprise/codeintel/ranking/pages/CodeIntelRankingPage.tsx

Lines changed: 40 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { formatDistance, format, parseISO } from 'date-fns'
55

66
import { Timestamp } from '@sourcegraph/branded/src/components/Timestamp'
77
import { TelemetryProps, TelemetryService } from '@sourcegraph/shared/src/telemetry/telemetryService'
8-
import { Container, ErrorAlert, LoadingSpinner, PageHeader, H4, H3 } from '@sourcegraph/wildcard'
8+
import { Container, ErrorAlert, LoadingSpinner, PageHeader, H4, H3, Text } from '@sourcegraph/wildcard'
99

1010
import { Collapsible } from '../../../../components/Collapsible'
1111

@@ -103,31 +103,44 @@ const Summary: FunctionComponent<SummaryProps> = ({ summary, displayGraphKey })
103103
{displayGraphKey && <H4>Historic ranking calculation ({summary.graphKey})</H4>}
104104

105105
<div className={displayGraphKey ? 'px-4' : ''}>
106-
<Progress title="Path Aggregation Process" progress={summary.pathMapperProgress} />
106+
<Progress
107+
title="Path mapper"
108+
subtitle="Reads the paths of SCIP indexes exported for ranking and produce path/zero-count pairs consumed by the ranking phase."
109+
progress={summary.pathMapperProgress}
110+
/>
107111

108112
<Progress
109-
title="Reference Aggregation Process"
113+
title="Reference count mapper"
114+
subtitle="Reads the symbol references of SCIP indexes exported for ranking, join them to exported definitions, and produce definition path/count pairs consumed by the ranking phase."
110115
progress={summary.referenceMapperProgress}
111116
className="mt-4"
112117
/>
113118

114119
{summary.reducerProgress && (
115-
<Progress title="Reducing Process" progress={summary.reducerProgress} className="mt-4" />
120+
<Progress
121+
title="Reference count reducer"
122+
subtitle="Sums the references for each definition path produced by the mapping phases and groups them by repository."
123+
progress={summary.reducerProgress}
124+
className="mt-4"
125+
/>
116126
)}
117127
</div>
118128
</div>
119129
)
120130

121131
interface ProgressProps {
122132
title: string
133+
subtitle?: string
123134
progress: Progress
124135
className?: string
125136
}
126137

127-
const Progress: FunctionComponent<ProgressProps> = ({ title, progress, className }) => (
138+
const Progress: FunctionComponent<ProgressProps> = ({ title, subtitle, progress, className }) => (
128139
<div>
129140
<div className={classNames(styles.tableContainer, className)}>
130141
<H4 className="p-0 m-0">{title}</H4>
142+
{subtitle && <Text size="small">{subtitle}</Text>}
143+
131144
<div className={styles.row}>
132145
<div>Queued records</div>
133146
<div>
@@ -140,44 +153,39 @@ const Progress: FunctionComponent<ProgressProps> = ({ title, progress, className
140153
)}
141154
</div>
142155
</div>
156+
143157
<div className={styles.row}>
144-
<div>Started</div>
158+
<div>Progress</div>
145159
<div>
146-
{format(parseISO(progress.startedAt), 'MMM d y h:mm:ss a')} (
147-
<Timestamp date={progress.startedAt} />)
160+
{progress.total === 0 ? 100 : Math.floor(((progress.processed / progress.total) * 100 * 100) / 100)}
161+
%
148162
</div>
149163
</div>
164+
150165
<div className={styles.row}>
151-
<div>Completed</div>
166+
<div>Started</div>
152167
<div>
153-
{progress.completedAt ? (
154-
<>
155-
{format(parseISO(progress.completedAt), 'MMM d y h:mm:ss a')} (
156-
<Timestamp date={progress.completedAt} />)
157-
</>
158-
) : (
159-
'-'
160-
)}
168+
{format(parseISO(progress.startedAt), 'MMM d y h:mm:ss a')} (
169+
<Timestamp date={progress.startedAt} />)
161170
</div>
162171
</div>
163-
<div className={styles.row}>
164-
<div>Duration</div>
165-
<div>
166-
{progress.completedAt && (
167-
<> Ran for {formatDistance(new Date(progress.completedAt), new Date(progress.startedAt))}</>
168-
)}
172+
173+
{progress.completedAt && (
174+
<div className={styles.row}>
175+
<div>Completed</div>
176+
<div>
177+
{format(parseISO(progress.completedAt), 'MMM d y h:mm:ss a')} (
178+
<Timestamp date={progress.completedAt} />)
179+
</div>
169180
</div>
170-
</div>
181+
)}
171182

172-
<div className={styles.row}>
173-
<div>Progress</div>
174-
<div>
175-
{progress.processed === 0
176-
? 100
177-
: Math.floor(((progress.processed / progress.total) * 100 * 100) / 100)}
178-
%
183+
{progress.completedAt && (
184+
<div className={styles.row}>
185+
<div>Duration</div>
186+
<div>Ran for {formatDistance(new Date(progress.completedAt), new Date(progress.startedAt))}</div>
179187
</div>
180-
</div>
188+
)}
181189
</div>
182190
</div>
183191
)

0 commit comments

Comments
 (0)