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

DataFlow backfill - disabled but most of the functionality is there #1261

Merged
merged 70 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
a4cf14b
Turning everything back on
travjenkins Sep 16, 2024
48a53e8
Moving steps stuff into a manual machine state in a store
travjenkins Sep 16, 2024
89736ca
Getting actions buttons wired up
travjenkins Sep 16, 2024
9a03b21
Moving more stuff into content
travjenkins Sep 16, 2024
46775ca
checking first step
travjenkins Sep 16, 2024
c0491d3
Updating typing a lot
travjenkins Sep 17, 2024
f820b36
typing tweaks
travjenkins Sep 17, 2024
38ee682
Storing off step definition
travjenkins Sep 17, 2024
6ffd672
Updating key to keep consistent
travjenkins Sep 17, 2024
afebcf9
Adding support for a context to store data... but this feels wrong
travjenkins Sep 17, 2024
d5b94e1
adding quick support to store off things in a keyed / machine way
travjenkins Sep 17, 2024
1cf48d3
cleaning up handled as we are not using this
travjenkins Sep 17, 2024
1cf6db5
Forcing to pass an index when updating a step
travjenkins Sep 17, 2024
2ce4b59
quick hack and typing update
travjenkins Sep 17, 2024
cf48496
Checking locked to skip showing the load bar
travjenkins Sep 18, 2024
0e329e9
Adding handled to get no response when an insert is done to reduce ne…
travjenkins Sep 18, 2024
8cacc59
Storing stuff to re-enable the capture
travjenkins Sep 18, 2024
232e8b9
marking valid so the next step works
travjenkins Sep 18, 2024
9503ce3
Starting to wire up the last step
travjenkins Sep 18, 2024
cdb05a9
Updating ChipList to:
travjenkins Sep 19, 2024
e94ff64
Making code a bit safer
travjenkins Sep 19, 2024
fd5ad1f
Typing for chiplist changes
travjenkins Sep 19, 2024
c46a656
styling the options better so the collections don't overlap the option
travjenkins Sep 19, 2024
653a701
Reset the state when leaving the flow
travjenkins Sep 19, 2024
67a86e6
Probably best to just store the publication status as a whole
travjenkins Sep 19, 2024
39e905f
Adding a "review selections" step as an idea
travjenkins Sep 19, 2024
3e43464
Refactoring to reduce need of functions
travjenkins Sep 19, 2024
6238b84
Resetting when closing as doing it in store is not working
travjenkins Sep 19, 2024
bdedc89
Moving hydrator within modal so it is always reset when opening and c…
travjenkins Sep 19, 2024
3a9d9fb
Breaking out the review table
travjenkins Sep 19, 2024
447d2b1
Adding more plural support
travjenkins Sep 19, 2024
84c8f67
Updating content as requested
travjenkins Sep 19, 2024
88e71f8
styling tweaks
travjenkins Sep 19, 2024
147c999
Putting routes nested
travjenkins Sep 19, 2024
6b0c903
Sharing the link to details
travjenkins Sep 19, 2024
0670fe8
A bit better error handling and messaging
travjenkins Sep 19, 2024
8ef6fed
clearing our errors when success
travjenkins Sep 19, 2024
b4eea48
Using related collections list
travjenkins Sep 19, 2024
a136944
Making sure we only count the enabled bindings in the list
travjenkins Sep 24, 2024
3c4a4dd
cleaning up hook that is not used
travjenkins Sep 24, 2024
6c95eab
Fixing the warning to display correctly
travjenkins Sep 24, 2024
1f4a57d
Making the save and publish logging and warning shared
travjenkins Sep 24, 2024
f72ddf4
Moved to a component fold
travjenkins Sep 24, 2024
29b55ce
Updating handling
travjenkins Sep 24, 2024
aa61b36
Ended up not needing the hook
travjenkins Sep 24, 2024
aa31af2
Updating messaging
travjenkins Sep 24, 2024
97682e3
Not show logs right away
travjenkins Sep 24, 2024
bb95c6a
Merge remote-tracking branch 'origin/main' into travjenkins/feature/f…
travjenkins Sep 24, 2024
ab92377
Merge remote-tracking branch 'origin/main' into travjenkins/feature/f…
travjenkins Sep 24, 2024
b38dc4d
Merge branch 'main' into travjenkins/feature/full-entity-refresh/serv…
travjenkins Sep 24, 2024
dc81e37
Adding a uuid so make things a bit more traceable
travjenkins Sep 25, 2024
f1abfca
Adding a LR event to try to make these sessions easier to find
travjenkins Sep 25, 2024
01b7099
Cleaning up comments
travjenkins Sep 25, 2024
9c4c128
Cleaning up comments
travjenkins Sep 25, 2024
e64c7d3
Adding some handling for draft errors
travjenkins Sep 25, 2024
e10ca70
Wiring up to exit the flow when complete
travjenkins Sep 25, 2024
6b3396b
Updating details message
travjenkins Sep 25, 2024
35ee6d8
Disabling all the new stuff so this can be merged
travjenkins Sep 25, 2024
a4a6de2
Removing `detail` from the forms.
travjenkins Sep 25, 2024
bb93b11
Removing code that is not needed
travjenkins Sep 25, 2024
44efb6b
PR: comments
travjenkins Sep 25, 2024
ff37f81
PR: commenting out function that isn't used
travjenkins Sep 25, 2024
7e7e6fe
PR: commenting out to disable this
travjenkins Sep 25, 2024
e2efcb6
Making code a bit simpler
travjenkins Sep 25, 2024
a89a4fe
Getting the chips aligned
travjenkins Sep 25, 2024
e901568
PR: putting original count back in
travjenkins Sep 25, 2024
c4e48f8
Updating content to be more clear
travjenkins Sep 25, 2024
6750662
PR: typo and small content change
travjenkins Sep 25, 2024
8396d89
PR: content typo
travjenkins Sep 25, 2024
2e80049
Merge branch 'main' into travjenkins/feature/full-entity-refresh/serv…
travjenkins Sep 25, 2024
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
5 changes: 3 additions & 2 deletions src/api/draftSpecs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export const createDraftSpec = (
catalogName: string,
draftSpec: any,
specType?: Entity | null,
lastPubId?: string | null
lastPubId?: string | null,
noResponse?: boolean
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A simple way to make sure extra data is not returned. This matches how the newer API for Supabase works. However, a lot of code relies on it so making it a flag for now.

) => {
let matchData: CreateMatchData = {
draft_id: draftId,
Expand All @@ -55,7 +56,7 @@ export const createDraftSpec = (
matchData = { ...matchData, expect_pub_id: lastPubId };
}

return insertSupabase(TABLES.DRAFT_SPECS, matchData);
return insertSupabase(TABLES.DRAFT_SPECS, matchData, noResponse);
};

export const modifyDraftSpec = (
Expand Down
49 changes: 47 additions & 2 deletions src/api/liveSpecsExt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ export interface LiveSpecsExtQuery_DetailsForm {
spec_type: Entity;
spec: any;
data_plane_id: string;
detail: string | null;
connector_tag_id: string;
connector_image_name: string;
connector_image_tag: string;
Expand All @@ -219,7 +218,6 @@ const DETAILS_FORM_QUERY = `
spec_type,
spec,
data_plane_id,
detail,
connector_tag_id,
connector_image_name,
connector_image_tag,
Expand Down Expand Up @@ -372,6 +370,14 @@ const getLiveSpecsByLiveSpecId = async (liveSpecId: string) => {
return data;
};

const getLiveSpecSpec = (liveSpecId: string) => {
return supabaseClient
.from(TABLES.LIVE_SPECS_EXT)
.select(`spec`)
.eq('id', liveSpecId)
.single();
};

const getLiveSpecShards = (tenant: string, entityType: Entity) => {
return supabaseClient
.from(TABLES.LIVE_SPECS_EXT)
Expand All @@ -380,6 +386,44 @@ const getLiveSpecShards = (tenant: string, entityType: Entity) => {
.eq('spec_type', entityType);
};

const liveSpecsExtRelatedColumns = ['catalog_name', 'reads_from', 'id'];
export const liveSpecsExtRelatedQuery = liveSpecsExtRelatedColumns.join(',');
export interface LiveSpecsExt_Related {
catalog_name: string;
reads_from: string[];
id: string;
}
// const getLiveSpecsRelatedToMaterialization = async (
// collectionNames: string[]
// ) => {
// const limiter = pLimit(3);
// const promises = [];
// let index = 0;

// // TODO (retry) promise generator
// const promiseGenerator = (idx: number) => {
// return supabaseClient
// .from(TABLES.LIVE_SPECS_EXT)
// .select(liveSpecsExtRelatedQuery)
// .eq('spec_type', 'materialization')
// .overlaps(
// 'reads_from',
// collectionNames.slice(idx, idx + CHUNK_SIZE)
// )
// .returns<LiveSpecsExt_Related[]>();
// };

// while (index < collectionNames.length) {
// const prom = promiseGenerator(index);
// promises.push(limiter(() => prom));
// index = index + CHUNK_SIZE;
// }

// const response = await Promise.all(promises);
// const errors = response.filter((r) => r.error);
// return errors[0] ?? response[0];
// };

export {
getLiveSpecs_captures,
getLiveSpecs_collections,
Expand All @@ -392,4 +436,5 @@ export {
getLiveSpecsByConnectorId,
getLiveSpecsByLiveSpecId,
getLiveSpecShards,
getLiveSpecSpec,
};
11 changes: 6 additions & 5 deletions src/components/editor/Bindings/Backfill/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import {
useBinding_currentCollection,
useBinding_currentBindingUUID,
useBinding_setBackfilledBindings,
useBinding_collections_count,
useBinding_backfillSupported,
useBinding_enabledCollections_count,
} from 'stores/Binding/hooks';
import {
useFormStateStore_isActive,
Expand All @@ -36,7 +36,7 @@ function Backfill({ description, bindingIndex = -1 }: BackfillProps) {
// Binding Store
const currentCollection = useBinding_currentCollection();
const currentBindingUUID = useBinding_currentBindingUUID();
const collectionsCount = useBinding_collections_count();
const collectionsCount = useBinding_enabledCollections_count();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to disable the "backfill all" button only when there are no enabled bindings

const allBindingsDisabled = useBinding_allBindingsDisabled();

const backfillAllBindings = useBinding_backfillAllBindings();
Expand Down Expand Up @@ -199,10 +199,11 @@ function Backfill({ description, bindingIndex = -1 }: BackfillProps) {
) : null}
</Stack>

{/*TODO (data flow reset)*/}
{/* {bindingIndex === -1 && workflow === 'capture_edit' ? (
{/*TODO (data flow reset)
travjenkins marked this conversation as resolved.
Show resolved Hide resolved
{bindingIndex === -1 && workflow === 'capture_edit' ? (
<BackfillDataFlowOption />
) : null}*/}
) : null}
*/}
</Box>
);
}
Expand Down
8 changes: 3 additions & 5 deletions src/components/editor/Bindings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ function BindingsMultiEditor({
{workflow === 'capture_edit' ||
workflow === 'materialization_edit' ? (
<Backfill
description={
<FormattedMessage
id={`workflows.collectionSelector.manualBackfill.message.${entityType}.allBindings`}
/>
}
description={intl.formatMessage({
id: `workflows.collectionSelector.manualBackfill.message.${entityType}.allBindings`,
})}
/>
) : null}
</Stack>
Expand Down
89 changes: 50 additions & 39 deletions src/components/editor/Shards/Disable/Warning.tsx
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing this warning message showing all the time. Also, moved the logic to show and hide into the component itself to reduce extra renders elsewhere.

Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,61 @@ import { FormattedMessage } from 'react-intl';
import { useEntityType } from 'context/EntityContext';

import AlertBox from 'components/shared/AlertBox';
import useGlobalSearchParams, {
GlobalSearchParams,
} from 'hooks/searchParams/useGlobalSearchParams';

function ShardsDisableWarning() {
const forcedToEnable = useGlobalSearchParams<number>(
GlobalSearchParams.FORCED_SHARD_ENABLE
);

const entityType = useEntityType();

return (
<Box
sx={{
'mb': 2,
'& .MuiAlertTitle-root': {
textTransform: 'capitalize',
},
}}
>
<AlertBox
short
severity="warning"
title={
<FormattedMessage
id="workflows.disable.autoEnabledAlert.title"
values={{
entityType,
}}
/>
}
if (forcedToEnable === 0) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the main change

return (
<Box
sx={{
'mb': 2,
'& .MuiAlertTitle-root': {
textTransform: 'capitalize',
},
}}
>
<Box>
<FormattedMessage
id="workflows.disable.autoEnabledAlert.message"
values={{
entityType,
}}
/>
</Box>
<Box>
<FormattedMessage
id="workflows.disable.autoEnabledAlert.instructions"
values={{
entityType,
}}
/>
</Box>
</AlertBox>
</Box>
);
<AlertBox
short
severity="warning"
title={
<FormattedMessage
id="workflows.disable.autoEnabledAlert.title"
values={{
entityType,
}}
/>
}
>
<Box>
<FormattedMessage
id="workflows.disable.autoEnabledAlert.message"
values={{
entityType,
}}
/>
</Box>
<Box>
<FormattedMessage
id="workflows.disable.autoEnabledAlert.instructions"
values={{
entityType,
}}
/>
</Box>
</AlertBox>
</Box>
);
}

return null;
}

export default ShardsDisableWarning;
10 changes: 2 additions & 8 deletions src/components/editor/Shards/Disable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@ import { Stack, Typography } from '@mui/material';
import { FormattedMessage } from 'react-intl';
import { useEntityType } from 'context/EntityContext';
import { useEditorStore_persistedDraftId } from 'components/editor/Store/hooks';
import useGlobalSearchParams, {
GlobalSearchParams,
} from 'hooks/searchParams/useGlobalSearchParams';

import ShardsDisableForm from './Form';
import ShardsDisableWarning from './Warning';

function ShardsDisable() {
const forcedToEnable = useGlobalSearchParams(
GlobalSearchParams.FORCED_SHARD_ENABLE
);

const entityType = useEntityType();

const draftId = useEditorStore_persistedDraftId();
Expand All @@ -23,7 +17,7 @@ function ShardsDisable() {

return (
<>
{forcedToEnable ? <ShardsDisableWarning /> : null}
<ShardsDisableWarning />

<Stack spacing={1} sx={{ mb: 2 }}>
<Typography variant="formSectionHeader">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { Stack, Typography } from '@mui/material';
import { PostgrestError } from '@supabase/postgrest-js';
import { authenticatedRoutes } from 'app/routes';
import LinkWrapper from 'components/shared/LinkWrapper';
import {
semiTransparentBackground_blue,
semiTransparentBackground_purple,
semiTransparentBackground_teal,
} from 'context/Theme';
import { CloudDownload, CloudUpload, DatabaseScript } from 'iconoir-react';

import { FormattedMessage, useIntl } from 'react-intl';
import { Entity } from 'types';
import { ENTITY_SETTINGS } from 'utils/entity-utils';
import ActiveEntityCount from './ActiveEntityCount';
import Statistic from './Statistic';

Expand All @@ -21,56 +16,6 @@ interface Props {
monthlyUsageLoading?: boolean;
}

const getEntityPageURLPath = (entityType: string): string => {
if (entityType === 'collection') {
return authenticatedRoutes.collections.fullPath;
}

if (entityType === 'capture') {
return authenticatedRoutes.captures.fullPath;
}

return authenticatedRoutes.materializations.fullPath;
};

const getTitleId = (entityType: string): string => {
if (entityType === 'collection') {
return 'terms.collections';
}

if (entityType === 'capture') {
return 'terms.sources';
}

return 'terms.destinations';
};

const getBackgroundColor = (
entityType: string
): { dark: string; light: string } => {
if (entityType === 'collection') {
return semiTransparentBackground_blue;
}

if (entityType === 'capture') {
return semiTransparentBackground_teal;
}

return semiTransparentBackground_purple;
};

const getEntityIcon = (entityType: string) => {
if (entityType === 'collection') {
return DatabaseScript;
}

if (entityType === 'capture') {
return CloudUpload;
}

return CloudDownload;
};

export default function StatOverview({
entityType,
monthlyUsage,
Expand All @@ -80,11 +25,12 @@ export default function StatOverview({
}: Props) {
const intl = useIntl();

const route = getEntityPageURLPath(entityType);
const titleId = getTitleId(entityType);

const background = getBackgroundColor(entityType);
const Icon = getEntityIcon(entityType);
const {
routes: { viewAll },
termId: titleId,
background,
Icon,
} = ENTITY_SETTINGS[entityType];
Comment on lines +28 to +33
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing function call to just referencing object directly.


return (
<Stack
Expand Down Expand Up @@ -117,7 +63,7 @@ export default function StatOverview({
</Typography>
</Stack>

<LinkWrapper link={route}>
<LinkWrapper link={viewAll}>
<FormattedMessage id="cta.goToAll" />
</LinkWrapper>
</Stack>
Expand Down
Loading