scriptWriterEval

This commit is contained in:
SPRINX0\prochazka
2025-04-24 16:36:07 +02:00
parent e740db11ed
commit d331d48ca2
4 changed files with 108 additions and 20 deletions

View File

@@ -1,6 +1,6 @@
import _ from 'lodash';
import moment from 'moment';
import { ScriptWriterJavaScript, ScriptWriterJson } from 'dbgate-tools';
import { ScriptWriterGeneric, ScriptWriterJavaScript, ScriptWriterJson } from 'dbgate-tools';
import getAsArray from '../utility/getAsArray';
import { getConnectionInfo } from '../utility/metadataLoaders';
import { findEngineDriver, findObjectLike } from 'dbgate-tools';
@@ -203,12 +203,12 @@ export function normalizeExportColumnMap(colmap) {
return null;
}
export default async function createImpExpScript(extensions, values, forceScript = false) {
export default async function createImpExpScript(extensions, values, format = undefined) {
const config = getCurrentConfig();
const script =
config.allowShellScripting || forceScript
? new ScriptWriterJavaScript(values.startVariableIndex || 0)
: new ScriptWriterJson(values.startVariableIndex || 0);
let script: ScriptWriterGeneric = new ScriptWriterJson(values.startVariableIndex || 0);
if (format == 'script' && config.allowShellScripting) {
script = new ScriptWriterJavaScript(values.startVariableIndex || 0);
}
const [sourceConnection, sourceDriver] = await getConnection(
extensions,

View File

@@ -167,7 +167,7 @@
const handleGenerateScript = async e => {
const values = $formValues as any;
const code = await createImpExpScript($extensions, values, true);
const code = await createImpExpScript($extensions, values, 'script');
openNewTab(
{
title: 'Shell #',
@@ -183,7 +183,7 @@
progressHolder = {};
const values = $formValues as any;
busy = true;
const script = await createImpExpScript($extensions, values);
const script = await createImpExpScript($extensions, values, 'json');
executeNumber += 1;
let runid = runnerId;
const resp = await apiCall('runners/start', { script });