Skip to content

Commit 3fa85ad

Browse files
authored
[JENKINS-75695] Pagination for item role assignments and UI refresh (jenkinsci#405)
2 parents 4ffe48a + 2ca51a1 commit 3fa85ad

27 files changed

+902
-539
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,15 @@ You can assign roles to users and user groups using the _Assign Roles_ screen
7070
* Hovering over a checkbox will show a tooltip with role, user/group and pattern.
7171

7272
#### Working with many roles
73-
The UI becomes slow to load when working with many roles. A setup with 400 item roles and one user/group assigned to each role will result in
74-
a table with 160k checkboxes. This will cause a high memory consumption of the browser and loading the page will take quite long (~ 1min and more).
75-
To improve the loading tooltips and table highlighting are disabled when the total number of checkboxes exceeds 40000 (that is 200 roles with 200 users/groups).
73+
To ensure a responsive UI the item assignment works with pagination. With many roles the tooltips and the highlighter might still be a bit laggy.
74+
Applying a role filter will make them work smoothly usually.
7675

77-
To further improve UI response times use the filters for users and roles.
76+
By default the number of rows is limited to 30 for the item role assignment page. You can change this by setting the system property
77+
`com.michelin.cio.hudson.plugins.rolestrategy.RoleStrategyConfig.MAX_ROWS` at jvm start or via the script console.
7878

79-
Another limitation is that when you run Jenkins via the built-in Jetty, that the max number of parameters in a form submission is 10000 and the max formsize is 200000. This can be
80-
increased by passing the parameter `--maxParamCount=N` to the Jenkins java call (See the [Winstone](https://github.com/jenkinsci/winstone) documentation) and setting the system
79+
The number of parameters in a form submission is limited to 10000 by default in Jenkins and the max formsize is limited to 200000 by Jetty.
80+
If you encounter problems when saving the "Manage Roles" due to too many form keys this can be increased by passing the parameter `--maxParamCount=N`
81+
to the Jenkins java call (See the [Winstone](https://github.com/jenkinsci/winstone) documentation) and setting the system
8182
property `-Dorg.eclipse.jetty.server.Request.maxFormContentSize=n` at jvm start.
8283

8384
![Assign roles](/docs/images/assignRoles.png)
@@ -152,5 +153,4 @@ an init hook script.
152153

153154
* [Changelog](https://github.com/jenkinsci/role-strategy-plugin/releases)
154155
* [Macro extensions](./docs/MACROS.md)
155-
* [Greasemonkey Addons for Web UI](./docs/USERSCRIPTS.md)
156156
* [Developer documentation](./docs/DEVELOPER.md)

docs/DEVELOPER.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ Verify that following things work on `Assign Roles`:
2929
2. Deleting a role by pressing on the red x deletes the role
3030
3. Hovering over the checkboxes properly highlights the row and column and shows a tooltip
3131
4. Entering html as user is printed as plain text in the field and in the tooltips.
32+
5. Check that pagination works especially in combination with the filters.
3233

33-
34+
Creating some hundred item roles and assignments
35+
Use the file [roles.groovy](roles.groovy) to generate 400 item roles and assign each role a user and a group
3436

3537
### Code details
3638

docs/USERSCRIPTS.md

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/images/assignRoles.png

31.9 KB
Loading

docs/images/configureSecurity.png

-19.2 KB
Loading
-23.6 KB
Binary file not shown.

docs/images/manageRoles.png

-62.1 KB
Loading
-9.06 KB
Binary file not shown.

docs/roles.groovy

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import com.michelin.cio.hudson.plugins.rolestrategy.AuthorizationType
2+
import com.michelin.cio.hudson.plugins.rolestrategy.PermissionEntry
3+
import com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy
4+
import com.michelin.cio.hudson.plugins.rolestrategy.Role
5+
import com.synopsys.arc.jenkins.plugins.rolestrategy.RoleType
6+
import hudson.security.Permission
7+
8+
9+
Jenkins jenkins = Jenkins.get()
10+
def rbas = jenkins.getAuthorizationStrategy()
11+
12+
/* create admin role */
13+
Set<Permission> permissions = new HashSet<>();
14+
permissions.add(Item.READ)
15+
permissions.add(Item.BUILD)
16+
17+
18+
itemRoleMap = rbas.getRoleMap(RoleType.Project)
19+
20+
for (i = 101; i <=500; i++) {
21+
role = "role-"+i;
22+
user = "user-"+i
23+
group = "group-"+i
24+
//r = new Role(role, role, permissions)
25+
//itemRoleMap.addRole(r)
26+
//itemRoleMap.assignRole(r, new PermissionEntry(AuthorizationType.USER, user))
27+
//itemRoleMap.assignRole(r, new PermissionEntry(AuthorizationType.GROUP, group))
28+
r = itemRoleMap.getRole(role)
29+
itemRoleMap.removeRole(r)
30+
}
31+
32+
jenkins.save()

pom.xml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,6 @@
2323
</license>
2424
</licenses>
2525

26-
<developers>
27-
<developer>
28-
<id>tmaurel</id>
29-
<name>Thomas Maurel</name>
30-
<timezone>+1</timezone>
31-
</developer>
32-
<developer>
33-
<id>rseguy</id>
34-
<name>Romain Seguy</name>
35-
<timezone>+1</timezone>
36-
</developer>
37-
<developer>
38-
<id>oleg_nenashev</id>
39-
<name>Oleg Nenashev</name>
40-
<email>o.v.nenashev@gmail.com</email>
41-
</developer>
42-
</developers>
43-
4426
<scm>
4527
<connection>scm:git:https://github.com/${gitHubRepo}.git</connection>
4628
<developerConnection>scm:git:git@github.com:${gitHubRepo}.git</developerConnection>

0 commit comments

Comments
 (0)