aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-05-20 16:35:25 -0500
committerJP Dillingham <jp@dillingham.me>2022-05-20 16:35:25 -0500
commit3403ed4ab1624cefb2217ad1c03e4a90ff70c3f5 (patch)
treed0f5f012f11ff166eee0b474fe332135ec0a99b2 /src
parent28fc4f8f91e69cf3f8245f2b5d7368cf11b538b2 (diff)
downloadslskd-3403ed4ab1624cefb2217ad1c03e4a90ff70c3f5.tar.gz
stub TransfersHeader
Diffstat (limited to 'src')
-rw-r--r--src/web/src/components/Transfers/Transfers.js18
-rw-r--r--src/web/src/components/Transfers/TransfersHeader.js76
2 files changed, 87 insertions, 7 deletions
diff --git a/src/web/src/components/Transfers/Transfers.js b/src/web/src/components/Transfers/Transfers.js
index 3d65ca69..96ac0e1f 100644
--- a/src/web/src/components/Transfers/Transfers.js
+++ b/src/web/src/components/Transfers/Transfers.js
@@ -3,6 +3,9 @@ import * as transfers from '../../lib/transfers';
import PlaceholderSegment from '../Shared/PlaceholderSegment';
import TransferGroup from './TransferGroup';
+import TransfersHeader from './TransfersHeader';
+
+import './Transfers.css';
class Transfers extends Component {
state = { fetchState: '', downloads: [], interval: undefined }
@@ -35,13 +38,14 @@ class Transfers extends Component {
const { direction } = this.props;
return (
- downloads.length === 0 ?
- <PlaceholderSegment icon={direction}/> :
- <div className='transfer-segment'>
- {downloads.map((user, index) =>
- <TransferGroup key={index} direction={this.props.direction} user={user}/>
- )}
- </div>
+ <>
+ <TransfersHeader/>
+ {downloads.length === 0 ?
+ <PlaceholderSegment icon={direction}/> :
+ downloads.map((user, index) =>
+ <TransferGroup key={index} direction={this.props.direction} user={user}/>
+ )}
+ </>
);
}
}
diff --git a/src/web/src/components/Transfers/TransfersHeader.js b/src/web/src/components/Transfers/TransfersHeader.js
new file mode 100644
index 00000000..f9151e5d
--- /dev/null
+++ b/src/web/src/components/Transfers/TransfersHeader.js
@@ -0,0 +1,76 @@
+import React, { useState } from 'react';
+
+import {
+ Segment,
+ Button,
+ Dropdown,
+} from 'semantic-ui-react';
+
+const TransfersHeader = ({ onRetryAll, onCancelAll, onRemoveAll }) => {
+ const [removeOption, setRemoveOption] = useState('Succeeded');
+ const [cancelOption, setCancelOption] = useState('All');
+ const [retryOption, setRetryOption] = useState('Errored');
+
+ return (
+ <>
+ <Segment className='transfers-header-segment' raised>
+ <Button.Group color='green'>
+ <Button
+ icon='redo'
+ onClick={onRetryAll}
+ content={`Retry ${retryOption === 'All' ? retryOption : `All ${retryOption}`}`}
+ />
+ <Dropdown
+ className='button icon'
+ options={[
+ { key: 'errored', text: 'Errored', value: 'Errored' },
+ { key: 'cancelled', text: 'Cancelled', value: 'Cancelled' },
+ { key: 'all', text: 'All', value: 'All' },
+ ]}
+ onChange={(_, data) => setRetryOption(data.value)}
+ trigger={<></>}
+ />
+ </Button.Group>
+ {' '}
+ <Button.Group color='red'>
+ <Button
+ icon='x'
+ onClick={onCancelAll}
+ content={`Cancel ${cancelOption === 'All' ? cancelOption : `All ${cancelOption}`}`}
+ />
+ <Dropdown
+ className='button icon'
+ options={[
+ { key: 'all', text: 'All', value: 'All' },
+ { key: 'queued', text: 'Queued', value: 'Queued' },
+ { key: 'inProgress', text: 'In Progress', value: 'In Progress' },
+ ]}
+ onChange={(_, data) => setCancelOption(data.value)}
+ trigger={<></>}
+ />
+ </Button.Group>
+ {' '}
+ <Button.Group>
+ <Button
+ icon='trash alternate'
+ onClick={onRemoveAll}
+ content={`Remove All ${removeOption}`}
+ />
+ <Dropdown
+ className='button icon'
+ options={[
+ { key: 'succeeded', text: 'Succeeded', value: 'Succeeded' },
+ { key: 'errored', text: 'Errored', value: 'Errored' },
+ { key: 'cancelled', text: 'Cancelled', value: 'Cancelled' },
+ { key: 'completed', text: 'Completed', value: 'Completed' },
+ ]}
+ onChange={(_, data) => setRemoveOption(data.value)}
+ trigger={<></>}
+ />
+ </Button.Group>
+ </Segment>
+ </>
+ )
+};
+
+export default TransfersHeader; \ No newline at end of file