mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 08:33:58 +00:00
archive folder supports links
This commit is contained in:
@@ -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({
|
||||
|
||||
14
packages/web/src/utility/openArchiveFolder.ts
Normal file
14
packages/web/src/utility/openArchiveFolder.ts
Normal 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 });
|
||||
}
|
||||
Reference in New Issue
Block a user