Lifecycle planning, and consistent empty and loading states

- Inventory: end of support and replacement cost per asset; a Lifecycle page showing what ages out year by year and what replacing it will cost; support ending within 90 days in the weekly digest
- Lists: a shared empty state saying what is missing, why, and the one thing to do; "nothing matches" with a clear button; skeleton rows instead of empty-looking lists while loading

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-18 23:18:42 +02:00
1 parent 92726568b7
commit 846af02851
50 files changed
+4434 -233

No files matched your search

+2
View File
@@ -589,6 +589,8 @@ The hardware inventory.
| `manufacturer`, `model`, `serial`, `location`, `rack_unit`, `notes` | text | | | `manufacturer`, `model`, `serial`, `location`, `rack_unit`, `notes` | text | |
| `purchase_date`, `warranty_until` | text | `YYYY-MM-DD`. | | `purchase_date`, `warranty_until` | text | `YYYY-MM-DD`. |
| `purchase_price` | real | In the currency set under the `inventory` settings key. | | `purchase_price` | real | In the currency set under the `inventory` settings key. |
| `end_of_support` | text | `YYYY-MM-DD`: when the maker stops patching it, or you plan to retire it. What the lifecycle report goes by (the warranty's end stands in when this is empty). |
| `replacement_cost` | real | What replacing it is expected to cost, in the same currency. The lifecycle report falls back to `purchase_price`. |
| `power_watts` | integer | Typical draw, for the running cost. | | `power_watts` | integer | Typical draw, for the running cost. |
| `server_id` | integer | The server this is, if it is one. A plain reference, **not a foreign key**: one whose server is gone shows as unlinked. | | `server_id` | integer | The server this is, if it is one. A plain reference, **not a foreign key**: one whose server is gone shows as unlinked. |
| `created_at`, `updated_at` | text NOT NULL | ISO. | | `created_at`, `updated_at` | text NOT NULL | ISO. |
+11 -1
View File
@@ -604,7 +604,17 @@ how much, when its warranty ends, its typical power draw, and which server it is
Summary cards show how much is under warranty (and what ends within 90 days), the total Summary cards show how much is under warranty (and what ends within 90 days), the total
draw, and — with a price per kWh set at the foot of the page — a rough yearly running draw, and — with a price per kWh set at the foot of the page — a rough yearly running
cost. Everyone signed in can look; operators keep it up to date; the weekly digest cost. Everyone signed in can look; operators keep it up to date; the weekly digest
mentions a warranty ending within 60 days. mentions a warranty ending within 60 days, or support ending within 90.
**Lifecycle planning** (Inventory → Lifecycle). Give a piece of hardware an **end of support** (when the maker stops patching it, or when you plan to retire it) and a
**replacement cost**, and the Lifecycle page lists what ages out, year by year for the next 3, 5, 7 or 10 years, with what replacing each year's hardware is expected to
cost (the total says how many have no figure, so it is "at least" that). What is already past its date is listed first, and what is further off, or has no date, is kept
apart. Until a piece has an end of support, the end of its warranty stands in — and the page says so — and until it has a replacement cost, what it was bought for does.
CSV export; the weekly digest also mentions support ending within 90 days.
**Empty and loading lists.** A list with nothing in it says what is missing, why that is, and — when you can — the one thing to do about it (a button that opens the right form, or
a link to the page that fills it). A list that has things but not the ones you searched for says so, with a button that clears the search and filters. While a list is on its way
it shows grey placeholder lines rather than looking empty.
Entries that are a server also pick up what its agent says the machine is: when you link an entry to a server (or the Entries that are a server also pick up what its agent says the machine is: when you link an entry to a server (or the
agent reports later), a blank maker, model or serial number is filled in from the firmware — never over what a person wrote. agent reports later), a blank maker, model or serial number is filled in from the firmware — never over what a person wrote.
+2
View File
@@ -0,0 +1,2 @@
ALTER TABLE `assets` ADD `end_of_support` text;--> statement-breakpoint
ALTER TABLE `assets` ADD `replacement_cost` real;
File diff suppressed because it is too large. Load diff
+7
View File
@@ -281,6 +281,13 @@
"when": 1792356659440, "when": 1792356659440,
"tag": "0039_old_blur", "tag": "0039_old_blur",
"breakpoints": true "breakpoints": true
},
{
"idx": 40,
"version": "6",
"when": 1792357895858,
"tag": "0040_petite_invaders",
"breakpoints": true
} }
] ]
} }
+2
View File
@@ -820,6 +820,8 @@ export const assets = sqliteTable("assets", {
purchaseDate: text("purchase_date"), // YYYY-MM-DD purchaseDate: text("purchase_date"), // YYYY-MM-DD
purchasePrice: real("purchase_price"), // in the currency set under Settings → Inventory purchasePrice: real("purchase_price"), // in the currency set under Settings → Inventory
warrantyUntil: text("warranty_until"), // YYYY-MM-DD warrantyUntil: text("warranty_until"), // YYYY-MM-DD
endOfSupport: text("end_of_support"), // YYYY-MM-DD — when the maker stops patching it, or you plan to retire it; what the lifecycle report goes by
replacementCost: real("replacement_cost"), // what replacing it is expected to cost, in the same currency; the lifecycle report falls back to the purchase price
location: text("location"), // room, rack, shelf location: text("location"), // room, rack, shelf
rackUnit: text("rack_unit"), // e.g. "U12" or "U12-13" rackUnit: text("rack_unit"), // e.g. "U12" or "U12-13"
powerWatts: integer("power_watts"), // typical draw, for the running cost powerWatts: integer("power_watts"), // typical draw, for the running cost
+13 -1
View File
@@ -5,7 +5,7 @@ import { db } from "../db/client.js";
import { assetKinds, assets, servers } from "../db/schema.js"; import { assetKinds, assets, servers } from "../db/schema.js";
import { requireAuth, requireRole } from "../auth/middleware.js"; import { requireAuth, requireRole } from "../auth/middleware.js";
import { recordAudit } from "../services/audit.js"; import { recordAudit } from "../services/audit.js";
import { isRealDate } from "../services/inventory.js"; import { isRealDate, lifecycleReport } from "../services/inventory.js";
import { blanksToFill, differences, hardwareOf } from "../services/inventoryAutofill.js"; import { blanksToFill, differences, hardwareOf } from "../services/inventoryAutofill.js";
import { getSettings, updateSettings } from "../services/settingsStore.js"; import { getSettings, updateSettings } from "../services/settingsStore.js";
import { asyncHandler } from "../utils/asyncHandler.js"; import { asyncHandler } from "../utils/asyncHandler.js";
@@ -26,6 +26,8 @@ const assetSchema = z.object({
purchaseDate: date, purchaseDate: date,
purchasePrice: z.number().min(0).max(1_000_000_000).nullable().optional(), purchasePrice: z.number().min(0).max(1_000_000_000).nullable().optional(),
warrantyUntil: date, warrantyUntil: date,
endOfSupport: date,
replacementCost: z.number().min(0).max(1_000_000_000).nullable().optional(),
location: text(120), location: text(120),
rackUnit: text(30), rackUnit: text(30),
powerWatts: z.number().int().min(0).max(100_000).nullable().optional(), powerWatts: z.number().int().min(0).max(100_000).nullable().optional(),
@@ -46,6 +48,8 @@ function values(d: z.infer<typeof assetSchema>) {
purchaseDate: clean(d.purchaseDate), purchaseDate: clean(d.purchaseDate),
purchasePrice: d.purchasePrice ?? null, purchasePrice: d.purchasePrice ?? null,
warrantyUntil: clean(d.warrantyUntil), warrantyUntil: clean(d.warrantyUntil),
endOfSupport: clean(d.endOfSupport),
replacementCost: d.replacementCost ?? null,
location: clean(d.location), location: clean(d.location),
rackUnit: clean(d.rackUnit), rackUnit: clean(d.rackUnit),
powerWatts: d.powerWatts ?? null, powerWatts: d.powerWatts ?? null,
@@ -83,6 +87,14 @@ inventoryRouter.get("/", asyncHandler(async (_req, res) => {
}); });
})); }));
// What ages out when, for planning what to replace: this year, the next few, later, and what has no date.
inventoryRouter.get("/lifecycle", asyncHandler(async (req, res) => {
const asked = Number(req.query.years);
const years = Number.isInteger(asked) && asked >= 1 && asked <= 10 ? asked : 5;
const [rows, settings] = await Promise.all([db.select().from(assets), getSettings()]);
res.json({ ...lifecycleReport(rows, new Date(), years), currency: settings.inventory.currency });
}));
const configSchema = z.object({ const configSchema = z.object({
currency: z.string().trim().max(8), currency: z.string().trim().max(8),
pricePerKwh: z.number().min(0).max(1000).nullable(), pricePerKwh: z.number().min(0).max(1000).nullable(),
+78
View File
@@ -30,6 +30,84 @@ export function warrantyStatus(warrantyUntil: string | null, now: Date = new Dat
return days <= warnDays ? "expiring" : "ok"; return days <= warnDays ? "expiring" : "ok";
} }
// ─── Lifecycle planning ─────────────────────────────────────────────────────
export interface LifecycleItem {
id: number;
name: string;
kind: string;
/** YYYY-MM-DD — when it ages out. */
endsOn: string;
/** What that date is: the end of support the maker gives (or you set), or, with none set, the end of the warranty. */
basis: "support" | "warranty";
daysLeft: number;
/** What replacing it is expected to cost, and where that figure comes from; null when there is none. */
cost: number | null;
costBasis: "replacement" | "purchase" | null;
}
export interface LifecycleYear {
year: number;
items: LifecycleItem[];
/** The sum of the figures that exist. */
totalCost: number;
/** How many have no figure, so the total is understood to be at least that. */
unpriced: number;
}
export interface LifecycleReport {
/** Already past their date. */
past: LifecycleItem[];
/** The years from this one on. */
years: LifecycleYear[];
/** Further off than the years shown. */
later: LifecycleItem[];
/** With no date at all: no end of support and no warranty. */
undated: { id: number; name: string; kind: string }[];
}
type LifecycleSource = { id: number; name: string; kind: string; endOfSupport: string | null; warrantyUntil: string | null; replacementCost: number | null; purchasePrice: number | null };
/**
* What ages out when, for planning what to replace. The date is the end of support where there is one, otherwise the end of the warranty (said
* so, since that is only a stand-in); the cost is the replacement cost where there is one, otherwise what it was bought for. Things already past
* their date, those in each of the next `yearsAhead` calendar years, those later, and those with no date at all are kept apart.
*/
export function lifecycleReport(assets: LifecycleSource[], now: Date = new Date(), yearsAhead = 5): LifecycleReport {
const thisYear = now.getUTCFullYear();
const years: LifecycleYear[] = Array.from({ length: yearsAhead }, (_, i) => ({ year: thisYear + i, items: [], totalCost: 0, unpriced: 0 }));
const past: LifecycleItem[] = [];
const later: LifecycleItem[] = [];
const undated: LifecycleReport["undated"] = [];
for (const a of assets) {
const support = a.endOfSupport && isRealDate(a.endOfSupport) ? a.endOfSupport : null;
const warranty = a.warrantyUntil && isRealDate(a.warrantyUntil) ? a.warrantyUntil : null;
const endsOn = support ?? warranty;
if (!endsOn) {
undated.push({ id: a.id, name: a.name, kind: a.kind });
continue;
}
const cost = a.replacementCost ?? a.purchasePrice ?? null;
const item: LifecycleItem = { id: a.id, name: a.name, kind: a.kind, endsOn, basis: support ? "support" : "warranty", daysLeft: warrantyDaysLeft(endsOn, now) ?? 0, cost, costBasis: a.replacementCost !== null ? "replacement" : a.purchasePrice !== null ? "purchase" : null };
if (item.daysLeft < 0) past.push(item);
else {
const bucket = years.find((y) => y.year === Number(endsOn.slice(0, 4)));
if (bucket) bucket.items.push(item);
else later.push(item);
}
}
const byDate = (x: LifecycleItem, y: LifecycleItem) => x.endsOn.localeCompare(y.endsOn) || x.name.localeCompare(y.name);
past.sort(byDate);
later.sort(byDate);
for (const y of years) {
y.items.sort(byDate);
y.totalCost = Math.round(y.items.reduce((n, i) => n + (i.cost ?? 0), 0));
y.unpriced = y.items.filter((i) => i.cost === null).length;
}
undated.sort((a, b) => a.name.localeCompare(b.name));
return { past, years, later, undated };
}
/** Kilowatt-hours a steady draw uses in a year. */ /** Kilowatt-hours a steady draw uses in a year. */
export function yearlyKwh(watts: number): number { export function yearlyKwh(watts: number): number {
return Math.round((watts / 1000) * 24 * 365 * 100) / 100; return Math.round((watts / 1000) * 24 * 365 * 100) / 100;
+6 -1
View File
@@ -185,11 +185,16 @@ export async function buildDigest(now: Date = new Date()): Promise<Digest> {
expiring.push({ daysLeft: d.daysLeft, text: d.daysLeft < 0 ? `Domain ${d.name} expired ${plural(Math.abs(d.daysLeft), "day")} ago` : `Domain ${d.name} expires in ${plural(d.daysLeft, "day")} (${d.expiresAt})` }); expiring.push({ daysLeft: d.daysLeft, text: d.daysLeft < 0 ? `Domain ${d.name} expired ${plural(Math.abs(d.daysLeft), "day")} ago` : `Domain ${d.name} expires in ${plural(d.daysLeft, "day")} (${d.expiresAt})` });
} }
// A warranty about to end is worth knowing while there is still time to claim on it; one that ended long ago is not news. // A warranty about to end is worth knowing while there is still time to claim on it; one that ended long ago is not news.
for (const a of await db.select({ name: assets.name, warrantyUntil: assets.warrantyUntil }).from(assets)) { for (const a of await db.select({ name: assets.name, warrantyUntil: assets.warrantyUntil, endOfSupport: assets.endOfSupport }).from(assets)) {
const days = warrantyDaysLeft(a.warrantyUntil, now); const days = warrantyDaysLeft(a.warrantyUntil, now);
if (days !== null && days >= -30 && days <= 60) { if (days !== null && days >= -30 && days <= 60) {
expiring.push({ daysLeft: days, text: days < 0 ? `Warranty on ${a.name} ended ${plural(Math.abs(days), "day")} ago` : `Warranty on ${a.name} ends in ${plural(days, "day")} (${a.warrantyUntil})` }); expiring.push({ daysLeft: days, text: days < 0 ? `Warranty on ${a.name} ended ${plural(Math.abs(days), "day")} ago` : `Warranty on ${a.name} ends in ${plural(days, "day")} (${a.warrantyUntil})` });
} }
// The end of support gives more notice: it is when something has to be replaced, not claimed on.
const supportDays = warrantyDaysLeft(a.endOfSupport, now);
if (supportDays !== null && supportDays >= -30 && supportDays <= 90) {
expiring.push({ daysLeft: supportDays, text: supportDays < 0 ? `Support for ${a.name} ended ${plural(Math.abs(supportDays), "day")} ago` : `Support for ${a.name} ends in ${plural(supportDays, "day")} (${a.endOfSupport})` });
}
} }
if (expiring.length > 0) { if (expiring.length > 0) {
expiring.sort((a, b) => a.daysLeft - b.daysLeft); expiring.sort((a, b) => a.daysLeft - b.daysLeft);
+145
View File
@@ -0,0 +1,145 @@
/**
* Lifecycle planning: what ages out when, what replacing it is expected to cost, the route, and the weekly digest's word about support ending.
*
* Run with: npm test --workspace server
*/
import { test, describe, before, after } from "node:test";
import assert from "node:assert/strict";
import { mkdtempSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import type { AddressInfo } from "node:net";
import type { Server } from "node:http";
const dir = mkdtempSync(join(tmpdir(), "hm-lifecycle-"));
process.env.DATABASE_PATH = join(dir, "test.sqlite");
process.env.SESSION_DIR = join(dir, "sessions");
process.env.CREDENTIALS_ENCRYPTION_KEY = "ab".repeat(32);
process.env.HEALTH_STARTUP_GRACE_MS = "0";
const express = (await import("express")).default;
const { db } = await import("../src/db/client.js");
const { users, servers } = await import("../src/db/schema.js");
const { runMigrations } = await import("../src/db/migrate.js");
const { inventoryRouter } = await import("../src/routes/inventory.js");
const { lifecycleReport } = await import("../src/services/inventory.js");
const { buildDigest } = await import("../src/services/weeklyDigest.js");
const { updateSettings } = await import("../src/services/settingsStore.js");
await runMigrations();
const NOW = new Date("2026-10-18T12:00:00Z");
const asset = (id: number, name: string, extra: Partial<{ endOfSupport: string | null; warrantyUntil: string | null; replacementCost: number | null; purchasePrice: number | null }> = {}) => ({
id, name, kind: "server", endOfSupport: null, warrantyUntil: null, replacementCost: null, purchasePrice: null, ...extra,
});
describe("what ages out when", () => {
const report = lifecycleReport(
[
asset(1, "NAS", { endOfSupport: "2026-12-31", replacementCost: 6000, purchasePrice: 5200 }),
asset(2, "Switch", { warrantyUntil: "2027-03-01", purchasePrice: 300 }),
asset(3, "Old router", { endOfSupport: "2025-01-01", purchasePrice: 100 }),
asset(4, "Shelf"),
asset(5, "New UPS", { endOfSupport: "2035-06-01", replacementCost: 900 }),
asset(6, "Mini PC", { endOfSupport: "2027-06-01" }),
asset(7, "Today's", { endOfSupport: "2026-10-18", replacementCost: 10 }),
asset(8, "Garbage date", { endOfSupport: "2027-02-30" }),
],
NOW,
3,
);
test("each thing goes where its date puts it: already past, one of the next years, later, or no date", () => {
assert.deepEqual(report.past.map((i) => i.name), ["Old router"]);
assert.deepEqual(report.years.map((y) => [y.year, y.items.map((i) => i.name)]), [[2026, ["Today's", "NAS"]], [2027, ["Switch", "Mini PC"]], [2028, []]]);
assert.deepEqual(report.later.map((i) => i.name), ["New UPS"]);
assert.deepEqual(report.undated.map((u) => u.name), ["Garbage date", "Shelf"], "an impossible date is no date");
});
test("the date is the end of support, or the warranty's end when none is set, and the report says which", () => {
const nas = report.years[0].items.find((i) => i.name === "NAS")!;
const sw = report.years[1].items.find((i) => i.name === "Switch")!;
assert.deepEqual([nas.basis, nas.endsOn], ["support", "2026-12-31"]);
assert.deepEqual([sw.basis, sw.endsOn], ["warranty", "2027-03-01"]);
assert.equal(report.years[0].items.find((i) => i.name === "Today's")!.daysLeft, 0, "today is not yet past");
});
test("the cost is the replacement cost, or what it was bought for, and a year's total says how many have no figure", () => {
const [y2026, y2027] = report.years;
assert.deepEqual(y2026.items.map((i) => [i.name, i.cost, i.costBasis]), [["Today's", 10, "replacement"], ["NAS", 6000, "replacement"]], "6000 and not the 5200 it was bought for");
assert.equal(y2026.totalCost, 6010);
assert.deepEqual(y2027.items.map((i) => [i.name, i.cost, i.costBasis]), [["Switch", 300, "purchase"], ["Mini PC", null, null]]);
assert.deepEqual([y2027.totalCost, y2027.unpriced], [300, 1], "the total is at least this much");
});
});
describe("through the route and the digest", () => {
let app: Server;
let base = "";
let who = "operator";
before(async () => {
await db.insert(users).values([
{ oidcSub: "operator", name: "Olga", role: "operator" },
{ oidcSub: "viewer", name: "Vic", role: "viewer" },
]);
await db.insert(servers).values({ name: "elsa", apiTokenHash: "e", apiTokenPrefix: "e", lastSeenAt: new Date().toISOString() });
const a = express();
a.use(express.json());
a.use((req, _res, next) => {
(req as unknown as { session: unknown }).session = { user: { sub: who } };
next();
});
a.use("/api/inventory", inventoryRouter);
app = await new Promise<Server>((resolve) => {
const s = a.listen(0, "127.0.0.1", () => resolve(s));
});
base = `http://127.0.0.1:${(app.address() as AddressInfo).port}/api/inventory`;
});
after(() => {
app.close();
try {
rmSync(dir, { recursive: true, force: true });
} catch {
// Windows keeps the database file locked until the process exits.
}
});
const send = (method: string, path: string, body?: unknown) => fetch(`${base}${path}`, { method, headers: { "content-type": "application/json" }, body: body === undefined ? undefined : JSON.stringify(body) });
const inDays = (n: number) => new Date(Date.now() + n * 86_400_000).toISOString().slice(0, 10);
test("an end of support and a replacement cost are kept; a wrong one is refused", async () => {
const res = await send("POST", "/", { name: "Synology DS920+", kind: "storage", endOfSupport: inDays(45), replacementCost: 6500, purchasePrice: 5200 });
assert.equal(res.status, 201);
const row = (await res.json()).asset;
assert.equal(row.endOfSupport, inDays(45));
assert.equal(row.replacementCost, 6500);
assert.equal((await send("POST", "/", { name: "x", kind: "other", endOfSupport: "next year" })).status, 400);
assert.equal((await send("POST", "/", { name: "x", kind: "other", replacementCost: -5 })).status, 400);
const blank = (await (await send("POST", "/", { name: "Blank", kind: "other", endOfSupport: null, replacementCost: null })).json()).asset;
assert.deepEqual([blank.endOfSupport, blank.replacementCost], [null, null]);
});
test("the report is for everyone signed in, with the currency, and the number of years can be asked for", async () => {
await updateSettings({ inventory: { currency: "SEK" } });
who = "viewer";
const res = await send("GET", "/lifecycle?years=2");
assert.equal(res.status, 200);
const body = await res.json();
assert.equal(body.currency, "SEK");
assert.equal(body.years.length, 2);
assert.equal(body.undated.some((u: { name: string }) => u.name === "Blank"), true);
assert.equal((await (await send("GET", "/lifecycle?years=nonsense")).json()).years.length, 5, "five by default");
assert.equal((await (await send("GET", "/lifecycle?years=99")).json()).years.length, 5, "and never absurd");
const all = [...body.past, ...body.years.flatMap((y: { items: unknown[] }) => y.items), ...body.later] as { name: string; basis: string; cost: number }[];
const nas = all.find((i) => i.name === "Synology DS920+")!;
assert.deepEqual([nas.basis, nas.cost], ["support", 6500]);
who = "operator";
});
test("support about to end is in the weekly digest, with its date", async () => {
const digest = await buildDigest(new Date());
assert.match(digest.message, /EXPIRING\n- Support for Synology DS920\+ ends in (44|45|46) days \(\d{4}-\d{2}-\d{2}\)/);
});
});
+2
View File
@@ -33,6 +33,7 @@ import Incidents from "./pages/Incidents";
import IncidentDetail from "./pages/IncidentDetail"; import IncidentDetail from "./pages/IncidentDetail";
import Inventory from "./pages/Inventory"; import Inventory from "./pages/Inventory";
import InventoryLabels from "./pages/InventoryLabels"; import InventoryLabels from "./pages/InventoryLabels";
import InventoryLifecycle from "./pages/InventoryLifecycle";
import Dependencies from "./pages/Dependencies"; import Dependencies from "./pages/Dependencies";
import Endpoints from "./pages/Endpoints"; import Endpoints from "./pages/Endpoints";
import ChangeLog from "./pages/ChangeLog"; import ChangeLog from "./pages/ChangeLog";
@@ -152,6 +153,7 @@ function Shelled({ user }: { user: CurrentUser }) {
<Route path="/updates" element={<Updates user={user} />} /> <Route path="/updates" element={<Updates user={user} />} />
<Route path="/inventory" element={<Inventory user={user} />} /> <Route path="/inventory" element={<Inventory user={user} />} />
<Route path="/inventory/labels" element={<InventoryLabels />} /> <Route path="/inventory/labels" element={<InventoryLabels />} />
<Route path="/inventory/lifecycle" element={<InventoryLifecycle />} />
<Route path="/dependencies" element={<Dependencies user={user} />} /> <Route path="/dependencies" element={<Dependencies user={user} />} />
<Route path="/endpoints" element={<Endpoints user={user} />} /> <Route path="/endpoints" element={<Endpoints user={user} />} />
<Route path="/changes" element={user.role === "viewer" ? <Navigate to="/" replace /> : <ChangeLog />} /> <Route path="/changes" element={user.role === "viewer" ? <Navigate to="/" replace /> : <ChangeLog />} />
+25
View File
@@ -909,6 +909,24 @@ export interface ChangeEntry {
serverId: number | null; serverId: number | null;
} }
export interface LifecycleItem {
id: number;
name: string;
kind: string;
endsOn: string;
basis: "support" | "warranty";
daysLeft: number;
cost: number | null;
costBasis: "replacement" | "purchase" | null;
}
export interface LifecycleReport {
past: LifecycleItem[];
years: { year: number; items: LifecycleItem[]; totalCost: number; unpriced: number }[];
later: LifecycleItem[];
undated: { id: number; name: string; kind: string }[];
currency: string;
}
export type AssetKind = "server" | "storage" | "network" | "power" | "client" | "other"; export type AssetKind = "server" | "storage" | "network" | "power" | "client" | "other";
export type DependencyNodeType = "server" | "integration"; export type DependencyNodeType = "server" | "integration";
@@ -965,6 +983,10 @@ export interface Asset {
purchaseDate: string | null; purchaseDate: string | null;
purchasePrice: number | null; purchasePrice: number | null;
warrantyUntil: string | null; warrantyUntil: string | null;
/** When the maker stops patching it, or you plan to retire it; the lifecycle report goes by this. */
endOfSupport: string | null;
/** What replacing it is expected to cost. */
replacementCost: number | null;
location: string | null; location: string | null;
rackUnit: string | null; rackUnit: string | null;
powerWatts: number | null; powerWatts: number | null;
@@ -988,6 +1010,8 @@ export interface AssetInput {
purchaseDate?: string | null; purchaseDate?: string | null;
purchasePrice?: number | null; purchasePrice?: number | null;
warrantyUntil?: string | null; warrantyUntil?: string | null;
endOfSupport?: string | null;
replacementCost?: number | null;
location?: string | null; location?: string | null;
rackUnit?: string | null; rackUnit?: string | null;
powerWatts?: number | null; powerWatts?: number | null;
@@ -1885,6 +1909,7 @@ export const api = {
create: (data: AssetInput) => request<{ asset: Asset }>("/api/inventory", { method: "POST", body: JSON.stringify(data) }), create: (data: AssetInput) => request<{ asset: Asset }>("/api/inventory", { method: "POST", body: JSON.stringify(data) }),
update: (id: number, data: AssetInput) => request<{ asset: Asset }>(`/api/inventory/${id}`, { method: "PUT", body: JSON.stringify(data) }), update: (id: number, data: AssetInput) => request<{ asset: Asset }>(`/api/inventory/${id}`, { method: "PUT", body: JSON.stringify(data) }),
remove: (id: number) => request<void>(`/api/inventory/${id}`, { method: "DELETE" }), remove: (id: number) => request<void>(`/api/inventory/${id}`, { method: "DELETE" }),
lifecycle: (years = 5) => request<LifecycleReport>(`/api/inventory/lifecycle?years=${years}`),
refreshFromAgent: (id: number) => request<{ asset: Asset; changed: string[] }>(`/api/inventory/${id}/refresh-from-agent`, { method: "POST" }), refreshFromAgent: (id: number) => request<{ asset: Asset; changed: string[] }>(`/api/inventory/${id}/refresh-from-agent`, { method: "POST" }),
setConfig: (data: InventoryConfig) => request<{ config: InventoryConfig }>("/api/inventory/config", { method: "PUT", body: JSON.stringify(data) }), setConfig: (data: InventoryConfig) => request<{ config: InventoryConfig }>("/api/inventory/config", { method: "PUT", body: JSON.stringify(data) }),
}, },
+63
View File
@@ -0,0 +1,63 @@
import type { ReactNode } from "react";
import { Link } from "react-router-dom";
import { IconInbox, IconSearch } from "@tabler/icons-react";
import { BlockSkeleton } from "./Skeleton";
export interface EmptyAction {
label: string;
/** Go to a page… */
to?: string;
/** …or do something here. */
onClick?: () => void;
}
/**
* What a list says when it has nothing in it: what is missing, why that is (or what puts something there), and the one thing to do about it
* when the person can. "Nothing matches" is the same thing for a list that has things but not these, with a way to clear what narrowed it.
*/
export default function EmptyState({ title, hint, action, filtered }: { title: string; hint?: ReactNode; action?: EmptyAction; filtered?: boolean }) {
const Icon = filtered ? IconSearch : IconInbox;
return (
<div className="empty-state" role="status">
<Icon size={28} stroke={1.5} className="empty-state-icon" aria-hidden="true" />
<div className="empty-state-title">{title}</div>
{hint && <div className="empty-state-hint">{hint}</div>}
{action &&
(action.to ? (
<Link to={action.to} className="btn btn-sm btn-primary mt-2">
{action.label}
</Link>
) : (
<button type="button" className="btn btn-sm btn-primary mt-2" onClick={action.onClick}>
{action.label}
</button>
))}
</div>
);
}
/** The same, as a row spanning a table. With \`filtered\`, it says nothing matches and offers to clear what narrowed the list. */
export function EmptyRow({ colSpan, title, hint, action, filtered }: { colSpan: number; title?: string; hint?: ReactNode; action?: EmptyAction; filtered?: () => void }) {
return (
<tr>
<td colSpan={colSpan}>
{filtered ? (
<EmptyState filtered title={title ?? "Nothing matches that"} hint={hint ?? "Try a different word, or clear the search and the filters."} action={{ label: "Clear the search and filters", onClick: filtered }} />
) : (
<EmptyState title={title ?? "Nothing here yet"} hint={hint} action={action} />
)}
</td>
</tr>
);
}
/** A table's one row while its list is still on the way, so a list that is loading doesn't look like one that is empty. */
export function LoadingRow({ colSpan, lines = 3 }: { colSpan: number; lines?: number }) {
return (
<tr>
<td colSpan={colSpan}>
<BlockSkeleton lines={lines} />
</td>
</tr>
);
}
+3 -5
View File
@@ -7,6 +7,7 @@ import { toast } from "../utils/toast";
import TimeAgo from "./TimeAgo"; import TimeAgo from "./TimeAgo";
import { ErrorNotice } from "./Notice"; import { ErrorNotice } from "./Notice";
import ExportTableButton from "./ExportTableButton"; import ExportTableButton from "./ExportTableButton";
import { EmptyRow, LoadingRow } from "./EmptyState";
// Monday first, as a week reads; the numbers are what the server keeps (0 = Sunday). // Monday first, as a week reads; the numbers are what the server keeps (0 = Sunday).
const DAYS: { value: number; short: string }[] = [ const DAYS: { value: number; short: string }[] = [
@@ -339,12 +340,9 @@ export default function RecurringMaintenance({ canEdit, targets, onChanged }: {
)} )}
</tr> </tr>
))} ))}
{schedules === null && <LoadingRow colSpan={canEdit ? 5 : 4} />}
{schedules?.length === 0 && ( {schedules?.length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 5 : 4} title="No recurring maintenance" hint="Add one for the night you patch, and its windows appear a week ahead, so alerts stay quiet without anyone remembering to." action={canEdit ? { label: "Add recurring maintenance", onClick: () => { setError(null); setAdding(true); } } : undefined} />
<td colSpan={canEdit ? 5 : 4} className="text-secondary text-center">
Nothing repeats yet. Add one for the night you patch, and its windows appear a week ahead.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+4 -10
View File
@@ -8,6 +8,7 @@ import { guessAdminUrl, portOptionLabel } from "../utils/adminLinkUrl";
import { confirmDialog } from "../utils/dialogs"; import { confirmDialog } from "../utils/dialogs";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import TableToolbar from "../components/TableToolbar"; import TableToolbar from "../components/TableToolbar";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
interface LinkForm { interface LinkForm {
serverId: number | ""; serverId: number | "";
@@ -304,19 +305,12 @@ export default function AdminLinks({ user }: { user: CurrentUser }) {
)} )}
</tr> </tr>
))} ))}
{links === null && <LoadingRow colSpan={canEdit ? 4 : 3} />}
{links !== null && links.length === 0 && ( {links !== null && links.length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 4 : 3} title="No admin links yet" hint="Shortcuts to the management pages of your equipment — a router, a NAS, a hypervisor — kept in one place." action={canEdit ? { label: "Add a link", onClick: startAdd } : undefined} />
<td colSpan={canEdit ? 4 : 3} className="text-secondary text-center">
No admin links added yet.
</td>
</tr>
)} )}
{links !== null && links.length > 0 && (sorted ?? []).length === 0 && ( {links !== null && links.length > 0 && (sorted ?? []).length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 4 : 3} filtered={() => setSearch("")} />
<td colSpan={canEdit ? 4 : 3} className="text-secondary text-center">
Nothing matches "{search}".
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -5
View File
@@ -17,6 +17,7 @@ import RunbookEntry from "../components/RunbookEntry";
import AckDrawer, { ackWords } from "../components/AckDrawer"; import AckDrawer, { ackWords } from "../components/AckDrawer";
import { useAlertsReport } from "../hooks/useAlertsReport"; import { useAlertsReport } from "../hooks/useAlertsReport";
import { summariseAlerts } from "../utils/alertSummary"; import { summariseAlerts } from "../utils/alertSummary";
import { EmptyRow } from "../components/EmptyState";
const SEVERITY: Record<AlertSeverity, { label: string; badge: string; rank: number }> = { const SEVERITY: Record<AlertSeverity, { label: string; badge: string; rank: number }> = {
critical: { label: "Critical", badge: "bg-red-lt text-red", rank: 0 }, critical: { label: "Critical", badge: "bg-red-lt text-red", rank: 0 },
@@ -431,11 +432,7 @@ export default function Alerts({ user }: { user: CurrentUser }) {
</Fragment> </Fragment>
))} ))}
{(sorted ?? []).length === 0 && ( {(sorted ?? []).length === 0 && (
<tr> <EmptyRow colSpan={canSilence ? 5 : 4} filtered={() => { setSeverity("all"); setCategory("all"); setSearch(""); setAttention("all"); setShowSilenced(true); }} />
<td colSpan={canSilence ? 5 : 4} className="text-secondary text-center">
Nothing matches these filters.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+3 -5
View File
@@ -9,6 +9,7 @@ import { downloadCsv } from "../utils/csv";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import { SearchBox } from "../components/TableToolbar"; import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch"; import { useTableSearch } from "../hooks/useTableSearch";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
function targetLabel(e: AuditLogEntry): string { function targetLabel(e: AuditLogEntry): string {
if (!e.targetType) return "—"; if (!e.targetType) return "—";
@@ -106,12 +107,9 @@ export default function AuditLog() {
</td> </td>
</tr> </tr>
))} ))}
{entries === null && <LoadingRow colSpan={6} />}
{sorted?.length === 0 && ( {sorted?.length === 0 && (
<tr> <EmptyRow colSpan={6} title="Nothing recorded yet" hint="Changes people make in the app, sign-ins and the app's own housekeeping are written here as they happen." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
<td colSpan={6} className="text-secondary text-center">
No activity recorded yet.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+3 -16
View File
@@ -14,6 +14,7 @@ import { useSortable } from "../hooks/useSortable";
import { useTableSearch } from "../hooks/useTableSearch"; import { useTableSearch } from "../hooks/useTableSearch";
import { downloadCsv } from "../utils/csv"; import { downloadCsv } from "../utils/csv";
import { readableError } from "../utils/errors"; import { readableError } from "../utils/errors";
import { EmptyRow } from "../components/EmptyState";
interface Row extends CoverageGuest { interface Row extends CoverageGuest {
/** Worst first, so a default sort puts what needs attention at the top. */ /** Worst first, so a default sort puts what needs attention at the top. */
@@ -300,17 +301,7 @@ export default function Backups({ user }: { user?: CurrentUser }) {
</tr> </tr>
))} ))}
{report !== null && sorted?.length === 0 && ( {report !== null && sorted?.length === 0 && (
<tr> <EmptyRow colSpan={5} {...(rows.length === 0 ? { title: "No Proxmox guests to show", hint: "Connect a Proxmox integration and its virtual machines and containers appear here, with when each was last backed up.", action: { label: "Connect Proxmox", to: "/integrations" } } : { filtered: () => { tableSearch.setQuery(""); setParam("status", null); } })} />
<td colSpan={5} className="text-secondary text-center">
{rows.length === 0 ? (
<>
No Proxmox guests to show. Connect a Proxmox integration under <Link to="/integrations">Integrations</Link>.
</>
) : (
"Nothing matches that."
)}
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
@@ -439,11 +430,7 @@ export default function Backups({ user }: { user?: CurrentUser }) {
</tr> </tr>
))} ))}
{tests !== null && tests.length === 0 && ( {tests !== null && tests.length === 0 && (
<tr> <EmptyRow colSpan={isAdmin ? 5 : 4} title="No restore recorded yet" hint="A backup nobody has restored is a hope, not a backup. Try restoring one — to a scratch machine is fine — and record how it went." action={canRecord ? { label: "Record a test", onClick: () => setDraft({ key: null, label: "", testedAt: todayIso(), result: "ok", note: "" }) } : undefined} />
<td colSpan={isAdmin ? 5 : 4} className="text-secondary text-center">
No restore has been recorded yet.{canRecord ? " After you next try one, record it here." : ""}
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+11 -4
View File
@@ -3,6 +3,7 @@ import { Link, useSearchParams } from "react-router-dom";
import { api, type ChangeEntry, type ChangeKind } from "../api/client"; import { api, type ChangeEntry, type ChangeKind } from "../api/client";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import { BlockSkeleton } from "../components/Skeleton"; import { BlockSkeleton } from "../components/Skeleton";
import EmptyState from "../components/EmptyState";
import { downloadCsv } from "../utils/csv"; import { downloadCsv } from "../utils/csv";
import { formatDate, formatTime } from "../utils/date"; import { formatDate, formatTime } from "../utils/date";
import { readableError } from "../utils/errors"; import { readableError } from "../utils/errors";
@@ -157,10 +158,16 @@ export default function ChangeLog() {
{entries === null && !error && <BlockSkeleton lines={5} />} {entries === null && !error && <BlockSkeleton lines={5} />}
{entries !== null && entries.length === 0 && ( {entries !== null && entries.length === 0 && (
<div className="card"> <div className="card">
<div className="card-body text-secondary text-center"> {q || kind || serverId ? (
Nothing {q || kind || serverId ? "matches that" : "has changed"} in {RANGES.find((r) => r.days === days)?.label.toLowerCase()}. <EmptyState
{(q || kind || serverId || days < 400) && " Try a wider range or fewer filters."} filtered
</div> title="Nothing matches that"
hint={`Nothing in ${RANGES.find((r) => r.days === days)?.label.toLowerCase()} fits what is searched for. Try a wider range, or fewer filters.`}
action={{ label: "Clear the search and filters", onClick: () => { setText(""); setParams(new URLSearchParams(), { replace: true }); } }}
/>
) : (
<EmptyState title="Nothing has changed" hint={`No change was recorded in ${RANGES.find((r) => r.days === days)?.label.toLowerCase()}. Try a wider range.`} action={days < 400 ? { label: "Show everything kept", onClick: () => setParam("days", "400") } : undefined} />
)}
</div> </div>
)} )}
{days_.map((group) => ( {days_.map((group) => (
+2 -5
View File
@@ -6,6 +6,7 @@ import { BlockSkeleton } from "../components/Skeleton";
import { confirmDialog } from "../utils/dialogs"; import { confirmDialog } from "../utils/dialogs";
import { readableError } from "../utils/errors"; import { readableError } from "../utils/errors";
import { toast } from "../utils/toast"; import { toast } from "../utils/toast";
import { EmptyRow } from "../components/EmptyState";
const TYPE_LABELS = { server: "Server", integration: "Integration" } as const; const TYPE_LABELS = { server: "Server", integration: "Integration" } as const;
@@ -162,11 +163,7 @@ export default function Dependencies({ user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{data && data.dependencies.length === 0 && ( {data && data.dependencies.length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 3 : 2} title="Nothing depends on anything yet" hint="Say what needs what — Gitea needs the server it is installed on — and when that one is down, the other's alert is held back under it instead of adding to the noise." />
<td colSpan={canEdit ? 3 : 2} className="text-secondary text-center">
Nothing written yet.{canEdit ? " Add the first above." : ""}
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+3 -5
View File
@@ -6,6 +6,7 @@ import SortableTh from "../components/SortableTh";
import { downloadCsv } from "../utils/csv"; import { downloadCsv } from "../utils/csv";
import { confirmDialog } from "../utils/dialogs"; import { confirmDialog } from "../utils/dialogs";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
const SOURCE_LABELS: Record<string, string> = { const SOURCE_LABELS: Record<string, string> = {
cloudflare: "Cloudflare", cloudflare: "Cloudflare",
@@ -186,12 +187,9 @@ export default function DiagLog() {
</td> </td>
</tr> </tr>
))} ))}
{entries === null && <LoadingRow colSpan={6} />}
{sorted?.length === 0 && ( {sorted?.length === 0 && (
<tr> <EmptyRow colSpan={6} {...(filterSource || filterOk ? { filtered: () => { setFilterSource(""); setFilterOk(""); } } : { title: "No diagnostic entries yet", hint: "Every call the app makes to an integration or a DNS provider is logged here, with how long it took and whether it worked." })} />
<td colSpan={6} className="text-secondary text-center">
No diagnostic entries{filterSource || filterOk ? " match these filters" : " yet"}.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+5 -16
View File
@@ -20,6 +20,7 @@ import { downloadCsv } from "../utils/csv";
import { confirmDialog } from "../utils/dialogs"; import { confirmDialog } from "../utils/dialogs";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import { toast } from "../utils/toast"; import { toast } from "../utils/toast";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
const PROVIDER_LABELS: Record<DnsProviderType, string> = { const PROVIDER_LABELS: Record<DnsProviderType, string> = {
cloudflare: "Cloudflare", cloudflare: "Cloudflare",
@@ -348,12 +349,9 @@ export default function Dns({ user }: { user: CurrentUser }) {
</td> </td>
</tr> </tr>
))} ))}
{providers === null && <LoadingRow colSpan={4} />}
{sortedProviders?.length === 0 && ( {sortedProviders?.length === 0 && (
<tr> <EmptyRow colSpan={4} title="No DNS providers yet" hint="Connect Cloudflare, Loopia, Pi-hole, Azure DNS, cPanel or Technitium to see its zones and records here, and to have names matched to your servers." />
<td colSpan={4} className="text-secondary text-center">
No DNS providers configured yet.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
@@ -446,11 +444,7 @@ export default function Dns({ user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{sortedZones && sortedZones.length === 0 && ( {sortedZones && sortedZones.length === 0 && (
<tr> <EmptyRow colSpan={3} title="No zones found" hint="The provider answered with none. Check that its credentials can see the zones, or sync it again." />
<td colSpan={3} className="text-secondary text-center">
No zones found for this provider.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
@@ -607,12 +601,7 @@ export default function Dns({ user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{sortedRecords?.length === 0 && ( {sortedRecords?.length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 5 : 4} title="No records cached" hint={syncedAt === null ? "Sync this zone to fetch its records from the provider." : "This zone has no records."} action={canEdit ? { label: "Add a record", onClick: startAddRecord } : undefined} />
<td colSpan={canEdit ? 5 : 4} className="text-secondary text-center">
No cached records.{" "}
{syncedAt === null ? "Sync this zone to fetch them." : ""}
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -5
View File
@@ -20,6 +20,7 @@ import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch"; import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer"; import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail"; import { useRowDetail } from "../hooks/useRowDetail";
import { EmptyRow } from "../components/EmptyState";
function updateBadge(c: DockhandContainer) { function updateBadge(c: DockhandContainer) {
if (c.updateAvailable === null) return <span className="text-secondary">—</span>; if (c.updateAvailable === null) return <span className="text-secondary">—</span>;
@@ -308,11 +309,7 @@ export default function Docker({ user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{data && sorted?.length === 0 && ( {data && sorted?.length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 6 : 5} {...(hostFilter ? { filtered: () => setHostFilter("") } : { title: "No containers found", hint: "Dockhand answered with no containers in any environment. Check the integration and its environments.", action: { label: "Check the integration", to: "/integrations" } })} />
<td colSpan={canEdit ? 6 : 5} className="text-secondary text-center">
{hostFilter ? `No containers found on "${hostFilter}".` : "No containers found across any environment."}
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -6
View File
@@ -12,6 +12,7 @@ import { confirmDialog } from "../utils/dialogs";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import { SearchBox } from "../components/TableToolbar"; import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch"; import { useTableSearch } from "../hooks/useTableSearch";
import { EmptyRow } from "../components/EmptyState";
function statusBadge(d: DomainRecord) { function statusBadge(d: DomainRecord) {
switch (d.status) { switch (d.status) {
@@ -227,12 +228,7 @@ export default function Domains({ user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{data && data.domains.length === 0 && ( {data && data.domains.length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 5 : 4} title="No domains tracked yet" hint={canEdit ? "Domains for your DNS zones appear after the next daily check, or when you press “Check all now”. You can also add one by hand above." : "Domains for your DNS zones appear after the next daily check."} />
<td colSpan={canEdit ? 5 : 4} className="text-secondary text-center">
No domains tracked yet. Ones for your DNS zones appear after the next daily check
{canEdit ? " — or use “Check all now”" : ""}.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -5
View File
@@ -14,6 +14,7 @@ import { downloadCsv } from "../utils/csv";
import { confirmDialog } from "../utils/dialogs"; import { confirmDialog } from "../utils/dialogs";
import { readableError } from "../utils/errors"; import { readableError } from "../utils/errors";
import { toast } from "../utils/toast"; import { toast } from "../utils/toast";
import { EmptyRow } from "../components/EmptyState";
const KIND_LABELS: Record<EndpointKind, string> = { http: "Web address", tcp: "Port", tls: "Certificate" }; const KIND_LABELS: Record<EndpointKind, string> = { http: "Web address", tcp: "Port", tls: "Certificate" };
const KIND_HINTS: Record<EndpointKind, string> = { const KIND_HINTS: Record<EndpointKind, string> = {
@@ -477,11 +478,7 @@ export default function Endpoints({ user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{checks !== null && sorted?.length === 0 && ( {checks !== null && sorted?.length === 0 && (
<tr> <EmptyRow colSpan={7} {...(tableSearch.active ? { filtered: () => tableSearch.setQuery("") } : { title: "Nothing is being checked yet", hint: "Ask a web address, a port or a certificate every few minutes, and hear about it when it stops answering or a certificate is about to run out.", action: isAdmin ? { label: "Add a check", onClick: () => setDraft({ ...EMPTY }) } : undefined })} />
<td colSpan={7} className="text-secondary text-center">
{tableSearch.active ? "Nothing matches that." : `Nothing is being checked yet.${isAdmin ? " Add the first check: a web address, a port, or a certificate." : ""}`}
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -5
View File
@@ -14,6 +14,7 @@ import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch"; import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer"; import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail"; import { useRowDetail } from "../hooks/useRowDetail";
import { EmptyRow } from "../components/EmptyState";
function runStatusBadge(repo: GiteaRepo) { function runStatusBadge(repo: GiteaRepo) {
const run = repo.latestRun; const run = repo.latestRun;
@@ -234,11 +235,7 @@ export default function Gitea({ user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{sorted?.length === 0 && ( {sorted?.length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 6 : 5} title="No repositories to show" hint="A token only sees the repositories it has been given access to. Check its permissions in Gitea." action={{ label: "Check the integration", to: "/integrations" }} filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
<td colSpan={canEdit ? 6 : 5} className="text-secondary text-center">
No repositories visible to this token.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -5
View File
@@ -12,6 +12,7 @@ import { BlockSkeleton } from "../components/Skeleton";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import { downloadCsv } from "../utils/csv"; import { downloadCsv } from "../utils/csv";
import { readableError } from "../utils/errors"; import { readableError } from "../utils/errors";
import { EmptyRow } from "../components/EmptyState";
export const CATEGORY_NAMES: Record<AlertCategory, string> = { export const CATEGORY_NAMES: Record<AlertCategory, string> = {
offline: "Server down", offline: "Server down",
@@ -177,11 +178,7 @@ export default function Incidents() {
</tr> </tr>
))} ))}
{incidents !== null && (sorted ?? []).length === 0 && ( {incidents !== null && (sorted ?? []).length === 0 && (
<tr> <EmptyRow colSpan={7} {...(tableSearch.active || status !== "all" ? { filtered: () => { tableSearch.setQuery(""); setStatus("all"); } } : { title: "No incidents yet", hint: "An incident is recorded each time an alert is raised and later goes away, so the first one appears when something goes wrong." })} />
<td colSpan={7} className="text-secondary text-center">
{tableSearch.active || status !== "all" ? "Nothing matches that." : "No incidents yet. They are recorded from the Alerts, so the first one appears when something is raised."}
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+37 -8
View File
@@ -15,6 +15,7 @@ import { confirmDialog } from "../utils/dialogs";
import { readableError } from "../utils/errors"; import { readableError } from "../utils/errors";
import { KIND_HINTS, KIND_LABELS, money, warrantyDays, warrantyState, yearlyCost, yearlyKwh } from "../utils/inventory"; import { KIND_HINTS, KIND_LABELS, money, warrantyDays, warrantyState, yearlyCost, yearlyKwh } from "../utils/inventory";
import { toast } from "../utils/toast"; import { toast } from "../utils/toast";
import { EmptyRow } from "../components/EmptyState";
const KINDS = Object.keys(KIND_LABELS) as AssetKind[]; const KINDS = Object.keys(KIND_LABELS) as AssetKind[];
@@ -28,6 +29,8 @@ interface Draft {
purchaseDate: string; purchaseDate: string;
purchasePrice: string; purchasePrice: string;
warrantyUntil: string; warrantyUntil: string;
endOfSupport: string;
replacementCost: string;
location: string; location: string;
rackUnit: string; rackUnit: string;
powerWatts: string; powerWatts: string;
@@ -35,7 +38,7 @@ interface Draft {
notes: string; notes: string;
} }
const EMPTY: Draft = { id: null, name: "", kind: "server", manufacturer: "", model: "", serial: "", purchaseDate: "", purchasePrice: "", warrantyUntil: "", location: "", rackUnit: "", powerWatts: "", serverId: "", notes: "" }; const EMPTY: Draft = { id: null, name: "", kind: "server", manufacturer: "", model: "", serial: "", purchaseDate: "", purchasePrice: "", warrantyUntil: "", endOfSupport: "", replacementCost: "", location: "", rackUnit: "", powerWatts: "", serverId: "", notes: "" };
function toDraft(a: Asset): Draft { function toDraft(a: Asset): Draft {
return { return {
@@ -48,6 +51,8 @@ function toDraft(a: Asset): Draft {
purchaseDate: a.purchaseDate ?? "", purchaseDate: a.purchaseDate ?? "",
purchasePrice: a.purchasePrice === null ? "" : String(a.purchasePrice), purchasePrice: a.purchasePrice === null ? "" : String(a.purchasePrice),
warrantyUntil: a.warrantyUntil ?? "", warrantyUntil: a.warrantyUntil ?? "",
endOfSupport: a.endOfSupport ?? "",
replacementCost: a.replacementCost === null ? "" : String(a.replacementCost),
location: a.location ?? "", location: a.location ?? "",
rackUnit: a.rackUnit ?? "", rackUnit: a.rackUnit ?? "",
powerWatts: a.powerWatts === null ? "" : String(a.powerWatts), powerWatts: a.powerWatts === null ? "" : String(a.powerWatts),
@@ -67,6 +72,8 @@ function toInput(d: Draft): AssetInput {
purchaseDate: d.purchaseDate || null, purchaseDate: d.purchaseDate || null,
purchasePrice: num(d.purchasePrice), purchasePrice: num(d.purchasePrice),
warrantyUntil: d.warrantyUntil || null, warrantyUntil: d.warrantyUntil || null,
endOfSupport: d.endOfSupport || null,
replacementCost: num(d.replacementCost),
location: d.location, location: d.location,
rackUnit: d.rackUnit, rackUnit: d.rackUnit,
powerWatts: num(d.powerWatts), powerWatts: num(d.powerWatts),
@@ -75,6 +82,14 @@ function toInput(d: Draft): AssetInput {
}; };
} }
/** Under the warranty: when support ends, in words that say how soon. */
function SupportLine({ until }: { until: string }) {
const days = warrantyDays(until);
if (days === null) return null;
const cls = days < 0 ? "text-red" : days <= 180 ? "text-yellow" : "text-secondary";
return <div className={`small ${cls}`}>{days < 0 ? `support ended ${until}` : days === 0 ? "support ends today" : `support ends ${until}`}</div>;
}
function WarrantyBadge({ until }: { until: string | null }) { function WarrantyBadge({ until }: { until: string | null }) {
const state = warrantyState(until); const state = warrantyState(until);
const days = warrantyDays(until); const days = warrantyDays(until);
@@ -191,8 +206,8 @@ export default function Inventory({ user }: { user: CurrentUser }) {
if (!sorted) return; if (!sorted) return;
downloadCsv( downloadCsv(
"inventory.csv", "inventory.csv",
["Name", "Kind", "Manufacturer", "Model", "Serial", "Location", "Rack unit", "Purchased", "Price", "Warranty until", "Power (W)", "Server", "Notes"], ["Name", "Kind", "Manufacturer", "Model", "Serial", "Location", "Rack unit", "Purchased", "Price", "Warranty until", "End of support", "Replacement cost", "Power (W)", "Server", "Notes"],
sorted.map((a) => [a.name, KIND_LABELS[a.kind], a.manufacturer ?? "", a.model ?? "", a.serial ?? "", a.location ?? "", a.rackUnit ?? "", a.purchaseDate ?? "", a.purchasePrice ?? "", a.warrantyUntil ?? "", a.powerWatts ?? "", a.server?.name ?? "", a.notes ?? ""]), sorted.map((a) => [a.name, KIND_LABELS[a.kind], a.manufacturer ?? "", a.model ?? "", a.serial ?? "", a.location ?? "", a.rackUnit ?? "", a.purchaseDate ?? "", a.purchasePrice ?? "", a.warrantyUntil ?? "", a.endOfSupport ?? "", a.replacementCost ?? "", a.powerWatts ?? "", a.server?.name ?? "", a.notes ?? ""]),
); );
} }
@@ -228,6 +243,9 @@ export default function Inventory({ user }: { user: CurrentUser }) {
<div className="d-flex align-items-center mb-3"> <div className="d-flex align-items-center mb-3">
<h2 className="page-title mb-0">Inventory</h2> <h2 className="page-title mb-0">Inventory</h2>
<div className="ms-auto d-flex gap-2"> <div className="ms-auto d-flex gap-2">
<Link to="/inventory/lifecycle" className="btn">
Lifecycle
</Link>
<Link to="/inventory/labels" className="btn"> <Link to="/inventory/labels" className="btn">
Print labels Print labels
</Link> </Link>
@@ -382,6 +400,20 @@ export default function Inventory({ user }: { user: CurrentUser }) {
</label> </label>
<input id="inv-warranty" type="date" className="form-control" value={draft.warrantyUntil} onChange={(e) => set("warrantyUntil", e.target.value)} /> <input id="inv-warranty" type="date" className="form-control" value={draft.warrantyUntil} onChange={(e) => set("warrantyUntil", e.target.value)} />
</div> </div>
<div className="col-md-3">
<label className="form-label" htmlFor="inv-eos">
End of support
</label>
<input id="inv-eos" type="date" className="form-control" value={draft.endOfSupport} onChange={(e) => set("endOfSupport", e.target.value)} />
<div className="form-hint text-secondary small mt-1">When the maker stops patching it, or you plan to retire it.</div>
</div>
<div className="col-md-3">
<label className="form-label" htmlFor="inv-repl">
Replacement cost {config.currency && <span className="text-secondary">({config.currency})</span>}
</label>
<input id="inv-repl" type="number" min={0} step="any" className="form-control" value={draft.replacementCost} onChange={(e) => set("replacementCost", e.target.value)} />
<div className="form-hint text-secondary small mt-1">What replacing it should cost. Left empty, the purchase price stands in.</div>
</div>
<div className="col-md-3"> <div className="col-md-3">
<label className="form-label" htmlFor="inv-power"> <label className="form-label" htmlFor="inv-power">
Typical power draw Typical power draw
@@ -507,6 +539,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
</td> </td>
<td className="stack-label" data-label="Warranty"> <td className="stack-label" data-label="Warranty">
<WarrantyBadge until={a.warrantyUntil} /> <WarrantyBadge until={a.warrantyUntil} />
{a.endOfSupport && <SupportLine until={a.endOfSupport} />}
</td> </td>
<td className="stack-label" data-label="Power">{a.powerWatts === null ? <span className="text-secondary">—</span> : `${a.powerWatts} W`}</td> <td className="stack-label" data-label="Power">{a.powerWatts === null ? <span className="text-secondary">—</span> : `${a.powerWatts} W`}</td>
{canEdit && ( {canEdit && (
@@ -524,11 +557,7 @@ export default function Inventory({ user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{assets !== null && sorted?.length === 0 && ( {assets !== null && sorted?.length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 7 : 6} {...(tableSearch.active || kind ? { filtered: () => { tableSearch.setQuery(""); setParams((p) => { const n = new URLSearchParams(p); n.delete("kind"); return n; }, { replace: true }); } } : { title: "Nothing in the inventory yet", hint: "Keep track of the hardware behind it all: what it is, when it was bought, how long it is covered, where it sits and what it draws.", action: canEdit ? { label: "Add the first piece of hardware", onClick: () => setDraft({ ...EMPTY }) } : undefined })} />
<td colSpan={canEdit ? 7 : 6} className="text-secondary text-center">
{tableSearch.active || kind ? "Nothing matches that." : `Nothing in the inventory yet.${canEdit ? " Add the first piece of hardware." : ""}`}
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+188
View File
@@ -0,0 +1,188 @@
import { useEffect, useState } from "react";
import { Link } from "react-router-dom";
import { api, type LifecycleItem, type LifecycleReport } from "../api/client";
import EmptyState from "../components/EmptyState";
import { ErrorNotice } from "../components/Notice";
import { BlockSkeleton } from "../components/Skeleton";
import { downloadCsv } from "../utils/csv";
import { readableError } from "../utils/errors";
import { KIND_LABELS, money } from "../utils/inventory";
import type { AssetKind } from "../api/client";
const YEARS = [3, 5, 7, 10];
const kindLabel = (k: string) => KIND_LABELS[k as AssetKind] ?? k;
function Items({ items, currency, showYear }: { items: LifecycleItem[]; currency: string; showYear?: boolean }) {
return (
<div className="table-responsive">
<table className="table table-vcenter card-table table-stack">
<thead>
<tr>
<th>Hardware</th>
<th>{showYear ? "Date" : "Ages out"}</th>
<th>Because</th>
<th className="text-end">Replacement</th>
</tr>
</thead>
<tbody>
{items.map((i) => (
<tr key={i.id}>
<td className="stack-wide">
<Link to={`/inventory?asset=${i.id}`}>{i.name}</Link> <span className="text-secondary small">{kindLabel(i.kind)}</span>
</td>
<td>
{i.endsOn}
<span className="text-secondary small"> · {i.daysLeft < 0 ? `${-i.daysLeft} d ago` : i.daysLeft === 0 ? "today" : `in ${i.daysLeft} d`}</span>
</td>
<td className="text-secondary">{i.basis === "support" ? "end of support" : "warranty ends (no end of support set)"}</td>
<td className="text-end stack-label" data-label="Replacement">
{i.cost === null ? (
<span className="text-secondary">—</span>
) : (
<>
{money(i.cost, currency)}
{i.costBasis === "purchase" && <span className="text-secondary small" title="No replacement cost is set, so what it was bought for stands in"> (bought for)</span>}
</>
)}
</td>
</tr>
))}
</tbody>
</table>
</div>
);
}
/**
* What ages out, year by year, for planning what to replace and roughly what it will cost. The date is the end of support where there is one (the
* warranty's end stands in where there is not, and says so); the cost is the replacement cost, or what it was bought for.
*/
export default function InventoryLifecycle() {
const [years, setYears] = useState(5);
const [report, setReport] = useState<LifecycleReport | null>(null);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
setReport(null);
api.inventory
.lifecycle(years)
.then((r) => {
setReport(r);
setError(null);
})
.catch((err) => setError(readableError(err)));
}, [years]);
const currency = report?.currency ?? "";
const dated = report ? report.past.length + report.later.length + report.years.reduce((n, y) => n + y.items.length, 0) : 0;
function exportCsv() {
if (!report) return;
const rows: (string | number)[][] = [];
const add = (group: string, i: LifecycleItem) => rows.push([group, i.name, kindLabel(i.kind), i.endsOn, i.basis === "support" ? "end of support" : "warranty", i.cost ?? "", i.costBasis ?? ""]);
report.past.forEach((i) => add("Already past", i));
for (const y of report.years) y.items.forEach((i) => add(String(y.year), i));
report.later.forEach((i) => add("Later", i));
report.undated.forEach((u) => rows.push(["No date", u.name, kindLabel(u.kind), "", "", "", ""]));
downloadCsv("lifecycle.csv", ["When", "Hardware", "Kind", "Ages out", "Because", "Replacement cost", "Cost is"], rows);
}
return (
<>
<div className="d-flex flex-wrap align-items-center gap-2 mb-1">
<h2 className="page-title mb-0">Lifecycle</h2>
<div className="ms-auto d-flex gap-2">
<select className="form-select w-auto" aria-label="How many years to show" value={years} onChange={(e) => setYears(Number(e.target.value))}>
{YEARS.map((y) => (
<option key={y} value={y}>
Next {y} years
</option>
))}
</select>
<button className="btn btn-outline-secondary" onClick={exportCsv} disabled={!report}>
Export CSV
</button>
<Link to="/inventory" className="btn">
Back to the inventory
</Link>
</div>
</div>
<p className="text-secondary">
What ages out, year by year, and roughly what replacing it will cost. Give a piece of hardware an <strong>end of support</strong> and a <strong>replacement cost</strong> in the inventory; until it has
an end of support, the end of its warranty stands in, and until it has a replacement cost, what it was bought for.
</p>
<ErrorNotice error={error} />
{!report && !error && <BlockSkeleton lines={5} />}
{report && dated === 0 && (
<div className="card">
<EmptyState
title="Nothing has a date yet"
hint="Edit a piece of hardware and give it an end of support (or a warranty end), and what ages out is listed here by year, with what replacing it will cost."
action={{ label: "Go to the inventory", to: "/inventory" }}
/>
</div>
)}
{report && report.past.length > 0 && (
<div className="card mb-3 border-red">
<div className="card-header">
<h3 className="card-title text-red">Already past ({report.past.length})</h3>
</div>
<Items items={report.past} currency={currency} showYear />
</div>
)}
{report &&
dated > 0 &&
report.years.map((y) => (
<div className="card mb-3" key={y.year}>
<div className="card-header">
<h3 className="card-title">
{y.year} <span className="text-secondary fw-normal">({y.items.length})</span>
</h3>
<div className="card-actions text-secondary">
{y.items.length === 0 ? (
"nothing ages out"
) : (
<>
about <strong className="text-body">{money(y.totalCost, currency)}</strong>
{y.unpriced > 0 && ` and ${y.unpriced} with no figure`}
</>
)}
</div>
</div>
{y.items.length > 0 && <Items items={y.items} currency={currency} showYear />}
</div>
))}
{report && report.later.length > 0 && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Later ({report.later.length})</h3>
</div>
<Items items={report.later} currency={currency} showYear />
</div>
)}
{report && dated > 0 && report.undated.length > 0 && (
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">No date yet ({report.undated.length})</h3>
</div>
<div className="card-body">
<div className="text-secondary small mb-2">These have neither an end of support nor a warranty end, so they are not in the plan.</div>
<div className="d-flex flex-wrap gap-2">
{report.undated.map((u) => (
<Link key={u.id} to={`/inventory?asset=${u.id}`} className="badge bg-secondary-lt text-secondary">
{u.name}
</Link>
))}
</div>
</div>
</div>
)}
</>
);
}
+4 -8
View File
@@ -10,6 +10,7 @@ import { useSelection } from "../hooks/useSelection";
import { confirmDialog, promptDialog } from "../utils/dialogs"; import { confirmDialog, promptDialog } from "../utils/dialogs";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import TableToolbar from "../components/TableToolbar"; import TableToolbar from "../components/TableToolbar";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
const emptyForm: IpamInput = { ipAddress: "", label: "", vendor: "", location: "", notes: "" }; const emptyForm: IpamInput = { ipAddress: "", label: "", vendor: "", location: "", notes: "" };
@@ -464,14 +465,9 @@ export default function Ipam({ user }: { user: CurrentUser }) {
)} )}
</tr> </tr>
))} ))}
{(sorted ?? []).length === 0 && ( {entries === null && <LoadingRow colSpan={canEdit ? 7 : 5} />}
<tr> {entries !== null && (sorted ?? []).length === 0 && (
<td colSpan={canEdit ? 7 : 5} className="text-secondary text-center"> <EmptyRow colSpan={canEdit ? 7 : 5} {...(entries && entries.length > 0 ? { filtered: () => { setSearch(""); setHideExcluded(false); }, hint: "Every tracked address is excluded or filtered out. Show the excluded ones, or clear the search, to see them." } : { title: "No IP addresses tracked yet", hint: "Track the addresses you hand out, so you can see what is taken, what is free and what clashes.", action: canEdit ? { label: "Add an address", onClick: startAdd } : undefined })} />
{entries && entries.length > 0
? "Every tracked address is currently excluded or filtered out — turn off “Hide excluded addresses”, or adjust your search, to see them."
: "No IP addresses tracked yet."}
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+3 -5
View File
@@ -21,6 +21,7 @@ import { confirmDialog } from "../utils/dialogs";
import MaintenanceTimeline from "../components/MaintenanceTimeline"; import MaintenanceTimeline from "../components/MaintenanceTimeline";
import RecurringMaintenance from "../components/RecurringMaintenance"; import RecurringMaintenance from "../components/RecurringMaintenance";
import ExportTableButton from "../components/ExportTableButton"; import ExportTableButton from "../components/ExportTableButton";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
const DURATIONS: { minutes: number; label: string }[] = [ const DURATIONS: { minutes: number; label: string }[] = [
{ minutes: 30, label: "30 minutes" }, { minutes: 30, label: "30 minutes" },
@@ -684,12 +685,9 @@ export default function Maintenance({ user }: { user: CurrentUser }) {
)} )}
</tr> </tr>
))} ))}
{windows === null && <LoadingRow colSpan={canEdit ? 5 : 4} />}
{windows?.length === 0 && ( {windows?.length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 5 : 4} title="Nothing is in maintenance" hint="Every alert is live. Start a window above before you work on something, so it doesn't raise alarms while you do." />
<td colSpan={canEdit ? 5 : 4} className="text-secondary text-center">
Nothing is in maintenance — all alerts are active.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -5
View File
@@ -9,6 +9,7 @@ import { formatAgo } from "../utils/duration";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import { SearchBox } from "../components/TableToolbar"; import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch"; import { useTableSearch } from "../hooks/useTableSearch";
import { EmptyRow } from "../components/EmptyState";
function priorityBadge(t: OsTicketTicket) { function priorityBadge(t: OsTicketTicket) {
if (!t.priorityName) return <span className="text-secondary">—</span>; if (!t.priorityName) return <span className="text-secondary">—</span>;
@@ -253,11 +254,7 @@ export default function OsTicket({ user: _user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{sortedTickets?.length === 0 && ( {sortedTickets?.length === 0 && (
<tr> <EmptyRow colSpan={9} title="No open tickets" hint="Nothing is waiting in osTicket right now." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
<td colSpan={9} className="text-secondary text-center">
No open tickets.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -5
View File
@@ -15,6 +15,7 @@ import { downloadCsv } from "../utils/csv";
import IntegrationPageTitle from "../components/IntegrationPageTitle"; import IntegrationPageTitle from "../components/IntegrationPageTitle";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import ExportTableButton from "../components/ExportTableButton"; import ExportTableButton from "../components/ExportTableButton";
import { EmptyRow } from "../components/EmptyState";
function formatBytes(bytes: number | null): string { function formatBytes(bytes: number | null): string {
if (bytes === null) return "—"; if (bytes === null) return "—";
@@ -282,11 +283,7 @@ export default function PbsBackup({ user: _user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{sortedDatastores?.length === 0 && ( {sortedDatastores?.length === 0 && (
<tr> <EmptyRow colSpan={5} title="No datastores found" hint="The Backup Server answered but listed none. Check that the API token has access to a datastore." action={{ label: "Check the integration", to: "/integrations" }} />
<td colSpan={5} className="text-secondary text-center">
No datastores found.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+5 -10
View File
@@ -17,6 +17,7 @@ import { downloadCsv } from "../utils/csv";
import { formatAgo } from "../utils/duration"; import { formatAgo } from "../utils/duration";
import { confirmDialog } from "../utils/dialogs"; import { confirmDialog } from "../utils/dialogs";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
const emptyForm: PortForwardInput = { const emptyForm: PortForwardInput = {
label: "", label: "",
@@ -229,12 +230,9 @@ export default function Ports({ user }: { user: CurrentUser }) {
<td className="text-secondary"><TimeAgo value={p.lastSeenAt} /></td> <td className="text-secondary"><TimeAgo value={p.lastSeenAt} /></td>
</tr> </tr>
))} ))}
{agentPorts === null && <LoadingRow colSpan={6} />}
{agentPorts !== null && agentPorts.length === 0 && ( {agentPorts !== null && agentPorts.length === 0 && (
<tr> <EmptyRow colSpan={6} title="No listening ports reported yet" hint="Each server's agent lists what is listening with its next report. Install or update the agent to see ports here." action={{ label: "Go to Servers", to: "/servers" }} />
<td colSpan={6} className="text-secondary text-center">
No servers have reported listening ports yet.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
@@ -418,12 +416,9 @@ export default function Ports({ user }: { user: CurrentUser }) {
)} )}
</tr> </tr>
))} ))}
{forwards === null && <LoadingRow colSpan={canEdit ? 6 : 5} />}
{forwards !== null && forwards.length === 0 && ( {forwards !== null && forwards.length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 6 : 5} title="No port openings recorded" hint="Write down what is forwarded through the router or opened by hand, so it isn't forgotten." action={canEdit ? { label: "Record one", onClick: startAdd } : undefined} />
<td colSpan={canEdit ? 6 : 5} className="text-secondary text-center">
No manual port openings recorded yet.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -5
View File
@@ -26,6 +26,7 @@ import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail"; import { useRowDetail } from "../hooks/useRowDetail";
import { formatDateTime } from "../utils/date"; import { formatDateTime } from "../utils/date";
import ExportTableButton from "../components/ExportTableButton"; import ExportTableButton from "../components/ExportTableButton";
import { EmptyRow } from "../components/EmptyState";
function proxmoxStatusBadge(status: string) { function proxmoxStatusBadge(status: string) {
return status === "running" ? ( return status === "running" ? (
@@ -590,11 +591,7 @@ export default function Proxmox({ user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{sortedGuests?.length === 0 && ( {sortedGuests?.length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 6 : 5} title="No guests found" hint="The cluster answered with no virtual machines or containers. Check that the API token can see them." action={{ label: "Check the integration", to: "/integrations" }} filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
<td colSpan={canEdit ? 6 : 5} className="text-secondary text-center">
No VMs or containers found across any node.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+4 -6
View File
@@ -13,6 +13,7 @@ import { confirmDialog } from "../utils/dialogs";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import { toast } from "../utils/toast"; import { toast } from "../utils/toast";
import TableToolbar from "../components/TableToolbar"; import TableToolbar from "../components/TableToolbar";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
const TYPE_LABELS: Record<SecretRecord["type"], string> = { const TYPE_LABELS: Record<SecretRecord["type"], string> = {
api_token: "API Token", api_token: "API Token",
@@ -458,12 +459,9 @@ export default function Secrets({ user }: { user: CurrentUser }) {
)} )}
</tr> </tr>
))} ))}
{(sorted ?? []).length === 0 && ( {secrets === null && <LoadingRow colSpan={canEdit ? 8 : 6} />}
<tr> {secrets !== null && (sorted ?? []).length === 0 && (
<td colSpan={canEdit ? 8 : 6} className="text-secondary text-center"> <EmptyRow colSpan={canEdit ? 8 : 6} title="No secrets tracked yet" hint="Track an API token, a certificate or a password that expires, and you are warned before it does. The form is at the top of this page." filtered={secrets && secrets.length > 0 ? () => { setSearch(""); setStatusFilter("all"); } : undefined} />
No secrets tracked yet.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -5
View File
@@ -21,6 +21,7 @@ import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch"; import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer"; import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail"; import { useRowDetail } from "../hooks/useRowDetail";
import { EmptyRow } from "../components/EmptyState";
function semaphoreStatusBadge(template: SemaphoreTemplate) { function semaphoreStatusBadge(template: SemaphoreTemplate) {
const status = template.lastTask?.status; const status = template.lastTask?.status;
@@ -226,11 +227,7 @@ export default function Semaphore({ user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{sorted?.length === 0 && ( {sorted?.length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 5 : 4} title="No templates found" hint="Create a task template in a Semaphore project (a playbook to run) and it appears here, ready to run from this app." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
<td colSpan={canEdit ? 5 : 4} className="text-secondary text-center">
No templates found across any project.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+8 -17
View File
@@ -22,6 +22,7 @@ import { useTableSearch } from "../hooks/useTableSearch";
import SaveViewButton from "../components/SaveViewButton"; import SaveViewButton from "../components/SaveViewButton";
import { agentState } from "../utils/agent"; import { agentState } from "../utils/agent";
import { BlockSkeleton } from "../components/Skeleton"; import { BlockSkeleton } from "../components/Skeleton";
import EmptyState, { EmptyRow, LoadingRow } from "../components/EmptyState";
function typeBadgeStyle(colors: Record<string, string>, type: string): CSSProperties { function typeBadgeStyle(colors: Record<string, string>, type: string): CSSProperties {
const color = colors[type]; const color = colors[type];
@@ -462,12 +463,9 @@ export default function Servers({ user }: { user: CurrentUser }) {
</td> </td>
</tr> </tr>
))} ))}
{!loaded && <LoadingRow colSpan={7} />}
{loaded && sortedServers?.length === 0 && ( {loaded && sortedServers?.length === 0 && (
<tr> <EmptyRow colSpan={7} title="No servers yet" hint="Add a server with the form above and install its agent: it then reports its tasks, disks, memory, open ports and waiting updates." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
<td colSpan={7} className="text-secondary text-center">
No servers registered yet.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
@@ -483,18 +481,11 @@ export default function Servers({ user }: { user: CurrentUser }) {
</div> </div>
) : servers.length === 0 ? ( ) : servers.length === 0 ? (
<div className="card"> <div className="card">
<div className="card-body text-secondary"> <EmptyState
No servers registered yet. title="No servers yet"
{isAdmin && ( hint="Add a server and install its agent: it then reports its tasks, disks, memory, open ports and waiting updates, and the app can tell when it goes quiet."
<> action={isAdmin ? { label: "Add a server", onClick: () => setManagingServers(true) } : undefined}
{" "} />
<button className="btn btn-link p-0 align-baseline" onClick={() => setManagingServers(true)}>
Add one
</button>
.
</>
)}
</div>
</div> </div>
) : ( ) : (
<> <>
+3 -5
View File
@@ -9,6 +9,7 @@ import { confirmDialog } from "../utils/dialogs";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import { SearchBox } from "../components/TableToolbar"; import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch"; import { useTableSearch } from "../hooks/useTableSearch";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
function friendlyUserAgent(ua: string | null): string { function friendlyUserAgent(ua: string | null): string {
if (!ua) return "—"; if (!ua) return "—";
@@ -162,12 +163,9 @@ export default function Sessions() {
</td> </td>
</tr> </tr>
))} ))}
{sessions === null && <LoadingRow colSpan={8} />}
{sorted?.length === 0 && ( {sorted?.length === 0 && (
<tr> <EmptyRow colSpan={8} title="No active sessions" hint="Everyone who is signed in appears here, with where from and until when." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
<td colSpan={8} className="text-secondary text-center">
No active sessions.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+3 -10
View File
@@ -14,6 +14,7 @@ import SortableTh from "../components/SortableTh";
import { downloadCsv } from "../utils/csv"; import { downloadCsv } from "../utils/csv";
import IntegrationPageTitle from "../components/IntegrationPageTitle"; import IntegrationPageTitle from "../components/IntegrationPageTitle";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import { EmptyRow } from "../components/EmptyState";
function healthBadge(status: string) { function healthBadge(status: string) {
return status === "normal" ? ( return status === "normal" ? (
@@ -302,11 +303,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{sortedVolumes?.length === 0 && ( {sortedVolumes?.length === 0 && (
<tr> <EmptyRow colSpan={4} title="No volumes found" hint="The NAS answered with none. Check the account's permissions in DSM." action={{ label: "Check the integration", to: "/integrations" }} />
<td colSpan={4} className="text-secondary text-center">
No volumes found.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
@@ -377,11 +374,7 @@ export default function Synology({ user: _user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{sortedDisks?.length === 0 && ( {sortedDisks?.length === 0 && (
<tr> <EmptyRow colSpan={5} title="No disks found" hint="The NAS answered with none. Check the account's permissions in DSM." action={{ label: "Check the integration", to: "/integrations" }} />
<td colSpan={5} className="text-secondary text-center">
No disks found.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -5
View File
@@ -22,6 +22,7 @@ import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch"; import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer"; import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail"; import { useRowDetail } from "../hooks/useRowDetail";
import { EmptyRow } from "../components/EmptyState";
const KEY_EXPIRY_WARN_DAYS = 30; const KEY_EXPIRY_WARN_DAYS = 30;
@@ -338,11 +339,7 @@ export default function Tailscale({ user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{sorted?.length === 0 && ( {sorted?.length === 0 && (
<tr> <EmptyRow colSpan={canEdit ? 8 : 6} title="No devices" hint="Devices appear here once they have joined the tailnet." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
<td colSpan={canEdit ? 8 : 6} className="text-secondary text-center">
No devices in this tailnet.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -5
View File
@@ -15,6 +15,7 @@ import { readableError } from "../utils/errors";
import ExportTableButton from "../components/ExportTableButton"; import ExportTableButton from "../components/ExportTableButton";
import UpdateRunDrawer from "../components/UpdateRunDrawer"; import UpdateRunDrawer from "../components/UpdateRunDrawer";
import UpdateRunsCard from "../components/UpdateRunsCard"; import UpdateRunsCard from "../components/UpdateRunsCard";
import { EmptyRow } from "../components/EmptyState";
interface Row { interface Row {
id: number; id: number;
@@ -243,11 +244,7 @@ export default function Updates({ user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{servers !== null && sorted?.length === 0 && ( {servers !== null && sorted?.length === 0 && (
<tr> <EmptyRow colSpan={canRun ? 7 : 6} {...(tableSearch.active || onlyWaiting ? { filtered: () => { tableSearch.setQuery(""); setOnlyWaiting(false); } } : { title: "No server has reported yet", hint: "Waiting updates are read by each server's agent. Install or update the agent and its figures appear here.", action: { label: "Go to Servers", to: "/servers" } })} />
<td colSpan={canRun ? 7 : 6} className="text-secondary text-center">
{tableSearch.active || onlyWaiting ? "Nothing matches that." : "No server has reported yet."}
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -5
View File
@@ -13,6 +13,7 @@ import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch"; import { useTableSearch } from "../hooks/useTableSearch";
import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer"; import DetailDrawer, { ObjectDetails } from "../components/DetailDrawer";
import { useRowDetail } from "../hooks/useRowDetail"; import { useRowDetail } from "../hooks/useRowDetail";
import { EmptyRow } from "../components/EmptyState";
function statusBadge(monitor: UptimeKumaMonitor) { function statusBadge(monitor: UptimeKumaMonitor) {
switch (monitor.status) { switch (monitor.status) {
@@ -203,11 +204,7 @@ export default function UptimeKuma({ user: _user }: { user: CurrentUser }) {
</tr> </tr>
))} ))}
{sorted?.length === 0 && ( {sorted?.length === 0 && (
<tr> <EmptyRow colSpan={7} title="No monitors" hint="Add monitors in Uptime Kuma and they appear here, with the server each one watches." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
<td colSpan={7} className="text-secondary text-center">
No monitors reported by this Uptime Kuma instance.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+3 -5
View File
@@ -8,6 +8,7 @@ import { downloadCsv } from "../utils/csv";
import { ErrorNotice } from "../components/Notice"; import { ErrorNotice } from "../components/Notice";
import { SearchBox } from "../components/TableToolbar"; import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch"; import { useTableSearch } from "../hooks/useTableSearch";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
const ROLES: UserRole[] = ["viewer", "operator", "admin"]; const ROLES: UserRole[] = ["viewer", "operator", "admin"];
@@ -117,12 +118,9 @@ export default function Users() {
<td>{u.lastLoginAt ? formatDateTime(new Date(u.lastLoginAt)) : "never"}</td> <td>{u.lastLoginAt ? formatDateTime(new Date(u.lastLoginAt)) : "never"}</td>
</tr> </tr>
))} ))}
{users === null && <LoadingRow colSpan={5} />}
{sorted?.length === 0 && ( {sorted?.length === 0 && (
<tr> <EmptyRow colSpan={5} title="No users yet" hint="People appear here the first time they sign in through Authentik; you decide their role." filtered={tableSearch.active ? () => tableSearch.setQuery("") : undefined} />
<td colSpan={5} className="text-secondary text-center">
No users yet.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
@@ -5,6 +5,7 @@ import { formatDateTime } from "../../utils/date";
import { formatAgo } from "../../utils/duration"; import { formatAgo } from "../../utils/duration";
import { readableError } from "../../utils/errors"; import { readableError } from "../../utils/errors";
import { ErrorNotice, SuccessNotice } from "../../components/Notice"; import { ErrorNotice, SuccessNotice } from "../../components/Notice";
import { PageSkeleton } from "../../components/Skeleton";
const SEVERITIES: { value: AlertTicketSeverity; label: string; hint: string }[] = [ const SEVERITIES: { value: AlertTicketSeverity; label: string; hint: string }[] = [
{ value: "critical", label: "Critical", hint: "A server down, a disk nearly full, a failed backup, something expired" }, { value: "critical", label: "Critical", hint: "A server down, a disk nearly full, a failed backup, something expired" },
@@ -51,7 +52,7 @@ export default function AlertTicketSettings() {
const dirty = useMemo(() => overview !== null && draft !== null && JSON.stringify(overview.settings) !== JSON.stringify(draft), [overview, draft]); const dirty = useMemo(() => overview !== null && draft !== null && JSON.stringify(overview.settings) !== JSON.stringify(draft), [overview, draft]);
if (!overview || !draft) { if (!overview || !draft) {
return error ? <div className="alert alert-danger">{error}</div> : <div className="text-secondary">Loading…</div>; return error ? <div className="alert alert-danger">{error}</div> : <PageSkeleton />;
} }
const set = (patch: Partial<Settings>) => { const set = (patch: Partial<Settings>) => {
+5 -10
View File
@@ -7,6 +7,7 @@ import { confirmDialog } from "../../utils/dialogs";
import { readableError } from "../../utils/errors"; import { readableError } from "../../utils/errors";
import { toast } from "../../utils/toast"; import { toast } from "../../utils/toast";
import ExportTableButton from "../../components/ExportTableButton"; import ExportTableButton from "../../components/ExportTableButton";
import { EmptyRow, LoadingRow } from "../../components/EmptyState";
const EVENT_WORDS: Record<WebhookEventName, string> = { const EVENT_WORDS: Record<WebhookEventName, string> = {
"alert.opened": "A problem begins", "alert.opened": "A problem begins",
@@ -213,12 +214,9 @@ export default function ApiSettings() {
</td> </td>
</tr> </tr>
))} ))}
{tokens === null && <LoadingRow colSpan={4} />}
{tokens?.length === 0 && ( {tokens?.length === 0 && (
<tr> <EmptyRow colSpan={4} title="No metrics tokens yet" hint="/metrics refuses everyone until a token is made. Make one for Prometheus and give it the secret, which is shown once." />
<td colSpan={4} className="text-secondary text-center">
No tokens yet, so /metrics refuses everyone.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
@@ -348,12 +346,9 @@ export default function ApiSettings() {
</td> </td>
</tr> </tr>
))} ))}
{hooks === null && <LoadingRow colSpan={4} />}
{hooks?.length === 0 && ( {hooks?.length === 0 && (
<tr> <EmptyRow colSpan={4} title="No webhooks yet" hint="A webhook tells another system when an alert opens or resolves, or when maintenance starts or ends." action={{ label: "Add a webhook", onClick: () => setAdding(true) }} />
<td colSpan={4} className="text-secondary text-center">
No webhooks yet.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+2 -1
View File
@@ -5,6 +5,7 @@ import { formatDateTime } from "../../utils/date";
import { readableError } from "../../utils/errors"; import { readableError } from "../../utils/errors";
import { parseNames } from "../../utils/nameLists"; import { parseNames } from "../../utils/nameLists";
import { ErrorNotice, SuccessNotice } from "../../components/Notice"; import { ErrorNotice, SuccessNotice } from "../../components/Notice";
import { PageSkeleton } from "../../components/Skeleton";
/** One list as it's being edited. The names are kept as the text in the box, so typing stays natural. */ /** One list as it's being edited. The names are kept as the text in the box, so typing stays natural. */
interface Draft { interface Draft {
@@ -217,7 +218,7 @@ export default function NameSettings() {
} }
if (!saved) { if (!saved) {
return error ? <div className="alert alert-danger">{error}</div> : <div className="text-secondary">Loading…</div>; return error ? <div className="alert alert-danger">{error}</div> : <PageSkeleton />;
} }
return ( return (
+5 -7
View File
@@ -4,11 +4,13 @@ import StatusPageEditor from "../../components/StatusPageEditor";
import CopyButton from "../../components/CopyButton"; import CopyButton from "../../components/CopyButton";
import TimeAgo from "../../components/TimeAgo"; import TimeAgo from "../../components/TimeAgo";
import { ErrorNotice } from "../../components/Notice"; import { ErrorNotice } from "../../components/Notice";
import { BlockSkeleton } from "../../components/Skeleton";
import { confirmDialog } from "../../utils/dialogs"; import { confirmDialog } from "../../utils/dialogs";
import { formatDateTime } from "../../utils/date"; import { formatDateTime } from "../../utils/date";
import { readableError } from "../../utils/errors"; import { readableError } from "../../utils/errors";
import { toast } from "../../utils/toast"; import { toast } from "../../utils/toast";
import ExportTableButton from "../../components/ExportTableButton"; import ExportTableButton from "../../components/ExportTableButton";
import { EmptyRow } from "../../components/EmptyState";
const LASTS: { days: number | null; label: string }[] = [ const LASTS: { days: number | null; label: string }[] = [
{ days: null, label: "Until I remove it" }, { days: null, label: "Until I remove it" },
@@ -227,16 +229,12 @@ export default function ShareSettings() {
</tr> </tr>
))} ))}
{links?.length === 0 && ( {links?.length === 0 && (
<tr> <EmptyRow colSpan={6} title="No share links yet" hint="A link lets a wall display or a status page be seen without signing in. Make one with the form above." />
<td colSpan={6} className="text-secondary text-center">
No share links yet.
</td>
</tr>
)} )}
{links === null && !error && ( {links === null && !error && (
<tr> <tr>
<td colSpan={6} className="text-secondary text-center"> <td colSpan={6}>
Loading… <BlockSkeleton lines={2} />
</td> </td>
</tr> </tr>
)} )}
+3 -5
View File
@@ -5,6 +5,7 @@ import { normalizeTagInput, refreshTagColors, tagBadge } from "../../utils/tags"
import { confirmDialog, promptDialog } from "../../utils/dialogs"; import { confirmDialog, promptDialog } from "../../utils/dialogs";
import { ErrorNotice, SuccessNotice } from "../../components/Notice"; import { ErrorNotice, SuccessNotice } from "../../components/Notice";
import ExportTableButton from "../../components/ExportTableButton"; import ExportTableButton from "../../components/ExportTableButton";
import { EmptyRow, LoadingRow } from "../../components/EmptyState";
const DEFAULT_PICK = "#3b82f6"; const DEFAULT_PICK = "#3b82f6";
@@ -221,12 +222,9 @@ export default function TagSettings() {
</tr> </tr>
); );
})} })}
{tags === null && <LoadingRow colSpan={4} />}
{tags && tags.length === 0 && ( {tags && tags.length === 0 && (
<tr> <EmptyRow colSpan={4} title="No tags yet" hint="Tags are labels for grouping and filtering servers (prod, lab, nas). Add one above, or tag a server from its own page." />
<td colSpan={4} className="text-secondary text-center">
No tags yet. Add one above, or tag a server from its page.
</td>
</tr>
)} )}
</tbody> </tbody>
</table> </table>
+22
View File
@@ -1716,3 +1716,25 @@ tr.alert-row-child > td:first-child {
height: 1.25rem; height: 1.25rem;
} }
} }
/* ── What a list says when it has nothing in it (see EmptyState). ── */
.empty-state {
padding: 1.6rem 1rem;
text-align: center;
}
.empty-state-icon {
margin-bottom: 0.35rem;
color: var(--tblr-secondary);
}
.empty-state-title {
font-weight: 600;
}
.empty-state-hint {
max-width: 34rem;
margin: 0.2rem auto 0;
font-size: 0.875rem;
color: var(--tblr-secondary);
}