diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/web/src/components/System/Data/index.js | 45 | ||||
| -rw-r--r-- | src/web/src/components/System/System.css | 4 |
2 files changed, 49 insertions, 0 deletions
diff --git a/src/web/src/components/System/Data/index.js b/src/web/src/components/System/Data/index.js new file mode 100644 index 00000000..a0642c59 --- /dev/null +++ b/src/web/src/components/System/Data/index.js @@ -0,0 +1,45 @@ +import React, { useState } from 'react'; +import { Button, Divider, Header, Icon } from 'semantic-ui-react'; +import { toast } from 'react-toastify'; + +import { clearCompleted } from '../../../lib/transfers'; + +const Data = () => { + const [up, setUp] = useState(false); + const [down, setDown] = useState(false); + + const clear = async ({ direction, setState }) => { + setState(true); + await clearCompleted({ direction }); + setState(false); + toast.success(`Completed ${direction}s cleared!`); + }; + + return ( + <div> + <Header as='h3' className='transfer-header'>Transfer Data</Header> + <Divider/> + <p> + The Uploads and Downloads pages can become unresponsive if too many transfers are displayed. If you're having trouble with either page, try using the buttons below to remove completed transfers. + </p> + <Button + primary + loading={up} + onClick={() => clear({ direction: 'upload', setState: setUp })} + > + <Icon name='trash alternate'/> + Clear All Completed Uploads + </Button> + <Button + primary + loading={down} + onClick={() => clear({ direction: 'download', setState: setDown })} + > + <Icon name='trash alternate'/> + Clear All Completed Downloads + </Button> + </div> + ); +}; + +export default Data;
\ No newline at end of file diff --git a/src/web/src/components/System/System.css b/src/web/src/components/System/System.css index a463ab08..dc32d583 100644 --- a/src/web/src/components/System/System.css +++ b/src/web/src/components/System/System.css @@ -67,4 +67,8 @@ .share-scan-detail { margin-top: 10px; font-size: 14px; +} + +.transfer-header { + margin-bottom: -15px !important; }
\ No newline at end of file |
