cloud file, folder operations

This commit is contained in:
SPRINX0\prochazka
2025-05-28 10:46:35 +02:00
parent 741b942dea
commit 7b50a19b2c
9 changed files with 150 additions and 41 deletions

View File

@@ -206,7 +206,14 @@
showModal(ConfirmModal, {
message: `Really delete file ${data.file}?`,
onConfirm: () => {
apiCall('files/delete', data);
if (data.folid && data.cntid) {
apiCall('cloud/delete-content', {
folid: data.folid,
cntid: data.cntid,
});
} else {
apiCall('files/delete', data);
}
},
});
};
@@ -217,7 +224,15 @@
label: 'New file name',
header: 'Rename file',
onConfirm: newFile => {
apiCall('files/rename', { ...data, newFile });
if (data.folid && data.cntid) {
apiCall('cloud/rename-content', {
folid: data.folid,
cntid: data.cntid,
name: newFile,
});
} else {
apiCall('files/rename', { ...data, newFile });
}
},
});
};
@@ -226,9 +241,17 @@
showModal(InputTextModal, {
value: data.file,
label: 'New file name',
header: 'Rename file',
header: 'Copy file',
onConfirm: newFile => {
apiCall('files/copy', { ...data, newFile });
if (data.folid && data.cntid) {
apiCall('cloud/copy-file', {
folid: data.folid,
cntid: data.cntid,
name: newFile,
});
} else {
apiCall('files/copy', { ...data, newFile });
}
},
});
};
@@ -236,11 +259,19 @@
const handleDownload = () => {
saveFileToDisk(
async filePath => {
await apiCall('files/export-file', {
folder,
file: data.file,
filePath,
});
if (data.folid && data.cntid) {
await apiCall('cloud/export-file', {
folid: data.folid,
cntid: data.cntid,
filePath,
});
} else {
await apiCall('files/export-file', {
folder,
file: data.file,
filePath,
});
}
},
{ formatLabel: handler.label, formatExtension: handler.format, defaultFileName: data.file }
);