Better messaging in create repo
This commit is contained in:
parent
74feb4216a
commit
9d26c79db0
4 changed files with 25 additions and 4 deletions
|
@ -2167,15 +2167,20 @@ quayApp.directive('namespaceSelector', function () {
|
|||
$scope.namespaces = {};
|
||||
|
||||
$scope.initialize = function(user) {
|
||||
var preferredNamespace = user.username;
|
||||
var namespaces = {};
|
||||
namespaces[user.username] = user;
|
||||
if (user.organizations) {
|
||||
for (var i = 0; i < user.organizations.length; ++i) {
|
||||
namespaces[user.organizations[i].name] = user.organizations[i];
|
||||
if (user.organizations[i].preferred_namespace) {
|
||||
preferredNamespace = user.organizations[i].name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var initialNamespace = $routeParams['namespace'] || CookieService.get('quay.namespace') || $scope.user.username;
|
||||
var initialNamespace = $routeParams['namespace'] || CookieService.get('quay.namespace') ||
|
||||
preferredNamespace || $scope.user.username;
|
||||
$scope.namespaces = namespaces;
|
||||
$scope.setNamespace($scope.namespaces[initialNamespace]);
|
||||
};
|
||||
|
@ -2198,6 +2203,12 @@ quayApp.directive('namespaceSelector', function () {
|
|||
}
|
||||
};
|
||||
|
||||
$scope.$watch('namespace', function(namespace) {
|
||||
if ($scope.namespaceObj && namespace && namespace != $scope.namespaceObj.username) {
|
||||
$scope.setNamespace($scope.namespaces[namespace]);
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$watch('user', function(user) {
|
||||
$scope.user = user;
|
||||
$scope.initialize(user);
|
||||
|
|
Reference in a new issue