diff options
Diffstat (limited to 'src/web')
| -rw-r--r-- | src/web/src/components/System/Shares/ShareTable.js | 2 | ||||
| -rw-r--r-- | src/web/src/components/System/Shares/index.js | 9 |
2 files changed, 10 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..0d93a6a3 100644 --- a/src/web/src/components/System/Shares/index.js +++ b/src/web/src/components/System/Shares/index.js @@ -1,5 +1,6 @@ import React, { useState, useEffect } from 'react'; import { toast } from 'react-toastify'; +import { flatten } from 'lodash'; import * as sharesLib from '../../../lib/shares'; import { @@ -39,7 +40,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); |
