aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-10-18 09:22:05 -0500
committerJP Dillingham <jp@dillingham.me>2022-10-18 09:22:05 -0500
commit5951ce9feee7cb22cebcca79e829fc32fb29d6c9 (patch)
tree8e27f4de49427dfaec349e089f0fedf925d983f1
parent566efcee1ace6a962805c6da83547cff16b4760a (diff)
downloadslskd-5951ce9feee7cb22cebcca79e829fc32fb29d6c9.tar.gz
add data page
-rw-r--r--src/web/src/components/System/Data/index.js45
-rw-r--r--src/web/src/components/System/System.css4
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