Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add alternative hostname support to snowflake * move hostname support out of additional details * Update modules/drivers/snowflake/src/metabase/driver/snowflake.clj * Update modules/drivers/snowflake/src/metabase/driver/snowflake.clj * Update modules/drivers/snowflake/test/metabase/driver/snowflake_test.clj * opt-in ---------
- Loading branch information
Showing
7 changed files
with
88 additions
and
5 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
.../databases/components/DatabaseHostnameSectionField/DatabaseHostameSectionField.styled.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,15 @@ | ||
import styled from "@emotion/styled"; | ||
|
||
import Button from "metabase/core/components/Button"; | ||
import { color } from "metabase/lib/colors"; | ||
|
||
export const SectionButton = styled(Button)` | ||
color: ${color("brand")}; | ||
padding: 0; | ||
border: none; | ||
border-radius: 0; | ||
&:hover { | ||
background-color: transparent; | ||
} | ||
`; |
32 changes: 32 additions & 0 deletions
32
...etabase/databases/components/DatabaseHostnameSectionField/DatabaseHostameSectionField.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,32 @@ | ||
import { useField } from "formik"; | ||
import { useCallback } from "react"; | ||
import { t } from "ttag"; | ||
|
||
import FormField from "metabase/core/components/FormField"; | ||
|
||
import { SectionButton } from "./DatabaseHostameSectionField.styled"; | ||
|
||
export interface DatabaseHostnameSectionFieldProps { | ||
name: string; | ||
} | ||
|
||
const DatabaseHostnameSectionField = ({ | ||
name, | ||
}: DatabaseHostnameSectionFieldProps): JSX.Element => { | ||
const [{ value }, , { setValue }] = useField(name); | ||
|
||
const handleClick = useCallback(() => { | ||
setValue(!value); | ||
}, [value, setValue]); | ||
|
||
return ( | ||
<FormField> | ||
<SectionButton type="button" onClick={handleClick}> | ||
{value ? t`Use hostname` : t`Use account name`} | ||
</SectionButton> | ||
</FormField> | ||
); | ||
}; | ||
|
||
// eslint-disable-next-line import/no-default-export -- deprecated usage | ||
export default DatabaseHostnameSectionField; |
2 changes: 2 additions & 0 deletions
2
frontend/src/metabase/databases/components/DatabaseHostnameSectionField/index.ts
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,2 @@ | ||
// eslint-disable-next-line import/no-default-export -- deprecated usage | ||
export { default } from "./DatabaseHostameSectionField"; |
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
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