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

knowledgepixels / nanodash / 18222607513

03 Oct 2025 12:44PM UTC coverage: 14.137% (+0.4%) from 13.699%
18222607513

push

github

tkuhn
feat(Spaces): Set SPACE query param for pinned queries and views

453 of 4116 branches covered (11.01%)

Branch coverage included in aggregate %.

1199 of 7570 relevant lines covered (15.84%)

0.71 hits per line

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

0.0
src/main/java/com/knowledgepixels/nanodash/component/PinGroupList.java
1
package com.knowledgepixels.nanodash.component;
2

3
import java.io.Serializable;
4
import java.util.ArrayList;
5
import java.util.Collections;
6
import java.util.List;
7

8
import org.apache.commons.lang3.tuple.Pair;
9
import org.apache.wicket.markup.html.WebMarkupContainer;
10
import org.apache.wicket.markup.html.panel.Panel;
11
import org.apache.wicket.markup.repeater.Item;
12
import org.apache.wicket.markup.repeater.data.DataView;
13
import org.apache.wicket.markup.repeater.data.ListDataProvider;
14
import org.apache.wicket.request.mapper.parameter.PageParameters;
15

16
import com.knowledgepixels.nanodash.GrlcQuery;
17
import com.knowledgepixels.nanodash.Space;
18
import com.knowledgepixels.nanodash.template.Template;
19

20
public class PinGroupList extends Panel {
21

22
    public PinGroupList(String markupId, Space space) {
23
        super(markupId);
×
24

25
        final PageParameters tParams = new PageParameters();
×
26
        tParams.add("param_SPACE", space.getId());
×
27
        if (space.getDefaultProvenance() != null) {
×
28
            tParams.add("prtemplate", space.getDefaultProvenance().stringValue());
×
29
        }
30

31
        final PageParameters qParams = new PageParameters();
×
32
        qParams.add("queryparam_SPACE", space.getId());
×
33

34
        List<Pair<String, List<Serializable>>> pinnedResourcesList = new ArrayList<>();
×
35
        List<String> pinGroupTags = new ArrayList<>(space.getPinGroupTags());
×
36
        Collections.sort(pinGroupTags);
×
37
        List<Serializable> pinnedResources = new ArrayList<>(space.getPinnedResources());
×
38
        for (String tag : pinGroupTags) {
×
39
            for (Object pinned : space.getPinnedResourceMap().get(tag)) {
×
40
                if (pinnedResources.contains(pinned)) pinnedResources.remove(pinned);
×
41
            }
×
42
            pinnedResourcesList.add(Pair.of(tag, space.getPinnedResourceMap().get(tag)));
×
43
        }
×
44
        if (!pinnedResources.isEmpty()) {
×
45
            String l = pinnedResourcesList.isEmpty() ? "Resources" : "Other Resources";
×
46
            pinnedResourcesList.add(Pair.of(l, pinnedResources));
×
47
        }
48

49
        add(new DataView<Pair<String, List<Serializable>>>("pin-groups", new ListDataProvider<>(pinnedResourcesList)) {
×
50
            @Override
51
            protected void populateItem(Item<Pair<String, List<Serializable>>> item) {
52
               item.add(new ItemListPanel<Serializable>(
×
53
                        "pin-group",
54
                        item.getModelObject().getLeft(),
×
55
                        item.getModelObject().getRight(),
×
56
                        (o) -> {
57
                            if (o instanceof Template t) {
×
58
                                t.addToLabelMap(space.getId(), space.getLabel());
×
59
                                return new TemplateItem("item", t, tParams, false);
×
60
                            }
61
                            if (o instanceof GrlcQuery q) {
×
62
                                return new QueryItem("item", q, qParams, false);
×
63
                            }
64
                            return null;
×
65
                        }));
66
            }
×
67
        });
68

69
        add(new WebMarkupContainer("emptynotice").setVisible(pinnedResourcesList.isEmpty()));
×
70
    }
×
71

72

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