Fix create robot and create team in the new layout "new" header button
This commit is contained in:
parent
b02b98def3
commit
4dff6557ae
3 changed files with 35 additions and 12 deletions
|
@ -13,7 +13,8 @@ angular.module('quay').directive('robotsManager', function () {
|
|||
'user': '=user',
|
||||
'isEnabled': '=isEnabled'
|
||||
},
|
||||
controller: function($scope, $element, ApiService, $routeParams, CreateService, Config) {
|
||||
controller: function($scope, $element, ApiService, $routeParams, $location, CreateService,
|
||||
Config, $rootScope) {
|
||||
$scope.ROBOT_PATTERN = ROBOT_PATTERN;
|
||||
|
||||
$scope.robots = null;
|
||||
|
@ -22,6 +23,17 @@ angular.module('quay').directive('robotsManager', function () {
|
|||
$scope.showRobotCounter = 0;
|
||||
$scope.Config = Config;
|
||||
|
||||
// Listen for route changes and update the tabs accordingly.
|
||||
var locationListener = $rootScope.$on('$routeUpdate', function(){
|
||||
if ($location.search()['showRobot']) {
|
||||
$scope.filterToRobot($location.search()['showRobot']);
|
||||
}
|
||||
});
|
||||
|
||||
$scope.$on('$destroy', function() {
|
||||
locationListener && locationListener();
|
||||
});
|
||||
|
||||
var loadRobotPermissions = function(info) {
|
||||
var shortName = $scope.getShortenedName(info.name);
|
||||
info.loading_permissions = true;
|
||||
|
@ -31,6 +43,20 @@ angular.module('quay').directive('robotsManager', function () {
|
|||
}, ApiService.errorDisplay('Could not load robot permissions'));
|
||||
};
|
||||
|
||||
$scope.filterToRobot = function(robotName) {
|
||||
if ($scope.robotFilter == robotName) {
|
||||
return;
|
||||
}
|
||||
|
||||
var index = $scope.findRobotIndexByName(robotName);
|
||||
if (index < 0) {
|
||||
// Robot doesn't exist. Reload the list to see if we can find it.
|
||||
update();
|
||||
}
|
||||
|
||||
$scope.robotFilter = robotName;
|
||||
};
|
||||
|
||||
$scope.showPermissions = function(robotInfo) {
|
||||
robotInfo.showing_permissions = !robotInfo.showing_permissions;
|
||||
|
||||
|
@ -112,10 +138,7 @@ angular.module('quay').directive('robotsManager', function () {
|
|||
$scope.loading = false;
|
||||
|
||||
if ($routeParams.showRobot) {
|
||||
var index = $scope.findRobotIndexByName($routeParams.showRobot);
|
||||
if (index >= 0) {
|
||||
$scope.robotFilter = $routeParams.showRobot;
|
||||
}
|
||||
$scope.filterToRobot($routeParams.showRobot);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
Reference in a new issue