Converting download rows to use Loader when pending.

This commit is contained in:
Roland 2022-10-25 15:06:52 -06:00
parent d575b087b3
commit 7a1f6a9b1f
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
2 changed files with 12 additions and 14 deletions

View file

@ -1,4 +1,4 @@
import React, {useContext, useState} from "react";
import React, {useContext} from "react";
import {clearCompletedDownloads, clearFailedDownloads, killDownload, postDownload} from "../../api";
import {Link} from "react-router-dom";
import {
@ -11,6 +11,7 @@ import {
import {
Button as SemanticButton,
Confirm,
Loader,
Modal,
PlaceholderLine,
TableBody,
@ -19,7 +20,7 @@ import {
TableHeaderCell,
TableRow
} from "semantic-ui-react";
import {Button, Header, Icon, Placeholder, Table} from "../Theme";
import {Button, Header, Placeholder, Table} from "../Theme";
import {ThemeContext} from "../../contexts/contexts";
import {useDownloads} from "../../hooks/customHooks";
@ -181,11 +182,7 @@ class StoppableRow extends React.Component {
let completedAtCell = last_successful_download ? secondsToElapsedPopup(last_successful_download) : null;
let buttonCell = <TableCell/>;
let positive = false;
let negative = false;
let warning = false;
if (status === 'pending' || status === 'new') {
positive = status === 'pending';
buttonCell = (
<TableCell>
<Button
@ -202,8 +199,6 @@ class StoppableRow extends React.Component {
</TableCell>
);
} else if (status === 'failed' || status === 'deferred') {
negative = status === 'failed';
warning = status === 'deferred';
buttonCell = (
<TableCell>
<Button
@ -258,11 +253,14 @@ class StoppableRow extends React.Component {
}
return (
<TableRow positive={positive} negative={negative} warning={warning}>
<TableRow>
<TableCell>
{link(textEllipsis(url, 50))}
</TableCell>
<TableCell>{completedAtCell}</TableCell>
<TableCell>
{completedAtCell}
{status === 'pending' ? <Loader active inline size='tiny'/> : null}
</TableCell>
{buttonCell}
</TableRow>
);

View file

@ -58,7 +58,7 @@ function DiskBandwidth({name, bytes_read_ps, bytes_write_ps}) {
</Grid>
}
function CPUTemperatureStatistic({value, high_temperature, critical_temperature}) {
function CPUTemperatureStatistic({value, high_temperature, critical_temperature, ...props}) {
if (!value) {
return <Statistic label='Temp C°' value='?'/>
}
@ -66,7 +66,6 @@ function CPUTemperatureStatistic({value, high_temperature, critical_temperature}
// Critical and high are equal, manually change it so high changes color before critical.
high_temperature = critical_temperature - 25;
}
const props = {};
if ((critical_temperature && value >= critical_temperature) || (!critical_temperature && value >= 75)) {
props['color'] = 'red';
} else if ((high_temperature && value >= high_temperature) || (!high_temperature && value >= 55)) {
@ -209,10 +208,11 @@ export function Status() {
value={temperature}
high_temperature={high_temperature}
critical_temperature={critical_temperature}
style={{marginRight: 0}}
/>
<LoadStatistic label='1 Min. Load' value={minute_1} cores={cores}/>
<LoadStatistic label='5 Min. Load' value={minute_5} cores={cores}/>
<LoadStatistic label='15 Min. Load' value={minute_15} cores={cores}/>
<LoadStatistic label='5 Min.' value={minute_5} cores={cores}/>
<LoadStatistic label='15 Min.' value={minute_15} cores={cores}/>
</StatisticGroup>
<Header as='h2'>Network Bandwidth</Header>