diff options
| -rw-r--r-- | src/web/src/components/System/Shares/Share.js | 4 | ||||
| -rw-r--r-- | src/web/src/components/System/Shares/index.js | 44 | ||||
| -rw-r--r-- | src/web/src/components/System/System.js | 2 |
3 files changed, 36 insertions, 14 deletions
diff --git a/src/web/src/components/System/Shares/Share.js b/src/web/src/components/System/Shares/Share.js index eadcd07b..61080453 100644 --- a/src/web/src/components/System/Shares/Share.js +++ b/src/web/src/components/System/Shares/Share.js @@ -5,7 +5,7 @@ import { } from 'semantic-ui-react'; const Share = ({ share = {}, onBrowse } = {}) => { - const { id, remotePath, localPath, mask, alias, isExcluded } = share; + const { id, remotePath, localPath, mask, alias, isExcluded, directories, files } = share; return ( <Item> @@ -14,7 +14,7 @@ const Share = ({ share = {}, onBrowse } = {}) => { <Item.Meta>Description</Item.Meta> <Item.Description> <pre> - {JSON.stringify({ id, localPath, mask, alias, isExcluded }, null, 2)} + {JSON.stringify({ id, localPath, mask, alias, isExcluded, directories, files }, null, 2)} </pre> </Item.Description> </Item.Content> diff --git a/src/web/src/components/System/Shares/index.js b/src/web/src/components/System/Shares/index.js index 5f3ae971..aa8db54a 100644 --- a/src/web/src/components/System/Shares/index.js +++ b/src/web/src/components/System/Shares/index.js @@ -2,15 +2,16 @@ import React, { useState, useEffect } from 'react'; import { toast } from 'react-toastify'; import * as sharesLib from '../../../lib/shares'; -import { LoaderSegment } from '../../Shared'; +import { LoaderSegment, PlaceholderSegment, ShrinkableButton, Switch } from '../../Shared'; import Share from './Share'; import { Modal, Button, + Divider, } from 'semantic-ui-react'; -const Index = () => { +const Index = ({ state }) => { const [loading, setLoading] = useState(true); const [shares, setShares] = useState([]); const [everything, setEverything] = useState(); @@ -38,22 +39,43 @@ const Index = () => { setModal(true); }; + const rescan = async () => { + await sharesLib.rescan(); + }; + if (loading) { return LoaderSegment; } + const { filling, filled, faulted, fillProgress, directories, files, excludedDirectories } = state; + return ( <> - <div className='view-code-container'> - <ol> - {shares.map(share => ( - <Share share={share} onBrowse={() => browse({ id: share.id })}/> - ))} - </ol> - <pre> - {JSON.stringify(everything, null, 2)} - </pre> + <div className="header-buttons"> + <ShrinkableButton + primary + icon='refresh' + loading={filling} + disabled={filling} + mediaQuery={'(max-width: 516px)'} + onClick={rescan} + >{filling ? 'Scanning shares' : 'Rescan Shares'}</ShrinkableButton> </div> + <Divider/> + <Switch + filling={filling && <PlaceholderSegment loading caption={fillProgress}/>} + > + <div className='view-code-container'> + <ol> + {shares.map(share => ( + <Share share={share} onBrowse={() => browse({ id: share.id })}/> + ))} + </ol> + <pre> + {JSON.stringify(state, null, 2)} + </pre> + </div> + </Switch> <Modal size='large' open={modal} diff --git a/src/web/src/components/System/System.js b/src/web/src/components/System/System.js index 73904006..6c0229cf 100644 --- a/src/web/src/components/System/System.js +++ b/src/web/src/components/System/System.js @@ -40,7 +40,7 @@ const System = ({ state = {}, options = {} }) => { icon: 'share external', content: 'Shares', }, - render: () => <Tab.Pane><Shares/></Tab.Pane>, + render: () => <Tab.Pane><Shares state={state.sharedFileCache}/></Tab.Pane>, }, { route: 'logs', |
