mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 04:26:01 +00:00
28 lines
714 B
TypeScript
28 lines
714 B
TypeScript
import { QuickExportDefinition } from 'dbgate-types';
|
|
import { getExtensions } from '../stores';
|
|
|
|
export function createQuickExportMenuItems(handler: (fmt: QuickExportDefinition) => Function, advancedExportMenuItem) {
|
|
const extensions = getExtensions();
|
|
return [
|
|
...extensions.quickExports.map(fmt => ({
|
|
text: fmt.label,
|
|
onClick: handler(fmt),
|
|
})),
|
|
{ divider: true },
|
|
{
|
|
text: 'More...',
|
|
...advancedExportMenuItem,
|
|
},
|
|
];
|
|
}
|
|
|
|
export default function createQuickExportMenu(
|
|
handler: (fmt: QuickExportDefinition) => Function,
|
|
advancedExportMenuItem
|
|
) {
|
|
return {
|
|
text: 'Export',
|
|
submenu: createQuickExportMenuItems(handler, advancedExportMenuItem),
|
|
};
|
|
}
|