mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
fix(k8s/gitops): missing git auth toggle in k8s app edit page [EE-5320] (#8741)
This commit is contained in:
parent
5ac1ea3df8
commit
a65ffe519a
11 changed files with 93 additions and 29 deletions
|
@ -18,14 +18,14 @@ import { NewCredentialForm } from './NewCredentialForm';
|
|||
interface Props {
|
||||
value: GitAuthModel;
|
||||
onChange: (value: Partial<GitAuthModel>) => void;
|
||||
isExplanationVisible?: boolean;
|
||||
isAuthExplanationVisible?: boolean;
|
||||
errors?: FormikErrors<GitAuthModel>;
|
||||
}
|
||||
|
||||
export function AuthFieldset({
|
||||
value,
|
||||
onChange,
|
||||
isExplanationVisible,
|
||||
isAuthExplanationVisible,
|
||||
errors,
|
||||
}: Props) {
|
||||
const [username, setUsername] = useDebounce(
|
||||
|
@ -56,7 +56,7 @@ export function AuthFieldset({
|
|||
|
||||
{value.RepositoryAuthentication && (
|
||||
<>
|
||||
{isExplanationVisible && (
|
||||
{isAuthExplanationVisible && (
|
||||
<TextTip color="orange">
|
||||
Enabling authentication will store the credentials and it is
|
||||
advisable to use a git service account
|
||||
|
@ -143,7 +143,8 @@ export function AuthFieldset({
|
|||
}
|
||||
|
||||
export function gitAuthValidation(
|
||||
gitCredentials: Array<GitCredential>
|
||||
gitCredentials: Array<GitCredential>,
|
||||
isAuthEdit: boolean
|
||||
): SchemaOf<GitAuthModel> {
|
||||
return object({
|
||||
RepositoryAuthentication: boolean().default(false),
|
||||
|
@ -156,7 +157,7 @@ export function gitAuthValidation(
|
|||
.default(''),
|
||||
RepositoryPassword: string()
|
||||
.when(['RepositoryAuthentication', 'RepositoryGitCredentialID'], {
|
||||
is: (auth: boolean, id: number) => auth && !id,
|
||||
is: (auth: boolean, id: number) => auth && !id && !isAuthEdit,
|
||||
then: string().required('Password is required'),
|
||||
})
|
||||
.default(''),
|
||||
|
|
|
@ -51,7 +51,7 @@ export function GitForm({
|
|||
<AuthFieldset
|
||||
value={value}
|
||||
onChange={handleChange}
|
||||
isExplanationVisible={isAuthExplanationVisible}
|
||||
isAuthExplanationVisible={isAuthExplanationVisible}
|
||||
errors={errors}
|
||||
/>
|
||||
|
||||
|
@ -162,5 +162,5 @@ export function buildGitValidationSchema(
|
|||
RepositoryURLValid: boolean().default(false),
|
||||
AutoUpdate: autoUpdateValidation().nullable(),
|
||||
TLSSkipVerify: boolean().default(false),
|
||||
}).concat(gitAuthValidation(gitCredentials));
|
||||
}).concat(gitAuthValidation(gitCredentials, false));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue