archive folder supports links

This commit is contained in:
Jan Prochazka
2021-10-14 19:51:46 +02:00
parent 8f54a6b03d
commit 2e196178ab
12 changed files with 74 additions and 22 deletions

View File

@@ -19,6 +19,7 @@ import './recentDatabaseSwitch';
import hasPermission from '../utility/hasPermission';
import _ from 'lodash';
import { findEngineDriver } from 'dbgate-tools';
import { openArchiveFolder } from '../utility/openArchiveFolder';
const electron = getElectron();
@@ -213,6 +214,13 @@ if (electron) {
keyText: 'Ctrl+O',
onClick: openElectronFile,
});
registerCommand({
id: 'file.openArchive',
category: 'File',
name: 'Open DB Model/Archive',
onClick: openArchiveFolder,
});
}
registerCommand({

View File

@@ -0,0 +1,14 @@
import { get } from 'svelte/store';
import getElectron from './getElectron';
import { extensions } from '../stores';
import axiosInstance from '../utility/axiosInstance';
export function openArchiveFolder() {
const electron = getElectron();
const ext = get(extensions);
const filePaths = electron.remote.dialog.showOpenDialogSync(electron.remote.getCurrentWindow(), {
properties: ['openDirectory'],
});
const linkedFolder = filePaths && filePaths[0];
axiosInstance.post('archive/create-link', { linkedFolder });
}