rename alternateDomains to redirectDomains

This commit is contained in:
Girish Ramakrishnan
2022-01-14 22:32:41 -08:00
parent 9109c89d8f
commit fd9efe3da3
5 changed files with 37 additions and 37 deletions

View File

@@ -289,27 +289,27 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
domain: null,
location: '',
alternateDomains: [],
redirectDomains: [],
aliasDomains: [],
portBindings: {},
portBindingsEnabled: {},
portBindingsInfo: {},
addAlternateDomain: function (event) {
addRedirectDomain: function (event) {
event.preventDefault();
$scope.location.alternateDomains.push({
$scope.location.redirectDomains.push({
domain: $scope.domains.filter(function (d) { return d.domain === $scope.app.domain; })[0], // pre-select app's domain by default
subdomain: ''
});
setTimeout(function () {
document.getElementById('alternateDomainsInput-' + ($scope.location.alternateDomains.length-1)).focus();
document.getElementById('redirectDomainsInput-' + ($scope.location.redirectDomains.length-1)).focus();
}, 200);
},
delAlternateDomain: function (event, index) {
delRedirectDomain: function (event, index) {
event.preventDefault();
$scope.location.alternateDomains.splice(index, 1);
$scope.location.redirectDomains.splice(index, 1);
},
addAliasDomain: function (event) {
@@ -337,7 +337,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.location.location = app.location;
$scope.location.domain = $scope.domains.filter(function (d) { return d.domain === app.domain; })[0];
$scope.location.portBindingsInfo = angular.extend({}, app.manifest.tcpPorts, app.manifest.udpPorts); // Portbinding map only for information
$scope.location.alternateDomains = app.alternateDomains.map(function (a) { return { subdomain: a.subdomain, domain: $scope.domains.filter(function (d) { return d.domain === a.domain; })[0] };});
$scope.location.redirectDomains = app.redirectDomains.map(function (a) { return { subdomain: a.subdomain, domain: $scope.domains.filter(function (d) { return d.domain === a.domain; })[0] };});
$scope.location.aliasDomains = app.aliasDomains.map(function (a) { return { subdomain: a.subdomain, domain: $scope.domains.filter(function (d) { return d.domain === a.domain; })[0] };});
// fill the portBinding structures. There might be holes in the app.portBindings, which signalizes a disabled port
@@ -372,15 +372,15 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
location: $scope.location.location,
domain: $scope.location.domain.domain,
portBindings: portBindings,
alternateDomains: $scope.location.alternateDomains.map(function (a) { return { subdomain: a.subdomain, domain: a.domain.domain };}),
redirectDomains: $scope.location.redirectDomains.map(function (a) { return { subdomain: a.subdomain, domain: a.domain.domain };}),
aliasDomains: $scope.location.aliasDomains.map(function (a) { return { subdomain: a.subdomain, domain: a.domain.domain };})
};
// pre-flight only for changed domains
var domains = [];
if ($scope.app.domain !== data.domain || $scope.app.location !== data.location) domains.push({ subdomain: data.location, domain: data.domain, type: 'main' });
data.alternateDomains.forEach(function (a) {
if ($scope.app.alternateDomains.some(function (d) { return d.domain === a.domain && d.subdomain === a.subdomain; })) return;
data.redirectDomains.forEach(function (a) {
if ($scope.app.redirectDomains.some(function (d) { return d.domain === a.domain && d.subdomain === a.subdomain; })) return;
domains.push({ subdomain: a.subdomain, domain: a.domain, type: 'redirect' });
});
data.aliasDomains.forEach(function (a) {
@@ -399,7 +399,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
} else if (domain.type === 'alias') {
$scope.location.error.aliasDomains = domain.domain + ' ' + result.error.message;
} else {
$scope.location.error.alternateDomains = domain.domain + ' ' + result.error.message;
$scope.location.error.redirectDomains = domain.domain + ' ' + result.error.message;
}
$scope.location.busy = false;
return;
@@ -427,7 +427,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.location.error.location = error.message;
$scope.locationForm.$setPristine();
} else { // FIXME: check error in aliasDomains
$scope.location.error.alternateDomains = error.message;
$scope.location.error.redirectDomains = error.message;
}
} else if (error.portName || error.field === 'portBindings') {
$scope.location.error.port = error.message;
@@ -1569,7 +1569,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
location: null,
domain: null,
alternateDomains: [],
redirectDomains: [],
aliasDomains: [],
backups: [],
@@ -1583,7 +1583,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
$scope.repair.retryBusy = false;
$scope.repair.location = null;
$scope.repair.domain = null;
$scope.repair.alternateDomains = [];
$scope.repair.redirectDomains = [];
$scope.repair.aliasDomains = [];
$scope.repair.backupId = '';
@@ -1604,8 +1604,8 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
};
});
$scope.repair.alternateDomains = $scope.app.alternateDomains;
$scope.repair.alternateDomains = $scope.app.alternateDomains.map(function (altDomain) {
$scope.repair.redirectDomains = $scope.app.redirectDomains;
$scope.repair.redirectDomains = $scope.app.redirectDomains.map(function (altDomain) {
return {
subdomain: altDomain.subdomain,
enabled: true,
@@ -1648,7 +1648,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location'
data.domain = $scope.repair.domain.domain;
data.aliasDomains = $scope.repair.aliasDomains.filter(function (a) { return a.enabled; })
.map(function (d) { return { subdomain: d.subdomain, domain: d.domain.domain }; });
data.alternateDomains = $scope.repair.alternateDomains.filter(function (a) { return a.enabled; })
data.redirectDomains = $scope.repair.redirectDomains.filter(function (a) { return a.enabled; })
.map(function (d) { return { subdomain: d.subdomain, domain: d.domain.domain }; });
data.overwriteDns = true; // always overwriteDns. user can anyway check and uncheck above
repairFunc = Client.configureApp.bind(null, $scope.app.id, 'location', data);