5 Commits

Author SHA1 Message Date
Ian Renton
05bc65337f Fix a bug in the mobile view where the second line doesn't get painted green for SSE new spots. Closes #87 2025-12-24 11:16:03 +00:00
Ian Renton
d2c1dbb377 Fix a bug in the mobile view where the second line doesn't get painted green for SSE new spots. Closes #87 2025-12-24 11:14:03 +00:00
Ian Renton
6cf1b38355 Fix metrics content type? 2025-12-24 10:10:46 +00:00
Ian Renton
ac566553d8 nginx config #3 2025-12-24 09:47:26 +00:00
Ian Renton
bcc40d1416 SSE custom headers #3 2025-12-24 09:44:55 +00:00
5 changed files with 27 additions and 6 deletions

View File

@@ -157,6 +157,8 @@ server {
location / {
add_header Access-Control-Allow-Origin $xssorigin;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://127.0.0.1:8080;
}
}

View File

@@ -53,6 +53,11 @@ class APIAlertsStreamHandler(tornado_eventsource.handler.EventSourceHandler):
self.sse_alert_queues = sse_alert_queues
self.web_server_metrics = web_server_metrics
# Custom headers to avoid e.g. nginx reverse proxy from buffering SSE data
def custom_headers(self):
return {"Cache-Control": "no-store",
"X-Accel-Buffering": "no"}
def open(self):
try:
# Metrics

View File

@@ -54,6 +54,11 @@ class APISpotsStreamHandler(tornado_eventsource.handler.EventSourceHandler):
self.sse_spot_queues = sse_spot_queues
self.web_server_metrics = web_server_metrics
# Custom headers to avoid e.g. nginx reverse proxy from buffering SSE data
def custom_headers(self):
return {"Cache-Control": "no-store",
"X-Accel-Buffering": "no"}
# Called once on the client opening a connection, set things up
def open(self):
try:

View File

@@ -1,5 +1,5 @@
import tornado
from prometheus_client.openmetrics.exposition import CONTENT_TYPE_LATEST
from prometheus_client import CONTENT_TYPE_LATEST
from core.prometheus_metrics_handler import get_metrics

View File

@@ -182,9 +182,6 @@ function createNewTableRowsForSpot(s, highlightNew) {
// Create row
let $tr = $('<tr>');
if (highlightNew) {
$tr.addClass("new");
}
// Apply striping to the table. We can't just use Bootstrap's table-striped class because we have all sorts of
// extra faff to deal with, like the mobile view having extra rows, and the On Now / Next 24h / Later banners
@@ -195,7 +192,13 @@ function createNewTableRowsForSpot(s, highlightNew) {
// Show faded out if QRT
if (s["qrt"] == true) {
$tr.addClass("table-faded");
$tr.addClass("table-faded");
}
// If we are asked to highlight new rows (i.e. this row is being added "live" via the SSE client and not as a bulk
// reload of the whole table)
if (highlightNew) {
$tr.addClass("new");
}
// Format a UTC or local time for display
@@ -341,12 +344,18 @@ function createNewTableRowsForSpot(s, highlightNew) {
// Second row for mobile view only, containing type, ref & comment
$tr2 = $("<tr class='hidenotonmobile'>");
// Apply styles as per the first row
if (rowCount % 2 == 1) {
$tr2.addClass("table-active");
}
if (s["qrt"] == true) {
$tr2.addClass("table-faded");
$tr2.addClass("table-faded");
}
if (highlightNew) {
$tr2.addClass("new");
}
$td2 = $("<td colspan='100'>");
if (showType) {
$td2.append(`<span class='icon-wrapper'><i class='fa-solid fa-${s["icon"]}'></i></span> ${typeText} `);