-
Notifications
You must be signed in to change notification settings - Fork 1
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
Enabling entity level setting for sourceCapture
optional settings
#1326
Merged
travjenkins
merged 60 commits into
main
from
travjenkins/feature/incompatible-schema-entity-level
Dec 5, 2024
Merged
Changes from 50 commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
25f61b0
Moving file and adding new section
travjenkins d5083a7
Merge branch 'main' into travjenkins/feature/incompatible-schema-enti…
travjenkins 72d8b19
Merge remote-tracking branch 'origin/main' into travjenkins/feature/i…
travjenkins fea1924
Starting wiring up stuff. Going to end up sharing a lot of this code
travjenkins 8075993
Merge branch 'main' into travjenkins/feature/incompatible-schema-enti…
travjenkins faea0de
Switching to new design where both settings are just switches
travjenkins 2be4a10
Merge remote-tracking branch 'origin/main' into travjenkins/feature/i…
travjenkins 3be6125
adding items to the store
travjenkins c7b33d1
Moving everything inside the chip
travjenkins 688e424
Moving everything inside the chip as requested
travjenkins 4dca48b
Fixing the delete button size
travjenkins 7777ede
Adding some more space
travjenkins 3349e4a
more spacing tweaks
travjenkins 49055ca
tweaking spacing a bit more
travjenkins d8af346
final spacing tweak
travjenkins f45097f
more work to get the styling right
travjenkins a813a3d
this is so gross but works and I am out of patience
travjenkins e68e51c
Starting to wire up passing around the new props
travjenkins 3dc7ff6
Making this fetch just grab the object we need
travjenkins 8c921a0
TODO
travjenkins ecc9ac6
moving around and adding util functions
travjenkins 752b262
Doing deeper compares to know when to update (so flags are updated pr…
travjenkins 003bda8
Getting some more specific typing handled
travjenkins e661964
Won't need binding index because these settings are INSIDE the resource
travjenkins b7e583f
reducing duplication for json schema annotations
travjenkins 954b42e
Starting to wire up if the optional settings are supported
travjenkins d6f7828
Moving some shared stuff out to make file smaller
travjenkins eaf7f57
Moving some content to lang files
travjenkins 9635b2d
Merge remote-tracking branch 'origin/main' into travjenkins/feature/i…
travjenkins 2e56e23
Adding support for the labels to always show
travjenkins 9973289
Do not need to mess with opacity
travjenkins 77c8293
Changing how we generate our AJV instance
travjenkins e6aa9e3
Disabling stuff so this can be merged while we wait on the new wasm
travjenkins cfa6e26
disabling always updating
travjenkins a762449
putting everything back in
travjenkins 0727a7d
Getting the initial loading working
travjenkins 0933a0d
Removing some of the code to handle setting on bindings as that will be
travjenkins a8d153d
A better way to default settings just for edit
travjenkins a178979
Merge branch 'main' into travjenkins/feature/incompatible-schema-enti…
travjenkins 393e161
Being safe and checking if the form is active. Hard to open the modal
travjenkins 4471f04
Removing an unused file from a previous approach
travjenkins c062aa4
cleaning up logging
travjenkins c449b99
Not used
travjenkins 76683b3
pr: noting why a hack exists
travjenkins a52b7ea
removing TODO as this seems alright now
travjenkins a0fb0c7
Using the shared hook and merging the updates in
travjenkins 1fdd888
Renaming files
travjenkins 8349a56
not needed
travjenkins c96ca7a
marking todo
travjenkins ff5d994
marking todo
travjenkins 4eb0b59
removing commented code
travjenkins b028f0b
Not needed
travjenkins d44619e
Merge remote-tracking branch 'origin/main' into travjenkins/feature/i…
travjenkins a93eedb
PR: copy and paste design bug
travjenkins 0e3dfaf
Need to always make sure the input assume it is a boolean
travjenkins 5235df5
Need the memo to stop extra renders
travjenkins b9f4c74
keeping the optional settings rendering like buttons so we can always
travjenkins be7d94d
This needs to get each independent part of the def because it needs
travjenkins a7879c7
Similar to add where it is safest to piece this together
travjenkins 6d51ce4
Merge branch 'main' into travjenkins/feature/incompatible-schema-enti…
travjenkins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { AddDialogProps } from 'components/shared/Entity/AddDialog/types'; | ||
import { ReactNode } from 'react'; | ||
|
||
export interface CollectionSelectorProps { | ||
selectedCollections: string[]; | ||
AddSelectedButton: AddDialogProps['PrimaryCTA']; | ||
itemType?: string; | ||
readOnly?: boolean; | ||
RediscoverButton?: ReactNode; | ||
} | ||
|
||
export interface BindingsEditorAddProps { | ||
selectedCollections: string[]; | ||
AddSelectedButton: AddDialogProps['PrimaryCTA']; | ||
disabled?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { FormControl, FormControlLabel, Stack, Switch } from '@mui/material'; | ||
import { useIntl } from 'react-intl'; | ||
import { useFormStateStore_isActive } from 'stores/FormState/hooks'; | ||
import { useSourceCaptureStore } from 'stores/SourceCapture/Store'; | ||
|
||
// https://docs.estuary.dev/concepts/materialization/#delta-updates | ||
function DeltaUpdates() { | ||
const intl = useIntl(); | ||
|
||
const formActive = useFormStateStore_isActive(); | ||
|
||
const [deltaUpdates, setDeltaUpdates] = useSourceCaptureStore((state) => [ | ||
state.deltaUpdates, | ||
state.setDeltaUpdates, | ||
]); | ||
|
||
return ( | ||
<Stack spacing={2} sx={{ maxWidth: 'fit-content' }}> | ||
<FormControl> | ||
<FormControlLabel | ||
control={ | ||
<Switch | ||
size="small" | ||
value={deltaUpdates} | ||
checked={deltaUpdates} | ||
disabled={formActive} | ||
onChange={(event, checked) => { | ||
setDeltaUpdates(checked); | ||
}} | ||
/> | ||
} | ||
label={intl.formatMessage({ | ||
id: 'workflows.sourceCapture.optionalSettings.deltaUpdates.control', | ||
})} | ||
/> | ||
</FormControl> | ||
</Stack> | ||
); | ||
} | ||
|
||
export default DeltaUpdates; |
23 changes: 23 additions & 0 deletions
23
src/components/editor/Bindings/SchemaMode/SelectorOption.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Stack, Typography } from '@mui/material'; | ||
import { SelectorOptionProps } from './types'; | ||
|
||
function SelectorOption({ option }: SelectorOptionProps) { | ||
const { description, label } = option; | ||
|
||
return ( | ||
<Stack component="span" spacing={1}> | ||
<Typography component="span">{label}</Typography> | ||
<Typography | ||
component="span" | ||
variant="caption" | ||
sx={{ | ||
pl: 1.5, | ||
}} | ||
> | ||
{description} | ||
</Typography> | ||
</Stack> | ||
); | ||
} | ||
|
||
export default SelectorOption; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { FormControl, FormControlLabel, Switch } from '@mui/material'; | ||
import { useIntl } from 'react-intl'; | ||
import { useFormStateStore_isActive } from 'stores/FormState/hooks'; | ||
import { useSourceCaptureStore } from 'stores/SourceCapture/Store'; | ||
|
||
function SchemaMode() { | ||
const intl = useIntl(); | ||
|
||
const formActive = useFormStateStore_isActive(); | ||
|
||
const [targetSchema, setTargetSchema] = useSourceCaptureStore((state) => [ | ||
state.targetSchema, | ||
state.setTargetSchema, | ||
]); | ||
|
||
return ( | ||
<FormControl> | ||
<FormControlLabel | ||
control={ | ||
<Switch | ||
size="small" | ||
value={targetSchema} | ||
checked={targetSchema === 'fromSourceName'} | ||
disabled={formActive} | ||
onChange={(event, checked) => { | ||
setTargetSchema( | ||
checked ? 'fromSourceName' : 'leaveEmpty' | ||
); | ||
}} | ||
/> | ||
} | ||
label={intl.formatMessage({ | ||
id: 'workflows.sourceCapture.optionalSettings.targetSchema.control', | ||
})} | ||
/> | ||
</FormControl> | ||
); | ||
} | ||
|
||
export default SchemaMode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { getTypedAutoCompleteDefaults } from 'components/shared/AutoComplete/DefaultProps'; | ||
import { AutoCompleteOption } from './types'; | ||
|
||
export const choices = ['leaveEmpty', 'fromSourceName'] as const; | ||
|
||
export const autoCompleteDefaultProps = | ||
getTypedAutoCompleteDefaults<AutoCompleteOption>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { choices } from './shared'; | ||
|
||
export interface AutoCompleteOption { | ||
description: string; | ||
label: string; | ||
val: (typeof choices)[number]; | ||
} | ||
|
||
export interface SelectorOptionProps { | ||
option: AutoCompleteOption; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/components/materialization/SourceCapture/CancelSourceCaptureButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Button } from '@mui/material'; | ||
import { AddCollectionDialogCTAProps } from 'components/shared/Entity/types'; | ||
import { useRef } from 'react'; | ||
|
||
import { FormattedMessage } from 'react-intl'; | ||
import { useMount } from 'react-use'; | ||
import { | ||
useSourceCaptureStore_setSourceCaptureDefinition, | ||
useSourceCaptureStore_sourceCaptureDefinition, | ||
} from 'stores/SourceCapture/hooks'; | ||
|
||
import { SourceCaptureDef } from 'types'; | ||
|
||
function CancelSourceCaptureButton({ toggle }: AddCollectionDialogCTAProps) { | ||
// This is here so that we can switch settings back to how they originally were. | ||
// Since the Source Capture modal has a 'cancel' button we need to allow the user | ||
// to change the optional settings and then click cancel and not change anything | ||
// on their draft. | ||
const settingsCacheHack = useRef<SourceCaptureDef | null>(null); | ||
|
||
const sourceCaptureDefinition = | ||
useSourceCaptureStore_sourceCaptureDefinition(); | ||
const setSourceCaptureDefinition = | ||
useSourceCaptureStore_setSourceCaptureDefinition(); | ||
|
||
const close = async () => { | ||
if (settingsCacheHack.current) { | ||
if (settingsCacheHack.current.capture.length > 0) { | ||
setSourceCaptureDefinition(settingsCacheHack.current); | ||
} else { | ||
setSourceCaptureDefinition(null); | ||
} | ||
} | ||
|
||
toggle(false); | ||
}; | ||
|
||
useMount(() => { | ||
settingsCacheHack.current = sourceCaptureDefinition; | ||
}); | ||
|
||
return ( | ||
<Button variant="contained" onClick={close}> | ||
<FormattedMessage id="cta.cancel" /> | ||
</Button> | ||
); | ||
} | ||
|
||
export default CancelSourceCaptureButton; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why use the
contained
variant for this Cancel button and not one of lesser weight?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.
Copy and paste error - it is supposed to be outlined like it is today.