mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 02:25:59 +00:00
init added to shell script
This commit is contained in:
@@ -19,6 +19,7 @@ import LoadingInfo from '../widgets/LoadingInfo';
|
|||||||
|
|
||||||
const configRegex = /\s*\/\/\s*@ImportExportConfigurator\s*\n\s*\/\/\s*(\{[^\n]+\})\n/;
|
const configRegex = /\s*\/\/\s*@ImportExportConfigurator\s*\n\s*\/\/\s*(\{[^\n]+\})\n/;
|
||||||
const requireRegex = /\s*(\/\/\s*@require\s+[^\n]+)\n/g;
|
const requireRegex = /\s*(\/\/\s*@require\s+[^\n]+)\n/g;
|
||||||
|
const initRegex = /([^\n]+\/\/\s*@init)/g;
|
||||||
|
|
||||||
export default function ShellTab({ tabid, tabVisible, toolbarPortalRef, ...other }) {
|
export default function ShellTab({ tabid, tabVisible, toolbarPortalRef, ...other }) {
|
||||||
const [busy, setBusy] = React.useState(false);
|
const [busy, setBusy] = React.useState(false);
|
||||||
@@ -60,7 +61,9 @@ export default function ShellTab({ tabid, tabVisible, toolbarPortalRef, ...other
|
|||||||
let runid = runnerId;
|
let runid = runnerId;
|
||||||
const resp = await axios.post('runners/start', {
|
const resp = await axios.post('runners/start', {
|
||||||
script: selectedText
|
script: selectedText
|
||||||
? [...(editorData || '').matchAll(requireRegex)].map((x) => `${x[1]}\n`).join('') + selectedText
|
? [...(editorData || '').matchAll(requireRegex)].map((x) => `${x[1]}\n`).join('') +
|
||||||
|
[...(editorData || '').matchAll(initRegex)].map((x) => `${x[1]}\n`).join('') +
|
||||||
|
selectedText
|
||||||
: editorData,
|
: editorData,
|
||||||
});
|
});
|
||||||
runid = resp.data.runid;
|
runid = resp.data.runid;
|
||||||
|
|||||||
Reference in New Issue
Block a user