Skip to content

Commit 98be6dc

Browse files
authored
Merge pull request #2176 from jaimergp/add-total-children
Status page: Add descendants count, sort alphabetically
2 parents 76d174d + bcde9c5 commit 98be6dc

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

src/components/MigrationDetails/index.jsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,11 @@ function Table({ details }) {
206206
const rows = ORDERED.reduce((rows, [status]) => (
207207
filters[status] ? rows :
208208
rows.concat((details[status]).map(name => ([name, status])))
209-
), []);
209+
), []).sort((a, b) => (
210+
feedstock[b[0]]["num_descendants"] - feedstock[a[0]]["num_descendants"]
211+
|| ORDERED.findIndex(x => x[0] == a[1]) - ORDERED.findIndex(x => x[0] == b[1])
212+
|| a[0].localeCompare(b[0]))
213+
);
210214
return (
211215
<>
212216
<Filters
@@ -218,8 +222,9 @@ function Table({ details }) {
218222
<thead>
219223
<tr>
220224
<th style={{ width: 200 }}>Name</th>
221-
<th style={{ width: 115 }}>PRs made</th>
222-
<th style={{ flex: 1 }}>Immediate Children</th>
225+
<th style={{ width: 115 }}>Status</th>
226+
<th style={{ width: 115 }}>Total number of children</th>
227+
<th style={{ flex: 1 }}>Immediate children</th>
223228
</tr>
224229
</thead>
225230
<tbody>
@@ -235,7 +240,8 @@ function Table({ details }) {
235240
function Row({ children }) {
236241
const [collapsed, setState] = useState(true);
237242
const { feedstock, name, status } = children;
238-
const immediate = feedstock["immediate_children"] || [];
243+
const immediate_children = feedstock["immediate_children"] || [];
244+
const total_children = feedstock["num_descendants"];
239245
const href = feedstock["pr_url"];
240246
const details = feedstock["pre_pr_migrator_status"];
241247
return (<>
@@ -252,13 +258,14 @@ function Row({ children }) {
252258
<span>{name}</span>)
253259
)}
254260
</td>
255-
<td>{TITLES[status]}</td>
261+
<td style={{ textAlign: "center" }}>{TITLES[status]}</td>
262+
<td style={{ textAlign: "center" }}>{total_children || null}</td>
256263
<td>
257-
{immediate.map((name, index) => (<React.Fragment key={index}>
264+
{immediate_children.map((name, index) => (<React.Fragment key={index}>
258265
<span
259266
style={{ marginBottom: 1 }}
260267
className="badge badge--secondary">{name}</span>
261-
{immediate.length - 1 === index ? "" : " "}
268+
{immediate_children.length - 1 === index ? "" : " "}
262269
</React.Fragment>))}
263270
</td>
264271
</tr>

0 commit comments

Comments
 (0)