Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support to default private data plane if there is only one #1525

Merged
merged 7 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"main": "index.js",
"private": true,
"engines": {
"node": "20.10.0",
"npm": "10.2.3"
"node": ">=20",
"npm": "^10"
},
"scripts": {
"build": "vite build",
Expand Down
2 changes: 1 addition & 1 deletion src/api/dataPlanes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const COLUMNS = [
'cidr_blocks',
'gcp_service_account_email',
'aws_iam_user_arn',
// 'aws_link_endpoints', uncomment after https://github.com/estuary/flow/pull/1816 is done
// 'aws_link_endpoints', TODO uncomment after https://github.com/estuary/flow/pull/1816 is done
];

const QUERY = COLUMNS.join(',');
Expand Down
5 changes: 0 additions & 5 deletions src/components/editor/MonacoEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,6 @@ function MonacoEditor({

// Make sure we have all the props needed to update the value
if (validValue && catalogName && catalogType) {
logRocketConsole('editor:update:saving', {
processedVal,
catalogName,
catalogType,
});
setStatus(EditorStatus.SAVING, evaluatedPath);

// Check if there is a scope to update (ex: Schema editing for bindings editor)
Expand Down
70 changes: 20 additions & 50 deletions src/stores/DetailsForm/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getLiveSpecs_detailsForm } from 'api/liveSpecsExt';
import { GlobalSearchParams } from 'hooks/searchParams/useGlobalSearchParams';
import produce from 'immer';
import { isEmpty } from 'lodash';
import { logRocketConsole, logRocketEvent } from 'services/shared';
import { logRocketEvent } from 'services/shared';
import { CustomEvents } from 'services/types';
import { DATA_PLANE_SETTINGS } from 'settings/dataPlanes';
import {
Expand Down Expand Up @@ -39,9 +39,6 @@ const getConnectorImage = async (
connectorId: string,
existingImageTag?: ConnectorVersionEvaluationOptions['existingImageTag']
): Promise<Details['data']['connectorImage'] | null> => {
logRocketConsole('DetailsFormHydrator>getConnectorImage', {
connectorId,
});
const { data, error } = await getConnectors_detailsForm(connectorId);

if (!error && data && data.length > 0) {
Expand All @@ -68,6 +65,25 @@ const getDataPlane = (
return selectedOption;
}

// TODO (private data plane) - we need to add support for allowing tenants to configure their
// preferred data plane.

// If we are not trying to find a specific data plane and there is only one option
// and it is private we are pretty safe in prefilling that one.
if (
!dataPlaneId &&
dataPlaneOptions.length === 1 &&
dataPlaneOptions[0].dataPlaneName.whole.includes(
DATA_PLANE_SETTINGS.private.prefix
)
) {
logRocketEvent(CustomEvents.DATA_PLANE_SELECTOR, {
defaultedPrivate: true,
});
return dataPlaneOptions[0];
}

// Try to find the default public data plane
const defaultOption = dataPlaneOptions.find(
({ dataPlaneName }) =>
dataPlaneName.whole ===
Expand Down Expand Up @@ -193,9 +209,6 @@ export const getInitialState = (
set(
produce((state: DetailsFormState) => {
if (connectorImage.id === '') {
logRocketConsole(
'DetailsFormHydrator>setDetails_connector>resetting'
);
state.details.data.connectorImage =
getInitialStateData().details.data.connectorImage;
} else {
Expand Down Expand Up @@ -299,24 +312,11 @@ export const getInitialState = (
workflow === 'capture_create' ||
workflow === 'materialization_create';

logRocketConsole('DetailsFormHydrator>hydrateState', {
connectorId,
createWorkflow,
dataPlaneId,
liveSpecId,
searchParams: searchParams.toString(),
workflow,
});

if (connectorId) {
let dataPlaneOptions: DataPlaneOption[] = [];

const dataPlaneResponse = await getDataPlaneOptions();

logRocketConsole(
'DetailsFormHydrator>hydrateState>getDataPlaneOptions'
);

if (
!dataPlaneResponse.error &&
dataPlaneResponse.data &&
Expand All @@ -326,9 +326,6 @@ export const getInitialState = (
generateDataPlaneOption
);

logRocketConsole(
'DetailsFormHydrator>hydrateState>setDataPlaneOptions'
);
get().setDataPlaneOptions(dataPlaneOptions);
} else {
get().setHydrationError(
Expand All @@ -338,30 +335,10 @@ export const getInitialState = (
}

if (createWorkflow) {
logRocketConsole(
'DetailsFormHydrator>hydrateState>createWorkflow'
);
const connectorImage = await getConnectorImage(connectorId);
logRocketConsole(
'DetailsFormHydrator>hydrateState>createWorkflow>getConnectorImage',
{
connectorId: connectorImage?.connectorId,
connectorImageId: connectorImage?.id,
}
);

const dataPlane = getDataPlane(dataPlaneOptions, dataPlaneId);
logRocketConsole(
'DetailsFormHydrator>hydrateState>createWorkflow>getDataPlane',
{
dataPlaneName: dataPlane?.dataPlaneName,
}
);

if (connectorImage && dataPlane === null) {
logRocketConsole(
'DetailsFormHydrator>hydrateState>createWorkflow>setDetails_connector'
);
get().setDetails_connector(connectorImage);

const {
Expand All @@ -374,10 +351,6 @@ export const getInitialState = (
errors,
});
} else if (connectorImage && dataPlane !== null) {
logRocketConsole(
'DetailsFormHydrator>hydrateState>createWorkflow>setDetails_connector&setDetails_dataPlane'
);

get().setDetails_connector(connectorImage);

const {
Expand All @@ -391,9 +364,6 @@ export const getInitialState = (
errors,
});
} else {
logRocketConsole(
'DetailsFormHydrator>hydrateState>createWorkflow>setHydrationErrorsExist'
);
get().setHydrationErrorsExist(true);
}
} else if (liveSpecId) {
Expand Down
7 changes: 0 additions & 7 deletions src/stores/EndpointConfig/Hydrator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ export const EndpointConfigHydrator = ({ children }: BaseComponentProps) => {
const hydrateState = useEndpointConfig_hydrateState();
const setActive = useEndpointConfig_setActive();

logRocketConsole('EndpointConfigHydrator', {
runHydration: Boolean(runHydration.current),
hydrated,
connectorTagId,
entityType,
});

useEffect(() => {
if (
runHydration.current &&
Expand Down
22 changes: 0 additions & 22 deletions src/stores/EndpointConfig/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { GlobalSearchParams } from 'hooks/searchParams/useGlobalSearchParams';
import produce from 'immer';
import { isEmpty } from 'lodash';
import { createJSONFormDefaults } from 'services/ajv';
import { logRocketConsole } from 'services/shared';
import {
CustomError,
fetchErrors,
Expand Down Expand Up @@ -217,35 +216,14 @@ const getInitialState = (
get().setServerUpdateRequired(true);
}

logRocketConsole('EndpointConfigHydrator>hydrateState', {
active: get().active,
});

if (get().active && connectorTagId && connectorTagId.length > 0) {
logRocketConsole(
'EndpointConfigHydrator>hydrateState>fetch>getSchema_Endpoint',
{
active: get().active,
}
);

const { data, error } = await getSchema_Endpoint(connectorTagId);

if (error) {
logRocketConsole(
'EndpointConfigHydrator>hydrateState>fetch>setHydrationErrorsExist',
{
active: get().active,
}
);
get().setHydrationErrorsExist(true);
}

if (get().active && data) {
logRocketConsole(
'EndpointConfigHydrator>hydrateState>fetch>setEndpointSchema'
);

await get().setEndpointSchema(
data.endpoint_spec_schema as unknown as Schema
);
Expand Down