Search in sources :

Example 1 with TableTag

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

the class SqsQueuesDailyDigest method buildContent.

private Optional<ContainerTag<?>> buildContent(ContentType contentType) {
    ClientId clientId = Scanner.of(datarouterClients.getClientIds()).include(client -> datarouterClients.getClientTypeInstance(client) instanceof SqsClientType).findFirst().orElse(null);
    if (clientId == null) {
        return Optional.empty();
    }
    List<String> unreferencedQueues = queueRegistryService.getSqsQueuesForClient(clientId).getRight();
    if (unreferencedQueues.isEmpty()) {
        return Optional.empty();
    }
    TableTag unreferencedQueuesTable = new TableTag();
    if (contentType == ContentType.PAGE) {
        unreferencedQueuesTable = new J2HtmlTable<String>().withClasses("sortable table table-sm table-striped my-4 border").withHtmlColumn(th("Queue Name"), TagCreator::td).build(unreferencedQueues);
    } else if (contentType == ContentType.EMAIL) {
        unreferencedQueuesTable = new J2HtmlEmailTable<String>().withColumn("Queue Name", row -> row).build(unreferencedQueues);
    }
    ContainerTag<?> header = digestService.makeHeader("Unreferenced Sqs Queues", paths.datarouter.client.inspectClient, "?clientName=sqs");
    return Optional.of(div(header, unreferencedQueuesTable));
}
Also used : J2HtmlTable(io.datarouter.web.html.j2html.J2HtmlTable) Scanner(io.datarouter.scanner.Scanner) J2HtmlEmailTable(io.datarouter.email.html.J2HtmlEmailTable) DatarouterWebPaths(io.datarouter.web.config.DatarouterWebPaths) DailyDigestGrouping(io.datarouter.web.digest.DailyDigestGrouping) Singleton(javax.inject.Singleton) TableTag(j2html.tags.specialized.TableTag) ZoneId(java.time.ZoneId) ContainerTag(j2html.tags.ContainerTag) Inject(javax.inject.Inject) List(java.util.List) TagCreator.th(j2html.TagCreator.th) ClientId(io.datarouter.storage.client.ClientId) Optional(java.util.Optional) DailyDigest(io.datarouter.web.digest.DailyDigest) TagCreator.div(j2html.TagCreator.div) J2HtmlTable(io.datarouter.web.html.j2html.J2HtmlTable) TagCreator(j2html.TagCreator) SqsClientType(io.datarouter.aws.sqs.SqsClientType) DatarouterClients(io.datarouter.storage.client.DatarouterClients) DailyDigestService(io.datarouter.web.digest.DailyDigestService) SqsClientType(io.datarouter.aws.sqs.SqsClientType) TagCreator(j2html.TagCreator) TableTag(j2html.tags.specialized.TableTag) ClientId(io.datarouter.storage.client.ClientId) J2HtmlEmailTable(io.datarouter.email.html.J2HtmlEmailTable)

Aggregations

SqsClientType (io.datarouter.aws.sqs.SqsClientType)1 J2HtmlEmailTable (io.datarouter.email.html.J2HtmlEmailTable)1 Scanner (io.datarouter.scanner.Scanner)1 ClientId (io.datarouter.storage.client.ClientId)1 DatarouterClients (io.datarouter.storage.client.DatarouterClients)1 DatarouterWebPaths (io.datarouter.web.config.DatarouterWebPaths)1 DailyDigest (io.datarouter.web.digest.DailyDigest)1 DailyDigestGrouping (io.datarouter.web.digest.DailyDigestGrouping)1 DailyDigestService (io.datarouter.web.digest.DailyDigestService)1 J2HtmlTable (io.datarouter.web.html.j2html.J2HtmlTable)1 TagCreator (j2html.TagCreator)1 TagCreator.div (j2html.TagCreator.div)1 TagCreator.th (j2html.TagCreator.th)1 ContainerTag (j2html.tags.ContainerTag)1 TableTag (j2html.tags.specialized.TableTag)1 ZoneId (java.time.ZoneId)1 List (java.util.List)1 Optional (java.util.Optional)1 Inject (javax.inject.Inject)1 Singleton (javax.inject.Singleton)1