mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
rename archive file
This commit is contained in:
parent
25fe1df43b
commit
241c7746c2
@ -84,6 +84,12 @@ module.exports = {
|
|||||||
socket.emitChanged(`archive-files-changed-${folder}`);
|
socket.emitChanged(`archive-files-changed-${folder}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
renameFile_meta: 'post',
|
||||||
|
async renameFile({ folder, file, newFile }) {
|
||||||
|
await fs.rename(path.join(resolveArchiveFolder(folder), `${file}.jsonl`), path.join(resolveArchiveFolder(folder), `${newFile}.jsonl`));
|
||||||
|
socket.emitChanged(`archive-files-changed-${folder}`);
|
||||||
|
},
|
||||||
|
|
||||||
deleteFolder_meta: 'post',
|
deleteFolder_meta: 'post',
|
||||||
async deleteFolder({ folder }) {
|
async deleteFolder({ folder }) {
|
||||||
if (!folder) throw new Error('Missing folder parameter');
|
if (!folder) throw new Error('Missing folder parameter');
|
||||||
|
@ -67,9 +67,21 @@
|
|||||||
import openNewTab from '../utility/openNewTab';
|
import openNewTab from '../utility/openNewTab';
|
||||||
import AppObjectCore from './AppObjectCore.svelte';
|
import AppObjectCore from './AppObjectCore.svelte';
|
||||||
import getConnectionLabel from '../utility/getConnectionLabel';
|
import getConnectionLabel from '../utility/getConnectionLabel';
|
||||||
|
import InputTextModal from '../modals/InputTextModal.svelte';
|
||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
|
|
||||||
|
const handleRename = () => {
|
||||||
|
showModal(InputTextModal, {
|
||||||
|
value: data.file,
|
||||||
|
label: 'New file name',
|
||||||
|
header: 'Rename file',
|
||||||
|
onConfirm: newFile => {
|
||||||
|
axiosInstance.post('archive/rename-file', { file: data.fileName, folder: data.folderName, newFile });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const handleDelete = () => {
|
const handleDelete = () => {
|
||||||
axiosInstance.post('archive/delete-file', { file: data.fileName, folder: data.folderName });
|
axiosInstance.post('archive/delete-file', { file: data.fileName, folder: data.folderName });
|
||||||
};
|
};
|
||||||
@ -115,6 +127,7 @@
|
|||||||
data.fileType == 'jsonl' && { text: 'Open (readonly)', onClick: handleOpenRead },
|
data.fileType == 'jsonl' && { text: 'Open (readonly)', onClick: handleOpenRead },
|
||||||
data.fileType == 'jsonl' && { text: 'Open in free table editor', onClick: handleOpenWrite },
|
data.fileType == 'jsonl' && { text: 'Open in free table editor', onClick: handleOpenWrite },
|
||||||
{ text: 'Delete', onClick: handleDelete },
|
{ text: 'Delete', onClick: handleDelete },
|
||||||
|
{ text: 'Rename', onClick: handleRename },
|
||||||
data.fileType == 'jsonl' &&
|
data.fileType == 'jsonl' &&
|
||||||
createQuickExportMenu($extensions, fmt => async () => {
|
createQuickExportMenu($extensions, fmt => async () => {
|
||||||
exportElectronFile(
|
exportElectronFile(
|
||||||
|
Loading…
Reference in New Issue
Block a user