diff --git a/packages/api/src/controllers/runners.js b/packages/api/src/controllers/runners.js index e8f573d8e..957e88647 100644 --- a/packages/api/src/controllers/runners.js +++ b/packages/api/src/controllers/runners.js @@ -43,8 +43,8 @@ ${ ? ` const downloaded=await dbgateApi.download(${JSON.stringify(props.downloadUrl)}); const reader=await ${extractShellApiFunctionName(functionName)}(Object.assign(${JSON.stringify( - props - )}, { fileName: downloaded, downloadUrl: undefined })); + _.omit(props, ['downloadUrl']) + )}, { fileName: downloaded })); ` : `const reader=await ${extractShellApiFunctionName(functionName)}(${JSON.stringify(props)});` } diff --git a/packages/api/src/shell/download.js b/packages/api/src/shell/download.js index 070f68213..bfe9e474b 100644 --- a/packages/api/src/shell/download.js +++ b/packages/api/src/shell/download.js @@ -4,7 +4,7 @@ const { uploadsdir } = require('../utility/directories'); const { downloadFile } = require('../utility/downloader'); async function download(url) { - const tmpFile = path.join(uploadsdir(), uuidv1() + '.tgz'); + const tmpFile = path.join(uploadsdir(), uuidv1()); await downloadFile(url, tmpFile); return tmpFile; } diff --git a/packages/web/src/icons.js b/packages/web/src/icons.js index e48cd087f..cdee1c8cc 100644 --- a/packages/web/src/icons.js +++ b/packages/web/src/icons.js @@ -1,5 +1,4 @@ import React from 'react'; -import _ from 'lodash'; const iconNames = { 'icon minus-box': 'mdi mdi-minus-box-outline', @@ -26,6 +25,7 @@ const iconNames = { 'icon save': 'mdi mdi-content-save', 'icon account': 'mdi mdi-account', 'icon sql-file': 'mdi mdi-file', + 'icon web': 'mdi mdi-web', 'icon edit': 'mdi mdi-pencil', 'icon delete': 'mdi mdi-delete', diff --git a/packages/web/src/impexp/ImportExportConfigurator.js b/packages/web/src/impexp/ImportExportConfigurator.js index e2bf92134..9267aa32d 100644 --- a/packages/web/src/impexp/ImportExportConfigurator.js +++ b/packages/web/src/impexp/ImportExportConfigurator.js @@ -61,12 +61,17 @@ const SourceNameWrapper = styled.div` justify-content: space-between; `; -const TrashWrapper = styled.div` +const SourceNameButtons = styled.div` + display: flex; +`; + +const IconButtonWrapper = styled.div` &:hover { background-color: ${(props) => props.theme.modal_background2}; } cursor: pointer; color: ${(props) => props.theme.modal_font_blue[7]}; + margin-left: 5px; `; const SqlWrapper = styled.div` @@ -371,19 +376,36 @@ function SourceTargetConfig({ function SourceName({ name }) { const { values, setFieldValue } = useFormikContext(); const theme = useTheme(); + const showModal = useShowModal(); + const obj = values[`sourceFile_${name}`]; const handleDelete = () => { setFieldValue( 'sourceList', values.sourceList.filter((x) => x != name) ); }; + const doChangeUrl = (url) => { + setFieldValue(`sourceFile_${name}`, { downloadUrl: url }); + }; + const handleChangeUrl = () => { + showModal((modalState) => ( + + )); + }; return (
{name}
- - - + + {obj && !!obj.downloadUrl && ( + + + + )} + + + +
); } diff --git a/packages/web/src/impexp/ScriptWriter.js b/packages/web/src/impexp/ScriptWriter.js index 832a7f7f3..f85dcccfb 100644 --- a/packages/web/src/impexp/ScriptWriter.js +++ b/packages/web/src/impexp/ScriptWriter.js @@ -24,12 +24,9 @@ export default class ScriptWriter { const fileNameVar = this.allocVariable(); this.put(`const ${fileNameVar} = await dbgateApi.download(${JSON.stringify(props.downloadUrl)});`); this.put( - `const ${variableName} = await ${extractShellApiFunctionName(functionName)}( - Object.assign(${JSON.stringify(props)}, { - fileName: ${fileNameVar}, - downloadUrl: undefined - }) - );` + `const ${variableName} = await ${extractShellApiFunctionName(functionName)}(Object.assign(${JSON.stringify( + _.omit(props, ['downloadUrl']) + )}, { fileName: ${fileNameVar} }));` ); } else { this.put(`const ${variableName} = await ${extractShellApiFunctionName(functionName)}(${JSON.stringify(props)});`);