Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status page: Add descendants count, sort alphabetically #2176

Merged
merged 6 commits into from
May 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions src/components/MigrationDetails/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,11 @@ function Table({ details }) {
const rows = ORDERED.reduce((rows, [status]) => (
filters[status] ? rows :
rows.concat((details[status]).map(name => ([name, status])))
), []);
), []).sort((a, b) => (
feedstock[b[0]]["num_descendants"] - feedstock[a[0]]["num_descendants"]
|| ORDERED.findIndex(x => x[0] == a[1]) - ORDERED.findIndex(x => x[0] == b[1])
|| a[0].localeCompare(b[0]))
);
return (
<>
<Filters
Expand All @@ -218,8 +222,9 @@ function Table({ details }) {
<thead>
<tr>
<th style={{ width: 200 }}>Name</th>
<th style={{ width: 115 }}>PRs made</th>
<th style={{ flex: 1 }}>Immediate Children</th>
<th style={{ width: 115 }}>Status</th>
<th style={{ width: 115 }}>Total number of children</th>
<th style={{ flex: 1 }}>Immediate children</th>
</tr>
</thead>
<tbody>
Expand All @@ -235,7 +240,8 @@ function Table({ details }) {
function Row({ children }) {
const [collapsed, setState] = useState(true);
const { feedstock, name, status } = children;
const immediate = feedstock["immediate_children"] || [];
const immediate_children = feedstock["immediate_children"] || [];
const total_children = feedstock["num_descendants"];
const href = feedstock["pr_url"];
const details = feedstock["pre_pr_migrator_status"];
return (<>
Expand All @@ -252,13 +258,14 @@ function Row({ children }) {
<span>{name}</span>)
)}
</td>
<td>{TITLES[status]}</td>
<td style={{ textAlign: "center" }}>{TITLES[status]}</td>
<td style={{ textAlign: "center" }}>{total_children || null}</td>
<td>
{immediate.map((name, index) => (<React.Fragment key={index}>
{immediate_children.map((name, index) => (<React.Fragment key={index}>
<span
style={{ marginBottom: 1 }}
className="badge badge--secondary">{name}</span>
{immediate.length - 1 === index ? "" : " "}
{immediate_children.length - 1 === index ? "" : " "}
</React.Fragment>))}
</td>
</tr>
Expand Down