Update ReUI skill documentation to reflect the addition of 3 new components, increasing the total from 17 to 20. Adjust descriptions and examples accordingly, including updates to the data-grid API to align with TanStack Table v9. Ensure all references to components and their usage are consistent across the documentation.
This commit is contained in:
1 parent
721332e767
commit
3fb8480f8a
27 files changed
+444
-108
No files matched your search
+69
-10
@@ -1605,6 +1605,49 @@ export function aggregateIpHealthByRefs(
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Group-scope badge health: only IPs that are currently published/probed
|
||||
* (A-record binding IPs of enabled services). Ignores stale pool-only rows.
|
||||
*/
|
||||
export function aggregateGroupScopeHealthByIds(
|
||||
db: Db,
|
||||
groupIds: number[],
|
||||
): Map<number, HealthAggregate> {
|
||||
const result = new Map<number, HealthAggregate>();
|
||||
if (groupIds.length === 0) return result;
|
||||
const idList = sql.join(
|
||||
groupIds.map((id) => sql`${id}`),
|
||||
sql`, `,
|
||||
);
|
||||
const rows = db.all<{
|
||||
ref_id: number;
|
||||
health_status: string | null;
|
||||
health_latency_ms: number | null;
|
||||
}>(sql`
|
||||
SELECT ihs.ref_id AS ref_id,
|
||||
${WORST_HEALTH_SQL} AS health_status,
|
||||
MAX(ihs.latency_ms) AS health_latency_ms
|
||||
FROM ip_health_status ihs
|
||||
WHERE ihs.scope = 'group'
|
||||
AND ihs.ref_id IN (${idList})
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM service_binding_ips sbi
|
||||
JOIN service_bindings sb ON sb.id = sbi.binding_id
|
||||
JOIN services s ON s.id = sb.service_id
|
||||
WHERE s.service_group_id = ihs.ref_id
|
||||
AND s.enabled = 1
|
||||
AND sbi.ip = ihs.ip
|
||||
AND (sb.cname_target IS NULL OR sb.cname_target = '')
|
||||
)
|
||||
GROUP BY ihs.ref_id
|
||||
`);
|
||||
for (const row of rows) {
|
||||
result.set(row.ref_id, parseHealthAggregateRow(row));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Worst binding-scope health rolled up per service_id. */
|
||||
export function aggregateIpHealthByServiceIds(
|
||||
db: Db,
|
||||
@@ -1744,7 +1787,10 @@ export function deleteIpHealthStatusForIp(
|
||||
.run();
|
||||
}
|
||||
|
||||
/** Drop health rows whose IP is no longer a live probe target for that scope/ref. */
|
||||
/** Drop health rows whose IP is no longer a live probe target for that scope/ref.
|
||||
* Also clears refs that have stored rows but zero active targets (e.g. all
|
||||
* services disabled) — otherwise stale `down` keeps poisoning the group badge.
|
||||
*/
|
||||
export function pruneStaleIpHealthStatus(
|
||||
db: Db,
|
||||
activeTargets: Array<{ scope: HealthCheckScope; ref_id: number; ip: string }>,
|
||||
@@ -1760,12 +1806,19 @@ export function pruneStaleIpHealthStatus(
|
||||
ips.add(t.ip);
|
||||
}
|
||||
|
||||
const storedRefs = db.all<{ scope: HealthCheckScope; ref_id: number }>(sql`
|
||||
SELECT DISTINCT scope, ref_id FROM ip_health_status
|
||||
`);
|
||||
|
||||
let deleted = 0;
|
||||
for (const [key, ips] of byRef) {
|
||||
const sep = key.indexOf(":");
|
||||
const scope = key.slice(0, sep) as HealthCheckScope;
|
||||
const refId = Number(key.slice(sep + 1));
|
||||
if (!Number.isFinite(refId)) continue;
|
||||
for (const { scope, ref_id: refId } of storedRefs) {
|
||||
const key = `${scope}:${refId}`;
|
||||
const ips = byRef.get(key);
|
||||
if (!ips || ips.size === 0) {
|
||||
deleteIpHealthStatusForRef(db, scope, refId);
|
||||
deleted += 1;
|
||||
continue;
|
||||
}
|
||||
for (const row of listIpHealthStatus(db, scope, refId)) {
|
||||
if (!ips.has(row.ip)) {
|
||||
deleteIpHealthStatusForIp(db, scope, refId, row.ip);
|
||||
@@ -1799,8 +1852,11 @@ export function listHealthCheckTargets(db: Db): HealthCheckTarget[] {
|
||||
WHERE sb.health_check_enabled = 1
|
||||
`);
|
||||
|
||||
// Group FQDN probes the same A-record IPs that DNS publishes (binding IPs of
|
||||
// enabled services) — NOT the full service_ips pool. Pool-only dead IPs must
|
||||
// not mark the group Down while the published domain stays healthy.
|
||||
const groupTargets = db.all<HealthCheckTarget>(sql`
|
||||
SELECT 'group' AS scope, sg.id AS ref_id, sip.ip,
|
||||
SELECT DISTINCT 'group' AS scope, sg.id AS ref_id, sbi.ip,
|
||||
sg.domain AS hostname,
|
||||
sg.health_check_type AS type,
|
||||
sg.health_check_port AS port,
|
||||
@@ -1808,13 +1864,16 @@ export function listHealthCheckTargets(db: Db): HealthCheckTarget[] {
|
||||
sg.health_check_expected_status AS expected_status,
|
||||
sg.health_check_timeout_ms AS timeout_ms,
|
||||
sg.health_check_verify_tls AS verify_tls
|
||||
FROM services s
|
||||
JOIN service_ips sip ON sip.service_id = s.id
|
||||
FROM service_binding_ips sbi
|
||||
JOIN service_bindings sb ON sb.id = sbi.binding_id
|
||||
JOIN services s ON s.id = sb.service_id
|
||||
JOIN service_groups sg ON sg.id = s.service_group_id
|
||||
WHERE sg.health_check_enabled = 1
|
||||
AND sg.domain IS NOT NULL
|
||||
AND sg.domain <> ''
|
||||
AND s.enabled = 1
|
||||
AND (sg.enabled = 1)
|
||||
AND sg.enabled = 1
|
||||
AND (sb.cname_target IS NULL OR sb.cname_target = '')
|
||||
`);
|
||||
|
||||
// IPs of A-bindings of enabled services in a group whose group has health-check enabled.
|
||||
|
||||
Reference in new issue
Block a user