1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00

Merge pull request #1188 from anytypeio/dump-localstore

Export localstore
This commit is contained in:
Razor 2021-10-27 14:52:32 +03:00 committed by GitHub
commit b73c85b590
3 changed files with 35 additions and 0 deletions

View file

@ -611,6 +611,10 @@ function menuInit () {
label: 'Export templates',
click: () => { send('command', 'exportTemplates'); }
},
{
label: 'Export localstore',
click: () => { send('command', 'exportLocalstore'); }
},
{
label: 'Create workspace',
click: () => { send('commandGlobal', 'workspace'); }

View file

@ -630,6 +630,27 @@ class App extends React.Component<Props, State> {
});
});
break;
case 'exportLocalstore':
options = {
properties: [ 'openDirectory' ],
};
dialog.showOpenDialog(options).then((result: any) => {
const files = result.filePaths;
if ((files == undefined) || !files.length) {
return;
};
C.ExportLocalstore(files[0], [], (message: any) => {
if (message.error.code) {
return;
};
ipcRenderer.send('pathOpen', files[0]);
});
});
break;
};
};

View file

@ -72,6 +72,15 @@ const ExportTemplates = (path: string, callBack?: (message: any) => void) => {
dispatcher.request('exportTemplates', request, callBack);
};
const ExportLocalstore = (path: string, ids: string[], callBack?: (message: any) => void) => {
const request = new Rpc.ExportLocalstore.Request();
request.setPath(path);
request.setDocidsList(ids);
dispatcher.request('exportLocalstore', request, callBack);
};
const UploadFile = (url: string, path: string, type: I.FileType, enc: boolean, callBack?: (message: any) => void) => {
if (!url && !path) {
return;
@ -1172,6 +1181,7 @@ export {
ProcessCancel,
Export,
ExportTemplates,
ExportLocalstore,
FileListOffload,
WalletCreate,