MPR advanced exports

This commit is contained in:
Jan Prochazka
2025-10-26 09:33:48 +01:00
parent c741434e3c
commit 864797fc99
4 changed files with 6 additions and 2 deletions

View File

@@ -468,12 +468,14 @@ await dbgateApi.executeQuery(${JSON.stringify(
{ divider: true }, { divider: true },
isSqlOrDoc && isSqlOrDoc &&
isProApp() &&
!connection.isReadOnly && !connection.isReadOnly &&
hasPermission(`dbops/import`) && { hasPermission(`dbops/import`) && {
onClick: handleImport, onClick: handleImport,
text: _t('database.import', { defaultMessage: 'Import' }), text: _t('database.import', { defaultMessage: 'Import' }),
}, },
isSqlOrDoc && isSqlOrDoc &&
isProApp() &&
hasPermission(`dbops/export`) && { hasPermission(`dbops/export`) && {
onClick: handleExport, onClick: handleExport,
text: _t('database.export', { defaultMessage: 'Export' }), text: _t('database.export', { defaultMessage: 'Export' }),

View File

@@ -689,7 +689,7 @@ registerCommand({
name: 'Export database', name: 'Export database',
toolbar: true, toolbar: true,
icon: 'icon export', icon: 'icon export',
testEnabled: () => getCurrentDatabase() != null && hasPermission(`dbops/export`), testEnabled: () => getCurrentDatabase() != null && hasPermission(`dbops/export`) && isProApp(),
onClick: () => { onClick: () => {
openImportExportTab({ openImportExportTab({
targetStorageType: getDefaultFileFormat(getExtensions()).storageType, targetStorageType: getDefaultFileFormat(getExtensions()).storageType,

View File

@@ -94,6 +94,7 @@
title: 'Export database', title: 'Export database',
description: 'Export to file like CSV, JSON, Excel, or other DB', description: 'Export to file like CSV, JSON, Excel, or other DB',
command: 'database.export', command: 'database.export',
isProFeature: true,
testid: 'NewObjectModal_databaseExport', testid: 'NewObjectModal_databaseExport',
disabledMessage: 'Export is not available for current database', disabledMessage: 'Export is not available for current database',
}, },

View File

@@ -1,11 +1,12 @@
import type { QuickExportDefinition } from 'dbgate-types'; import type { QuickExportDefinition } from 'dbgate-types';
import { currentArchive, getCurrentArchive, getExtensions } from '../stores'; import { currentArchive, getCurrentArchive, getExtensions } from '../stores';
import hasPermission from './hasPermission'; import hasPermission from './hasPermission';
import { isProApp } from './proTools';
export function createQuickExportMenuItems(handler: (fmt: QuickExportDefinition) => Function, advancedExportMenuItem) { export function createQuickExportMenuItems(handler: (fmt: QuickExportDefinition) => Function, advancedExportMenuItem) {
const extensions = getExtensions(); const extensions = getExtensions();
return [ return [
{ isProApp() && {
text: 'Export advanced...', text: 'Export advanced...',
...advancedExportMenuItem, ...advancedExportMenuItem,
}, },