Sorting the chapters of the HA guide

Closes #38721

Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
Alexander Schwartz
2025-04-11 13:37:07 +02:00
committed by GitHub
parent 74188c33e4
commit 4e93379254
9 changed files with 61 additions and 30 deletions

View File

@@ -1,13 +1,16 @@
introduction
concepts-multi-site
bblocks-multi-site
concepts-database-connections
concepts-threads
concepts-memory-and-cpu-sizing
concepts-infinispan-cli-batch
deploy-aurora-multi-az
deploy-infinispan-kubernetes-crossdc
deploy-keycloak-kubernetes
deploy-aws-route53-loadbalancer
deploy-aws-route53-failover-lambda
deploy-aws-accelerator-loadbalancer
deploy-aws-accelerator-fencing-lambda
operate-site-offline
operate-site-online
operate-synchronize
health-checks-multi-site
operate-failover
operate-switch-over
operate-network-partition-recovery
operate-switch-back

View File

@@ -3,4 +3,12 @@ configuration-metrics
event-metrics
keycloak-service-level-indicators
metrics-for-troubleshooting
metrics-for-troubleshooting-keycloak
metrics-for-troubleshooting-jvm
metrics-for-troubleshooting-database
metrics-for-troubleshooting-http
metrics-for-troubleshooting-clustering-and-network
metrics-for-troubleshooting-embedded-caches
metrics-for-troubleshooting-embedded-caches-multi-site
metrics-for-troubleshooting-external-infinispan-multi-site
tracing

View File

@@ -6,7 +6,6 @@
<@tmpl.guide
title="Basic {project_name} deployment"
priority=20
summary="How to install {project_name} using the Operator">
== Performing a basic {project_name} deployment

View File

@@ -6,7 +6,6 @@
<@tmpl.guide
title="{project_name} Operator Installation"
priority=10
summary="How to install the {project_name} Operator on Kubernetes and OpenShift">
== Installing the {project_name} Operator

View File

@@ -5,7 +5,6 @@
<@tmpl.guide
title="{project_name} Realm Import"
priority=30
summary="How to perform an automated {project_name} Realm Import using the operator">
== Importing a {project_name} Realm

View File

@@ -4,7 +4,6 @@
<@tmpl.guide
title="Using a vault"
summary="Learn how to use and configure a vault in {project_name}"
priority=30
includedOptions="vault vault-*">
{project_name} provides two out-of-the-box implementations of the Vault SPI: a plain-text file-based vault and Java KeyStore-based vault.

View File

@@ -31,16 +31,30 @@ public class Context {
for (File f : srcDir.listFiles((dir, f) -> f.endsWith(".adoc") && !f.equals("index.adoc"))) {
Guide guide = parser.parse(f);
if (guidePriorities != null && guide != null) {
if (guide != null) {
if (guidePriorities != null) {
Integer priority = guidePriorities.get(guide.getId());
guide.setPriority(priority != null ? priority : Integer.MAX_VALUE);
if (priority != null) {
if (guide.getPriority() != Integer.MAX_VALUE) {
throw new RuntimeException("Guide is pinned, but has a priority specified: " + f.getName());
}
guidePriorities.remove(guide.getId());
guide.setPriority(priority);
}
}
if (!guide.isTileVisible() && guide.getPriority() == Integer.MAX_VALUE) {
throw new RuntimeException("Invisible tiles should be pinned or have an explicit priority: " + f.getName());
}
if (guide != null) {
guides.add(guide);
}
}
if (guidePriorities != null && !guidePriorities.isEmpty()) {
throw new RuntimeException("File 'pinned-guides' contains files that no longer exist or are misspelled: " + guidePriorities.keySet());
}
Collections.sort(guides, (o1, o2) -> {
if (o1.getPriority() == o2.getPriority()) {
return o1.getTitle().compareTo(o2.getTitle());

View File

@@ -6,7 +6,8 @@ public class Guide {
private String id;
private String title;
private String summary;
private int priority;
private int priority = Integer.MAX_VALUE;
private boolean tileVisible = true;
public String getTemplate() {
return template;
@@ -47,4 +48,12 @@ public class Guide {
public void setPriority(int priority) {
this.priority = priority;
}
public boolean isTileVisible() {
return tileVisible;
}
public void setTileVisible(boolean tileVisible) {
this.tileVisible = tileVisible;
}
}

View File

@@ -9,8 +9,8 @@ import java.util.regex.Pattern;
public class GuideParser {
private Pattern TEMPLATE_IMPORT_PATTERN = Pattern.compile("<#import \"/templates/guide.adoc\" as (?<importName>[^ ]*)>");
private Pattern GUIDE_ELEMENT_PATTERN = Pattern.compile("(?<key>priority|title|summary)=(\\\"(?<valueString>[^\\\"]*)\\\"|(?<valueInt>[\\d]*))");
private final Pattern TEMPLATE_IMPORT_PATTERN = Pattern.compile("<#import \"/templates/guide.adoc\" as (?<importName>[^ ]*)>");
private final Pattern GUIDE_ELEMENT_PATTERN = Pattern.compile("(?<key>priority|title|summary|tileVisible)=(\\\"(?<valueString>[^\\\"]*)\\\"|(?<valueInt>[\\d]*))");
/**
* Parses a FreeMarker template to retrieve Guide attributes
@@ -26,7 +26,6 @@ public class GuideParser {
if (importElement != null) {
Guide guide = new Guide();
guide.setTemplate(file.getName());
guide.setPriority(999);
guide.setId(file.getName().replaceAll(".adoc", ""));
@@ -79,6 +78,8 @@ public class GuideParser {
break;
case "priority":
guide.setPriority(Integer.parseInt(attributeMatcher.group("valueInt")));
case "tileVisible":
guide.setTileVisible(Boolean.parseBoolean(attributeMatcher.group("valueString")));
}
}
}