-
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
Open
travjenkins
wants to merge
53
commits into
main
Choose a base branch
from
travjenkins/feature/incompatible-schema-entity-level
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,056
−360
Open
Changes from all commits
Commits
Show all changes
53 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 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?