Skip to content

Commit

Permalink
Submit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
johnyrahul committed Jul 17, 2024
1 parent f4a01d4 commit ca52841
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Col, Modal, Row, Tabs, Typography } from "antd";
import PropTypes from "prop-types";
import { useState } from "react";
import { useEffect, useState } from "react";

import { ListOfConnectors } from "../list-of-connectors/ListOfConnectors";
import "./ConfigureConnectorModal.css";
Expand Down Expand Up @@ -28,6 +28,13 @@ function ConfigureConnectorModal({
setSelectedItemName,
}) {
const [activeKey, setActiveKey] = useState("1");
useEffect(() => {
if (connectorMetadata) {
setActiveKey("2"); // If connector is already configured
} else {
setActiveKey("1"); // default value
}
}, [open, connectorMetadata]);
const { setPostHogCustomEvent, posthogConnectorEventText } =
usePostHogEvents();
const tabItems = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function ConfigureFormsLayout({
connDetails={connDetails}
connType={connType}
selectedSourceName={selectedItemName}
formDataConfig={formDataConfig}
/>
)}
</div>
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/components/input-output/add-source/AddSource.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function AddSource({
handleUpdate,
connDetails,
connType,
formDataConfig,
}) {
const [spec, setSpec] = useState({});
const [formData, setFormData] = useState({});
Expand Down Expand Up @@ -54,6 +55,7 @@ function AddSource({
axiosPrivate(requestOptions)
.then((res) => {
const data = res?.data;
setFormData(metadata || {});
setSpec(data?.json_schema || {});
if (data?.oauth) {
setOAuthProvider(data?.python_social_auth_backend);
Expand Down Expand Up @@ -110,6 +112,7 @@ function AddSource({
metadata={metadata}
selectedSourceName={selectedSourceName}
connType={connType}
formDataConfig={formDataConfig}
/>
);
}
Expand All @@ -125,6 +128,7 @@ AddSource.propTypes = {
handleUpdate: PropTypes.func,
connDetails: PropTypes.object,
connType: PropTypes.string,
formDataConfig: PropTypes.object,
};

export { AddSource };
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function ConfigureDs({
metadata,
selectedSourceName,
connType,
formDataConfig,
}) {
const formRef = createRef(null);
const axiosPrivate = useAxiosPrivate();
Expand Down Expand Up @@ -252,7 +253,11 @@ function ConfigureDs({
.then((res) => {
const data = res?.data;
if (sourceTypes.connectors.includes(type)) {
handleUpdate({ connector_instance: data?.id });
handleUpdate(
{ connector_instance: data?.id, configuration: formDataConfig },
true
);
setIsTcSuccessful(false);
return;
}
if (data) {
Expand Down Expand Up @@ -351,6 +356,7 @@ ConfigureDs.propTypes = {
metadata: PropTypes.object,
selectedSourceName: PropTypes.string.isRequired,
connType: PropTypes.string,
formDataConfig: PropTypes.object,
};

export { ConfigureDs };

0 comments on commit ca52841

Please sign in to comment.