The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
import { useFormikContext } from "formik";
import { t } from "ttag";
import { FormTextInput } from "metabase/forms";
import { useGetAdminSettingsDetailsQuery } from "metabase/settings";
import { Box, Text } from "metabase/ui";
import { TOKEN_KEY, URL_KEY } from "../../constants";
import type { RemoteSyncSettingsFormState } from "../../types";
import { getEnvSettingProps } from "../../utils";
import { GitTestConnectionButton } from "./GitTestConnectionButton";
import { RemoteSyncSettingsSection } from "./RemoteSyncSettingsSection";
export const GitSettingsSection = () => {
const { values } = useFormikContext<RemoteSyncSettingsFormState>();
const { data: settingDetails } = useGetAdminSettingsDetailsQuery();
return (
<RemoteSyncSettingsSection title={t`Git settings`}>
<FormTextInput
name={URL_KEY}
label={t`Repository URL`}
placeholder="https://git-host.example.com/yourcompany/repo.git"
labelProps={{ mb: "0.75rem" }}
{...getEnvSettingProps(settingDetails?.[URL_KEY])}
/>
<FormTextInput
name={TOKEN_KEY}
label={t`Access Token`}
description={
<Text c="text-secondary" size="sm" lh="md" component="span">
{t`Personal access token with write permissions`}
</Text>
}
type="password"
{...getEnvSettingProps(settingDetails?.[TOKEN_KEY], {
inputWrapperOrder: ["label", "description", "error"],
})}
/>
<Box>
<GitTestConnectionButton
url={values[URL_KEY]}
token={values[TOKEN_KEY]}
/>
</Box>
</RemoteSyncSettingsSection>
);
};