Skip to content

Commit

Permalink
Move angular initialization to the end and improve config description
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosnils committed Oct 6, 2017
1 parent e3c935a commit 03e3a48
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 46 deletions.
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func ParseFlags() {
flag.StringVar(&HashKey, "hash_key", "salmonrosado", "Hash key to use for cookies")
flag.StringVar(&DindVolumeSize, "dind-volume-size", "5G", "Dind volume folder size")
flag.BoolVar(&NoWindows, "no-windows", false, "Don't allow windows instances")
flag.BoolVar(&ExternalDindVolume, "external-dind-volume", false, "Use external dind volume")
flag.BoolVar(&ExternalDindVolume, "external-dind-volume", false, "Use external dind volume though XFS volume driver")
flag.Float64Var(&MaxLoadAvg, "maxload", 100, "Maximum allowed load average before failing ping requests")
flag.StringVar(&SSHKeyPath, "ssh_key_path", "", "SSH Private Key to use")
flag.StringVar(&CookieHashKey, "cookie-hash-key", "", "Hash key to use to validate cookies")
Expand Down
91 changes: 46 additions & 45 deletions www/landing.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,51 +16,7 @@

<!-- Custom styles for this template -->
<link href="/assets/landing.css" rel="stylesheet">
<script>
angular.module('PWDLanding', ['ngCookies'])
.controller('LoginController', ['$cookies', '$scope', '$http', function($cookies, $scope, $http) {
$scope.providers = [];
$scope.loggedIn = $cookies.get('id') !== undefined;

$http({
method: 'GET',
url: '/oauth/providers'
}).then(function(response) {
$scope.providers = response.data;
if ($scope.providers.length == 0) {
$scope.loggedIn = true;
}
}, function(response) {
console.log('ERROR', response);
});

$scope.start = function() {
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}

var stack = getParameterByName('stack');
if (stack) {
document.getElementById('stack').value = stack;
}
var stackName = getParameterByName('stack_name');
if (stackName) {
document.getElementById('stack_name').value = stackName;
}
var imageName = getParameterByName('image_name');
if (imageName) {
document.getElementById('image_name').value = imageName;
}
document.getElementById('landingForm').submit();
}
}]);
</script>

</head>

<body>
Expand Down Expand Up @@ -111,6 +67,51 @@ <h1 class="display-3">Play with Docker</h1>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
<script>
angular.module('PWDLanding', ['ngCookies'])
.controller('LoginController', ['$cookies', '$scope', '$http', function($cookies, $scope, $http) {
$scope.providers = [];
$scope.loggedIn = $cookies.get('id') !== undefined;

$http({
method: 'GET',
url: '/oauth/providers'
}).then(function(response) {
$scope.providers = response.data;
if ($scope.providers.length == 0) {
$scope.loggedIn = true;
}
}, function(response) {
console.log('ERROR', response);
});

$scope.start = function() {
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}

var stack = getParameterByName('stack');
if (stack) {
document.getElementById('stack').value = stack;
}
var stackName = getParameterByName('stack_name');
if (stackName) {
document.getElementById('stack_name').value = stackName;
}
var imageName = getParameterByName('image_name');
if (imageName) {
document.getElementById('image_name').value = imageName;
}
document.getElementById('landingForm').submit();
}
}]);
</script>
</body>
</html>

0 comments on commit 03e3a48

Please sign in to comment.