aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2023-07-25 09:20:59 -0500
committerJP Dillingham <jp@dillingham.me>2023-07-25 09:20:59 -0500
commit863209c67d6fe3cce2ae8a6b0346ec4dbda286da (patch)
treee81e57d1d6695ec9596ee58b355c617d2722b49e /src
parent05742b5637e65c89d58daebbe01a52edc924774e (diff)
downloadslskd-863209c67d6fe3cce2ae8a6b0346ec4dbda286da.tar.gz
respect remote file management option in UI
Diffstat (limited to 'src')
-rw-r--r--src/web/src/components/System/Files/Explorer.js45
-rw-r--r--src/web/src/components/System/Files/index.js8
-rw-r--r--src/web/src/components/System/System.js2
3 files changed, 29 insertions, 26 deletions
diff --git a/src/web/src/components/System/Files/Explorer.js b/src/web/src/components/System/Files/Explorer.js
index 093192bf..77b2f958 100644
--- a/src/web/src/components/System/Files/Explorer.js
+++ b/src/web/src/components/System/Files/Explorer.js
@@ -11,7 +11,7 @@ import { list, deleteDirectory, deleteFile } from '../../../lib/files';
import { formatBytes, formatDate } from '../../../lib/util';
import { LoaderSegment } from '../../Shared';
-const Explorer = ({ root }) => {
+const Explorer = ({ root, remoteFileManagement }) => {
const [directory, setDirectory] = useState({ files: [], directories: [] });
const [subdirectory, setSubdirectory] = useState([]);
const [loading, setLoading] = useState(false);
@@ -46,27 +46,28 @@ const Explorer = ({ root }) => {
<Table.Cell>{modifiedAt ? formatDate(modifiedAt) : ''}</Table.Cell>
<Table.Cell>{length ? formatBytes(length) : ''}</Table.Cell>
<Table.Cell>
- <Modal
- trigger={
- <Icon name="trash alternate" color="red" style={{ cursor: 'pointer' }}/>
- }
- centered
- size='small'
- header={<Header icon='trash alternate' content='Confirm File Delete' />}
- content={`Are you sure you want to delete file '${fullName}'?`}
- actions={[
- 'Cancel',
- {
- key: 'done',
- content: 'Delete',
- negative: true,
- onClick: async () => {
- await deleteFile({ root, path: `${subdirectory.join('/')}/${fullName}`});
- fetch();
+ {remoteFileManagement
+ ? <Modal
+ trigger={
+ <Icon name="trash alternate" color="red" style={{ cursor: 'pointer' }}/>
+ }
+ centered
+ size='small'
+ header={<Header icon='trash alternate' content='Confirm File Delete' />}
+ content={`Are you sure you want to delete file '${fullName}'?`}
+ actions={[
+ 'Cancel',
+ {
+ key: 'done',
+ content: 'Delete',
+ negative: true,
+ onClick: async () => {
+ await deleteFile({ root, path: `${subdirectory.join('/')}/${fullName}`});
+ fetch();
+ },
},
- },
- ]}
- />
+ ]}/>
+ : <></>}
</Table.Cell>
</Table.Row>;
@@ -84,7 +85,7 @@ const Explorer = ({ root }) => {
<Table.Cell>{modifiedAt ? formatDate(modifiedAt) : ''}</Table.Cell>
<Table.Cell></Table.Cell>
<Table.Cell>
- {deletable
+ {remoteFileManagement && deletable
? <Modal
trigger={
<Icon name="trash alternate" color="red" style={{ cursor: 'pointer' }}/>
diff --git a/src/web/src/components/System/Files/index.js b/src/web/src/components/System/Files/index.js
index cf3dc869..a7a90aba 100644
--- a/src/web/src/components/System/Files/index.js
+++ b/src/web/src/components/System/Files/index.js
@@ -4,17 +4,19 @@ import { Tab } from 'semantic-ui-react';
import './Files.css';
import Explorer from './Explorer';
-const Files = () => {
+const Files = ({ options } = {}) => {
+ const { remoteFileManagement } = options;
+
const panes = [
{
route: 'downloads',
menuItem: 'Downloads',
- render: () => <Tab.Pane><Explorer root={'downloads'}/></Tab.Pane>,
+ render: () => <Tab.Pane><Explorer root={'downloads'} remoteFileManagement={remoteFileManagement}/></Tab.Pane>,
},
{
route: 'incomplete',
menuItem: 'Incomplete',
- render: () => <Tab.Pane><Explorer root={'incomplete'}/></Tab.Pane>,
+ render: () => <Tab.Pane><Explorer root={'incomplete'} remoteFileManagement={remoteFileManagement}/></Tab.Pane>,
},
];
diff --git a/src/web/src/components/System/System.js b/src/web/src/components/System/System.js
index 3629082e..2baba767 100644
--- a/src/web/src/components/System/System.js
+++ b/src/web/src/components/System/System.js
@@ -59,7 +59,7 @@ const System = ({ state = {}, theme, options = {} }) => {
icon: 'folder open',
content: 'Files',
},
- render: () => <Tab.Pane className='full-height'><Files theme={theme}/></Tab.Pane>,
+ render: () => <Tab.Pane className='full-height'><Files options={options} theme={theme}/></Tab.Pane>,
},
{
route: 'data',