-
Notifications
You must be signed in to change notification settings - Fork 2
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
Changes from 63 commits
a4cf14b
48a53e8
89736ca
9a03b21
46775ca
c0491d3
f820b36
38ee682
6ffd672
afebcf9
d5b94e1
1cf48d3
1cf6db5
2ce4b59
cf48496
0e329e9
8cacc59
232e8b9
9503ce3
cdb05a9
e94ff64
fd5ad1f
c46a656
653a701
67a86e6
39e905f
3e43464
6238b84
bdedc89
3a9d9fb
447d2b1
84c8f67
88e71f8
147c999
6b0c903
0670fe8
8ef6fed
b4eea48
a136944
3c4a4dd
6c95eab
1f4a57d
f72ddf4
29b55ce
aa61b36
aa31af2
97682e3
bb95c6a
ab92377
b38dc4d
dc81e37
f1abfca
01b7099
9c4c128
e64c7d3
e10ca70
6b3396b
35ee6d8
a4a6de2
bb93b11
44efb6b
ff37f81
7e7e6fe
e2efcb6
a89a4fe
e901568
c4e48f8
6750662
8396d89
2e80049
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import { useMemo } from 'react'; | |
import { useIntl } from 'react-intl'; | ||
import { | ||
useBinding_backfilledBindings_count, | ||
useBinding_collections_count, | ||
useBinding_enabledCollections_count, | ||
} from 'stores/Binding/hooks'; | ||
import { BackfillCountProps } from './types'; | ||
|
||
|
@@ -13,7 +13,7 @@ function BackfillCount({ disabled }: BackfillCountProps) { | |
const entityType = useEntityType(); | ||
|
||
const backfillCount = useBinding_backfilledBindings_count(); | ||
const bindingsTotal = useBinding_collections_count(); | ||
const bindingsTotal = useBinding_enabledCollections_count(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Switching to only count enabled collections
travjenkins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// Only reason noBackfill is in here is because we are already running the memo on backfillCount change | ||
const [noBackfill, itemType_backfill, itemType_bindings] = useMemo(() => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
|
@@ -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(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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(); | ||
|
@@ -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> | ||
); | ||
} | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
---|---|---|
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; |
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'; | ||
|
||
|
@@ -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, | ||
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replacing function call to just referencing object directly. |
||
|
||
return ( | ||
<Stack | ||
|
@@ -117,7 +63,7 @@ export default function StatOverview({ | |
</Typography> | ||
</Stack> | ||
|
||
<LinkWrapper link={route}> | ||
<LinkWrapper link={viewAll}> | ||
<FormattedMessage id="cta.goToAll" /> | ||
</LinkWrapper> | ||
</Stack> | ||
|
There was a problem hiding this comment.
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.