Skip to content

Commit

Permalink
Merge pull request #2390 from jaimergp/avoid-crash-on-status-missing
Browse files Browse the repository at this point in the history
Status page: do not error if migration details can't be fetched; show zeros instead
  • Loading branch information
beckermr authored Nov 28, 2024
2 parents a9614c2 + daf5366 commit f0079d7
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions src/components/StatusDashboard/current_migrations.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,18 @@ function TableContent({ collapsed, name, resort, rows, select, sort, fetched })
return (
<tr key={row.name}>
<td>
<Link href={href}
style={{ display: "block" }}
onClick={event => {
event.preventDefault();
setState(href);
}}>{row.name}</Link>
{row.success ?
<Link href={href}
style={{ display: "block" }}
onClick={event => {
event.preventDefault();
setState(href);
}}>{row.name}</Link>
: <>
<span title="Failed to load. Refresh the page to try again." style={{cursor: "pointer"}}>⚠️</span>
{" "}{row.name}
</>
}
</td>
<td>
<label className={styles.progress_bar}>
Expand Down Expand Up @@ -277,15 +283,27 @@ function fetchContent(onLoad, setState) {
for (const { name } of fetched[status]) {
promises.push(
(async (index) => {
let details, success;
try {
const url = urls.migrations.details.replace("<NAME>", name);
const response = await fetch(url);
const details = await response.json();
fetched[status][index].details = details;
fetched[status][index].progress = measureProgress(details);
details = await response.json();
success = true;
} catch (error) {
console.warn(`error loading migration: ${name}`, error);
details = {
"done": [],
"in-pr": [],
"awaiting-pr": [],
"awaiting-parents": [],
"not-solvable": [],
"bot-error": [],
}
success = false;
}
fetched[status][index].details = details;
fetched[status][index].progress = measureProgress(details);
fetched[status][index].success = success;
})(count++)
);
}
Expand Down

0 comments on commit f0079d7

Please sign in to comment.