use of j2html.tags.ContainerTag in project datarouter by hotpads.
the class Bootstrap4PageBuilder method build.
public DatarouterPage build() {
require.add(DatarouterWebRequireJsV2.BOOTSTRAP);
boolean isAdmin = mavProperties.getIsAdmin();
var head = new Bootstrap4PageHead(mavProperties, mavProperties.getContextPath(), webappRequireJsConfigJsonString, require.toArray(String[]::new), isAdmin, title, httpEquivs);
NavBar navbar = mavProperties.getIsDatarouterPage() ? mavProperties.getDatarouterNavBar() : mavProperties.getNavBar();
List<ContainerTag<?>> allNavbars = new ArrayList<>();
if (includeNav) {
if (isAdmin) {
allNavbars.add(new DatarouterNavbarV2Html(mavProperties).build());
}
allNavbars.add(new WebappNavbarV2Html(mavProperties, navbar).build());
allNavbars.addAll(navbars);
}
var body = new DatarouterPageBody(allNavbars.toArray(ContainerTag[]::new), content);
return new DatarouterPage(head, body);
}
use of j2html.tags.ContainerTag in project datarouter by hotpads.
the class WebappInstanceServersHandler method makeContent.
private ContainerTag<?> makeContent(Page<WebappInstanceLogDto> page, List<String> activeServerNames) {
var form = Bootstrap4PagerHtml.renderForm(page).withClass("mt-4");
var linkBar = Bootstrap4PagerHtml.renderLinkBar(page).withClass("mt-2");
ZoneId zoneId = getUserZoneId();
var table = new J2HtmlTable<WebappInstanceLogDto>().withClasses("sortable table table-sm table-striped my-4 border").withHtmlColumn("", row -> {
if (activeServerNames.contains(row.key.serverName)) {
if (row.shutdown.isEmpty()) {
return td();
}
if (row.shutdown.get().toEpochMilli() < System.currentTimeMillis()) {
return td();
}
return td(span("Active").withClass("badge badge-success"));
}
return td();
}).withColumn("Server Name", row -> row.key.serverName).withColumn("Private IP", row -> row.key.serverPrivateIp).withColumn("Build Date", row -> ZonedDateFormatterTool.formatInstantWithZone(row.key.buildDate, zoneId)).withColumn("Startup Range", row -> row.startup.map(date -> ZonedDateFormatterTool.formatInstantWithZone(date, zoneId)).orElse("unknown") + " - " + row.shutdown.map(date -> ZonedDateFormatterTool.formatInstantWithZone(date, zoneId)).orElse("unknown")).withColumn("Up Time", row -> {
if (row.startup.isEmpty() || row.shutdown.isEmpty()) {
return "unknown";
}
var duration = Duration.ofMillis(row.shutdown.get().toEpochMilli() - row.startup.get().toEpochMilli());
return new DatarouterDuration(duration).toString(TimeUnit.MINUTES);
}).build(page.rows);
return div(form, linkBar, table).withClass("container-fluid");
}
use of j2html.tags.ContainerTag 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));
}
use of j2html.tags.ContainerTag in project nivio by dedica-team.
the class SVGRelationTest method marker.
@Test
@DisplayName("The dataflow marker is not null")
void marker() {
ContainerTag containerTag = SVGRelation.dataflowMarker();
assertThat(containerTag).isNotNull();
assertThat(containerTag.getTagName()).isEqualTo("marker");
}
use of j2html.tags.ContainerTag in project nivio by dedica-team.
the class SVGBackgroundFactoryTest method generatesHexTemplate.
@Test
void generatesHexTemplate() {
ContainerTag hex = SVGBackgroundFactory.getHex();
assertThat(hex).isNotNull();
assertThat(hex.getTagName()).isEqualTo("polygon");
}
Aggregations