Radarr/frontend/src/System/Tasks/Queued/QueuedTasks.js

91 lines
1.8 KiB
JavaScript
Raw Normal View History

2018-11-23 07:04:42 +00:00
import PropTypes from 'prop-types';
import React from 'react';
import FieldSet from 'Components/FieldSet';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import Table from 'Components/Table/Table';
import TableBody from 'Components/Table/TableBody';
import translate from 'Utilities/String/translate';
import QueuedTaskRowConnector from './QueuedTaskRowConnector';
2018-11-23 07:04:42 +00:00
const columns = [
{
name: 'trigger',
label: () => translate('Trigger'),
2018-11-23 07:04:42 +00:00
isVisible: true
},
{
name: 'commandName',
label: () => translate('Name'),
2018-11-23 07:04:42 +00:00
isVisible: true
},
{
name: 'queued',
label: () => translate('Queued'),
2018-11-23 07:04:42 +00:00
isVisible: true
},
{
name: 'started',
label: () => translate('Started'),
2018-11-23 07:04:42 +00:00
isVisible: true
},
{
name: 'ended',
label: () => translate('Ended'),
2018-11-23 07:04:42 +00:00
isVisible: true
},
{
name: 'duration',
label: () => translate('Duration'),
2018-11-23 07:04:42 +00:00
isVisible: true
},
{
name: 'actions',
isVisible: true
}
];
function QueuedTasks(props) {
const {
isFetching,
isPopulated,
items
} = props;
return (
<FieldSet legend={translate('Queue')}>
2018-11-23 07:04:42 +00:00
{
isFetching && !isPopulated &&
<LoadingIndicator />
2018-11-23 07:04:42 +00:00
}
{
isPopulated &&
<Table
columns={columns}
>
<TableBody>
{
items.map((item) => {
return (
<QueuedTaskRowConnector
key={item.id}
{...item}
/>
);
})
}
</TableBody>
</Table>
2018-11-23 07:04:42 +00:00
}
</FieldSet>
);
}
QueuedTasks.propTypes = {
isFetching: PropTypes.bool.isRequired,
isPopulated: PropTypes.bool.isRequired,
items: PropTypes.array.isRequired
};
export default QueuedTasks;