aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2022-05-27 13:12:06 -0500
committerJP Dillingham <jp@dillingham.me>2022-05-27 13:12:06 -0500
commit1152df08d7c7d7f3a6787f26a6946d3f6f07ea43 (patch)
tree761615e938747cc22a617dd2db58efb9245f3011 /src
parent7fdcc7c2cafd81db446c2ea96b3d620a7a0adf0f (diff)
downloadslskd-1152df08d7c7d7f3a6787f26a6946d3f6f07ea43.tar.gz
tidy up
Diffstat (limited to 'src')
-rw-r--r--src/web/src/components/System/Shares/ExclusionTable.js29
-rw-r--r--src/web/src/components/System/Shares/Share.js25
-rw-r--r--src/web/src/components/System/Shares/ShareTable.js38
-rw-r--r--src/web/src/components/System/Shares/index.js46
-rw-r--r--src/web/src/components/System/System.css4
5 files changed, 76 insertions, 66 deletions
diff --git a/src/web/src/components/System/Shares/ExclusionTable.js b/src/web/src/components/System/Shares/ExclusionTable.js
new file mode 100644
index 00000000..90ee2eff
--- /dev/null
+++ b/src/web/src/components/System/Shares/ExclusionTable.js
@@ -0,0 +1,29 @@
+import React from 'react';
+
+import {
+ Table,
+ Icon,
+} from 'semantic-ui-react';
+
+const ExclusionTable = ({ exclusions = [] } = {}) => {
+ if (exclusions.length === 0) {
+ return <></>;
+ }
+
+ return (
+ <Table>
+ <Table.Header>
+ <Table.Row>
+ <Table.HeaderCell>Excluded Paths</Table.HeaderCell>
+ </Table.Row>
+ </Table.Header>
+ <Table.Body>
+ {exclusions.map((share, index) => (<Table.Row key={index}>
+ <Table.Cell><Icon name='x' color='red'/>{share.localPath}</Table.Cell>
+ </Table.Row>))}
+ </Table.Body>
+ </Table>
+ );
+};
+
+export default ExclusionTable; \ No newline at end of file
diff --git a/src/web/src/components/System/Shares/Share.js b/src/web/src/components/System/Shares/Share.js
deleted file mode 100644
index 61080453..00000000
--- a/src/web/src/components/System/Shares/Share.js
+++ /dev/null
@@ -1,25 +0,0 @@
-import React from 'react';
-
-import {
- Item,
-} from 'semantic-ui-react';
-
-const Share = ({ share = {}, onBrowse } = {}) => {
- const { id, remotePath, localPath, mask, alias, isExcluded, directories, files } = share;
-
- return (
- <Item>
- <Item.Content>
- <Item.Header as='a' onClick={onBrowse}>{remotePath}</Item.Header>
- <Item.Meta>Description</Item.Meta>
- <Item.Description>
- <pre>
- {JSON.stringify({ id, localPath, mask, alias, isExcluded, directories, files }, null, 2)}
- </pre>
- </Item.Description>
- </Item.Content>
- </Item>
- );
-};
-
-export default Share; \ No newline at end of file
diff --git a/src/web/src/components/System/Shares/ShareTable.js b/src/web/src/components/System/Shares/ShareTable.js
new file mode 100644
index 00000000..ecd83e3f
--- /dev/null
+++ b/src/web/src/components/System/Shares/ShareTable.js
@@ -0,0 +1,38 @@
+import React from 'react';
+
+import {
+ Table,
+ Icon,
+} from 'semantic-ui-react';
+
+import { Link } from 'react-router-dom';
+
+const ShareTable = ({ shares, onClick }) => {
+ return (
+ <Table>
+ <Table.Header>
+ <Table.Row>
+ <Table.HeaderCell>Local Path</Table.HeaderCell>
+ <Table.HeaderCell className='share-count-column'>Directories</Table.HeaderCell>
+ <Table.HeaderCell className='share-count-column'>Files</Table.HeaderCell>
+ <Table.HeaderCell>Alias</Table.HeaderCell>
+ <Table.HeaderCell>Remote Path</Table.HeaderCell>
+ </Table.Row>
+ </Table.Header>
+ <Table.Body>
+ {shares.map((share, index) => (<Table.Row key={index}>
+ <Table.Cell onClick={() => onClick(share)}>
+ <Icon name='folder'/>
+ <Link to='#'>{share.localPath}</Link>
+ </Table.Cell>
+ <Table.Cell>{share.directories}</Table.Cell>
+ <Table.Cell>{share.files}</Table.Cell>
+ <Table.Cell>{share.alias}</Table.Cell>
+ <Table.Cell>{share.remotePath}</Table.Cell>
+ </Table.Row>))}
+ </Table.Body>
+ </Table>
+ );
+};
+
+export default ShareTable; \ No newline at end of file
diff --git a/src/web/src/components/System/Shares/index.js b/src/web/src/components/System/Shares/index.js
index 8da95034..5fe59cb2 100644
--- a/src/web/src/components/System/Shares/index.js
+++ b/src/web/src/components/System/Shares/index.js
@@ -6,17 +6,16 @@ import {
LoaderSegment,
ShrinkableButton,
Switch,
- Div,
} from '../../Shared';
import ContentsModal from './ContentsModal';
import {
Divider,
- Table,
- Icon,
} from 'semantic-ui-react';
-import { Link } from 'react-router-dom';
+
+import ExclusionTable from './ExclusionTable';
+import ShareTable from './ShareTable';
const Index = ({ state = {} } = {}) => {
const [loading, setLoading] = useState(true);
@@ -66,43 +65,8 @@ const Index = ({ state = {} } = {}) => {
<Switch
filling={(loading || filling) && <LoaderSegment caption={fillProgress}/>}
>
- <Table size='large'>
- <Table.Header>
- <Table.Row>
- <Table.HeaderCell>Local Path</Table.HeaderCell>
- <Table.HeaderCell style={{width: 110}}>Directories</Table.HeaderCell>
- <Table.HeaderCell style={{width: 110}}>Files</Table.HeaderCell>
- <Table.HeaderCell>Alias</Table.HeaderCell>
- <Table.HeaderCell>Remote Path</Table.HeaderCell>
- </Table.Row>
- </Table.Header>
- <Table.Body>
- {shared.map((share, index) => (<Table.Row key={index}>
- <Table.Cell onClick={() => setModal(share)}>
- <Icon name='folder'/>
- <Link to='#'>{share.localPath}</Link>
- </Table.Cell>
- <Table.Cell>{share.directories}</Table.Cell>
- <Table.Cell>{share.files}</Table.Cell>
- <Table.Cell>{share.alias}</Table.Cell>
- <Table.Cell>{share.remotePath}</Table.Cell>
- </Table.Row>))}
- </Table.Body>
- </Table>
- <Div hidden={!excluded || excluded.length === 0}>
- <Table size='large'>
- <Table.Header>
- <Table.Row>
- <Table.HeaderCell>Excluded Paths</Table.HeaderCell>
- </Table.Row>
- </Table.Header>
- <Table.Body>
- {excluded.map((share, index) => (<Table.Row key={index}>
- <Table.Cell><Icon name='x' color='red'/>{share.localPath}</Table.Cell>
- </Table.Row>))}
- </Table.Body>
- </Table>
- </Div>
+ <ShareTable shares={shared} onClick={setModal}/>
+ <ExclusionTable exclusions={excluded}/>
</Switch>
<ContentsModal share={modal} onClose={() => setModal(false)}/>
</>
diff --git a/src/web/src/components/System/System.css b/src/web/src/components/System/System.css
index e29487f1..a8e9cb8e 100644
--- a/src/web/src/components/System/System.css
+++ b/src/web/src/components/System/System.css
@@ -58,4 +58,8 @@
.edit-code-container, .edit-code-container-error {
overflow: auto;
+}
+
+.share-count-column {
+ width: 110px;
} \ No newline at end of file