Search in sources :

Example 1 with DivTag

use of j2html.tags.specialized.DivTag in project datarouter by hotpads.

the class AwsMemcachedWebInspector method getDetails.

@Override
protected Pair<Integer, DivTag> getDetails(ClientId clientId) {
    MemcachedClientMode mode = options.getClientMode(clientId.getName());
    Pair<Integer, DivTag> nodeCountByNodeTag = new Pair<>();
    if (mode == MemcachedClientMode.DYNAMIC) {
        List<AwsMemcachedNodeEndpointDto> nodeEndpointDtos = Scanner.of(getSpyClient(clientId).getAllNodeEndPoints()).map(nodeEndPoint -> new AwsMemcachedNodeEndpointDto(nodeEndPoint.getHostName(), nodeEndPoint.getIpAddress(), nodeEndPoint.getPort())).list();
        var table = new J2HtmlTable<AwsMemcachedNodeEndpointDto>().withClasses("sortable table table-sm table-striped my-4 border").withColumn("HostName", dto -> dto.hostName).withColumn("IpAddress", dto -> dto.ipAddress).withColumn("Port", dto -> dto.port).build(nodeEndpointDtos);
        DivTag divTable = div(table).withClass("container-fluid my-4").withStyle("padding-left: 0px");
        nodeCountByNodeTag.setLeft(nodeEndpointDtos.size());
        nodeCountByNodeTag.setRight(divTable);
    } else {
        List<LiTag> socketAddresses = Scanner.of(getSpyClient(clientId).getAvailableServers()).map(Object::toString).map(TagCreator::li).list();
        DivTag div = div(ul(socketAddresses.toArray(new ContainerTag[0])));
        nodeCountByNodeTag.setLeft(socketAddresses.size());
        nodeCountByNodeTag.setRight(div);
    }
    return nodeCountByNodeTag;
}
Also used : Scanner(io.datarouter.scanner.Scanner) MemcachedClientMode(io.datarouter.aws.memcached.client.MemcachedClientMode) DivTag(j2html.tags.specialized.DivTag) LiTag(j2html.tags.specialized.LiTag) MemcachedWebInspector(io.datarouter.client.memcached.web.MemcachedWebInspector) ContainerTag(j2html.tags.ContainerTag) Inject(javax.inject.Inject) List(java.util.List) ClientId(io.datarouter.storage.client.ClientId) Pair(io.datarouter.util.tuple.Pair) TagCreator.div(j2html.TagCreator.div) AwsMemcachedOptions(io.datarouter.aws.memcached.client.options.AwsMemcachedOptions) J2HtmlTable(io.datarouter.web.html.j2html.J2HtmlTable) TagCreator(j2html.TagCreator) TagCreator.ul(j2html.TagCreator.ul) DivTag(j2html.tags.specialized.DivTag) LiTag(j2html.tags.specialized.LiTag) MemcachedClientMode(io.datarouter.aws.memcached.client.MemcachedClientMode) Pair(io.datarouter.util.tuple.Pair)

Example 2 with DivTag

use of j2html.tags.specialized.DivTag in project openapi-diff by OpenAPITools.

the class HtmlRender method div_changedSchema.

private DivTag div_changedSchema(ChangedSchema schema) {
    DivTag div = div();
    div.with(h3("Schema" + (schema.isIncompatible() ? " incompatible" : "")));
    return div;
}
Also used : DivTag(j2html.tags.specialized.DivTag)

Example 3 with DivTag

use of j2html.tags.specialized.DivTag in project datarouter by hotpads.

the class SqsUpdateQueueHandler method buildPage.

private Mav buildPage(String href, String message) {
    DivTag backButton = div(a(i().withClass("fas fa-angle-left")).withText("Go back to client details").withHref(href).withClass("btn btn-primary"));
    DivTag content = div(backButton, div(message).withClass("my-4")).withClass("container my-4");
    return pageFactory.startBuilder(request).withContent(content).withTitle("Update Sqs Queue").buildMav();
}
Also used : DivTag(j2html.tags.specialized.DivTag)

Example 4 with DivTag

use of j2html.tags.specialized.DivTag 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 5 with DivTag

use of j2html.tags.specialized.DivTag in project datarouter by hotpads.

the class MemcachedWebInspector method getDetails.

protected Pair<Integer, DivTag> getDetails(ClientId clientId) {
    Pair<Integer, DivTag> nodeCountByNodeTag = new Pair<>();
    List<LiTag> socketAddresses = Scanner.of(memcachedOptions.getServers(clientId.getName())).map(InetSocketAddress::toString).map(TagCreator::li).list();
    DivTag div = div(ul(socketAddresses.toArray(new ContainerTag[0])));
    nodeCountByNodeTag.setLeft(socketAddresses.size());
    nodeCountByNodeTag.setRight(div);
    return nodeCountByNodeTag;
}
Also used : DivTag(j2html.tags.specialized.DivTag) LiTag(j2html.tags.specialized.LiTag) InetSocketAddress(java.net.InetSocketAddress) Pair(io.datarouter.util.tuple.Pair)

Aggregations

DivTag (j2html.tags.specialized.DivTag)5 Scanner (io.datarouter.scanner.Scanner)2 Pair (io.datarouter.util.tuple.Pair)2 J2HtmlTable (io.datarouter.web.html.j2html.J2HtmlTable)2 TagCreator (j2html.TagCreator)2 TagCreator.div (j2html.TagCreator.div)2 ContainerTag (j2html.tags.ContainerTag)2 LiTag (j2html.tags.specialized.LiTag)2 List (java.util.List)2 Inject (javax.inject.Inject)2 MemcachedClientMode (io.datarouter.aws.memcached.client.MemcachedClientMode)1 AwsMemcachedOptions (io.datarouter.aws.memcached.client.options.AwsMemcachedOptions)1 MemcachedWebInspector (io.datarouter.client.memcached.web.MemcachedWebInspector)1 MetricLinkBuilder (io.datarouter.instrumentation.metric.MetricLinkBuilder)1 PluginInjector (io.datarouter.plugin.PluginInjector)1 ClientId (io.datarouter.storage.client.ClientId)1 BaseHandler (io.datarouter.web.handler.BaseHandler)1 Mav (io.datarouter.web.handler.mav.Mav)1 MetricLinkDto (io.datarouter.web.metriclinks.MetricLinkDto)1 MetricLinkPage (io.datarouter.web.metriclinks.MetricLinkPage)1