update: increase the max length of the secret (#3493) (#3494)

This PR increases the default maxlength from 1024 characters to 10000,
which should be good for most cases.

---------

Co-authored-by: Ram Bhosale <rambhosale9@gamil.com>
This commit is contained in:
Ram Bhosale 2024-04-20 04:43:10 +05:30 committed by GitHub
parent 3f047635a0
commit 2d96ca504b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 8 additions and 1 deletions

View File

@ -31,5 +31,8 @@ export default {
PULL_REQUEST_DIFF_RENDERING_BLOCK_SIZE: 10, PULL_REQUEST_DIFF_RENDERING_BLOCK_SIZE: 10,
/** Detection margin for on-screen / off-screen rendering optimization. In pixels. */ /** Detection margin for on-screen / off-screen rendering optimization. In pixels. */
IN_VIEWPORT_DETECTION_MARGIN: 5_000 IN_VIEWPORT_DETECTION_MARGIN: 5_000,
/** Limit for the secret input in bytes */
SECRET_LIMIT_IN_BYTES: 5_242_880,
} as const } as const

View File

@ -37,6 +37,7 @@ import { useModalHook } from 'hooks/useModalHook'
import { useStrings } from 'framework/strings' import { useStrings } from 'framework/strings'
import type { OpenapiCreateSecretRequest, TypesSecret } from 'services/code' import type { OpenapiCreateSecretRequest, TypesSecret } from 'services/code'
import { getErrorMessage } from 'utils/Utils' import { getErrorMessage } from 'utils/Utils'
import Config from 'Config'
import css from './NewSecretModalButton.module.scss' import css from './NewSecretModalButton.module.scss'
export interface SecretFormData { export interface SecretFormData {
@ -144,6 +145,7 @@ export const NewSecretModalButton: React.FC<NewSecretModalButtonProps> = ({
tooltipProps={{ tooltipProps={{
dataTooltipId: 'secretDescriptionTextField' dataTooltipId: 'secretDescriptionTextField'
}} }}
maxLength={Config.SECRET_LIMIT_IN_BYTES}
autoComplete="off" autoComplete="off"
className={formik.values.showValue ? css.showValue : css.hideValue} className={formik.values.showValue ? css.showValue : css.hideValue}
/> />

View File

@ -39,6 +39,7 @@ import { useGetSpaceParam } from 'hooks/useGetSpaceParam'
import type { OpenapiUpdateSecretRequest, TypesSecret } from 'services/code' import type { OpenapiUpdateSecretRequest, TypesSecret } from 'services/code'
import type { SecretFormData } from 'components/NewSecretModalButton/NewSecretModalButton' import type { SecretFormData } from 'components/NewSecretModalButton/NewSecretModalButton'
import { getErrorMessage, truncateString } from 'utils/Utils' import { getErrorMessage, truncateString } from 'utils/Utils'
import Config from 'Config'
import css from './UpdateSecretModal.module.scss' import css from './UpdateSecretModal.module.scss'
const useUpdateSecretModal = () => { const useUpdateSecretModal = () => {
@ -134,6 +135,7 @@ const useUpdateSecretModal = () => {
tooltipProps={{ tooltipProps={{
dataTooltipId: 'secretDescriptionTextField' dataTooltipId: 'secretDescriptionTextField'
}} }}
maxLength={Config.SECRET_LIMIT_IN_BYTES}
autoComplete="off" autoComplete="off"
className={formik.values.showValue ? css.showValue : css.hideValue} className={formik.values.showValue ? css.showValue : css.hideValue}
/> />