Allow namespaces to be between 2 and 255 characters in length

[Delivers #137924329]
This commit is contained in:
Joseph Schorr 2017-01-18 17:42:27 -05:00
parent e2748fccd9
commit 7c7a07fb5a
8 changed files with 43 additions and 39 deletions

View file

@ -1,6 +1,6 @@
var TEAM_PATTERN = '^[a-z][a-z0-9]+$';
var ROBOT_PATTERN = '^[a-z][a-z0-9_]{3,29}$';
var USERNAME_PATTERN = '^(?=.{4,30}$)([a-z0-9]+(?:[._-][a-z0-9]+)*)$';
var ROBOT_PATTERN = '^[a-z][a-z0-9_]{1,254}$';
var USERNAME_PATTERN = '^(?=.{2,255}$)([a-z0-9]+(?:[._-][a-z0-9]+)*)$';
// Define the pages module.
quayPages = angular.module('quayPages', [], function(){});

View file

@ -10,7 +10,7 @@ angular.module('quay').directive('namespaceInput', function () {
restrict: 'C',
scope: {
'binding': '=binding',
'isBackIncompat': '=isBackIncompat',
'backIncompatMessage': '=backIncompatMessage',
'hasExternalError': '=?hasExternalError',
'namespaceTitle': '@namespaceTitle',
@ -21,11 +21,17 @@ angular.module('quay').directive('namespaceInput', function () {
$scope.$watch('binding', function(binding) {
if (!binding) {
$scope.isBackIncompat = false;
$scope.backIncompatMessage = null;
return;
}
$scope.isBackIncompat = (binding.indexOf('-') > 0 || binding.indexOf('.') > 0);
if (binding.indexOf('-') > 0 || binding.indexOf('.') > 0) {
$scope.backIncompatMessage = 'Namespaces with dashes or dots are only compatible with Docker 1.9+';
} else if (binding.length < 4 || binding.length > 30) {
$scope.backIncompatMessage = 'Namespaces less than 4 or more than 30 characters are only compatible with Docker 1.6+';
} else {
$scope.backIncompatMessage = null;
}
})
}
};