3a68740ff7
- Fixes a bug which allows for underscores at the beginning of namespaces: Fixes #1849 - Allows dots and dashes for newer Docker clients: Fixes #1188 - Has the UI display better messaging associated with namespace entry
32 lines
No EOL
900 B
JavaScript
32 lines
No EOL
900 B
JavaScript
/**
|
|
* An element which displays an input box for creating a namespace.
|
|
*/
|
|
angular.module('quay').directive('namespaceInput', function () {
|
|
var directiveDefinitionObject = {
|
|
priority: 0,
|
|
templateUrl: '/static/directives/namespace-input.html',
|
|
replace: false,
|
|
transclude: true,
|
|
restrict: 'C',
|
|
scope: {
|
|
'binding': '=binding',
|
|
'isBackIncompat': '=isBackIncompat',
|
|
'namespaceTitle': '@namespaceTitle',
|
|
},
|
|
controller: function($scope, $element) {
|
|
$scope.USERNAME_PATTERN = USERNAME_PATTERN;
|
|
$scope.usernamePattern = new RegExp(USERNAME_PATTERN);
|
|
|
|
|
|
$scope.$watch('binding', function(binding) {
|
|
if (!binding) {
|
|
$scope.isBackIncompat = false;
|
|
return;
|
|
}
|
|
|
|
$scope.isBackIncompat = (binding.indexOf('-') > 0 || binding.indexOf('.') > 0);
|
|
})
|
|
}
|
|
};
|
|
return directiveDefinitionObject;
|
|
}); |