1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-07 23:05:26 +02:00

fix(stack/template): web editor error shows for changing between same mustache templates [EE-6563] (#10976)

This commit is contained in:
Oscar Zhou 2024-01-19 09:28:09 +13:00 committed by GitHub
parent 1676fefd97
commit fa63432695
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 3 deletions

View file

@ -33,7 +33,7 @@ function validateYAML(yaml, containerNames, originalContainersNames = []) {
let yamlObject;
try {
yamlObject = YAML.parse(yaml);
yamlObject = YAML.parse(yaml, { mapAsMap: true });
} catch (err) {
return 'There is an error in the yaml syntax: ' + err;
}

View file

@ -33,7 +33,7 @@ class VariablesFieldController implements IComponentController {
}
$onChanges({ value }: IOnChangesObject) {
if (value.currentValue) {
if (value?.currentValue) {
this.checkValidity(value.currentValue);
}
}

View file

@ -328,6 +328,7 @@ angular
return;
}
const rendered = renderTemplate($scope.state.templateContent, $scope.formValues.Variables, $scope.state.selectedTemplate.Variables);
$scope.state.editorYamlValidationError = StackHelper.validateYAML(rendered, $scope.containerNames);
onChangeFormValues({ StackFileContent: rendered });
}