Start on mobilification of repo view

This commit is contained in:
Joseph Schorr 2015-04-20 17:42:33 -04:00
parent 79caf2dab2
commit a4cacd7307
31 changed files with 265 additions and 91 deletions

View file

@ -754,7 +754,10 @@ angular.module("core-ui", [])
displayer.removeAttr('ng-repeat');
}
displayer.append(headers[idx].clone(true).addClass('mobile-col-header'));
if (idx < headers.length) {
displayer.append(headers[idx].clone(true).addClass('mobile-col-header'));
}
displayer.append(cloneWithAttr(td, 'div', true).addClass('mobile-col-value'));
div.append(displayer);
});

View file

@ -18,12 +18,6 @@ angular.module('quay').directive('prototypeManager', function () {
$scope.clearCounter = 0;
$scope.newForWholeOrg = true;
$scope.roles = [
{ 'id': 'read', 'title': 'Read', 'kind': 'success' },
{ 'id': 'write', 'title': 'Write', 'kind': 'success' },
{ 'id': 'admin', 'title': 'Admin', 'kind': 'primary' }
];
$scope.setRole = function(role, prototype) {
var params = {
'orgname': $scope.organization.name,

View file

@ -28,13 +28,6 @@ angular.module('quay').directive('repositoryPermissionsTable', function () {
'repository': '=repository'
},
controller: function($scope, $element, ApiService, Restangular, UtilService) {
// TODO(jschorr): move this to a service.
$scope.roles = [
{ 'id': 'read', 'title': 'Read', 'kind': 'success' },
{ 'id': 'write', 'title': 'Write', 'kind': 'success' },
{ 'id': 'admin', 'title': 'Admin', 'kind': 'primary' }
];
$scope.permissionResources = {'team': {}, 'user': {}};
$scope.permissionCache = {};
$scope.permissions = {};

View file

@ -14,12 +14,6 @@ angular.module('quay').directive('repositoryTokensTable', function () {
'hasTokens': '=hasTokens'
},
controller: function($scope, $element, ApiService, Restangular, UtilService) {
$scope.roles = [
{ 'id': 'read', 'title': 'Read', 'kind': 'success' },
{ 'id': 'write', 'title': 'Write', 'kind': 'success' },
{ 'id': 'admin', 'title': 'Admin', 'kind': 'primary' }
];
$scope.hasTokens = false;
var loadTokens = function() {

View file

@ -15,13 +15,6 @@ angular.module('quay').directive('robotsManager', function () {
controller: function($scope, $element, ApiService, $routeParams, CreateService, Config) {
$scope.ROBOT_PATTERN = ROBOT_PATTERN;
// TODO(jschorr): move this to a service.
$scope.roles = [
{ 'id': 'read', 'title': 'Read', 'kind': 'success' },
{ 'id': 'write', 'title': 'Write', 'kind': 'success' },
{ 'id': 'admin', 'title': 'Admin', 'kind': 'primary' }
];
$scope.robots = null;
$scope.loading = false;
$scope.shownRobot = null;

View file

@ -10,12 +10,14 @@ angular.module('quay').directive('roleGroup', function () {
transclude: false,
restrict: 'C',
scope: {
'roles': '=roles',
'roles': '@roles',
'currentRole': '=currentRole',
'readOnly': '=readOnly',
'roleChanged': '&roleChanged'
},
controller: function($scope, $element) {
controller: function($scope, $element, RolesService) {
$scope.fullRoles = RolesService[$scope.roles];
$scope.setRole = function(role) {
if ($scope.currentRole == role) { return; }
if ($scope.roleChanged) {
@ -24,6 +26,14 @@ angular.module('quay').directive('roleGroup', function () {
$scope.currentRole = role;
}
};
$scope.getRoleInfo = function(role) {
var found = null;
$scope.fullRoles.forEach(function(r) {
if (r.id == role) { found = r; }
});
return found;
};
}
};
return directiveDefinitionObject;

View file

@ -97,12 +97,6 @@
$scope.TEAM_PATTERN = TEAM_PATTERN;
$rootScope.title = 'Loading...';
$scope.teamRoles = [
{ 'id': 'member', 'title': 'Member', 'kind': 'default' },
{ 'id': 'creator', 'title': 'Creator', 'kind': 'success' },
{ 'id': 'admin', 'title': 'Admin', 'kind': 'primary' }
];
$scope.setRole = function(role, teamname) {
var previousRole = $scope.organization.teams[teamname].role;
$scope.organization.teams[teamname].role = role;

View file

@ -110,12 +110,6 @@
}, ApiService.errorDisplay('Cannot change permission'));
};
$scope.roles = [
{ 'id': 'read', 'title': 'Read', 'kind': 'success' },
{ 'id': 'write', 'title': 'Write', 'kind': 'success' },
{ 'id': 'admin', 'title': 'Admin', 'kind': 'primary' }
];
$scope.setRole = function(role, entityName, kind) {
var permission = $scope.permissions[kind][entityName];
var currentRole = permission.role;

View file

@ -0,0 +1,20 @@
/**
* Service which defines the various role groups.
*/
angular.module('quay').factory('RolesService', [function() {
var roleService = {};
roleService.repoRoles = [
{ 'id': 'read', 'title': 'Read', 'kind': 'success', 'description': 'Can view and pull from the repository' },
{ 'id': 'write', 'title': 'Write', 'kind': 'success', 'description': 'Can view, pull and push to the repository' },
{ 'id': 'admin', 'title': 'Admin', 'kind': 'primary', 'description': 'Full admin access, pull and push on the repository' }
];
roleService.teamRoles = [
{ 'id': 'member', 'title': 'Member', 'kind': 'default', 'description': 'Inherits all permissions of the team' },
{ 'id': 'creator', 'title': 'Creator', 'kind': 'success', 'description': 'Member and can create new repositories' },
{ 'id': 'admin', 'title': 'Admin', 'kind': 'primary', 'description': 'Full admin access to the organization' }
];
return roleService;
}]);