Skip to content

Commit

Permalink
fix: display of no flagged pieces (#1511)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkmc authored Jun 9, 2023
1 parent a5d29f0 commit 4ee35f1
Showing 1 changed file with 49 additions and 53 deletions.
102 changes: 49 additions & 53 deletions react/src/LID.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,12 +238,6 @@ function FlaggedPieces({setSearchQuery}) {
const totalCount = data.piecesFlagged.totalCount
const moreRows = data.piecesFlagged.more

if (!totalCount) {
return <div className="flagged-pieces-none">
Boost doctor did not find any pieces with errors
</div>
}

var cursor = params.cursor
if (pageNum === 1 && rows.length) {
cursor = rows[0].CreatedAt.getTime()
Expand All @@ -265,25 +259,33 @@ function FlaggedPieces({setSearchQuery}) {
Flagged pieces ({totalCount})
</h3>

<table>
<tbody>
<tr>
<th>Piece CID</th>
<th>Index</th>
<th>Deals</th>
</tr>
{ totalCount ? (
<>
<table>
<tbody>
<tr>
<th>Piece CID</th>
<th>Index</th>
<th>Deals</th>
</tr>

{rows.map(piece => (
<FlaggedPieceRow
key={piece.Piece.PieceCid}
piece={piece.Piece}
setSearchQuery={setSearchQuery}
/>
))}
</tbody>
</table>
{rows.map(piece => (
<FlaggedPieceRow
key={piece.Piece.PieceCid}
piece={piece.Piece}
setSearchQuery={setSearchQuery}
/>
))}
</tbody>
</table>

<Pagination {...paginationParams} />
<Pagination {...paginationParams} />
</>
) : (
<div className="flagged-pieces-none">
Boost doctor did not find any pieces with errors
</div>
)}
</div>
}

Expand All @@ -301,10 +303,6 @@ function NoUnsealedSectorLink() {
return <div>&nbsp;</div>
}

if (!data.piecesFlaggedCount) {
return null
}

return <div>
<Link className="nav-link" to="/no-unsealed">See {data.piecesFlaggedCount} pieces with no unsealed copy ➜</Link>
</div>
Expand Down Expand Up @@ -373,12 +371,6 @@ function NoUnsealedSectorPieces() {
const totalCount = data.piecesFlagged.totalCount
const moreRows = data.piecesFlagged.more

if (!totalCount) {
return <div className="flagged-pieces-none">
Boost doctor did not find any pieces that were flagged because there is no unsealed copy of the sector
</div>
}

var cursor = params.cursor
if (pageNum === 1 && rows.length) {
cursor = rows[0].CreatedAt.getTime()
Expand All @@ -400,24 +392,32 @@ function NoUnsealedSectorPieces() {
Pieces with no unsealed sector ({totalCount})
</h3>

<table>
<tbody>
<tr>
<th>Piece CID</th>
<th>Index</th>
<th>Deals</th>
</tr>
{ totalCount ? (
<>
<table>
<tbody>
<tr>
<th>Piece CID</th>
<th>Index</th>
<th>Deals</th>
</tr>

{rows.map(piece => (
<FlaggedPieceRow
key={piece.Piece.PieceCid}
piece={piece.Piece}
/>
))}
</tbody>
</table>
{rows.map(piece => (
<FlaggedPieceRow
key={piece.Piece.PieceCid}
piece={piece.Piece}
/>
))}
</tbody>
</table>

<Pagination {...paginationParams} />
<Pagination {...paginationParams} />
</>
) : (
<div className="flagged-pieces-none">
Boost doctor did not find any pieces with no unsealed sector
</div>
)}
</div>
}

Expand All @@ -435,10 +435,6 @@ function FlaggedPiecesLink() {
return <div>&nbsp;</div>
}

if (!data.piecesFlaggedCount) {
return null
}

return <div>
<Link className="nav-link" to="/piece-doctor">See {data.piecesFlaggedCount} flagged pieces ➜</Link>
</div>
Expand Down

0 comments on commit 4ee35f1

Please sign in to comment.