mirror of
https://github.com/portainer/portainer.git
synced 2025-08-06 14:25:31 +02:00
feat(edge/templates): introduce custom templates [EE-6208] (#10561)
This commit is contained in:
parent
a0f583a17d
commit
68950fbb24
81 changed files with 2047 additions and 334 deletions
|
@ -28,9 +28,9 @@ interface Props {
|
|||
isAdditionalFilesFieldVisible?: boolean;
|
||||
isForcePullVisible?: boolean;
|
||||
isAuthExplanationVisible?: boolean;
|
||||
errors: FormikErrors<GitFormModel>;
|
||||
baseWebhookUrl: string;
|
||||
webhookId: string;
|
||||
errors?: FormikErrors<GitFormModel>;
|
||||
baseWebhookUrl?: string;
|
||||
webhookId?: string;
|
||||
webhooksDocs?: string;
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ export function GitForm({
|
|||
|
||||
{isAdditionalFilesFieldVisible && (
|
||||
<AdditionalFileField
|
||||
value={value.AdditionalFiles}
|
||||
value={value.AdditionalFiles || []}
|
||||
onChange={(value) => handleChange({ AdditionalFiles: value })}
|
||||
errors={errors.AdditionalFiles}
|
||||
/>
|
||||
|
@ -97,8 +97,8 @@ export function GitForm({
|
|||
{value.AutoUpdate && (
|
||||
<AutoUpdateFieldset
|
||||
environmentType={environmentType}
|
||||
webhookId={webhookId}
|
||||
baseWebhookUrl={baseWebhookUrl}
|
||||
webhookId={webhookId || ''}
|
||||
baseWebhookUrl={baseWebhookUrl || ''}
|
||||
value={value.AutoUpdate}
|
||||
onChange={(value) => handleChange({ AutoUpdate: value })}
|
||||
isForcePullVisible={isForcePullVisible}
|
||||
|
@ -165,5 +165,5 @@ export function buildGitValidationSchema(
|
|||
RepositoryURLValid: boolean().default(false),
|
||||
AutoUpdate: autoUpdateValidation().nullable(),
|
||||
TLSSkipVerify: boolean().default(false),
|
||||
}).concat(gitAuthValidation(gitCredentials, false));
|
||||
}).concat(gitAuthValidation(gitCredentials, false)) as SchemaOf<GitFormModel>;
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ interface Props {
|
|||
onChange(value: string): void;
|
||||
model: RefFieldModel;
|
||||
error?: string;
|
||||
isUrlValid: boolean;
|
||||
isUrlValid?: boolean;
|
||||
stackId?: StackId;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ export function RefSelector({
|
|||
value: string;
|
||||
stackId?: StackId;
|
||||
onChange: (value: string) => void;
|
||||
isUrlValid: boolean;
|
||||
isUrlValid?: boolean;
|
||||
}) {
|
||||
const creds = getAuthentication(model);
|
||||
const payload = {
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
export type AutoUpdateMechanism = 'Webhook' | 'Interval';
|
||||
|
||||
export interface AutoUpdateResponse {
|
||||
/* Auto update interval */
|
||||
Interval: string;
|
||||
|
@ -26,6 +25,7 @@ export interface RepoConfigResponse {
|
|||
ConfigFilePath: string;
|
||||
Authentication?: GitAuthenticationResponse;
|
||||
ConfigHash: string;
|
||||
TLSSkipVerify: boolean;
|
||||
}
|
||||
|
||||
export type AutoUpdateModel = {
|
||||
|
@ -52,11 +52,11 @@ export type GitAuthModel = GitCredentialsModel & GitNewCredentialModel;
|
|||
|
||||
export interface GitFormModel extends GitAuthModel {
|
||||
RepositoryURL: string;
|
||||
RepositoryURLValid: boolean;
|
||||
RepositoryURLValid?: boolean;
|
||||
ComposeFilePathInRepository: string;
|
||||
RepositoryAuthentication: boolean;
|
||||
RepositoryReferenceName?: string;
|
||||
AdditionalFiles: string[];
|
||||
AdditionalFiles?: string[];
|
||||
|
||||
SaveCredential?: boolean;
|
||||
NewCredentialName?: string;
|
||||
|
@ -78,3 +78,31 @@ export interface RelativePathModel {
|
|||
PerDeviceConfigsMatchType?: string;
|
||||
PerDeviceConfigsGroupMatchType?: string;
|
||||
}
|
||||
|
||||
export function toGitFormModel(response?: RepoConfigResponse): GitFormModel {
|
||||
if (!response) {
|
||||
return {
|
||||
RepositoryURL: '',
|
||||
ComposeFilePathInRepository: '',
|
||||
RepositoryAuthentication: false,
|
||||
TLSSkipVerify: false,
|
||||
};
|
||||
}
|
||||
|
||||
const { URL, ReferenceName, ConfigFilePath, Authentication, TLSSkipVerify } =
|
||||
response;
|
||||
|
||||
return {
|
||||
RepositoryURL: URL,
|
||||
ComposeFilePathInRepository: ConfigFilePath,
|
||||
RepositoryReferenceName: ReferenceName,
|
||||
RepositoryAuthentication: !!(
|
||||
Authentication &&
|
||||
(Authentication?.GitCredentialID || Authentication?.Username)
|
||||
),
|
||||
RepositoryUsername: Authentication?.Username,
|
||||
RepositoryPassword: Authentication?.Password,
|
||||
RepositoryGitCredentialID: Authentication?.GitCredentialID,
|
||||
TLSSkipVerify,
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue