• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

knowledgepixels / nanodash / 17496450008

05 Sep 2025 02:44PM UTC coverage: 12.094% (+0.004%) from 12.09%
17496450008

push

github

tkuhn
Add pagination for user lists

Still showing some issues:

- sometimes (but only sometimes) jumping to the top of page on
pagination link clicking
- when the list has updated in the background, it jumps to page 1

335 of 3876 branches covered (8.64%)

Branch coverage included in aggregate %.

972 of 6931 relevant lines covered (14.02%)

0.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
src/main/java/com/knowledgepixels/nanodash/page/UserListPage.java
1
package com.knowledgepixels.nanodash.page;
2

3
import java.util.HashMap;
4
import java.util.List;
5

6
import org.apache.wicket.Component;
7
import org.apache.wicket.markup.html.basic.Label;
8
import org.apache.wicket.markup.html.link.ExternalLink;
9
import org.apache.wicket.request.mapper.parameter.PageParameters;
10
import org.eclipse.rdf4j.model.IRI;
11
import org.nanopub.extra.services.ApiResponse;
12

13
import com.knowledgepixels.nanodash.ApiCache;
14
import com.knowledgepixels.nanodash.User;
15
import com.knowledgepixels.nanodash.component.ApiResultComponent;
16
import com.knowledgepixels.nanodash.component.TitleBar;
17
import com.knowledgepixels.nanodash.component.UserList;
18

19
/**
20
 * Page that lists all users and groups.
21
 */
22
public class UserListPage extends NanodashPage {
23

24
    private static final long serialVersionUID = 1L;
25

26
    /**
27
     * The mount path for this page.
28
     */
29
    public static final String MOUNT_PATH = "/userlist";
30

31
    /**
32
     * {@inheritDoc}
33
     */
34
    @Override
35
    public String getMountPath() {
36
        return MOUNT_PATH;
×
37
    }
38

39
    /**
40
     * Constructor for the user list page.
41
     *
42
     * @param parameters the page parameters
43
     */
44
    public UserListPage(final PageParameters parameters) {
45
        super(parameters);
×
46

47
        add(new TitleBar("titlebar", this, "users"));
×
48

49
//                final List<Group> groupList = new ArrayList<Group>(Group.getGroups());
50
//                add(new DataView<Group>("groups", new ListDataProvider<Group>(groupList)) {
51
//
52
//                        private static final long serialVersionUID = 1L;
53
//
54
//                        @Override
55
//                        protected void populateItem(Item<Group> item) {
56
//                                Group g = item.getModelObject();
57
//                                PageParameters params = new PageParameters();
58
//                                params.add("id", g.getIri());
59
//                                BookmarkablePageLink<Void> l = new BookmarkablePageLink<Void>("grouplink", GroupPage.class, params);
60
//                                l.add(new Label("linktext", g.getName()));
61
//                                item.add(l);
62
//                        }
63
//
64
//                });
65

66
        final HashMap<String, String> noParams = new HashMap<>();
×
67

68
        final String uQueryName = "get-top-creators-last30d";
×
69
        ApiResponse rResponse = ApiCache.retrieveResponse(uQueryName, noParams);
×
70
        if (rResponse != null) {
×
71
            add(new UserList("topcreators", rResponse, "userid"));
×
72
        } else {
73
            add(new ApiResultComponent("topcreators", uQueryName, noParams) {
×
74

75
                private static final long serialVersionUID = 1L;
76

77
                @Override
78
                public Component getApiResultComponent(String markupId, ApiResponse response) {
79
                    return new UserList(markupId, response, "userid");
×
80
                }
81
            });
82
        }
83

84
        final String aQueryName = "get-top-authors";
×
85
        ApiResponse aResponse = ApiCache.retrieveResponse(aQueryName, noParams);
×
86
        if (aResponse != null) {
×
87
            add(new UserList("topauthors", aResponse, "author"));
×
88
        } else {
89
            add(new ApiResultComponent("topauthors", aQueryName, noParams) {
×
90

91
                private static final long serialVersionUID = 1L;
92

93
                @Override
94
                public Component getApiResultComponent(String markupId, ApiResponse response) {
95
                    return new UserList(markupId, response, "author");
×
96
                }
97
            });
98
        }
99

100
        final List<IRI> userList = User.getUsers(true);
×
101
        add(new Label("usercount", userList.size()));
×
102

103
        add(new UserList("approved-users", userList));
×
104
        add(new UserList("other-users", User.getUsers(false)));
×
105

106
        add(new ExternalLink("approve", PublishPage.MOUNT_PATH + "?template=http://purl.org/np/RA6TVVSnZChEwyxjvFDNAujk1i8sSPnQx60ZQjldtiDkw&template-version=latest", "approve somebody else"));
×
107
        //add(new ExternalLink("newgroup", PublishPage.MOUNT_PATH + "?template=http://purl.org/np/RAJz6w5cvlsFGkCDtWOUXt2VwEQ3tVGtPdy3atPj_DUhk&template-version=latest", "new group"));
108
    }
×
109

110
    /**
111
     * {@inheritDoc}
112
     */
113
    @Override
114
    protected boolean hasAutoRefreshEnabled() {
115
        return true;
×
116
    }
117

118
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc