Always remind the user that the DNS zone has to be hosted on the provider

Do not use $location as the search() object is not consistent without
the angular router, which is not used here
This commit is contained in:
Johannes Zellner
2017-06-16 10:24:29 +02:00
parent 40aaffe365
commit 9952a986eb
2 changed files with 12 additions and 6 deletions
+10 -3
View File
@@ -1,9 +1,15 @@
'use strict';
// create main application module
var app = angular.module('Application', ['angular-md5', 'ui-notification', 'ngTld']);
var app = angular.module('Application', ['angular-md5', 'ui-notification']);
app.controller('SetupDNSController', ['$scope', '$http', 'Client', 'ngTld', '$location', function ($scope, $http, Client, ngTld, $location) {
app.filter('zoneName', function () {
return function (domain) {
return tld.getDomain(domain);
};
});
app.controller('SetupDNSController', ['$scope', '$http', 'Client', function ($scope, $http, Client) {
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.initialized = false;
@@ -12,6 +18,7 @@ app.controller('SetupDNSController', ['$scope', '$http', 'Client', 'ngTld', '$lo
$scope.provider = '';
$scope.showDNSSetup = false;
$scope.instanceId = '';
$scope.explicitZone = search.zone || '';
// keep in sync with certs.js
$scope.dnsProvider = [
@@ -38,7 +45,7 @@ app.controller('SetupDNSController', ['$scope', '$http', 'Client', 'ngTld', '$lo
var data = {
domain: $scope.dnsCredentials.domain,
zoneName: $location.search().zone || '',
zoneName: $scope.explicitZone,
provider: $scope.dnsCredentials.provider,
accessKeyId: $scope.dnsCredentials.accessKeyId,
secretAccessKey: $scope.dnsCredentials.secretAccessKey,
+2 -3
View File
@@ -28,7 +28,6 @@
<!-- Angular directives for tldjs -->
<script src="3rdparty/js/tld.js"></script>
<script src="3rdparty/js/angular-tld.js"></script>
<!-- Setup Application -->
<script src="js/setupdns.js"></script>
@@ -77,14 +76,14 @@
<div class="form-group" ng-class="{ 'has-error': dnsCredentialsForm.secretAccessKey.$dirty && dnsCredentialsForm.secretAccessKey.$invalid }" ng-show="dnsCredentials.provider === 'route53'">
<input type="text" class="form-control" ng-model="dnsCredentials.secretAccessKey" name="secretAccessKey" placeholder="Secret Access Key" ng-required="dnsCredentials.provider === 'route53'" ng-disabled="dnsCredentials.busy">
<br/>
<span>The domain {{ dnsCredentials.domain }} must be hosted on <a href="https://aws.amazon.com/route53/?nc2=h_m1" target="_blank">AWS Route53</a>.</span>
<span ng-show="dnsCredentials.domain || explicitZone"><b>{{ (explicitZone ? explicitZone : dnsCredentials.domain) | zoneName }}</b> must be hosted on <a href="https://aws.amazon.com/route53/?nc2=h_m1" target="_blank">AWS Route53</a>.</span>
</div>
<!-- DigitalOcean -->
<div class="form-group" ng-class="{ 'has-error': dnsCredentialsForm.digitalOceanToken.$dirty && dnsCredentialsForm.digitalOceanToken.$invalid }" ng-show="dnsCredentials.provider === 'digitalocean'">
<input type="text" class="form-control" ng-model="dnsCredentials.digitalOceanToken" name="digitalOceanToken" placeholder="API Token" ng-required="dnsCredentials.provider === 'digitalocean'" ng-disabled="dnsCredentials.busy">
<br/>
<span>The domain {{ dnsCredentials.domain }} must be hosted on <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean#step-two%E2%80%94change-your-domain-server" target="_blank">DigitalOcean</a>.</span>
<span ng-show="dnsCredentials.domain || explicitZone"><b>{{ (explicitZone ? explicitZone : dnsCredentials.domain) | zoneName }}</b> must be hosted on <a href="https://www.digitalocean.com/community/tutorials/how-to-set-up-a-host-name-with-digitalocean#step-two%E2%80%94change-your-domain-server" target="_blank">DigitalOcean</a>.</span>
</div>
<!-- Wildcard -->