mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-29 03:16:22 -05:00
Converting download rows to use Loader when pending.
This commit is contained in:
parent
d575b087b3
commit
7a1f6a9b1f
2 changed files with 12 additions and 14 deletions
|
|
@ -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>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue