diff --git a/ui_src/src/assets/images/cliIcon.svg b/ui_src/src/assets/images/cliIcon.svg new file mode 100644 index 000000000..ac22e43d5 --- /dev/null +++ b/ui_src/src/assets/images/cliIcon.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ui_src/src/assets/images/collapseArrowWhite.svg b/ui_src/src/assets/images/collapseArrowWhite.svg new file mode 100644 index 000000000..d0fd36596 --- /dev/null +++ b/ui_src/src/assets/images/collapseArrowWhite.svg @@ -0,0 +1,3 @@ + + + diff --git a/ui_src/src/components/Tabs/index.js b/ui_src/src/components/Tabs/index.js index 60d654868..b202c925d 100644 --- a/ui_src/src/components/Tabs/index.js +++ b/ui_src/src/components/Tabs/index.js @@ -24,7 +24,7 @@ import CheckboxComponent from '../checkBox'; import { PriorityHighRounded } from '@material-ui/icons'; import CloudOnly from '../cloudOnly'; -const CustomTabs = ({ tabs, onChange, value, disabled, length, tooltip, icon = false, checkbox = false, defaultActiveKey, tabsCounter }) => { +const CustomTabs = ({ tabs, onChange, value, disabled, length, tooltip, icon = false, checkbox = false, defaultActiveKey, tabsCounter, icons }) => { return (
+ {icons && icons[index] && !icon && icons[index]} {checkbox && } <> diff --git a/ui_src/src/components/cloneModal/index.js b/ui_src/src/components/cloneModal/index.js index ff7c67479..6b30b41c4 100644 --- a/ui_src/src/components/cloneModal/index.js +++ b/ui_src/src/components/cloneModal/index.js @@ -17,19 +17,34 @@ import { FiDownload } from 'react-icons/fi'; import Copy from '../copy'; import CustomTabs from '../Tabs'; import { githubUrls } from '../../const/globalConst'; +import { SiLinux, SiApple, SiWindows11 } from 'react-icons/si'; const CloneModal = ({ type }) => { - const [tabValue, setTabValue] = useState('HTTPS'); + const [tabValue, setTabValue] = useState(type === 'cli' ? 'Windows' : 'HTTPS'); const downloadRepoArchive = async () => { window.open(githubUrls[type].DOWNLOAD_URL, '_blank'); }; return (
-

Clone

-

Kindly clone our explanatory repository to quickly start.

- setTabValue(tabValue)} /> - {tabValue === 'HTTPS' ? ( + {type === 'cli' ? ( + <> +

Functions Template Generator

+ + ) : ( + <> +

Clone

+

Kindly clone our explanatory repository to quickly start.

+ + )} + , , , ] : []} + size={'small'} + tabValue={tabValue} + onChange={(tabValue) => setTabValue(tabValue)} + /> + {type !== 'cli' && tabValue === 'HTTPS' && ( <>

{githubUrls[type].MEMPHIS_GIT_HTTPS}

@@ -38,7 +53,8 @@ const CloneModal = ({ type }) => {
- ) : ( + )} + {type !== 'cli' && tabValue === 'SSH' && ( <>

{githubUrls[type].MEMPHIS_GIT_SSH}

@@ -48,23 +64,42 @@ const CloneModal = ({ type }) => {
)} + {type === 'cli' && ( + <> +
+

{githubUrls[type][tabValue]}

+
+ +
+
+

Create a basic Memphis function template

+
+

{githubUrls[type]?.code}

+
+ +
+
+ + )}

Use Git or checkout with SVN using the web URL.

-
-
- } - colorType={'purple'} - onClick={downloadRepoArchive} - fontSize={'14px'} - fontWeight={500} - border="none" - backgroundColorType={'none'} - /> -
+ {type !== 'cli' && ( +
+
+ } + colorType={'purple'} + onClick={downloadRepoArchive} + fontSize={'14px'} + fontWeight={500} + border="none" + backgroundColorType={'none'} + /> + + )} ); }; diff --git a/ui_src/src/components/cloneModal/style.scss b/ui_src/src/components/cloneModal/style.scss index 90c740075..5bfaa4e05 100644 --- a/ui_src/src/components/cloneModal/style.scss +++ b/ui_src/src/components/cloneModal/style.scss @@ -52,6 +52,11 @@ cursor: pointer; } } + .create-func-cli { + font-size: 14px; + font-family: 'InterMedium'; + margin: 15px 0px 5px 0px; + } .footer { border-top: 1px solid #e4e4e4; display: flex; diff --git a/ui_src/src/components/connectorError/index.js b/ui_src/src/components/connectorError/index.js index 4c36a5aad..d4f3019b7 100644 --- a/ui_src/src/components/connectorError/index.js +++ b/ui_src/src/components/connectorError/index.js @@ -38,15 +38,13 @@ const ConnectorError = ({ open, clickOutside, connectorId }) => { const [logs, setLogs] = useState(null); useEffect(() => { - open && getConnectorErrors(); + open && getConnectorErrors(connectorId); }, [open]); - const getConnectorErrors = async () => { + const getConnectorErrors = async (connectorId) => { setLoading(true); try { - const data = await httpRequest('GET', ApiEndpoints.GET_CONNECTOR_ERRORS, { - connector_id: connectorId - }); + const data = await httpRequest('GET', `${ApiEndpoints.GET_CONNECTOR_ERRORS}?connector_id=${connectorId}`); setLogs(data?.logs); } catch (error) { } finally { diff --git a/ui_src/src/components/connectorModal/index.js b/ui_src/src/components/connectorModal/index.js index 04a29153e..96a8401a1 100644 --- a/ui_src/src/components/connectorModal/index.js +++ b/ui_src/src/components/connectorModal/index.js @@ -81,8 +81,8 @@ const ConnectorModal = ({ open, clickOutside, newConnecor, source }) => { else setIsEditing(true); value !== '' && conntectorsNewFields[index]?.options?.push({ - name: value, - value: value + name: value?.trim(), + value: value?.trim() }); setConnectorInputFields(conntectorsNewFields); }; @@ -115,15 +115,19 @@ const ConnectorModal = ({ open, clickOutside, newConnecor, source }) => { ); const onFinish = async () => { try { - await connectorForm.validateFields(); if (step === 1) { - isCloud() ? createConnector() : setCloudModalOpen(true); + try { + await connectorForm.validateFields(); + isCloud() ? createConnector() : setCloudModalOpen(true); + } catch (err) { + return; + } } else { resError ? setStep(1) : clickOutside(); setError(null); } } catch (err) { - console.log(err); + return; } }; @@ -133,7 +137,6 @@ const ConnectorModal = ({ open, clickOutside, newConnecor, source }) => { setStep(2); try { const modifiedSettings = { ...formFields?.settings }; - for (const key in modifiedSettings) { if (Array.isArray(modifiedSettings[key])) { modifiedSettings[key] = modifiedSettings[key].join(','); @@ -155,7 +158,7 @@ const ConnectorModal = ({ open, clickOutside, newConnecor, source }) => { } }; - const generateFormItem = (input, index) => { + const generateFormItem = (input, index, depth, inputName) => { return ( <> { /> )} - {input?.children && + + {depth === 0 && + input?.children && formFields?.settings && formFields?.settings[input?.name] && - connectorInputFields[index][formFields?.settings[input?.name]]?.map((child, index) => generateFormItem(child, index))} + connectorInputFields[index][formFields?.settings[input?.name]]?.map((child, index) => generateFormItem(child, index, depth + 1, input?.name))} + + {depth === 1 && + input?.children && + formFields?.settings[input?.name] && + input[formFields?.settings[input?.name]]?.map((child, index) => generateFormItem(child, index, depth + 1, input?.name))} ); }; @@ -267,7 +277,6 @@ const ConnectorModal = ({ open, clickOutside, newConnecor, source }) => { } className={'modal-wrapper produce-modal'} width="550px" - height="60vh" clickOutside={clickOutside} open={open} displayButtons={true} @@ -317,16 +326,19 @@ const ConnectorModal = ({ open, clickOutside, newConnecor, source }) => { disabled={false} /> - -
- {formFields?.type && - connectorInputFields?.map((input, index) => { - return generateFormItem(input, index); - })} -
+ {formFields?.type && ( + <> + +
+ {connectorInputFields?.map((input, index) => { + return generateFormItem(input, index, 0); + })} +
+ + )} )} - {step === 2 && !resError && ( + {step === 2 && (!resError || (resError && Object.keys(resError)?.length === 0)) && (
{loading ? ( <> @@ -339,7 +351,7 @@ const ConnectorModal = ({ open, clickOutside, newConnecor, source }) => {
)} - {step === 2 && resError && !loading &&
{resError}
} + {step === 2 && resError && Object.keys(resError)?.length > 0 && !loading &&
{resError}
} setCloudModalOpen(false)} /> diff --git a/ui_src/src/components/connectorModal/style.scss b/ui_src/src/components/connectorModal/style.scss index 796069363..0fe0b553a 100644 --- a/ui_src/src/components/connectorModal/style.scss +++ b/ui_src/src/components/connectorModal/style.scss @@ -29,14 +29,14 @@ position: relative; } .connector-inputs { - height: calc(100% - 215px); + height: 350px; overflow-y: auto; padding: 2px; } .validation { width: 100%; margin: 20px 0px; - height: calc(100% - 40px); + height: 400px; border-radius: 12px; border: 1px solid #dcdcdc; display: flex; @@ -48,7 +48,7 @@ .result { width: 100%; margin: 20px 0px; - height: calc(100% - 40px); + height: 400px; border-radius: 12px; border: 1px solid #dcdcdc; padding: 20px; diff --git a/ui_src/src/components/customSelect/index.js b/ui_src/src/components/customSelect/index.js index ab2930ba2..dfedd337d 100644 --- a/ui_src/src/components/customSelect/index.js +++ b/ui_src/src/components/customSelect/index.js @@ -96,7 +96,7 @@ const CustomSelect = ({ options, onChange, value, placeholder, type = 'schema', )} {options?.map((schema) => { return ( -