aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-05-26 19:08:38 -0500
committerJP Dillingham <jp@dillingham.me>2022-05-26 19:08:38 -0500
commit492cfe9ad1fcaf2c7d11ca92089ca4e87b28bdc2 (patch)
tree476719ee597ce3fff46a76fc674e6f88c165087a
parentc16695fc69577b95592079c59cce4afec4ea80aa (diff)
downloadslskd-492cfe9ad1fcaf2c7d11ca92089ca4e87b28bdc2.tar.gz
wip
-rw-r--r--src/web/src/components/System/Shares/Share.js4
-rw-r--r--src/web/src/components/System/Shares/index.js44
-rw-r--r--src/web/src/components/System/System.js2
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',