Search in sources :

Example 1 with LiTag

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

the class HtmlRender method li_changedParam.

private LiTag li_changedParam(ChangedParameter changeParam) {
    if (changeParam.isDeprecated()) {
        return li_deprecatedParam(changeParam);
    }
    boolean changeRequired = changeParam.isChangeRequired();
    boolean changeDescription = Optional.ofNullable(changeParam.getDescription()).map(ChangedMetadata::isDifferent).orElse(false);
    Parameter rightParam = changeParam.getNewParameter();
    Parameter leftParam = changeParam.getNewParameter();
    LiTag li = li().withText(changeParam.getName() + " in " + changeParam.getIn());
    if (changeRequired) {
        li.withText(" change into " + (rightParam.getRequired() ? "required" : "not required"));
    }
    if (changeDescription) {
        li.withText(" Notes ").with(del(leftParam.getDescription()).withClass(COMMENT)).withText(" change into ").with(span(rightParam.getDescription()).withClass(COMMENT));
    }
    return li;
}
Also used : LiTag(j2html.tags.specialized.LiTag) Parameter(io.swagger.v3.oas.models.parameters.Parameter) ChangedParameter(org.openapitools.openapidiff.core.model.ChangedParameter)

Example 2 with LiTag

use of j2html.tags.specialized.LiTag 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 3 with LiTag

use of j2html.tags.specialized.LiTag 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

LiTag (j2html.tags.specialized.LiTag)3 Pair (io.datarouter.util.tuple.Pair)2 DivTag (j2html.tags.specialized.DivTag)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 Scanner (io.datarouter.scanner.Scanner)1 ClientId (io.datarouter.storage.client.ClientId)1 J2HtmlTable (io.datarouter.web.html.j2html.J2HtmlTable)1 Parameter (io.swagger.v3.oas.models.parameters.Parameter)1 TagCreator (j2html.TagCreator)1 TagCreator.div (j2html.TagCreator.div)1 TagCreator.ul (j2html.TagCreator.ul)1 ContainerTag (j2html.tags.ContainerTag)1 InetSocketAddress (java.net.InetSocketAddress)1 List (java.util.List)1 Inject (javax.inject.Inject)1 ChangedParameter (org.openapitools.openapidiff.core.model.ChangedParameter)1