ui(admin): too many changes, not enough commits
This commit is contained in:
parent
bca2338863
commit
8aa9641ec2
44 changed files with 1955 additions and 334 deletions
|
@ -31,7 +31,7 @@ const ChmodFileModal = ({ files, ...props }: OwnProps) => {
|
|||
const submit = ({ mode }: FormikValues, { setSubmitting }: FormikHelpers<FormikValues>) => {
|
||||
clearFlashes('files');
|
||||
|
||||
mutate(data => data.map(f => f.name === files[0].file ? { ...f, mode: fileBitsToString(mode, !f.isFile), modeBits: mode } : f), false);
|
||||
mutate(data => data!.map(f => f.name === files[0].file ? { ...f, mode: fileBitsToString(mode, !f.isFile), modeBits: mode } : f), false);
|
||||
|
||||
const data = files.map(f => ({ file: f.file, mode: mode }));
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ const FileDropdownMenu = ({ file }: { file: FileObject }) => {
|
|||
|
||||
// For UI speed, immediately remove the file from the listing before calling the deletion function.
|
||||
// If the delete actually fails, we'll fetch the current directory contents again automatically.
|
||||
mutate(files => files.filter(f => f.key !== file.key), false);
|
||||
mutate(files => files!.filter(f => f.key !== file.key), false);
|
||||
|
||||
deleteFiles(uuid, directory, [ file.name ]).catch(error => {
|
||||
mutate();
|
||||
|
|
|
@ -51,7 +51,7 @@ const MassActionsBar = () => {
|
|||
|
||||
deleteFiles(uuid, directory, selectedFiles)
|
||||
.then(() => {
|
||||
mutate(files => files.filter(f => selectedFiles.indexOf(f.name) < 0), false);
|
||||
mutate(files => files!.filter(f => selectedFiles.indexOf(f.name) < 0), false);
|
||||
setSelectedFiles([]);
|
||||
})
|
||||
.catch(error => {
|
||||
|
|
|
@ -55,7 +55,7 @@ export default ({ className }: WithClassname) => {
|
|||
|
||||
const submit = ({ directoryName }: Values, { setSubmitting }: FormikHelpers<Values>) => {
|
||||
createDirectory(uuid, directory, directoryName)
|
||||
.then(() => mutate(data => [ ...data, generateDirectoryData(directoryName) ], false))
|
||||
.then(() => mutate(data => [ ...data!, generateDirectoryData(directoryName) ], false))
|
||||
.then(() => setVisible(false))
|
||||
.catch(error => {
|
||||
console.error(error);
|
||||
|
|
|
@ -30,10 +30,10 @@ const RenameFileModal = ({ files, useMoveTerminology, ...props }: OwnProps) => {
|
|||
if (files.length === 1) {
|
||||
if (!useMoveTerminology && len === 1) {
|
||||
// Rename the file within this directory.
|
||||
mutate(data => data.map(f => f.name === files[0] ? { ...f, name } : f), false);
|
||||
mutate(data => data!.map(f => f.name === files[0] ? { ...f, name } : f), false);
|
||||
} else if ((useMoveTerminology || len > 1)) {
|
||||
// Remove the file from this directory since they moved it elsewhere.
|
||||
mutate(data => data.filter(f => f.name !== files[0]), false);
|
||||
mutate(data => data!.filter(f => f.name !== files[0]), false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue