From 863209c67d6fe3cce2ae8a6b0346ec4dbda286da Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Tue, 25 Jul 2023 09:20:59 -0500 Subject: respect remote file management option in UI --- src/web/src/components/System/Files/Explorer.js | 45 +++++++++++++------------ src/web/src/components/System/Files/index.js | 8 +++-- src/web/src/components/System/System.js | 2 +- 3 files changed, 29 insertions(+), 26 deletions(-) (limited to 'src/web') 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 }) => { {modifiedAt ? formatDate(modifiedAt) : ''} {length ? formatBytes(length) : ''} - - } - centered - size='small' - header={
} - 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 + ? + } + centered + size='small' + header={
} + 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(); + }, }, - }, - ]} - /> + ]}/> + : <>} ; @@ -84,7 +85,7 @@ const Explorer = ({ root }) => { {modifiedAt ? formatDate(modifiedAt) : ''} - {deletable + {remoteFileManagement && deletable ? 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: () => , + render: () => , }, { route: 'incomplete', menuItem: 'Incomplete', - render: () => , + render: () => , }, ]; 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: () => , + render: () => , }, { route: 'data', -- cgit v1.2.3