setup: have a single error object
This commit is contained in:
@@ -16,7 +16,7 @@ app.controller('SetupDNSController', ['$scope', '$http', '$timeout', 'Client', f
|
||||
var search = decodeURIComponent(window.location.search).slice(1).split('&').map(function (item) { return item.split('='); }).reduce(function (o, k) { o[k[0]] = k[1]; return o; }, {});
|
||||
|
||||
$scope.state = null; // 'initialized', 'waitingForDnsSetup', 'waitingForBox'
|
||||
$scope.error = null;
|
||||
$scope.error = {};
|
||||
$scope.provider = '';
|
||||
$scope.showDNSSetup = false;
|
||||
$scope.instanceId = '';
|
||||
@@ -67,7 +67,6 @@ app.controller('SetupDNSController', ['$scope', '$http', '$timeout', 'Client', f
|
||||
{ name: 'No-op (only for development)', value: 'noop' }
|
||||
];
|
||||
$scope.dnsCredentials = {
|
||||
error: null,
|
||||
busy: false,
|
||||
advancedVisible: false,
|
||||
domain: '',
|
||||
@@ -123,8 +122,7 @@ app.controller('SetupDNSController', ['$scope', '$http', '$timeout', 'Client', f
|
||||
|
||||
$scope.setDnsCredentials = function () {
|
||||
$scope.dnsCredentials.busy = true;
|
||||
$scope.dnsCredentials.error = null;
|
||||
$scope.error = null;
|
||||
$scope.error = {};
|
||||
|
||||
var provider = $scope.dnsCredentials.provider;
|
||||
|
||||
@@ -149,7 +147,7 @@ app.controller('SetupDNSController', ['$scope', '$http', '$timeout', 'Client', f
|
||||
throw 'fields_missing';
|
||||
}
|
||||
} catch(e) {
|
||||
$scope.dnsCredentials.error = 'Cannot parse Google Service Account Key';
|
||||
$scope.error.dnsCredentials = 'Cannot parse Google Service Account Key';
|
||||
$scope.dnsCredentials.busy = false;
|
||||
return;
|
||||
}
|
||||
@@ -183,11 +181,11 @@ app.controller('SetupDNSController', ['$scope', '$http', '$timeout', 'Client', f
|
||||
Client.setup($scope.dnsCredentials.domain, $scope.dnsCredentials.zoneName, provider, data, tlsConfig, function (error) {
|
||||
if (error && error.statusCode === 401) {
|
||||
$scope.dnsCredentials.busy = false;
|
||||
$scope.error = 'Wrong instance id provided.';
|
||||
$scope.error.ami = 'Wrong instance id provided.';
|
||||
return;
|
||||
} else if (error) {
|
||||
$scope.dnsCredentials.busy = false;
|
||||
$scope.dnsCredentials.error = error.message;
|
||||
$scope.error.dnsCredentials = error.message;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -201,8 +199,9 @@ app.controller('SetupDNSController', ['$scope', '$http', '$timeout', 'Client', f
|
||||
Client.getStatus(function (error, status) {
|
||||
if (!error && !status.setup.active) {
|
||||
if (!status.adminFqdn || status.setup.errorMessage) { // setup reset or errored. start over
|
||||
$scope.error = status.setup.errorMessage;
|
||||
$scope.error.setup = status.setup.errorMessage;
|
||||
$scope.state = 'initialized';
|
||||
$scope.dnsCredentials.busy = false;
|
||||
} else { // proceed to activation
|
||||
window.location.href = 'https://' + status.adminFqdn + '/setup.html';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user