aboutsummaryrefslogtreecommitdiffstats
path: root/src/web
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-11-04 10:51:17 -0500
committerGitHub <noreply@github.com>2022-11-04 10:51:17 -0500
commite31e9e5b0967d777fccb76a4c6113052a05b49fd (patch)
tree13408700fcbdc7ac681a6c51b7d4f2aac34cf5b5 /src/web
parent3b75717ab4562a516769bc731ac978db59297a08 (diff)
parent964d50bc5156069b4404f29f823a4a21bd15ffe5 (diff)
downloadslskd-e31e9e5b0967d777fccb76a4c6113052a05b49fd.tar.gz
Merge pull request #730 from slskd/shares
Improve computation of share statistics, fix a few bugs with network functionality
Diffstat (limited to 'src/web')
-rw-r--r--src/web/src/components/System/Shares/ShareTable.js2
-rw-r--r--src/web/src/components/System/Shares/index.js8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/web/src/components/System/Shares/ShareTable.js b/src/web/src/components/System/Shares/ShareTable.js
index d264fc8f..095a8380 100644
--- a/src/web/src/components/System/Shares/ShareTable.js
+++ b/src/web/src/components/System/Shares/ShareTable.js
@@ -13,6 +13,7 @@ const ShareTable = ({ shares, onClick }) => {
<Table>
<Table.Header>
<Table.Row>
+ <Table.HeaderCell>Host</Table.HeaderCell>
<Table.HeaderCell>Local Path</Table.HeaderCell>
<Table.HeaderCell className='share-count-column'>Directories</Table.HeaderCell>
<Table.HeaderCell className='share-count-column'>Files</Table.HeaderCell>
@@ -29,6 +30,7 @@ const ShareTable = ({ shares, onClick }) => {
</Table.Row>}
>
{shares.map((share, index) => (<Table.Row key={index}>
+ <Table.Cell>{share.host}</Table.Cell>
<Table.Cell onClick={() => onClick(share)}>
<Icon name='folder'/>
<Link to='#'>{share.localPath}</Link>
diff --git a/src/web/src/components/System/Shares/index.js b/src/web/src/components/System/Shares/index.js
index 6759ad6f..f4f9ac94 100644
--- a/src/web/src/components/System/Shares/index.js
+++ b/src/web/src/components/System/Shares/index.js
@@ -39,7 +39,13 @@ const Index = ({ state = {} } = {}) => {
const getAll = async () => {
try {
setLoading(true);
- setShares(await sharesLib.getAll());
+
+ const sharesByHost = await sharesLib.getAll();
+ const flattened = Object.entries(sharesByHost).reduce((acc, [host, shares]) => {
+ return acc.concat(shares.map(share => ({ host, ...share })));
+ }, []);
+
+ setShares(flattened);
} catch (error) {
console.error(error);
toast.error(error?.response?.data ?? error?.message ?? error);