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

knowledgepixels / nanodash / 23361100507

20 Mar 2026 08:21PM UTC coverage: 16.371% (-0.008%) from 16.379%
23361100507

push

github

tkuhn
feat: add upcoming events table view to home page and make nanopub set items-per-page configurable

Add the upcoming-events-view as a table alongside the most recent nanopubs
(reduced to 5 items) on the home page. Remove unnecessary DataView wrappers
for single-item views and strip col-* classes to avoid extra spacing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

731 of 5533 branches covered (13.21%)

Branch coverage included in aggregate %.

1877 of 10398 relevant lines covered (18.05%)

2.47 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/HomePage.java
1
package com.knowledgepixels.nanodash.page;
2

3
import com.knowledgepixels.nanodash.*;
4
import com.knowledgepixels.nanodash.component.*;
5
import com.knowledgepixels.nanodash.domain.User;
6
import com.knowledgepixels.nanodash.template.Template;
7
import com.knowledgepixels.nanodash.template.TemplateData;
8
import org.apache.wicket.AttributeModifier;
9
import org.apache.wicket.markup.html.basic.Label;
10
import org.apache.wicket.markup.repeater.Item;
11
import org.apache.wicket.markup.repeater.data.DataView;
12
import org.apache.wicket.markup.repeater.data.ListDataProvider;
13
import org.apache.wicket.request.mapper.parameter.PageParameters;
14
import org.eclipse.rdf4j.model.IRI;
15
import org.nanopub.extra.services.ApiResponseEntry;
16
import org.nanopub.extra.services.QueryRef;
17

18
import java.util.ArrayList;
19
import java.util.List;
20

21
/**
22
 * The home page of Nanodash, which shows the most recent nanopublications
23
 * and the latest accepted nanopublications.
24
 */
25
public class HomePage extends NanodashPage {
26

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

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

40
    /**
41
     * Constructor for the home page.
42
     *
43
     * @param parameters the page parameters
44
     */
45
    public HomePage(final PageParameters parameters) {
46
        super(parameters);
×
47

48
        add(new TitleBar("titlebar", this, null));
×
49
        final NanodashSession session = NanodashSession.get();
×
50
        String v = WicketApplication.getThisVersion();
×
51
        String lv = WicketApplication.getLatestVersion();
×
52
        if (NanodashPreferences.get().isOrcidLoginMode()) {
×
53
            add(new Label("warning", ""));
×
54
        } else if (v.endsWith("-SNAPSHOT")) {
×
55
            add(new Label("warning", "You are running a temporary snapshot version of Nanodash (" + v + "). The latest public version is " + lv + "."));
×
56
        } else if (lv != null && !v.equals(lv)) {
×
57
            add(new Label("warning", "There is a new version available: " + lv + ". You are currently using " + v + ". " +
×
58
                                     "Run 'update' (Unix/Mac) or 'update-under-windows.bat' (Windows) to update to the latest version, or manually download it " +
59
                                     "<a href=\"" + WicketApplication.LATEST_RELEASE_URL + "\">here</a>.").setEscapeModelStrings(false));
×
60
        } else {
61
            add(new Label("warning", ""));
×
62
        }
63
        if (NanodashPreferences.get().isReadOnlyMode()) {
×
64
            add(new Label("text", "This is a read-only instance, so you cannot publish new nanopublications here."));
×
65
        } else if (NanodashSession.get().isProfileComplete()) {
×
66
            add(new Label("text", ""));
×
67
        } else if (NanodashPreferences.get().isOrcidLoginMode() && session.getUserIri() == null) {
×
68
            String loginUrl = OrcidLoginPage.getOrcidLoginUrl(".");
×
69
            add(new Label("text", "In order to see your own nanopublications and publish new ones, <a href=\"" + loginUrl + "\">login to ORCID</a> first.").setEscapeModelStrings(false));
×
70
        } else {
×
71
            add(new Label("text", "Before you can start, you first need to <a href=\"" + ProfilePage.MOUNT_PATH + "\">complete your profile</a>.").setEscapeModelStrings(false));
×
72
        }
73

74
        setOutputMarkupId(true);
×
75

76
        View mostRecentNanopubsView = View.get("https://w3id.org/np/RA85WirEeiXnxKdoL5IJMgnz9J5KcQLivapXLzTrupT6k/most-recent-nanopubs");
×
77
        QueryRef rQueryRef = new QueryRef(mostRecentNanopubsView.getQuery().getQueryId());
×
78
        add(QueryResultNanopubSetBuilder.create("mostrecent", rQueryRef, new ViewDisplay(mostRecentNanopubsView))
×
79
                .setItemsPerPage(5)
×
80
                .build()
×
81
                .add(AttributeModifier.remove("class"))
×
82
        );
83

84
        View upcomingEventsView = View.get("https://w3id.org/np/RAq5EwXCcCUsBEc7bMUgrT5oeLvX7khfqhA4hKzCjjBwk/upcoming-events-view");
×
85
        QueryRef eQueryRef = new QueryRef(upcomingEventsView.getQuery().getQueryId());
×
86
        add(QueryResultTableBuilder.create("upcomingevents", eQueryRef, new ViewDisplay(upcomingEventsView))
×
87
                .build()
×
88
                .add(AttributeModifier.remove("class"))
×
89
        );
90

91
        View topCreatorsView = View.get("https://w3id.org/np/RAuv15ISgaPadgIj_LCSQNd2QRKmMcPulun6NyiblzEOs/top-creators-last-30days");
×
92
        add(new DataView<ViewDisplay>("topCreators", new ListDataProvider<ViewDisplay>(List.of(new ViewDisplay(topCreatorsView)))) {
×
93

94
            @Override
95
            protected void populateItem(Item<ViewDisplay> item) {
96
                item.add(new ItemListPanel<IRI>(
×
97
                        "creatorsView",
98
                        topCreatorsView.getTitle(),
×
99
                        new QueryRef(topCreatorsView.getQuery().getQueryId()),
×
100
                        (apiResponse) -> {
101
                            List<IRI> users = new ArrayList<>();
×
102
                            for (ApiResponseEntry e : apiResponse.getData()) {
×
103
                                users.add(Utils.vf.createIRI(e.get("userid")));
×
104
                            }
×
105
                            return users;
×
106
                        },
107
                        (userIri) -> new ItemListElement("item", UserPage.class, new PageParameters().set("id", userIri), User.getShortDisplayName(userIri))
×
108
                ));
109
            }
×
110
        });
111

112
        View getStartedView = View.get("https://w3id.org/np/RAx2ljM4FrwsW9evtQj5LJWlL21tJR3Z-b__PdOpws2lY/suggested-templates-get-started");
×
113
        add(new DataView<ViewDisplay>("getStartedTemplates", new ListDataProvider<ViewDisplay>(List.of(new ViewDisplay(topCreatorsView)))) {
×
114

115
            @Override
116
            protected void populateItem(Item<ViewDisplay> item) {
117
                item.add(new ItemListPanel<Template>(
×
118
                        "getStartedTemplatesView",
119
                        getStartedView.getTitle(),
×
120
                        new QueryRef(getStartedView.getQuery().getQueryId()),
×
121
                        TemplateData::getTemplateList,
122
                        (template) -> new TemplateItem("item", template)
×
123
                ));
124
            }
×
125
        });
126

127
    }
×
128

129
}
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