mirror of
https://github.com/portainer/portainer.git
synced 2026-06-23 04:10:29 +00:00
feat(stacks): use source for kubernetes manifest git stacks [BE-13045] (#2915)
Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -85,6 +85,7 @@
|
||||
is-force-pull-visible="false"
|
||||
is-additional-files-field-visible="true"
|
||||
is-auth-explanation-visible="true"
|
||||
is-source-selection-visible="true"
|
||||
deploy-method="{{ ctrl.state.DeployType === ctrl.ManifestDeployTypes.COMPOSE ? 'compose' : 'manifest' }}"
|
||||
base-webhook-url="{{ ctrl.state.baseWebhookUrl }}"
|
||||
webhook-id="{{ ctrl.state.webhookId }}"
|
||||
|
||||
@@ -68,6 +68,7 @@ class KubernetesDeployController {
|
||||
|
||||
this.formValues = {
|
||||
StackName: '',
|
||||
SourceId: undefined,
|
||||
RepositoryURL: '',
|
||||
RepositoryReferenceName: '',
|
||||
RepositoryAuthentication: false,
|
||||
@@ -308,13 +309,17 @@ class KubernetesDeployController {
|
||||
};
|
||||
|
||||
if (method === KubernetesDeployRequestMethods.REPOSITORY) {
|
||||
payload.TLSSkipVerify = this.formValues.TLSSkipVerify;
|
||||
payload.RepositoryURL = this.formValues.RepositoryURL;
|
||||
payload.RepositoryReferenceName = this.formValues.RepositoryReferenceName;
|
||||
payload.RepositoryAuthentication = this.formValues.RepositoryAuthentication ? true : false;
|
||||
if (payload.RepositoryAuthentication) {
|
||||
payload.RepositoryUsername = this.formValues.RepositoryUsername;
|
||||
payload.RepositoryPassword = this.formValues.RepositoryPassword;
|
||||
if (this.formValues.SourceId) {
|
||||
payload.SourceId = this.formValues.SourceId;
|
||||
} else {
|
||||
payload.TLSSkipVerify = this.formValues.TLSSkipVerify;
|
||||
payload.RepositoryURL = this.formValues.RepositoryURL;
|
||||
payload.RepositoryAuthentication = this.formValues.RepositoryAuthentication ? true : false;
|
||||
if (payload.RepositoryAuthentication) {
|
||||
payload.RepositoryUsername = this.formValues.RepositoryUsername;
|
||||
payload.RepositoryPassword = this.formValues.RepositoryPassword;
|
||||
}
|
||||
}
|
||||
payload.ManifestFile = this.formValues.ComposeFilePathInRepository;
|
||||
payload.AdditionalFiles = this.formValues.AdditionalFiles;
|
||||
|
||||
@@ -19,6 +19,8 @@ export default class GitFormController {
|
||||
|
||||
deployMethod?: DeployMethod;
|
||||
|
||||
isSourceSelectionVisible?: boolean;
|
||||
|
||||
/* @ngInject */
|
||||
constructor($async: <T>(fn: () => Promise<T>) => Promise<T>) {
|
||||
this.$async = $async;
|
||||
@@ -56,7 +58,8 @@ export default class GitFormController {
|
||||
this.errors = await validateGitForm(
|
||||
value,
|
||||
isCreatedFromCustomTemplate,
|
||||
this.deployMethod
|
||||
this.deployMethod,
|
||||
this.isSourceSelectionVisible
|
||||
);
|
||||
if (this.errors && Object.keys(this.errors).length > 0) {
|
||||
this.gitForm?.$setValidity('gitForm', false, this.gitForm);
|
||||
|
||||
@@ -5,7 +5,7 @@ import controller from './git-form.controller';
|
||||
export const gitForm: IComponentOptions = {
|
||||
template: `
|
||||
<ng-form name="$ctrl.gitForm">
|
||||
<react-git-form
|
||||
<react-git-form
|
||||
value="$ctrl.value"
|
||||
on-change="$ctrl.handleChange"
|
||||
environment-type="$ctrl.environmentType"
|
||||
@@ -18,6 +18,7 @@ export const gitForm: IComponentOptions = {
|
||||
webhook-id="$ctrl.webhookId"
|
||||
webhooks-docs="$ctrl.webhooksDocs"
|
||||
created-from-custom-template-id="$ctrl.createdFromCustomTemplateId"
|
||||
is-source-selection-visible="$ctrl.isSourceSelectionVisible"
|
||||
errors="$ctrl.errors">
|
||||
</react-git-form>
|
||||
</ng-form>`,
|
||||
@@ -34,6 +35,7 @@ export const gitForm: IComponentOptions = {
|
||||
webhookId: '@',
|
||||
webhooksDocs: '@',
|
||||
createdFromCustomTemplateId: '<',
|
||||
isSourceSelectionVisible: '<',
|
||||
},
|
||||
controller,
|
||||
};
|
||||
|
||||
+1
@@ -76,6 +76,7 @@ export function ApplicationDetailsWidget() {
|
||||
gitConfig={stack.GitConfig}
|
||||
currentDeploymentInfo={stack.CurrentDeploymentInfo}
|
||||
stackType="kubernetes"
|
||||
sourceId={stack.GitSourceId}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ export function ButtonsLine({
|
||||
},
|
||||
{
|
||||
enabled:
|
||||
stack &&
|
||||
!!stack &&
|
||||
(!stack.GitConfig ||
|
||||
!isGitConfigDiverged(stack.GitConfig, stack.CurrentDeploymentInfo)),
|
||||
}
|
||||
|
||||
@@ -175,10 +175,17 @@ export function GitForm({
|
||||
export async function validateGitForm(
|
||||
formValues: GitFormModel,
|
||||
isCreatedFromCustomTemplate: boolean,
|
||||
deployMethod: DeployMethod = 'compose'
|
||||
deployMethod: DeployMethod = 'compose',
|
||||
isSourceSelection = false
|
||||
) {
|
||||
return validateForm<GitFormModel>(
|
||||
() => buildGitValidationSchema(isCreatedFromCustomTemplate, deployMethod),
|
||||
() =>
|
||||
buildGitValidationSchema(
|
||||
isCreatedFromCustomTemplate,
|
||||
deployMethod,
|
||||
false,
|
||||
isSourceSelection
|
||||
),
|
||||
formValues
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user