quick export from web

This commit is contained in:
Jan Prochazka
2022-03-10 10:15:05 +01:00
parent 008a09cc81
commit 8c3708fc8c
9 changed files with 46 additions and 43 deletions

View File

@@ -1,30 +1,27 @@
import { ExtensionsDirectory, QuickExportDefinition } from 'dbgate-types';
import { getExtensions } from '../stores';
import getElectron from './getElectron';
export function createQuickExportMenuItems(
extensions: ExtensionsDirectory,
handler: (fmt: QuickExportDefinition) => Function
) {
const electron = getElectron();
if (!electron) {
return null;
}
export function createQuickExportMenuItems(handler: (fmt: QuickExportDefinition) => Function) {
// const electron = getElectron();
// if (!electron) {
// return null;
// }
const extensions = getExtensions();
console.log('extensions', extensions);
return extensions.quickExports.map(fmt => ({
text: fmt.label,
onClick: handler(fmt),
}));
}
export default function createQuickExportMenu(
extensions: ExtensionsDirectory,
handler: (fmt: QuickExportDefinition) => Function
) {
const electron = getElectron();
if (!electron) {
return { _skip: true };
}
export default function createQuickExportMenu(handler: (fmt: QuickExportDefinition) => Function) {
// const electron = getElectron();
// if (!electron) {
// return { _skip: true };
// }
return {
text: 'Quick export',
submenu: createQuickExportMenuItems(extensions, handler),
submenu: createQuickExportMenuItems(handler),
};
}