Search in sources :

Example 1 with MetricLinkPage

use of io.datarouter.web.metriclinks.MetricLinkPage in project datarouter by hotpads.

the class MetricLinksHandler method view.

@Handler
public Mav view() {
    List<ContainerTag<DivTag>> tags = pluginInjector.scanInstances(MetricLinkPage.KEY).sort(Comparator.comparing(MetricLinkPage::getHtmlName)).exclude(page -> page.getMetricLinks().isEmpty()).map(this::makeContent).collect(Collectors.toList());
    DivTag content = div(each(tags, item -> TagCreator.div(item)));
    return pageFactory.startBuilder(request).withTitle("Metric Links").withContent(content).withRequires(DatarouterWebRequireJsV2.SORTTABLE).buildMav();
}
Also used : TagCreator.join(j2html.TagCreator.join) Scanner(io.datarouter.scanner.Scanner) DivTag(j2html.tags.specialized.DivTag) PluginInjector(io.datarouter.plugin.PluginInjector) TagCreator.h2(j2html.TagCreator.h2) Attr(j2html.attributes.Attr) Inject(javax.inject.Inject) MetricLinkPage(io.datarouter.web.metriclinks.MetricLinkPage) DatarouterWebRequireJsV2(io.datarouter.web.requirejs.DatarouterWebRequireJsV2) J2HtmlTable(io.datarouter.web.html.j2html.J2HtmlTable) TagCreator(j2html.TagCreator) TagCreator.i(j2html.TagCreator.i) MetricLinkDto(io.datarouter.web.metriclinks.MetricLinkDto) Mav(io.datarouter.web.handler.mav.Mav) TagCreator.each(j2html.TagCreator.each) TagCreator.a(j2html.TagCreator.a) Collectors(java.util.stream.Collectors) ContainerTag(j2html.tags.ContainerTag) List(java.util.List) TagCreator.th(j2html.TagCreator.th) TagCreator.td(j2html.TagCreator.td) BaseHandler(io.datarouter.web.handler.BaseHandler) Comparator(java.util.Comparator) TagCreator.div(j2html.TagCreator.div) MetricLinkBuilder(io.datarouter.instrumentation.metric.MetricLinkBuilder) DivTag(j2html.tags.specialized.DivTag) MetricLinkPage(io.datarouter.web.metriclinks.MetricLinkPage) ContainerTag(j2html.tags.ContainerTag) BaseHandler(io.datarouter.web.handler.BaseHandler)

Example 2 with MetricLinkPage

use of io.datarouter.web.metriclinks.MetricLinkPage in project datarouter by hotpads.

the class MetricNamesSubnavFactory method build.

public Subnav build(String contextPath) {
    Subnav subnav = new Subnav("Metric Links", "", ID);
    pluginInjector.scanInstances(MetricLinkPage.KEY).sort(Comparator.comparing(dto -> dto.getCategory().getName())).collect(Collectors.groupingBy(MetricLinkPage::getCategory)).entrySet().stream().sorted(Comparator.comparing((Entry<MetricLinkCategory, List<MetricLinkPage>> entry) -> entry.getKey().getName())).forEach(entry -> {
        Dropdown dropdown = new Dropdown(entry.getKey().getName());
        entry.getValue().forEach(page -> dropdown.addItem(page.getName(), contextPath + paths.datarouter.metric.metricLinks.view.toSlashedString() + "#" + page.getHtmlId()));
        subnav.add(dropdown);
    });
    subnav.add(other(contextPath));
    return subnav;
}
Also used : Subnav(io.datarouter.web.html.nav.Subnav) Entry(java.util.Map.Entry) MetricLinkPage(io.datarouter.web.metriclinks.MetricLinkPage) Dropdown(io.datarouter.web.html.nav.Subnav.Dropdown)

Aggregations

MetricLinkPage (io.datarouter.web.metriclinks.MetricLinkPage)2 MetricLinkBuilder (io.datarouter.instrumentation.metric.MetricLinkBuilder)1 PluginInjector (io.datarouter.plugin.PluginInjector)1 Scanner (io.datarouter.scanner.Scanner)1 BaseHandler (io.datarouter.web.handler.BaseHandler)1 Mav (io.datarouter.web.handler.mav.Mav)1 J2HtmlTable (io.datarouter.web.html.j2html.J2HtmlTable)1 Subnav (io.datarouter.web.html.nav.Subnav)1 Dropdown (io.datarouter.web.html.nav.Subnav.Dropdown)1 MetricLinkDto (io.datarouter.web.metriclinks.MetricLinkDto)1 DatarouterWebRequireJsV2 (io.datarouter.web.requirejs.DatarouterWebRequireJsV2)1 TagCreator (j2html.TagCreator)1 TagCreator.a (j2html.TagCreator.a)1 TagCreator.div (j2html.TagCreator.div)1 TagCreator.each (j2html.TagCreator.each)1 TagCreator.h2 (j2html.TagCreator.h2)1 TagCreator.i (j2html.TagCreator.i)1 TagCreator.join (j2html.TagCreator.join)1 TagCreator.td (j2html.TagCreator.td)1 TagCreator.th (j2html.TagCreator.th)1