mirror of
https://github.com/portainer/portainer.git
synced 2025-07-20 13:59:40 +02:00
fix(edge/templates): fix issues with git templates [EE-6357] (#10679)
This commit is contained in:
parent
974378c9b5
commit
2a18c9f215
16 changed files with 201 additions and 116 deletions
|
@ -112,8 +112,7 @@ export default class CreateEdgeStackViewController {
|
|||
PrePullImage: template.EdgeSettings.PrePullImage || false,
|
||||
RetryDeploy: template.EdgeSettings.RetryDeploy || false,
|
||||
PrivateRegistryId: template.EdgeSettings.PrivateRegistryId || null,
|
||||
SupportRelativePath: template.EdgeSettings.RelativePathSettings.SupportRelativePath || false,
|
||||
FilesystemPath: template.EdgeSettings.RelativePathSettings.FilesystemPath || '',
|
||||
...template.EdgeSettings.RelativePathSettings,
|
||||
}
|
||||
: {}),
|
||||
};
|
||||
|
@ -195,11 +194,7 @@ export default class CreateEdgeStackViewController {
|
|||
createStack() {
|
||||
return this.$async(async () => {
|
||||
const name = this.formValues.Name;
|
||||
let method = this.state.Method;
|
||||
|
||||
if (method === 'template') {
|
||||
method = 'editor';
|
||||
}
|
||||
const method = getMethod(this.state.Method, this.state.templateValues.template);
|
||||
|
||||
if (!this.validateForm(method)) {
|
||||
return;
|
||||
|
@ -338,3 +333,20 @@ export default class CreateEdgeStackViewController {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {'template'|'repository' | 'editor' | 'upload'} method
|
||||
* @param {import('@/react/portainer/templates/custom-templates/types').CustomTemplate | undefined} template
|
||||
* @returns 'repository' | 'editor' | 'upload'
|
||||
*/
|
||||
function getMethod(method, template) {
|
||||
if (method !== 'template') {
|
||||
return method;
|
||||
}
|
||||
|
||||
if (template && template.GitConfig) {
|
||||
return 'repository';
|
||||
}
|
||||
return 'editor';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue