Skip to content

Commit

Permalink
🪟🔧 Connector builder: Switch on builder navigation (#6341)
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Reuter committed May 11, 2023
1 parent cb46216 commit 5310435
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const ConnectorGrid = <T extends ConnectorDefinition>({
showConnectorBuilderButton = false,
}: ConnectorGridProps<T>) => {
const [searchTerm, setSearchTerm] = useState("");
const showBuilderNavigationLinks = useExperiment("connectorBuilder.showNavigationLinks", false);
const showBuilderNavigationLinks = useExperiment("connectorBuilder.showNavigationLinks", true);

const filteredDefinitions = useMemo(
() =>
Expand Down
2 changes: 1 addition & 1 deletion airbyte-webapp/src/packages/cloud/cloudRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const MainRoutes: React.FC = () => {
);
useAnalyticsRegisterValues(analyticsContext);

const showBuilderNavigationLinks = useExperiment("connectorBuilder.showNavigationLinks", false);
const showBuilderNavigationLinks = useExperiment("connectorBuilder.showNavigationLinks", true);

return (
<ApiErrorBoundary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const SourcesPage: React.FC = () => {
const { sources } = useSourceList();
const sourceDefinitions = useAvailableSourceDefinitions();

const showBuilderNavigationLinks = useExperiment("connectorBuilder.showNavigationLinks", false);
const showBuilderNavigationLinks = useExperiment("connectorBuilder.showNavigationLinks", true);

const { mutateAsync: updateSourceDefinition } = useUpdateSourceDefinition();
const [updatingDefinitionId, setUpdatingDefinitionId] = useState<string>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const CreateConnector: React.FC<IProps> = ({ type }) => {
setIsModalOpen(!isModalOpen);
setErrorMessage("");
};
const showBuilderNavigationLinks = useExperiment("connectorBuilder.showNavigationLinks", false);
const showBuilderNavigationLinks = useExperiment("connectorBuilder.showNavigationLinks", true);

const { formatMessage } = useIntl();

Expand Down
41 changes: 13 additions & 28 deletions airbyte-webapp/src/pages/source/CreateSourcePage/SourceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@ import React, { useState } from "react";
import { FormattedMessage } from "react-intl";
import { useLocation } from "react-router-dom";

import { BuilderPrompt } from "components/connectorBuilder/BuilderPrompt";
import { Card } from "components/ui/Card";

import { ConnectionConfiguration } from "core/domain/connection";
import { SourceDefinitionRead } from "core/request/AirbyteClient";
import { LogsRequestError } from "core/request/LogsRequestError";
import { useExperiment } from "hooks/services/Experiment";
import { RoutePaths } from "pages/routePaths";
import { useGetSourceDefinitionSpecificationAsync } from "services/connector/SourceDefinitionSpecificationService";
import { FormError } from "utils/errorStatusMessage";
import { ConnectorCard } from "views/Connector/ConnectorCard";
import { ConnectorCardValues } from "views/Connector/ConnectorForm/types";

import styles from "./SourceForm.module.scss";

export interface SourceFormValues {
name: string;
serviceType: string;
Expand Down Expand Up @@ -66,28 +59,20 @@ export const SourceForm: React.FC<SourceFormProps> = ({
...values,
sourceDefinitionId: sourceDefinitionSpecification?.sourceDefinitionId,
});
const showBuilderNavigationLinks = useExperiment("connectorBuilder.showNavigationLinks", false);

return (
<>
<ConnectorCard
formType="source"
title={<FormattedMessage id="onboarding.sourceSetUp" />}
description={<FormattedMessage id="sources.description" />}
isLoading={isLoading}
fetchingConnectorError={sourceDefinitionError instanceof Error ? sourceDefinitionError : null}
availableConnectorDefinitions={sourceDefinitions}
onConnectorDefinitionSelect={onDropDownSelect}
selectedConnectorDefinitionSpecification={sourceDefinitionSpecification}
selectedConnectorDefinitionId={sourceDefinitionId}
onSubmit={onSubmitForm}
jobInfo={LogsRequestError.extractJobInfo(error)}
/>
{showBuilderNavigationLinks && !sourceDefinitionSpecification && (
<Card fullWidth className={styles.builderPrompt}>
<BuilderPrompt builderRoutePath={`../../${RoutePaths.ConnectorBuilder}`} />
</Card>
)}
</>
<ConnectorCard
formType="source"
title={<FormattedMessage id="onboarding.sourceSetUp" />}
description={<FormattedMessage id="sources.description" />}
isLoading={isLoading}
fetchingConnectorError={sourceDefinitionError instanceof Error ? sourceDefinitionError : null}
availableConnectorDefinitions={sourceDefinitions}
onConnectorDefinitionSelect={onDropDownSelect}
selectedConnectorDefinitionSpecification={sourceDefinitionSpecification}
selectedConnectorDefinitionId={sourceDefinitionId}
onSubmit={onSubmitForm}
jobInfo={LogsRequestError.extractJobInfo(error)}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { WarningMessage } from "../../WarningMessage";
type MenuWithRequestButtonProps = MenuListProps<DropDownOptionDataItem, false> & { selectProps: any };

const ConnectorList: React.FC<React.PropsWithChildren<MenuWithRequestButtonProps>> = ({ children, ...props }) => {
const showBuilderNavigationLinks = useExperiment("connectorBuilder.showNavigationLinks", false);
const showBuilderNavigationLinks = useExperiment("connectorBuilder.showNavigationLinks", true);

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion airbyte-webapp/src/views/layout/SideBar/MainNavItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import SourceIcon from "./components/SourceIcon";
import styles from "./MainNavItems.module.scss";

export const MainNavItems: React.FC = () => {
const showBuilderNavigationLinks = useExperiment("connectorBuilder.showNavigationLinks", false);
const showBuilderNavigationLinks = useExperiment("connectorBuilder.showNavigationLinks", true);

return (
<MenuContent data-testid="navMainItems">
Expand Down

0 comments on commit 5310435

Please sign in to comment.