Half way fix for clone, we need to adjust the error reporting for the clone api from the backend

This commit is contained in:
Johannes Zellner
2022-02-08 22:11:41 +01:00
parent 7a66a104ad
commit 8a36e2c730

View File

@@ -1603,7 +1603,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
if (result.needsOverwrite) {
$scope.clone.needsOverwrite = true;
$scope.clone.overwriteDns = true;
return callback({ type: 'exists', fqdn: fqdn, message: 'DNS Record already exists. Confirm that the domain is not in use for services external to Cloudron' });
return callback({ type: 'externally_exists', fqdn: fqdn, message: 'DNS Record already exists. Confirm that the domain is not in use for services external to Cloudron' });
}
callback();
@@ -1629,12 +1629,9 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
var errorMessage = error.message.toLowerCase();
if (errorMessage.indexOf('port') !== -1) {
$scope.clone.error.port = error.message;
} else if (error.message.indexOf('location') !== -1) {
if (errorMessage.indexOf('primary') !== -1) {
$scope.clone.error.location = error.message;
} else {
$scope.clone.error.secondaryDomain = error.message;
}
} else if (error.message.indexOf('location') !== -1 || error.message.indexOf('subdomain') !== -1) {
// TODO extract fqdn from error message, currently we just set it always to the main location
$scope.clone.error.location = { type: 'internally_exists', fqdn: data.subdomain + '.' + data.domain, message: error.message };
$('#cloneLocationInput').focus();
} else {
Client.error(error);