Skip to content

Commit

Permalink
Merge pull request #1112 from cdapio/cp/1109-tink
Browse files Browse the repository at this point in the history
cherry pick [CDAP-20804] into release 6.9
  • Loading branch information
seanfeld authored Oct 5, 2023
2 parents 091f9cb + 7e37166 commit 14ef587
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function TransformAddButton({
// todo replace this with a useReducer
const [anchorEl, setAnchorEl] = useState(null);
const [subMenuAnchorEl, setSubMenuAnchorEl] = useState(null);
const [directive, setDirective] = useState(null);
const [directive, setDirective] = useState<'tink' | 'rename' | 'mask' | null>(null);
const [directiveText, setDirectiveText] = useState('');
const [maskAnchorEl, setMaskAnchorEl] = useState(null);
const maskOpen = !!maskAnchorEl;
Expand All @@ -46,9 +46,9 @@ export default function TransformAddButton({
setAnchorEl(event.currentTarget);
};

const handleMenuClick = (event) => {
setDirective(event.currentTarget.innerText);
setSubMenuAnchorEl(event.currentTarget);
const handleMenuClick = (directiveType: 'tink' | 'rename' | 'mask') => {
// set the type of directive we're using so add to transforms knows the context
setDirective(directiveType);
};

const handleClose = () => {
Expand Down Expand Up @@ -88,7 +88,7 @@ export default function TransformAddButton({

if (directive === 'tink') {
fullDirective = addTinkToTransforms(transformInfo);
} else if (directive === 'Rename') {
} else if (directive === 'rename') {
fullDirective = addRenameToTransforms(transformInfo);
} else {
fullDirective = addMaskToTransforms(transformInfo);
Expand Down Expand Up @@ -135,7 +135,10 @@ export default function TransformAddButton({
dense: true,
}}
>
<MenuItem onClick={handleMenuClick}>
<MenuItem onClick={(event) => {
handleMenuClick('rename');
setSubMenuAnchorEl(event.currentTarget);
}}>
Rename <ArrowRight />
</MenuItem>
<MenuItem disabled={!isString} onClick={handleMaskOpen}>
Expand Down Expand Up @@ -163,11 +166,17 @@ export default function TransformAddButton({
<MenuItem disabled={!isString} onClick={() => handleSetMaskLast(4)}>
Show last 4
</MenuItem>
<MenuItem disabled={!isString} onClick={handleMenuClick}>
<MenuItem disabled={!isString} onClick={(event) => {
handleMenuClick('mask');
setSubMenuAnchorEl(event.currentTarget);
}}>
Custom <ArrowRight />
</MenuItem>
{tinkEnabled && (
<MenuItem onClick={handleMenuClick}>
<MenuItem onClick={(event) => {
handleMenuClick('tink');
setSubMenuAnchorEl(event.currentTarget);
}}>
TINK <ArrowRight />
</MenuItem>
)}
Expand All @@ -194,7 +203,7 @@ export default function TransformAddButton({
<TextField
size="small"
id={`${row.name}-outlined-multiline-flexible-directive-text`}
label={directive === 'Custom' ? 'Mask (ie: right * 4)' : directive}
label={directive === 'mask' ? 'Mask (ie: right * 4)' : directive}
variant="outlined"
value={directiveText}
onChange={handleDirectiveChange}
Expand Down
1 change: 1 addition & 0 deletions src/e2e-test/features/wrangler.spanner.feature
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ Feature: Wrangler Spanner Tests
Then Verify URL navigation

@WRANGLER_SPANNER_TEST
@ignore
Scenario: Should delete an existing connection
When Open Connections Page
Then Delete Connection "spanner_randomtest1234"
Expand Down

0 comments on commit 14ef587

Please sign in to comment.