feat(ui): turn the landing page into a dashboard with a built-in wait view (#5594)

* feat(ui): turn the landing page into a dashboard with a built-in wait view

The page served to browsers on / becomes a dashboard: how to connect
(endpoint, region, account and copyable snippets), the init stages and
scripts, runtime facts, services grouped by category with a filter, and
an opt-in news panel. The top bar shows the emulator status and its
version, and reports "Shutting down" once shutdown has started.

The news panel makes no request until it is turned on. It then reads
floci.io/news.json, a feed shared by every Floci emulator: an item may
carry a product, and this page shows items for "aws" and items with no
product. The choice is remembered in local storage when the browser
allows it and otherwise lasts for the page view. An item without a date
is shown without one.

The "starting Floci UI" interstitial is now a second view of the same
file, picked from the request path, so /_floci/ui serves index.html and
starting.html is removed. The wait view shows elapsed time, the error
the emulator reports, and a retry, and still redirects once the UI
sidecar is ready.

StartingPageEscapesUntrustedTextTest now reads index.html: the launch
error must go through textContent and the status error shown on the
dashboard must be escaped.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

* fix(ui): correct the update hint and the news gate wording, drop em-dashes

The release note told users to run "floci update", which replaces only
the CLI binary; "floci start" pulls with the "missing" policy and
"floci restart" forces it, so a cached image stayed in place. The note
now says to pull the new image and restart, and gives the CLI form:
"floci stop", then "floci start --pull always".

The news gate said the page only talks to the local emulator, which is
not true while the fonts load from Google Fonts. It now says what holds:
nothing is fetched from the news host until news is turned on.

Em-dashes are removed from the UiController Javadoc, the Runtime
placeholders and the page title.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>

---------

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-10-13 23:26:58 -04:00
1 parent 8bd88bfb40
commit 73b034aa18
5 files changed
+759 -344

No files matched your search

@@ -16,9 +16,10 @@ import jakarta.ws.rs.core.Response;
* Browser-facing endpoints that launch and redirect to the floci-ui sidecar.
*
* <ul>
* <li>{@code GET /_floci/ui} — kicks off the sidecar start (async) and returns a
* small interstitial page that polls {@code /status} and redirects when ready.</li>
* <li>{@code GET /_floci/ui/status} — JSON {@code {ready, url, error}} the
* <li>{@code GET /_floci/ui}: kicks off the sidecar start (async) and returns the
* landing page, which shows its wait view on this path: it polls {@code /status}
* and redirects when ready.</li>
* <li>{@code GET /_floci/ui/status}: JSON {@code {ready, url, error}} the
* interstitial polls.</li>
* </ul>
*/
@@ -38,7 +39,7 @@ public class UiController {
@Produces(MediaType.TEXT_HTML)
public Response ui() {
uiManager.ensureStartedAsync();
return Response.ok(uiPages.startingHtml()).build();
return Response.ok(uiPages.landingHtml()).build();
}
@RegisterForReflection
@@ -7,20 +7,18 @@ import java.io.InputStream;
import java.nio.charset.StandardCharsets;
/**
* Loads and caches the small embedded HTML pages served to browsers: the Floci
* landing page and the "starting the UI" interstitial. Resources are read from
* the classpath ({@code ui/*.html}) and must be registered in
* {@code quarkus.native.resources.includes} so they are embedded in the native
* image.
* Loads and caches the embedded HTML page served to browsers. One file holds two
* views, the dashboard and the "starting the UI" wait view, and picks between them
* from the request path. It is read from the classpath ({@code ui/*.html}) and must
* be registered in {@code quarkus.native.resources.includes} so it is embedded in
* the native image.
*/
@ApplicationScoped
public class UiPages {
private static final String LANDING_RESOURCE = "ui/index.html";
private static final String STARTING_RESOURCE = "ui/starting.html";
private volatile String landing;
private volatile String starting;
public String landingHtml() {
String result = landing;
@@ -31,15 +29,6 @@ public class UiPages {
return result;
}
public String startingHtml() {
String result = starting;
if (result == null) {
result = readResource(STARTING_RESOURCE);
starting = result;
}
return result;
}
private static String readResource(String resourceName) {
ClassLoader loader = UiPages.class.getClassLoader();
try (InputStream input = loader.getResourceAsStream(resourceName)) {