mirror of
https://github.com/harness/drone.git
synced 2025-05-05 23:42:57 +00:00
fix: [CODE-3500] put UI Git LFS support in the repository setting behind FF (#3698)
This commit is contained in:
parent
8b277e62d7
commit
799a8b0de8
@ -83,6 +83,7 @@ const GeneralSettingsContent = (props: GeneralSettingsProps) => {
|
|||||||
path: `/api/v1/repos/${repoMetadata?.path}/+/public-access`
|
path: `/api/v1/repos/${repoMetadata?.path}/+/public-access`
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { CODE_GIT_LFS_ENABLED } = hooks?.useFeatureFlags()
|
||||||
const { data: generalSettingsData, refetch: refetchSettings } = useGet({
|
const { data: generalSettingsData, refetch: refetchSettings } = useGet({
|
||||||
path: `/api/v1/repos/${repoMetadata?.path}/+/settings/general`,
|
path: `/api/v1/repos/${repoMetadata?.path}/+/settings/general`,
|
||||||
queryParams: { routingId: routingId }
|
queryParams: { routingId: routingId }
|
||||||
@ -425,56 +426,58 @@ const GeneralSettingsContent = (props: GeneralSettingsProps) => {
|
|||||||
</Layout.Horizontal>
|
</Layout.Horizontal>
|
||||||
</Container>
|
</Container>
|
||||||
</Render>
|
</Render>
|
||||||
<Container padding="medium" margin={{ bottom: 'medium' }} className={css.generalContainer}>
|
<Render when={standalone || CODE_GIT_LFS_ENABLED}>
|
||||||
<Layout.Horizontal padding={{ bottom: 'medium' }}>
|
<Container padding="medium" margin={{ bottom: 'medium' }} className={css.generalContainer}>
|
||||||
<Container className={css.label}>
|
<Layout.Horizontal padding={{ bottom: 'medium' }}>
|
||||||
<Text color={Color.GREY_600} className={css.textSize} margin={{ top: 'medium' }}>
|
<Container className={css.label}>
|
||||||
{getString('generalSetting.features')}
|
<Text color={Color.GREY_600} className={css.textSize} margin={{ top: 'medium' }}>
|
||||||
</Text>
|
{getString('generalSetting.features')}
|
||||||
</Container>
|
</Text>
|
||||||
<Layout.Vertical spacing="small" padding={{ button: 'small', top: 'small' }}>
|
|
||||||
<Container className={css.content}>
|
|
||||||
<Layout.Horizontal flex={{ alignItems: 'center' }} spacing={'small'}>
|
|
||||||
<FormInput.Toggle
|
|
||||||
{...permissionProps(permEditResult, standalone)}
|
|
||||||
key={'gitLFSEnabled'}
|
|
||||||
style={{ margin: '0px' }}
|
|
||||||
label=""
|
|
||||||
name="gitLFSEnabled"
|
|
||||||
/>
|
|
||||||
<Text color={Color.GREY_800} className={css.featureText}>
|
|
||||||
{getString('generalSetting.gitLFSEnable')}
|
|
||||||
</Text>
|
|
||||||
<Text color={Color.GREY_500} className={css.featureText}>
|
|
||||||
{getString('generalSetting.gitLFSEnableDesc')}
|
|
||||||
</Text>
|
|
||||||
</Layout.Horizontal>
|
|
||||||
<Layout.Horizontal className={css.buttonContainer}>
|
|
||||||
{generalSettingsData?.git_lfs_enabled !== formik.values.gitLFSEnabled ? (
|
|
||||||
<Button
|
|
||||||
margin={{ top: 'medium' }}
|
|
||||||
type="submit"
|
|
||||||
text={getString('save')}
|
|
||||||
variation={ButtonVariation.PRIMARY}
|
|
||||||
size={ButtonSize.SMALL}
|
|
||||||
onClick={() => {
|
|
||||||
updateGeneralSettings({ git_lfs_enabled: formik.values.gitLFSEnabled })
|
|
||||||
.then(() => {
|
|
||||||
showSuccess(getString('repoUpdate'))
|
|
||||||
refetchSettings()
|
|
||||||
})
|
|
||||||
.catch(err => {
|
|
||||||
showError(getErrorMessage(err))
|
|
||||||
})
|
|
||||||
}}
|
|
||||||
{...permissionProps(permEditResult, standalone)}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
</Layout.Horizontal>
|
|
||||||
</Container>
|
</Container>
|
||||||
</Layout.Vertical>
|
<Layout.Vertical spacing="small" padding={{ button: 'small', top: 'small' }}>
|
||||||
</Layout.Horizontal>
|
<Container className={css.content}>
|
||||||
</Container>
|
<Layout.Horizontal flex={{ alignItems: 'center' }} spacing={'small'}>
|
||||||
|
<FormInput.Toggle
|
||||||
|
{...permissionProps(permEditResult, standalone)}
|
||||||
|
key={'gitLFSEnabled'}
|
||||||
|
style={{ margin: '0px' }}
|
||||||
|
label=""
|
||||||
|
name="gitLFSEnabled"
|
||||||
|
/>
|
||||||
|
<Text color={Color.GREY_800} className={css.featureText}>
|
||||||
|
{getString('generalSetting.gitLFSEnable')}
|
||||||
|
</Text>
|
||||||
|
<Text color={Color.GREY_500} className={css.featureText}>
|
||||||
|
{getString('generalSetting.gitLFSEnableDesc')}
|
||||||
|
</Text>
|
||||||
|
</Layout.Horizontal>
|
||||||
|
<Layout.Horizontal className={css.buttonContainer}>
|
||||||
|
{generalSettingsData?.git_lfs_enabled !== formik.values.gitLFSEnabled ? (
|
||||||
|
<Button
|
||||||
|
margin={{ top: 'medium' }}
|
||||||
|
type="submit"
|
||||||
|
text={getString('save')}
|
||||||
|
variation={ButtonVariation.PRIMARY}
|
||||||
|
size={ButtonSize.SMALL}
|
||||||
|
onClick={() => {
|
||||||
|
updateGeneralSettings({ git_lfs_enabled: formik.values.gitLFSEnabled })
|
||||||
|
.then(() => {
|
||||||
|
showSuccess(getString('repoUpdate'))
|
||||||
|
refetchSettings()
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
showError(getErrorMessage(err))
|
||||||
|
})
|
||||||
|
}}
|
||||||
|
{...permissionProps(permEditResult, standalone)}
|
||||||
|
/>
|
||||||
|
) : null}
|
||||||
|
</Layout.Horizontal>
|
||||||
|
</Container>
|
||||||
|
</Layout.Vertical>
|
||||||
|
</Layout.Horizontal>
|
||||||
|
</Container>
|
||||||
|
</Render>
|
||||||
<Container padding="medium" margin={{ bottom: 'medium' }} className={css.generalContainer}>
|
<Container padding="medium" margin={{ bottom: 'medium' }} className={css.generalContainer}>
|
||||||
<Layout.Horizontal padding={{ bottom: 'medium' }}>
|
<Layout.Horizontal padding={{ bottom: 'medium' }}>
|
||||||
<Container className={css.label}>
|
<Container className={css.label}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user