use of io.datarouter.email.html.J2HtmlEmailTable in project datarouter by hotpads.
the class WebappInstanceAlertJob method makeContent.
private ContainerTag<?> makeContent(WebappInstance webappInstance, DatarouterDuration buildAge) {
ZoneId zoneId = defaultDistributionListZoneId.get();
var rows = List.of(new Twin<>("webapp", webappInstance.getKey().getWebappName()), new Twin<>("build date", ZonedDateFormatterTool.formatInstantWithZone(webappInstance.getBuildInstant(), zoneId)), new Twin<>("build age", buildAge.toString()), new Twin<>("startup date", ZonedDateFormatterTool.formatInstantWithZone(webappInstance.getStartupInstant(), zoneId)), new Twin<>("commitId", webappInstance.getCommitId()));
return new J2HtmlEmailTable<Twin<String>>().withColumn(new J2HtmlEmailTableColumn<>(null, row -> makeDivBoldRight(row.getLeft()))).withColumn(new J2HtmlEmailTableColumn<>(null, row -> text(row.getRight()))).build(rows);
}
use of io.datarouter.email.html.J2HtmlEmailTable 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));
}
Aggregations