Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97fcb518d8 | ||
|
|
90859dcde6 | ||
|
|
a7630b7d6d | ||
|
|
2dbeb792a7 | ||
|
|
e68a1491ae | ||
|
|
29c827f1be | ||
|
|
d0fe65a1d6 | ||
|
|
3c83e646ca | ||
|
|
27decf209a | ||
|
|
75bf432859 | ||
|
|
12cad9d3fb | ||
|
|
d39d6cf888 | ||
|
|
2613a556b1 | ||
|
|
346bead673 | ||
|
|
3a16f63e26 | ||
|
|
54afb14030 | ||
|
|
af394577b8 | ||
|
|
f8d3d5893a | ||
|
|
803d590a16 | ||
|
|
aa891d61ed | ||
|
|
f52a391157 | ||
|
|
d4b075ba55 | ||
|
|
86550aadc9 |
No files matched your search
@@ -36,8 +36,6 @@ pnpm cli harness setup feature-board
|
||||
|
||||
The command builds `homarr:feature-board`, starts a container with a persistent data volume, enables demo mode, and keeps demo mutations writable (`DEMO_READ_ONLY=false`). Docker assigns a free host port by default; use the URL printed by the command or query it later:
|
||||
|
||||
The demo board includes every widget kind. Integration-backed widgets use the bundled mock integration; media widgets use public stock assets.
|
||||
|
||||
```sh
|
||||
pnpm cli harness port feature-board
|
||||
```
|
||||
|
||||
+1
-1
@@ -4387,7 +4387,7 @@
|
||||
"enum": ["input", "icon"]
|
||||
},
|
||||
"logoDisplay": {
|
||||
"default": "logoAndText",
|
||||
"default": "logo",
|
||||
"type": "string",
|
||||
"enum": ["logo", "logoAndText"]
|
||||
},
|
||||
|
||||
@@ -16,10 +16,7 @@
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--mantine-spacing-sm);
|
||||
box-sizing: border-box;
|
||||
min-width: 0;
|
||||
height: 100%;
|
||||
padding-inline-end: rem(10px);
|
||||
overflow-x: auto;
|
||||
scrollbar-width: none;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ import { describe, test } from "vitest";
|
||||
|
||||
import { createHomarrContainer } from "./shared/create-homarr-container";
|
||||
import { createSqliteDbFileAsync } from "./shared/e2e-db";
|
||||
import { loginAsync } from "./shared/login";
|
||||
import { seedAdminUserAsync } from "./shared/seed-admin-user";
|
||||
import * as sqliteSchema from "../packages/db/schema/sqlite";
|
||||
|
||||
@@ -41,7 +40,13 @@ describe("Assistant management", () => {
|
||||
const page = await context.newPage();
|
||||
|
||||
try {
|
||||
await loginAsync({ page, baseUrl, credentials: adminCredentials, destination: "/manage/assistant" });
|
||||
await page.goto(`${baseUrl}/auth/login`);
|
||||
await page.getByLabel("Username").fill(adminCredentials.username);
|
||||
await page.locator("#password").fill(adminCredentials.password);
|
||||
await page.getByRole("button", { name: "Login" }).click();
|
||||
await expect(page).not.toHaveURL(/\/auth\/login/, { timeout: 30_000 });
|
||||
|
||||
await page.goto(`${baseUrl}/manage/assistant`);
|
||||
await expect(page.getByRole("heading", { name: "Assistant" })).toBeVisible();
|
||||
await expect(page.getByText("Connection ready")).toBeVisible();
|
||||
await expect(page.getByText("Encrypted API key saved")).toBeVisible();
|
||||
|
||||
@@ -8,7 +8,6 @@ import { describe, test } from "vitest";
|
||||
import * as sqliteSchema from "../packages/db/schema/sqlite";
|
||||
import { createHomarrContainer } from "./shared/create-homarr-container";
|
||||
import { createSqliteDbFileAsync } from "./shared/e2e-db";
|
||||
import { loginAsync } from "./shared/login";
|
||||
import { seedAdminUserAsync } from "./shared/seed-admin-user";
|
||||
|
||||
const adminCredentials = {
|
||||
@@ -117,7 +116,15 @@ describe("lazy widget application graph", () => {
|
||||
let releaseRefresh: (() => void) | undefined;
|
||||
|
||||
try {
|
||||
await loginAsync({ page, baseUrl, credentials: adminCredentials });
|
||||
await page.goto(`${baseUrl}/auth/login`);
|
||||
await page.getByLabel("Username").fill(adminCredentials.username);
|
||||
await page.locator("#password").fill(adminCredentials.password);
|
||||
const signedIn = page.waitForURL((url) => url.origin === baseUrl && url.pathname === "/", {
|
||||
waitUntil: "commit",
|
||||
timeout: 60_000,
|
||||
});
|
||||
await page.locator("css=button[type='submit']").click();
|
||||
await signedIn;
|
||||
|
||||
const visibleBoard = page.locator("[data-homarr-dev-benchmark-board]").filter({ visible: true }).first();
|
||||
await expect(visibleBoard).toBeVisible({ timeout: 30_000 });
|
||||
|
||||
@@ -3,12 +3,7 @@ import { z } from "zod/v4";
|
||||
|
||||
import { ResponseError } from "@homarr/common/server";
|
||||
import { createLogger } from "@homarr/core/infrastructure/logs";
|
||||
import {
|
||||
anchorNotesListInputSchema,
|
||||
anchorNoteUpdateInputSchema,
|
||||
createIntegrationAsync,
|
||||
mockWidgetData,
|
||||
} from "@homarr/integrations";
|
||||
import { anchorNotesListInputSchema, anchorNoteUpdateInputSchema, createIntegrationAsync } from "@homarr/integrations";
|
||||
import { anchorNoteRequestHandler, anchorNotesListRequestHandler } from "@homarr/request-handler/anchor-notes";
|
||||
|
||||
import { createOneIntegrationMiddleware } from "../../middlewares/integration";
|
||||
@@ -20,12 +15,6 @@ const noteIdInput = z.object({
|
||||
|
||||
const logger = createLogger({ module: "anchorNotesRouter" });
|
||||
|
||||
const assertMockNoteExists = (noteId: string) => {
|
||||
if (noteId === mockWidgetData.anchorNote.id) return;
|
||||
|
||||
throw new TRPCError({ code: "NOT_FOUND", message: "Note not found" });
|
||||
};
|
||||
|
||||
const isJsonDeltaString = (value: string) => {
|
||||
try {
|
||||
const parsed: unknown = JSON.parse(value);
|
||||
@@ -51,64 +40,34 @@ const normalizeAnchorContent = (content: string | undefined) => {
|
||||
|
||||
export const anchorNotesRouter = createTRPCRouter({
|
||||
listNotes: publicProcedure
|
||||
.concat(createOneIntegrationMiddleware("query", "anchor", "mock"))
|
||||
.concat(createOneIntegrationMiddleware("query", "anchor"))
|
||||
.input(anchorNotesListInputSchema)
|
||||
.query(async ({ ctx, input }) => {
|
||||
if (ctx.integration.kind === "mock") {
|
||||
const search = input.search?.toLowerCase();
|
||||
const notes = mockWidgetData.anchorNotes.filter((note) => !search || note.title.toLowerCase().includes(search));
|
||||
return notes.slice(0, input.limit ?? 50);
|
||||
}
|
||||
|
||||
const handler = anchorNotesListRequestHandler.handler(
|
||||
{ ...ctx.integration, kind: "anchor" },
|
||||
{
|
||||
...input,
|
||||
limit: input.limit ?? 50,
|
||||
},
|
||||
);
|
||||
const handler = anchorNotesListRequestHandler.handler(ctx.integration, { ...input, limit: input.limit ?? 50 });
|
||||
|
||||
const { data } = await handler.getDataAsync();
|
||||
|
||||
return data;
|
||||
}),
|
||||
getNote: publicProcedure
|
||||
.concat(createOneIntegrationMiddleware("query", "anchor", "mock"))
|
||||
.concat(createOneIntegrationMiddleware("query", "anchor"))
|
||||
.input(noteIdInput)
|
||||
.query(async ({ ctx, input }) => {
|
||||
if (ctx.integration.kind === "mock") {
|
||||
assertMockNoteExists(input.noteId);
|
||||
return mockWidgetData.anchorNote;
|
||||
}
|
||||
|
||||
const handler = anchorNoteRequestHandler.handler(
|
||||
{ ...ctx.integration, kind: "anchor" },
|
||||
{ noteId: input.noteId },
|
||||
);
|
||||
const handler = anchorNoteRequestHandler.handler(ctx.integration, { noteId: input.noteId });
|
||||
|
||||
const { data } = await handler.getDataAsync();
|
||||
|
||||
return data;
|
||||
}),
|
||||
updateNote: protectedProcedure
|
||||
.concat(createOneIntegrationMiddleware("interact", "anchor", "mock"))
|
||||
.concat(createOneIntegrationMiddleware("interact", "anchor"))
|
||||
.input(anchorNoteUpdateInputSchema)
|
||||
.mutation(async ({ ctx, input }) => {
|
||||
const integrationInstance = await createIntegrationAsync(ctx.integration);
|
||||
const normalizedContent = normalizeAnchorContent(input.content);
|
||||
const isContentNormalized =
|
||||
input.content !== undefined && normalizedContent !== undefined && input.content !== normalizedContent;
|
||||
|
||||
if (ctx.integration.kind === "mock") {
|
||||
assertMockNoteExists(input.noteId);
|
||||
return {
|
||||
...mockWidgetData.anchorNote,
|
||||
...(input.title !== undefined ? { title: input.title } : {}),
|
||||
...(normalizedContent !== undefined ? { content: normalizedContent } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
const integrationInstance = await createIntegrationAsync({ ...ctx.integration, kind: "anchor" });
|
||||
|
||||
try {
|
||||
const updatedNote = await integrationInstance.updateNoteAsync({
|
||||
noteId: input.noteId,
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import { archiveTeamWarriorRequestHandler } from "@homarr/request-handler/archive-team-warrior";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
|
||||
import { createOneIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||
|
||||
export const archiveTeamWarriorRouter = createTRPCRouter({
|
||||
getStatus: publicProcedure
|
||||
.concat(createOneIntegrationMiddleware("query", "archiveTeamWarrior", "mock"))
|
||||
.concat(createOneIntegrationMiddleware("query", "archiveTeamWarrior"))
|
||||
.query(async ({ ctx }) => {
|
||||
if (ctx.integration.kind === "mock") {
|
||||
return { status: mockWidgetData.archiveTeamWarrior, updatedAt: new Date(mockWidgetData.timestamp) };
|
||||
}
|
||||
|
||||
const handler = archiveTeamWarriorRequestHandler.handler({ ...ctx.integration, kind: "archiveTeamWarrior" }, {});
|
||||
const handler = archiveTeamWarriorRequestHandler.handler(ctx.integration, {});
|
||||
const { data, timestamp } = await handler.getDataAsync();
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
import { audiobookshelfRequestHandler } from "@homarr/request-handler/audiobookshelf";
|
||||
import { navidromeRequestHandler } from "@homarr/request-handler/navidrome";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
|
||||
import { createOneIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||
|
||||
export const audioStatsRouter = createTRPCRouter({
|
||||
getStats: publicProcedure
|
||||
.concat(createOneIntegrationMiddleware("query", "navidrome", "audiobookshelf", "mock"))
|
||||
.concat(createOneIntegrationMiddleware("query", "navidrome", "audiobookshelf"))
|
||||
.query(async ({ ctx }) => {
|
||||
const { kind } = ctx.integration;
|
||||
if (kind === "mock") return { kind: "navidrome" as const, data: mockWidgetData.audioStats };
|
||||
|
||||
const fetchByKind = {
|
||||
navidrome: async () => {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { bazarrBadgesRequestHandler } from "@homarr/request-handler/bazarr";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
|
||||
import { createOneIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||
@@ -13,11 +12,9 @@ export const bazarrRouter = createTRPCRouter({
|
||||
"Get missing subtitle counts, provider issues, and health warnings for a Bazarr integration. REQUIRED: integrationId from integration_all",
|
||||
},
|
||||
})
|
||||
.concat(createOneIntegrationMiddleware("query", "bazarr", "mock"))
|
||||
.concat(createOneIntegrationMiddleware("query", "bazarr"))
|
||||
.query(async ({ ctx }) => {
|
||||
if (ctx.integration.kind === "mock") return mockWidgetData.bazarr;
|
||||
|
||||
const innerHandler = bazarrBadgesRequestHandler.handler({ ...ctx.integration, kind: "bazarr" }, {});
|
||||
const innerHandler = bazarrBadgesRequestHandler.handler(ctx.integration, {});
|
||||
const data = await innerHandler.getDataAsync();
|
||||
return data.data;
|
||||
}),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { CoolifyInstanceInfo } from "@homarr/integrations/types";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
import { coolifyRequestHandler } from "@homarr/request-handler/coolify";
|
||||
|
||||
import { createManyIntegrationMiddleware } from "../../middlewares/integration";
|
||||
@@ -17,22 +16,12 @@ interface CoolifyInstanceResult {
|
||||
|
||||
export const coolifyRouter = createTRPCRouter({
|
||||
getInstancesInfo: publicProcedure
|
||||
.concat(createManyIntegrationMiddleware("query", "coolify", "mock"))
|
||||
.concat(createManyIntegrationMiddleware("query", "coolify"))
|
||||
.query(async ({ ctx }) => {
|
||||
return await settleIntegrationQueries(
|
||||
ctx.integrations,
|
||||
async (integration): Promise<CoolifyInstanceResult> => {
|
||||
if (integration.kind === "mock") {
|
||||
return {
|
||||
integrationId: integration.id,
|
||||
integrationName: integration.name,
|
||||
integrationUrl: integration.url,
|
||||
instanceInfo: mockWidgetData.coolify,
|
||||
updatedAt: new Date(mockWidgetData.timestamp),
|
||||
};
|
||||
}
|
||||
|
||||
const innerHandler = coolifyRequestHandler.handler({ ...integration, kind: "coolify" }, {});
|
||||
const innerHandler = coolifyRequestHandler.handler(integration, {});
|
||||
const { data, timestamp } = await innerHandler.getDataAsync();
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { getIntegrationKindsByCategory } from "@homarr/definitions";
|
||||
import type { IntegrationKind } from "@homarr/definitions";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
import {
|
||||
firewallCpuRequestHandler,
|
||||
firewallInterfacesRequestHandler,
|
||||
@@ -12,53 +10,29 @@ import { createManyIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { settleIntegrationQueries, toPublicIntegrationError } from "../../settle-integrations";
|
||||
import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||
|
||||
const firewallMiddleware = createManyIntegrationMiddleware(
|
||||
"query",
|
||||
...getIntegrationKindsByCategory("firewall"),
|
||||
"mock",
|
||||
);
|
||||
const firewallMiddleware = createManyIntegrationMiddleware("query", ...getIntegrationKindsByCategory("firewall"));
|
||||
|
||||
interface FirewallResult<TSummary> {
|
||||
integration: { id: string; name: string; kind: IntegrationKind; updatedAt: Date };
|
||||
summary: TSummary;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
const queryFirewall = <TSummary>(
|
||||
handler: {
|
||||
handler: (
|
||||
integration: any,
|
||||
input: Record<string, never>,
|
||||
) => { getDataAsync: () => Promise<{ data: TSummary; timestamp: Date }> };
|
||||
const queryFirewall = <
|
||||
THandler extends {
|
||||
handler: (integration: any, input: any) => { getDataAsync: () => Promise<{ data: any; timestamp: Date }> };
|
||||
},
|
||||
createFallback: () => TSummary,
|
||||
getMockData: () => TSummary,
|
||||
>(
|
||||
handler: THandler,
|
||||
createFallback: () => Awaited<ReturnType<ReturnType<THandler["handler"]>["getDataAsync"]>>["data"],
|
||||
) =>
|
||||
publicProcedure.concat(firewallMiddleware).query(async ({ ctx }) =>
|
||||
settleIntegrationQueries(
|
||||
ctx.integrations,
|
||||
async (integration): Promise<FirewallResult<TSummary>> => {
|
||||
if (integration.kind === "mock") {
|
||||
return {
|
||||
integration: {
|
||||
id: integration.id,
|
||||
name: integration.name,
|
||||
kind: integration.kind,
|
||||
updatedAt: new Date(mockWidgetData.timestamp),
|
||||
},
|
||||
summary: getMockData(),
|
||||
error: undefined,
|
||||
};
|
||||
}
|
||||
const { data, timestamp } = await handler.handler({ ...integration, kind: "opnsense" }, {}).getDataAsync();
|
||||
async (integration) => {
|
||||
const { data, timestamp } = await handler.handler(integration, {}).getDataAsync();
|
||||
return {
|
||||
integration: { id: integration.id, name: integration.name, kind: integration.kind, updatedAt: timestamp },
|
||||
summary: data,
|
||||
error: undefined,
|
||||
summary: data as Awaited<ReturnType<ReturnType<THandler["handler"]>["getDataAsync"]>>["data"],
|
||||
error: undefined as string | undefined,
|
||||
};
|
||||
},
|
||||
{
|
||||
fallback: (integration, error): FirewallResult<TSummary> => ({
|
||||
fallback: (integration, error) => ({
|
||||
integration: { id: integration.id, name: integration.name, kind: integration.kind, updatedAt: new Date(0) },
|
||||
summary: createFallback(),
|
||||
error: toPublicIntegrationError(error),
|
||||
@@ -69,24 +43,8 @@ const queryFirewall = <TSummary>(
|
||||
);
|
||||
|
||||
export const firewallRouter = createTRPCRouter({
|
||||
getFirewallCpuStatus: queryFirewall(
|
||||
firewallCpuRequestHandler,
|
||||
() => ({ total: 0 }),
|
||||
() => mockWidgetData.firewallCpu,
|
||||
),
|
||||
getFirewallInterfacesStatus: queryFirewall(
|
||||
firewallInterfacesRequestHandler,
|
||||
() => [],
|
||||
() => mockWidgetData.firewallInterfaces,
|
||||
),
|
||||
getFirewallVersionStatus: queryFirewall(
|
||||
firewallVersionRequestHandler,
|
||||
() => ({ version: "Unknown" }),
|
||||
() => mockWidgetData.firewallVersion,
|
||||
),
|
||||
getFirewallMemoryStatus: queryFirewall(
|
||||
firewallMemoryRequestHandler,
|
||||
() => ({ used: 0, total: 0, percent: 0 }),
|
||||
() => mockWidgetData.firewallMemory,
|
||||
),
|
||||
getFirewallCpuStatus: queryFirewall(firewallCpuRequestHandler, () => ({ total: 0 })),
|
||||
getFirewallInterfacesStatus: queryFirewall(firewallInterfacesRequestHandler, () => []),
|
||||
getFirewallVersionStatus: queryFirewall(firewallVersionRequestHandler, () => ({ version: "Unknown" })),
|
||||
getFirewallMemoryStatus: queryFirewall(firewallMemoryRequestHandler, () => ({ used: 0, total: 0, percent: 0 })),
|
||||
});
|
||||
@@ -1,7 +1,6 @@
|
||||
import { z } from "zod/v4";
|
||||
|
||||
import { getIntegrationKindsByCategory } from "@homarr/definitions";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
import {
|
||||
immichAlbumRequestHandler,
|
||||
immichAlbumsRequestHandler,
|
||||
@@ -13,12 +12,11 @@ import { createOneIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||
|
||||
const createImmichIntegrationMiddleware = (action: IntegrationAction) =>
|
||||
createOneIntegrationMiddleware(action, ...getIntegrationKindsByCategory("photoService"), "mock");
|
||||
createOneIntegrationMiddleware(action, ...getIntegrationKindsByCategory("photoService"));
|
||||
|
||||
export const immichRouter = createTRPCRouter({
|
||||
getServerStats: publicProcedure.concat(createImmichIntegrationMiddleware("query")).query(async ({ ctx }) => {
|
||||
if (ctx.integration.kind === "mock") return mockWidgetData.immichStats;
|
||||
const innerHandler = immichStatsRequestHandler.handler({ ...ctx.integration, kind: "immich" }, {});
|
||||
const innerHandler = immichStatsRequestHandler.handler(ctx.integration, {});
|
||||
const data = await innerHandler.getDataAsync();
|
||||
return data.data;
|
||||
}),
|
||||
@@ -31,13 +29,7 @@ export const immichRouter = createTRPCRouter({
|
||||
}),
|
||||
)
|
||||
.query(async ({ ctx, input }) => {
|
||||
if (ctx.integration.kind === "mock") return mockWidgetData.immichAlbum;
|
||||
const innerHandler = immichAlbumRequestHandler.handler(
|
||||
{ ...ctx.integration, kind: "immich" },
|
||||
{
|
||||
albumId: input.albumId,
|
||||
},
|
||||
);
|
||||
const innerHandler = immichAlbumRequestHandler.handler(ctx.integration, { albumId: input.albumId });
|
||||
const data = await innerHandler.getDataAsync();
|
||||
return data.data;
|
||||
}),
|
||||
@@ -50,13 +42,7 @@ export const immichRouter = createTRPCRouter({
|
||||
)
|
||||
.concat(createImmichIntegrationMiddleware("query"))
|
||||
.query(async ({ ctx, input }) => {
|
||||
if (ctx.integration.kind === "mock") return mockWidgetData.immichAlbums.slice(0, input.limit);
|
||||
const innerHandler = immichAlbumsRequestHandler.handler(
|
||||
{ ...ctx.integration, kind: "immich" },
|
||||
{
|
||||
limit: input.limit,
|
||||
},
|
||||
);
|
||||
const innerHandler = immichAlbumsRequestHandler.handler(ctx.integration, { limit: input.limit });
|
||||
const data = await innerHandler.getDataAsync();
|
||||
return data.data;
|
||||
}),
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import { paperlessNgxStatsRequestHandler } from "@homarr/request-handler/paperless-ngx";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
|
||||
import { createOneIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||
|
||||
export const paperlessNgxRouter = createTRPCRouter({
|
||||
getStats: publicProcedure
|
||||
.concat(createOneIntegrationMiddleware("query", "paperlessNgx", "mock"))
|
||||
.query(async ({ ctx }) => {
|
||||
if (ctx.integration.kind === "mock") return mockWidgetData.paperlessNgx;
|
||||
const innerHandler = paperlessNgxStatsRequestHandler.handler({ ...ctx.integration, kind: "paperlessNgx" }, {});
|
||||
const data = await innerHandler.getDataAsync();
|
||||
return data.data;
|
||||
}),
|
||||
getStats: publicProcedure.concat(createOneIntegrationMiddleware("query", "paperlessNgx")).query(async ({ ctx }) => {
|
||||
const innerHandler = paperlessNgxStatsRequestHandler.handler(ctx.integration, {});
|
||||
const data = await innerHandler.getDataAsync();
|
||||
return data.data;
|
||||
}),
|
||||
});
|
||||
@@ -1,5 +1,4 @@
|
||||
import { patchmonStatsRequestHandler } from "@homarr/request-handler/patchmon";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
|
||||
import { createOneIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { createTRPCRouter, protectedProcedure } from "../../trpc";
|
||||
@@ -13,10 +12,9 @@ export const patchmonRouter = createTRPCRouter({
|
||||
"Get PatchMon host patch statistics including total hosts, hosts needing updates, security update counts, up-to-date hosts, outdated packages, repositories, and OS distribution. REQUIRED: integrationId (single PatchMon integration ID from integration_all). Requires authenticated session (API key or browser login) and integration query access.",
|
||||
},
|
||||
})
|
||||
.concat(createOneIntegrationMiddleware("query", "patchmon", "mock"))
|
||||
.concat(createOneIntegrationMiddleware("query", "patchmon"))
|
||||
.query(async ({ ctx }) => {
|
||||
if (ctx.integration.kind === "mock") return mockWidgetData.patchmon;
|
||||
const innerHandler = patchmonStatsRequestHandler.handler({ ...ctx.integration, kind: "patchmon" }, {});
|
||||
const innerHandler = patchmonStatsRequestHandler.handler(ctx.integration, {});
|
||||
const { data } = await innerHandler.getDataAsync();
|
||||
return data;
|
||||
}),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { speedtestTrackerRequestHandler } from "@homarr/request-handler/speedtest-tracker";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
|
||||
import { createManyIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { settleIntegrationQueries, toPublicIntegrationError } from "../../settle-integrations";
|
||||
@@ -7,22 +6,12 @@ import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||
|
||||
export const speedtestTrackerRouter = createTRPCRouter({
|
||||
getDashboard: publicProcedure
|
||||
.concat(createManyIntegrationMiddleware("query", "speedtestTracker", "mock"))
|
||||
.concat(createManyIntegrationMiddleware("query", "speedtestTracker"))
|
||||
.query(async ({ ctx }) => {
|
||||
return await settleIntegrationQueries(
|
||||
ctx.integrations,
|
||||
async (integration) => {
|
||||
if (integration.kind === "mock") {
|
||||
return {
|
||||
integrationId: integration.id,
|
||||
integrationName: integration.name,
|
||||
integrationUrl: integration.url,
|
||||
dashboard: mockWidgetData.speedtestTracker,
|
||||
updatedAt: new Date(mockWidgetData.timestamp),
|
||||
error: undefined,
|
||||
};
|
||||
}
|
||||
const innerHandler = speedtestTrackerRequestHandler.handler({ ...integration, kind: "speedtestTracker" }, {});
|
||||
const innerHandler = speedtestTrackerRequestHandler.handler(integration, {});
|
||||
const { data, timestamp } = await innerHandler.getDataAsync();
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,50 +1,37 @@
|
||||
import { tracearrRequestHandler } from "@homarr/request-handler/tracearr";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
|
||||
import { createManyIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { settleIntegrationQueries, toPublicIntegrationError } from "../../settle-integrations";
|
||||
import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||
|
||||
export const tracearrRouter = createTRPCRouter({
|
||||
getDashboard: publicProcedure
|
||||
.concat(createManyIntegrationMiddleware("query", "tracearr", "mock"))
|
||||
.query(async ({ ctx }) => {
|
||||
return await settleIntegrationQueries(
|
||||
ctx.integrations,
|
||||
async (integration) => {
|
||||
if (integration.kind === "mock") {
|
||||
return {
|
||||
integrationId: integration.id,
|
||||
integrationName: integration.name,
|
||||
integrationUrl: integration.url,
|
||||
dashboard: mockWidgetData.tracearr,
|
||||
updatedAt: new Date(mockWidgetData.timestamp),
|
||||
error: undefined,
|
||||
};
|
||||
}
|
||||
const innerHandler = tracearrRequestHandler.handler({ ...integration, kind: "tracearr" }, {});
|
||||
const { data, timestamp } = await innerHandler.getDataAsync();
|
||||
getDashboard: publicProcedure.concat(createManyIntegrationMiddleware("query", "tracearr")).query(async ({ ctx }) => {
|
||||
return await settleIntegrationQueries(
|
||||
ctx.integrations,
|
||||
async (integration) => {
|
||||
const innerHandler = tracearrRequestHandler.handler(integration, {});
|
||||
const { data, timestamp } = await innerHandler.getDataAsync();
|
||||
|
||||
return {
|
||||
integrationId: integration.id,
|
||||
integrationName: integration.name,
|
||||
integrationUrl: integration.url,
|
||||
dashboard: data as typeof data | null,
|
||||
updatedAt: timestamp,
|
||||
error: undefined as string | undefined,
|
||||
};
|
||||
},
|
||||
{
|
||||
fallback: (integration, error) => ({
|
||||
integrationId: integration.id,
|
||||
integrationName: integration.name,
|
||||
integrationUrl: integration.url,
|
||||
dashboard: null,
|
||||
updatedAt: new Date(0),
|
||||
error: toPublicIntegrationError(error),
|
||||
}),
|
||||
throwOnAllFailures: true,
|
||||
},
|
||||
);
|
||||
}),
|
||||
return {
|
||||
integrationId: integration.id,
|
||||
integrationName: integration.name,
|
||||
integrationUrl: integration.url,
|
||||
dashboard: data as typeof data | null,
|
||||
updatedAt: timestamp,
|
||||
error: undefined as string | undefined,
|
||||
};
|
||||
},
|
||||
{
|
||||
fallback: (integration, error) => ({
|
||||
integrationId: integration.id,
|
||||
integrationName: integration.name,
|
||||
integrationUrl: integration.url,
|
||||
dashboard: null,
|
||||
updatedAt: new Date(0),
|
||||
error: toPublicIntegrationError(error),
|
||||
}),
|
||||
throwOnAllFailures: true,
|
||||
},
|
||||
);
|
||||
}),
|
||||
});
|
||||
@@ -1,5 +1,4 @@
|
||||
import { traefikRequestHandler } from "@homarr/request-handler/traefik";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
|
||||
import { createManyIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { settleIntegrationQueries, toPublicIntegrationError } from "../../settle-integrations";
|
||||
@@ -14,22 +13,12 @@ export const traefikRouter = createTRPCRouter({
|
||||
"Retrieve Traefik dashboard data, including routers, services, middlewares, and entry points, for the given integration IDs.",
|
||||
},
|
||||
})
|
||||
.concat(createManyIntegrationMiddleware("query", "traefik", "mock"))
|
||||
.concat(createManyIntegrationMiddleware("query", "traefik"))
|
||||
.query(async ({ ctx }) => {
|
||||
return await settleIntegrationQueries(
|
||||
ctx.integrations,
|
||||
async (integration) => {
|
||||
if (integration.kind === "mock") {
|
||||
return {
|
||||
integrationId: integration.id,
|
||||
integrationName: integration.name,
|
||||
integrationUrl: integration.url,
|
||||
dashboard: mockWidgetData.traefik,
|
||||
updatedAt: new Date(mockWidgetData.timestamp),
|
||||
error: undefined,
|
||||
};
|
||||
}
|
||||
const innerHandler = traefikRequestHandler.handler({ ...integration, kind: "traefik" }, {});
|
||||
const innerHandler = traefikRequestHandler.handler(integration, {});
|
||||
const { data, timestamp } = await innerHandler.getDataAsync();
|
||||
|
||||
return {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { z } from "zod/v4";
|
||||
|
||||
import { createLogger } from "@homarr/core/infrastructure/logs";
|
||||
import { ErrorWithMetadata } from "@homarr/core/infrastructure/logs/error";
|
||||
import { createIntegrationAsync, mockWidgetData } from "@homarr/integrations";
|
||||
import { createIntegrationAsync } from "@homarr/integrations";
|
||||
import {
|
||||
umamiActiveVisitorsRequestHandler,
|
||||
umamiEventNamesRequestHandler,
|
||||
@@ -19,18 +19,15 @@ import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||
const logger = createLogger({ module: "umami-router" });
|
||||
|
||||
export const umamiRouter = createTRPCRouter({
|
||||
getWebsites: publicProcedure
|
||||
.concat(createOneIntegrationMiddleware("query", "umami", "mock"))
|
||||
.query(async ({ ctx }) => {
|
||||
if (ctx.integration.kind === "mock") return mockWidgetData.umamiWebsites;
|
||||
try {
|
||||
const instance = await createIntegrationAsync({ ...ctx.integration, kind: "umami" });
|
||||
return await instance.getWebsitesAsync();
|
||||
} catch (error) {
|
||||
logger.warn(new Error("Failed to load websites", { cause: error }));
|
||||
return [];
|
||||
}
|
||||
}),
|
||||
getWebsites: publicProcedure.concat(createOneIntegrationMiddleware("query", "umami")).query(async ({ ctx }) => {
|
||||
try {
|
||||
const instance = await createIntegrationAsync(ctx.integration);
|
||||
return await instance.getWebsitesAsync();
|
||||
} catch (error) {
|
||||
logger.warn(new Error("Failed to load websites", { cause: error }));
|
||||
return [];
|
||||
}
|
||||
}),
|
||||
|
||||
getVisitorStats: publicProcedure
|
||||
.input(
|
||||
@@ -40,26 +37,14 @@ export const umamiRouter = createTRPCRouter({
|
||||
eventName: z.string().optional(),
|
||||
}),
|
||||
)
|
||||
.concat(createManyIntegrationMiddleware("query", "umami", "mock"))
|
||||
.concat(createManyIntegrationMiddleware("query", "umami"))
|
||||
.query(async ({ ctx, input }) => {
|
||||
return await settleIntegrationQueries(ctx.integrations, async (integration) => {
|
||||
if (integration.kind === "mock") {
|
||||
return {
|
||||
integrationId: integration.id,
|
||||
integrationName: integration.name,
|
||||
integrationUrl: integration.url,
|
||||
visitorStats: { ...mockWidgetData.umamiVisitorStats, timeFrame: input.timeFrame },
|
||||
updatedAt: new Date(mockWidgetData.timestamp),
|
||||
};
|
||||
}
|
||||
const innerHandler = umamiRequestHandler.handler(
|
||||
{ ...integration, kind: "umami" },
|
||||
{
|
||||
websiteId: input.websiteId,
|
||||
timeFrame: input.timeFrame,
|
||||
eventName: input.eventName,
|
||||
},
|
||||
);
|
||||
const innerHandler = umamiRequestHandler.handler(integration, {
|
||||
websiteId: input.websiteId,
|
||||
timeFrame: input.timeFrame,
|
||||
eventName: input.eventName,
|
||||
});
|
||||
const { data, timestamp } = await innerHandler.getDataAsync();
|
||||
|
||||
return {
|
||||
@@ -74,16 +59,10 @@ export const umamiRouter = createTRPCRouter({
|
||||
|
||||
getEventNames: publicProcedure
|
||||
.input(z.object({ websiteId: z.string() }))
|
||||
.concat(createOneIntegrationMiddleware("query", "umami", "mock"))
|
||||
.concat(createOneIntegrationMiddleware("query", "umami"))
|
||||
.query(async ({ ctx, input }) => {
|
||||
if (ctx.integration.kind === "mock") return mockWidgetData.umamiEventNames;
|
||||
try {
|
||||
const innerHandler = umamiEventNamesRequestHandler.handler(
|
||||
{ ...ctx.integration, kind: "umami" },
|
||||
{
|
||||
websiteId: input.websiteId,
|
||||
},
|
||||
);
|
||||
const innerHandler = umamiEventNamesRequestHandler.handler(ctx.integration, { websiteId: input.websiteId });
|
||||
const { data } = await innerHandler.getDataAsync();
|
||||
return data;
|
||||
} catch (error) {
|
||||
@@ -102,18 +81,14 @@ export const umamiRouter = createTRPCRouter({
|
||||
limit: z.number().int().min(1).max(500),
|
||||
}),
|
||||
)
|
||||
.concat(createOneIntegrationMiddleware("query", "umami", "mock"))
|
||||
.concat(createOneIntegrationMiddleware("query", "umami"))
|
||||
.query(async ({ ctx, input }) => {
|
||||
if (ctx.integration.kind === "mock") return mockWidgetData.umamiTopPages.slice(0, input.limit);
|
||||
try {
|
||||
const innerHandler = umamiTopPagesRequestHandler.handler(
|
||||
{ ...ctx.integration, kind: "umami" },
|
||||
{
|
||||
websiteId: input.websiteId,
|
||||
timeFrame: input.timeFrame,
|
||||
limit: input.limit,
|
||||
},
|
||||
);
|
||||
const innerHandler = umamiTopPagesRequestHandler.handler(ctx.integration, {
|
||||
websiteId: input.websiteId,
|
||||
timeFrame: input.timeFrame,
|
||||
limit: input.limit,
|
||||
});
|
||||
const { data } = await innerHandler.getDataAsync();
|
||||
return data;
|
||||
} catch (error) {
|
||||
@@ -136,18 +111,14 @@ export const umamiRouter = createTRPCRouter({
|
||||
limit: z.number().int().min(1).max(500),
|
||||
}),
|
||||
)
|
||||
.concat(createOneIntegrationMiddleware("query", "umami", "mock"))
|
||||
.concat(createOneIntegrationMiddleware("query", "umami"))
|
||||
.query(async ({ ctx, input }) => {
|
||||
if (ctx.integration.kind === "mock") return mockWidgetData.umamiTopReferrers.slice(0, input.limit);
|
||||
try {
|
||||
const innerHandler = umamiTopReferrersRequestHandler.handler(
|
||||
{ ...ctx.integration, kind: "umami" },
|
||||
{
|
||||
websiteId: input.websiteId,
|
||||
timeFrame: input.timeFrame,
|
||||
limit: input.limit,
|
||||
},
|
||||
);
|
||||
const innerHandler = umamiTopReferrersRequestHandler.handler(ctx.integration, {
|
||||
websiteId: input.websiteId,
|
||||
timeFrame: input.timeFrame,
|
||||
limit: input.limit,
|
||||
});
|
||||
const { data } = await innerHandler.getDataAsync();
|
||||
return data;
|
||||
} catch (error) {
|
||||
@@ -170,21 +141,15 @@ export const umamiRouter = createTRPCRouter({
|
||||
eventNames: z.array(z.string()),
|
||||
}),
|
||||
)
|
||||
.concat(createOneIntegrationMiddleware("query", "umami", "mock"))
|
||||
.concat(createOneIntegrationMiddleware("query", "umami"))
|
||||
.query(async ({ ctx, input }) => {
|
||||
if (ctx.integration.kind === "mock") {
|
||||
return mockWidgetData.umamiEventSeries.filter((series) => input.eventNames.includes(series.eventName));
|
||||
}
|
||||
try {
|
||||
const sortedNames = [...input.eventNames].toSorted();
|
||||
const innerHandler = umamiMultiEventRequestHandler.handler(
|
||||
{ ...ctx.integration, kind: "umami" },
|
||||
{
|
||||
websiteId: input.websiteId,
|
||||
timeFrame: input.timeFrame,
|
||||
eventNames: sortedNames,
|
||||
},
|
||||
);
|
||||
const innerHandler = umamiMultiEventRequestHandler.handler(ctx.integration, {
|
||||
websiteId: input.websiteId,
|
||||
timeFrame: input.timeFrame,
|
||||
eventNames: sortedNames,
|
||||
});
|
||||
const { data } = await innerHandler.getDataAsync();
|
||||
return data;
|
||||
} catch (error) {
|
||||
@@ -201,16 +166,12 @@ export const umamiRouter = createTRPCRouter({
|
||||
|
||||
getActiveVisitors: publicProcedure
|
||||
.input(z.object({ websiteId: z.string() }))
|
||||
.concat(createOneIntegrationMiddleware("query", "umami", "mock"))
|
||||
.concat(createOneIntegrationMiddleware("query", "umami"))
|
||||
.query(async ({ ctx, input }) => {
|
||||
if (ctx.integration.kind === "mock") return 7;
|
||||
try {
|
||||
const innerHandler = umamiActiveVisitorsRequestHandler.handler(
|
||||
{ ...ctx.integration, kind: "umami" },
|
||||
{
|
||||
websiteId: input.websiteId,
|
||||
},
|
||||
);
|
||||
const innerHandler = umamiActiveVisitorsRequestHandler.handler(ctx.integration, {
|
||||
websiteId: input.websiteId,
|
||||
});
|
||||
const { data } = await innerHandler.getDataAsync();
|
||||
return data;
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { uptimeKumaRequestHandler } from "@homarr/request-handler/uptime-kuma";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
|
||||
import { createManyIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { settleIntegrationQueries, toPublicIntegrationError } from "../../settle-integrations";
|
||||
@@ -7,22 +6,12 @@ import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||
|
||||
export const uptimeKumaRouter = createTRPCRouter({
|
||||
getDashboard: publicProcedure
|
||||
.concat(createManyIntegrationMiddleware("query", "uptimeKuma", "mock"))
|
||||
.concat(createManyIntegrationMiddleware("query", "uptimeKuma"))
|
||||
.query(async ({ ctx }) => {
|
||||
return await settleIntegrationQueries(
|
||||
ctx.integrations,
|
||||
async (integration) => {
|
||||
if (integration.kind === "mock") {
|
||||
return {
|
||||
integrationId: integration.id,
|
||||
integrationName: integration.name,
|
||||
integrationUrl: integration.url,
|
||||
dashboard: mockWidgetData.uptimeKuma,
|
||||
updatedAt: new Date(mockWidgetData.timestamp),
|
||||
error: undefined,
|
||||
};
|
||||
}
|
||||
const innerHandler = uptimeKumaRequestHandler.handler({ ...integration, kind: "uptimeKuma" }, {});
|
||||
const innerHandler = uptimeKumaRequestHandler.handler(integration, {});
|
||||
const { data, timestamp } = await innerHandler.getDataAsync();
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,41 +1,18 @@
|
||||
import { getIntegrationKindsByCategory } from "@homarr/definitions";
|
||||
import type { IntegrationKind } from "@homarr/definitions";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
import type { VpnSummary } from "@homarr/integrations/types";
|
||||
import { vpnSummaryHandler } from "@homarr/request-handler/vpn";
|
||||
|
||||
import { createManyIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { settleIntegrationQueries, toPublicIntegrationError } from "../../settle-integrations";
|
||||
import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||
|
||||
interface VpnResult {
|
||||
integration: { id: string; name: string; kind: IntegrationKind; updatedAt: Date };
|
||||
summary: VpnSummary | null;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export const vpnRouter = createTRPCRouter({
|
||||
getSummaries: publicProcedure
|
||||
.unstable_concat(createManyIntegrationMiddleware("query", ...getIntegrationKindsByCategory("vpn"), "mock"))
|
||||
.unstable_concat(createManyIntegrationMiddleware("query", ...getIntegrationKindsByCategory("vpn")))
|
||||
.query(async ({ ctx }) => {
|
||||
return await settleIntegrationQueries(
|
||||
ctx.integrations,
|
||||
async (integration): Promise<VpnResult> => {
|
||||
if (integration.kind === "mock") {
|
||||
return {
|
||||
integration: {
|
||||
id: integration.id,
|
||||
name: integration.name,
|
||||
kind: integration.kind,
|
||||
updatedAt: new Date(mockWidgetData.timestamp),
|
||||
},
|
||||
summary: mockWidgetData.vpn,
|
||||
error: undefined,
|
||||
};
|
||||
}
|
||||
const { data, timestamp } = await vpnSummaryHandler
|
||||
.handler({ ...integration, kind: "gluetun" }, {})
|
||||
.getDataAsync();
|
||||
async (integration) => {
|
||||
const { data, timestamp } = await vpnSummaryHandler.handler(integration, {}).getDataAsync();
|
||||
return {
|
||||
integration: {
|
||||
id: integration.id,
|
||||
@@ -48,7 +25,7 @@ export const vpnRouter = createTRPCRouter({
|
||||
};
|
||||
},
|
||||
{
|
||||
fallback: (integration, error): VpnResult => ({
|
||||
fallback: (integration, error) => ({
|
||||
integration: {
|
||||
id: integration.id,
|
||||
name: integration.name,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { wudStatsRequestHandler } from "@homarr/request-handler/wud";
|
||||
import { mockWidgetData } from "@homarr/integrations";
|
||||
|
||||
import { createOneIntegrationMiddleware } from "../../middlewares/integration";
|
||||
import { createTRPCRouter, publicProcedure } from "../../trpc";
|
||||
@@ -10,15 +9,12 @@ export const wudRouter = createTRPCRouter({
|
||||
mcp: {
|
||||
enabled: true,
|
||||
description:
|
||||
"Returns monitored-container counts and available updates from a What's Up Docker integration, or mock statistics from a mock integration. REQUIRED: integrationId from integration_all. The caller needs query permission for that integration.",
|
||||
"Returns monitored-container counts and available updates from a What's Up Docker integration. REQUIRED: integrationId from integration_all. The caller needs query permission for that integration.",
|
||||
},
|
||||
})
|
||||
.concat(createOneIntegrationMiddleware("query", "wud", "mock"))
|
||||
.concat(createOneIntegrationMiddleware("query", "wud"))
|
||||
.query(async ({ ctx }) => {
|
||||
if (ctx.integration.kind === "mock") {
|
||||
return { stats: mockWidgetData.wud, updatedAt: new Date(mockWidgetData.timestamp) };
|
||||
}
|
||||
const handler = wudStatsRequestHandler.handler({ ...ctx.integration, kind: "wud" }, {});
|
||||
const handler = wudStatsRequestHandler.handler(ctx.integration, {});
|
||||
const { data, timestamp } = await handler.getDataAsync();
|
||||
|
||||
return {
|
||||
|
||||
@@ -144,8 +144,7 @@ export const customWidgetAssistantEvaluationToolDefinitions: ToolDefinition[] =
|
||||
type: "function",
|
||||
function: {
|
||||
name: "customWidget_getComponent",
|
||||
description:
|
||||
"Get installed documentation and safety rules for one named Custom JSX component. Fetch only a selected component, one tool call at a time, after any optional example.",
|
||||
description: "Get installed documentation and safety rules for one named Custom JSX component.",
|
||||
parameters: objectSchema({ name: { type: "string" } }, ["name"]),
|
||||
},
|
||||
},
|
||||
@@ -163,8 +162,7 @@ export const customWidgetAssistantEvaluationToolDefinitions: ToolDefinition[] =
|
||||
type: "function",
|
||||
function: {
|
||||
name: "customWidget_getExample",
|
||||
description:
|
||||
"Optionally get one installed Custom JSX example by catalog ID before requesting any component documentation.",
|
||||
description: "Get one installed Custom JSX example by catalog ID.",
|
||||
parameters: objectSchema({ name: { type: "string" } }, ["name"]),
|
||||
},
|
||||
},
|
||||
@@ -253,24 +251,11 @@ export function executeAssistantEvaluationTool(
|
||||
name: string,
|
||||
input: Record<string, unknown>,
|
||||
): unknown {
|
||||
const componentDocumentCount = state.calledTools.filter(
|
||||
(toolName) => toolName === "customWidget_getComponent",
|
||||
).length;
|
||||
if (name === "customWidget_getExample") {
|
||||
if (componentDocumentCount > 0) {
|
||||
return {
|
||||
error:
|
||||
"An example must be loaded before component documentation. Keep the existing component-document budget and continue to customWidget_validate.",
|
||||
};
|
||||
}
|
||||
const example = typeof input.name === "string" ? getCustomWidgetExample(input.name) : null;
|
||||
if (!example) return { error: "Custom JSX example not found" };
|
||||
state.calledTools.push(name);
|
||||
const { template, ...widget } = example.widget;
|
||||
return { ...example, widget: { ...widget, templateLines: template.split("\n") } };
|
||||
}
|
||||
const componentDocumentLimit = state.calledTools.includes("customWidget_getExample") ? 4 : 8;
|
||||
if (name === "customWidget_getComponent" && componentDocumentCount >= componentDocumentLimit) {
|
||||
if (
|
||||
name === "customWidget_getComponent" &&
|
||||
state.calledTools.filter((toolName) => toolName === "customWidget_getComponent").length >= componentDocumentLimit
|
||||
) {
|
||||
return {
|
||||
error:
|
||||
"The targeted component-document budget is exhausted. Continue with validation using the documentation already loaded.",
|
||||
@@ -292,6 +277,12 @@ export function executeAssistantEvaluationTool(
|
||||
? getCustomWidgetSharedProps(names)
|
||||
: { error: "At least one shared prop name is required" };
|
||||
}
|
||||
if (name === "customWidget_getExample") {
|
||||
const example = typeof input.name === "string" ? getCustomWidgetExample(input.name) : null;
|
||||
if (!example) return { error: "Custom JSX example not found" };
|
||||
const { template, ...widget } = example.widget;
|
||||
return { ...example, widget: { ...widget, templateLines: template.split("\n") } };
|
||||
}
|
||||
if (name === "customWidget_validate") {
|
||||
const parsed = parseDefinition(input.widget);
|
||||
if (!parsed.success) return { valid: false, issues: parsed.issues };
|
||||
@@ -585,11 +576,11 @@ async function runAssistantAttempt(args: {
|
||||
process.stdout.write(` tool: ${toolCall.function.name}\n`);
|
||||
let output: unknown;
|
||||
try {
|
||||
const parsed: unknown = JSON.parse(toolCall.function.arguments);
|
||||
let input: Record<string, unknown> = {};
|
||||
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
||||
input = Object.fromEntries(Object.entries(parsed));
|
||||
}
|
||||
const parsed = JSON.parse(toolCall.function.arguments) as unknown;
|
||||
const input =
|
||||
parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)
|
||||
? (parsed as Record<string, unknown>)
|
||||
: {};
|
||||
output = executeAssistantEvaluationTool(args.testCase, state, toolCall.function.name, input);
|
||||
} catch (error) {
|
||||
output = { error: error instanceof Error ? error.message : "Tool input was not valid JSON" };
|
||||
|
||||
@@ -219,7 +219,7 @@ export function buildRepairPrompt(
|
||||
export function buildJudgePrompt(testCase: CustomWidgetAiEvaluationCase, widget: HomarrCustomWidgetV2): string {
|
||||
return `You are a hostile-but-fair product review panel evaluating a safe dashboard widget. Most competent drafts should score 55-75, not 90. Judge only evidence present in the manifest and JSX. Never reward unsupported capabilities, invented API routes, aspirational claims, or code that merely validates.
|
||||
|
||||
The installed Homarr skill and runtime references below are authoritative. The verified API notes and representative response fixtures are authoritative for endpoint paths, authentication requirements, and response shapes unless the validated manifest contradicts them. Do not invent external endpoint or authentication objections from outside assumptions. Decorative icons paired with equivalent adjacent visible status text need no separate aria-label. A Badge containing explicit visible status text is not color-only. A readable absolute UTC date and time is valid; do not require relative or localized time without a documented safe helper. In particular, request state is exposed as status.<requestId> with loading/ok/status/error fields while successful payloads are exposed as data.<requestId>. RefreshButton is an installed runtime helper that manually refreshes load queries. Every component in this already-validated template exists in the installed release. Do not penalize those documented facts. The widget has already passed Homarr's real schema and JSX analyzer, which proves syntax and component compatibility but does not prove API correctness, visual quality, usefulness, or accessibility.
|
||||
The installed Homarr skill and runtime references below are authoritative. In particular, request state is exposed as status.<requestId> with loading/ok/status/error fields while successful payloads are exposed as data.<requestId>. RefreshButton is an installed runtime helper that manually refreshes load queries. Every component in this already-validated template exists in the installed release. Do not penalize those documented facts. The widget has already passed Homarr's real schema and JSX analyzer, which proves syntax and component compatibility but does not prove API correctness, visual quality, usefulness, or accessibility.
|
||||
|
||||
Installed Homarr Custom Widget authoring contract:
|
||||
${getCustomWidgetSkillContent()}
|
||||
@@ -254,14 +254,16 @@ Required review behavior:
|
||||
- Give a concrete evidence sentence for every category. List all score-capping issues under fatalProblems.
|
||||
- Return an empty fatalProblems array when there are no fatal problems; never put "none" or an explanation of their absence in that array.
|
||||
|
||||
Homarr computes the weighted total and final verdict itself. Your total and verdict are advisory, but must be internally honest. A pass requires a weighted total of at least 85, every category at least 75, goalFulfillment at least 85, complexityDiscipline at least 80, no fatal problem, and dailyUseDecision="would-use-daily". Return only the requested structured object.`;
|
||||
Homarr computes the weighted total and final verdict itself. Your total and verdict are advisory, but must be internally honest. A pass requires a weighted total of at least 90, every category at least 75, goalFulfillment/visualQuality/dailyUsefulness at least 85, complexityDiscipline at least 80, no fatal problem, and dailyUseDecision="would-use-daily". Return only the requested structured object.`;
|
||||
}
|
||||
|
||||
export function judgePasses(result: CustomWidgetJudgeResult): boolean {
|
||||
return (
|
||||
result.total >= 85 &&
|
||||
result.total >= 90 &&
|
||||
Object.values(result.categories).every((score) => score >= 75) &&
|
||||
result.categories.goalFulfillment >= 85 &&
|
||||
result.categories.visualQuality >= 85 &&
|
||||
result.categories.dailyUsefulness >= 85 &&
|
||||
result.categories.complexityDiscipline >= 80 &&
|
||||
result.dailyUseDecision === "would-use-daily" &&
|
||||
result.fatalProblems.length === 0
|
||||
|
||||
@@ -15,55 +15,58 @@ if (!apiKey) {
|
||||
const requestedCase = process.argv.find((value) => value.startsWith("--case="))?.slice("--case=".length);
|
||||
const assistantMode = process.argv.includes("--assistant");
|
||||
const configuredLoops = Number(process.env.CUSTOM_WIDGET_AI_MAX_LOOPS ?? 10);
|
||||
const maxLoops = Number.isInteger(configuredLoops) && configuredLoops > 0 ? Math.min(configuredLoops, 10) : 10;
|
||||
let selectableCases = CUSTOM_WIDGET_AI_EVALUATION_CASES;
|
||||
if (assistantMode) {
|
||||
selectableCases = CUSTOM_WIDGET_AI_EVALUATION_CASES.filter(
|
||||
(testCase) =>
|
||||
(testCase.sampleResponse !== undefined || testCase.previewResponses?.length) &&
|
||||
testCase.expectations !== undefined,
|
||||
);
|
||||
}
|
||||
let selectedCases = selectableCases;
|
||||
if (requestedCase)
|
||||
selectedCases = CUSTOM_WIDGET_AI_EVALUATION_CASES.filter((testCase) => testCase.id === requestedCase);
|
||||
const totalLoopBudget = Number.isInteger(configuredLoops) && configuredLoops > 0 ? Math.min(configuredLoops, 10) : 10;
|
||||
const selectableCases = assistantMode
|
||||
? CUSTOM_WIDGET_AI_EVALUATION_CASES.filter(
|
||||
(testCase) =>
|
||||
(testCase.sampleResponse !== undefined || testCase.previewResponses?.length) &&
|
||||
testCase.expectations !== undefined,
|
||||
)
|
||||
: CUSTOM_WIDGET_AI_EVALUATION_CASES;
|
||||
const selectedCases = requestedCase
|
||||
? CUSTOM_WIDGET_AI_EVALUATION_CASES.filter((testCase) => testCase.id === requestedCase)
|
||||
: selectableCases;
|
||||
if (selectedCases.length === 0) throw new Error(`Unknown AI evaluation case '${requestedCase}'`);
|
||||
if (totalLoopBudget < selectedCases.length) {
|
||||
throw new Error(`CUSTOM_WIDGET_AI_MAX_LOOPS must be at least ${selectedCases.length} for this run`);
|
||||
}
|
||||
|
||||
const runId = new Date().toISOString().replaceAll(/[:.]/gu, "-");
|
||||
const outputRoot = path.resolve(process.cwd(), ".ai-evaluations", runId);
|
||||
await mkdir(outputRoot, { recursive: true });
|
||||
|
||||
const results: Array<AiEvaluationResult | CustomWidgetAssistantEvaluationResult> = [];
|
||||
let remainingLoopBudget = totalLoopBudget;
|
||||
for (const testCase of selectedCases) {
|
||||
const remainingCases = selectedCases.length - results.length;
|
||||
const maxLoops = Math.max(1, Math.floor(remainingLoopBudget / remainingCases));
|
||||
process.stdout.write(`Evaluating ${testCase.id}...\n`);
|
||||
let result: AiEvaluationResult | CustomWidgetAssistantEvaluationResult;
|
||||
if (assistantMode) {
|
||||
result = await evaluateCustomWidgetAssistantCase({
|
||||
testCase,
|
||||
apiKey,
|
||||
baseUrl: providerBaseUrl,
|
||||
outputRoot,
|
||||
maxLoops,
|
||||
generatorModel,
|
||||
judgeModel,
|
||||
});
|
||||
} else {
|
||||
result = await evaluateCustomWidgetCase({
|
||||
testCase,
|
||||
apiKey,
|
||||
baseUrl: providerBaseUrl,
|
||||
outputRoot,
|
||||
maxLoops,
|
||||
generatorModel,
|
||||
judgeModel,
|
||||
});
|
||||
}
|
||||
const result = assistantMode
|
||||
? await evaluateCustomWidgetAssistantCase({
|
||||
testCase,
|
||||
apiKey,
|
||||
baseUrl: providerBaseUrl,
|
||||
outputRoot,
|
||||
maxLoops,
|
||||
generatorModel,
|
||||
judgeModel,
|
||||
})
|
||||
: await evaluateCustomWidgetCase({
|
||||
testCase,
|
||||
apiKey,
|
||||
baseUrl: providerBaseUrl,
|
||||
outputRoot,
|
||||
maxLoops,
|
||||
generatorModel,
|
||||
judgeModel,
|
||||
});
|
||||
results.push(result);
|
||||
if (result.judge) {
|
||||
process.stdout.write(` ${result.judge.total}/100 after ${result.attempts} attempt(s)\n`);
|
||||
} else {
|
||||
process.stdout.write(` failed after ${result.attempts} attempt(s)\n`);
|
||||
}
|
||||
remainingLoopBudget -= result.attempts;
|
||||
process.stdout.write(
|
||||
result.judge
|
||||
? ` ${result.judge.total}/100 after ${result.attempts} attempt(s)\n`
|
||||
: ` failed after ${result.attempts} attempt(s)\n`,
|
||||
);
|
||||
}
|
||||
|
||||
const summary = {
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
import type { HomarrCustomWidgetV2 } from "./custom-jsx-schema";
|
||||
import { customJsxAuthoringCatalog } from "./component-catalog";
|
||||
import {
|
||||
redactCustomWidgetAiContext,
|
||||
redactCustomWidgetAiResponse,
|
||||
redactCustomWidgetAiText,
|
||||
redactCustomWidgetAiUrl,
|
||||
} from "./definition-security";
|
||||
import { customJsxExamples } from "./examples";
|
||||
|
||||
export interface CustomWidgetAiDraft {
|
||||
@@ -112,28 +106,19 @@ export const CUSTOM_WIDGET_AUTHORING_PROMPT = AUTHORING_PROMPT;
|
||||
|
||||
export const CUSTOM_WIDGET_MCP_AUTHORING_PROMPT = `Author one Homarr Custom JSX v2 widget at a time.
|
||||
|
||||
Mandatory sequence — follow it exactly:
|
||||
1. First call customWidget_getSkill and follow the complete installed skill and bundled references.
|
||||
2. Call customWidget_schema, then customWidget_getComponentCatalog.
|
||||
3. If a complete example is useful, call customWidget_getExample before any customWidget_getComponent call. Then choose at most four component names total and never request a fifth. Fetch only those named docs and, once, any named shared props with customWidget_getSharedProps.
|
||||
4. Before validation, quickly reject IIFEs, new, block callbacks or => {, and raw HTML tags such as span; use catalog components instead. Immediately call customWidget_validate with the complete definition and repair every issue.
|
||||
5. Call customWidget_previewCreate with that exact validated definition.
|
||||
6. Call customWidget_previewQuery once for every query returned by the preview and inspect every response.
|
||||
7. Call customWidget_createFromPreview with the exact fully tested preview session ID.
|
||||
|
||||
Make one documentation tool call at a time. Never issue batched customWidget_getComponent calls, speculate about components, or walk the catalog. If preview evidence requires a definition change, restart at step 4 with the revised complete definition. The live resources are authoritative for this Homarr release.
|
||||
First call customWidget_getSkill. Its single lazy response contains the complete installed SKILL.md and every bundled reference; follow all of it. Read the live schema and compact component catalog. Fetch only the named component and example resources needed for the design. Component resources contain component-specific props; if shared props are needed, collect their catalog names and fetch those docs together once with customWidget_getSharedProps. The live resources are authoritative for this Homarr release.
|
||||
|
||||
Keep the documentation phase bounded. Fetch at most eight named component documents before the first validation, or at most four after loading a complete example. Fetch another component only to resolve a concrete validation issue or missing interaction; never walk the catalog component-by-component. Move promptly from the smallest sufficient documentation set to a complete customWidget_validate call.
|
||||
|
||||
Construct one credential-free definition. Supply required manual parameters to preview queries, inspect the real response shape and HTTP status, and open or provide the returned previewPath for visual review. Use customWidget_create only when no reusable preview session exists. Prefer templateLines over a JSON-escaped template string for multiline JSX in validate and preview tool inputs.
|
||||
Follow this lifecycle without skipping steps: construct one credential-free definition; call customWidget_validate; repair every reported issue; call customWidget_previewCreate; call customWidget_previewQuery once for every query returned by that preview (supplying required manual parameters); inspect the real response shape and HTTP status; adjust paths and template bindings; validate and preview again after changes; open or provide the returned previewPath for visual review; only then call customWidget_createFromPreview with the exact final tested preview session ID. Use customWidget_create only when no reusable preview session exists. Prefer templateLines over a JSON-escaped template string for multiline JSX in validate and preview tool inputs.
|
||||
|
||||
Do not claim a query works when it has not returned a successful preview response. Configure deployment-specific source URLs and request credentials through Homarr when needed; never repeat plaintext. Use simulated preview actions unless the user explicitly enables live preview actions.
|
||||
|
||||
Treat preview data as the binding contract: render every core requested field, guard optional arrays and nested values before indexing, and do not silently drop returned items. Show timestamps as concise human-readable absolute dates and times; do not compute relative time with Date, Date.now, or Date.parse unless the live docs provide a safe helper. Give recoverable load errors and empty states a clear refresh or retry path.
|
||||
Treat preview data as the binding contract: render every core requested field, guard optional arrays and nested values before indexing, and do not silently drop returned items. Show concise freshness context when the response supplies a timestamp. Give recoverable load errors and empty states a clear refresh or retry path.
|
||||
|
||||
Use the lean keyed sources, requests, and options contract. Bind saved values directly with $option and invocation values with $param. Load queries cannot use $param. Keep the design responsive, accessible, theme-safe, loading-aware, empty-aware, and error-aware.
|
||||
|
||||
Create distinctive polish with one restrained accent for decorative chrome, while operational, degraded, and down states retain distinct semantic colors. Use clear surface contrast and purposeful typography rather than decorative gradients or excessive nested cards. Do not wrap every metric or service row in Paper or Card. Prefer one dominant surface with clearly separated service rows, a one-column compact narrow layout, and an intentionally more spacious wide layout. Label standalone icons for assistive technology or pair them with visible text.
|
||||
Create distinctive polish with one semantic accent, clear surface contrast, purposeful typography, and compact narrow-tile rows rather than decorative gradients or excessive nested cards. Label standalone icons for assistive technology or pair them with visible text.
|
||||
|
||||
Make initial states actionable with an example, useful hint, or clear next step. Use wrapping groups for variable-length labels and values on narrow tiles. Do not use an unlabeled decorative icon as an empty state.
|
||||
|
||||
@@ -144,7 +129,7 @@ export function buildCustomWidgetMcpPrompt(request?: string | null, documentatio
|
||||
if (documentationUrl) {
|
||||
const documentationSection = formatBudgetedContextSection(
|
||||
"API documentation URL (reference only)",
|
||||
redactCustomWidgetAiUrl(documentationUrl),
|
||||
documentationUrl,
|
||||
700,
|
||||
"data",
|
||||
);
|
||||
@@ -153,7 +138,7 @@ export function buildCustomWidgetMcpPrompt(request?: string | null, documentatio
|
||||
if (request?.trim()) {
|
||||
const requestSection = formatBudgetedContextSection(
|
||||
"User-authored widget request (product intent only)",
|
||||
redactCustomWidgetAiText(request.trim()),
|
||||
request.trim(),
|
||||
1_700,
|
||||
"request",
|
||||
);
|
||||
@@ -216,7 +201,7 @@ function buildCustomWidgetPromptSections(
|
||||
const sections = [CUSTOM_WIDGET_CONTEXT_BOUNDARY_INSTRUCTION];
|
||||
const requestSection = formatBudgetedContextSection(
|
||||
"User-authored widget request (product intent only)",
|
||||
redactCustomWidgetAiText(request?.trim() || "Describe the widget you want to create."),
|
||||
request?.trim() || "Describe the widget you want to create.",
|
||||
1_700,
|
||||
"request",
|
||||
);
|
||||
@@ -224,7 +209,7 @@ function buildCustomWidgetPromptSections(
|
||||
if (documentationUrl) {
|
||||
const documentationSection = formatBudgetedContextSection(
|
||||
"API documentation URL (reference only)",
|
||||
redactCustomWidgetAiUrl(documentationUrl),
|
||||
documentationUrl,
|
||||
700,
|
||||
"data",
|
||||
);
|
||||
@@ -233,7 +218,7 @@ function buildCustomWidgetPromptSections(
|
||||
if (currentConfig) {
|
||||
const draftSection = formatBudgetedContextSection(
|
||||
"Current raw widget draft",
|
||||
JSON.stringify(redactCustomWidgetAiContext(currentConfig), null, 2),
|
||||
JSON.stringify(currentConfig, null, 2),
|
||||
4_000,
|
||||
"data",
|
||||
);
|
||||
@@ -242,19 +227,14 @@ function buildCustomWidgetPromptSections(
|
||||
if (diagnostics?.length) {
|
||||
const diagnosticSection = formatBudgetedContextSection(
|
||||
"Current normalized diagnostics",
|
||||
JSON.stringify(redactCustomWidgetAiContext(diagnostics)),
|
||||
JSON.stringify(diagnostics),
|
||||
1_500,
|
||||
"data",
|
||||
);
|
||||
if (diagnosticSection) sections.push(diagnosticSection);
|
||||
}
|
||||
if (rawResponse) {
|
||||
const responseSection = formatBudgetedContextSection(
|
||||
"Sample API response",
|
||||
redactCustomWidgetAiResponse(rawResponse),
|
||||
1_000,
|
||||
"data",
|
||||
);
|
||||
const responseSection = formatBudgetedContextSection("Sample API response", rawResponse, 1_000, "data");
|
||||
if (responseSection) sections.push(responseSection);
|
||||
}
|
||||
const authoringBudget = CUSTOM_WIDGET_AI_PROMPT_LIMIT - sections.join("\n\n").length - footerLength - 8;
|
||||
|
||||
@@ -191,70 +191,6 @@ export function redactCustomWidgetCredentialLiterals(value: string): string {
|
||||
);
|
||||
}
|
||||
|
||||
export function redactCustomWidgetAiContext(value: unknown, path: DefinitionPath = []): unknown {
|
||||
if (Array.isArray(value)) return value.map((entry, index) => redactCustomWidgetAiContext(entry, [...path, index]));
|
||||
if (value !== null && typeof value === "object") {
|
||||
return Object.fromEntries(
|
||||
Object.entries(value).map(([key, entry]) => {
|
||||
const entryPath = [...path, key];
|
||||
const risk = getCustomWidgetCredentialKeyRisk(key);
|
||||
if (risk === "strong" && !isSchemaAuthenticationControl(entryPath)) {
|
||||
if (!isHarmlessCustomWidgetCredentialSetting(entry)) return [key, "[REDACTED]"];
|
||||
}
|
||||
if (risk === "ambiguous" && typeof entry === "string") {
|
||||
if (redactCustomWidgetCredentialLiterals(entry) !== entry) return [key, "[REDACTED]"];
|
||||
}
|
||||
return [key, redactCustomWidgetAiContext(entry, entryPath)];
|
||||
}),
|
||||
);
|
||||
}
|
||||
if (typeof value !== "string") return value;
|
||||
|
||||
const lastPathPart = path.at(-1);
|
||||
let key = "";
|
||||
if (typeof lastPathPart === "string") key = lastPathPart;
|
||||
if (["sources", "requests", "options"].includes(key)) {
|
||||
try {
|
||||
const parsed: unknown = JSON.parse(value);
|
||||
return redactCustomWidgetAiContext(parsed, path);
|
||||
} catch {
|
||||
/* Invalid editor JSON is still useful prompt context. */
|
||||
}
|
||||
}
|
||||
if (key === "baseUrl" || key === "iconUrl") {
|
||||
return redactCustomWidgetCredentialLiterals(redactCustomWidgetAiUrl(value));
|
||||
}
|
||||
return redactCustomWidgetAiText(value);
|
||||
}
|
||||
|
||||
export function redactCustomWidgetAiResponse(value: string): string {
|
||||
try {
|
||||
const parsed: unknown = JSON.parse(value);
|
||||
return JSON.stringify(redactCustomWidgetAiContext(parsed), null, 2);
|
||||
} catch {
|
||||
return redactCustomWidgetAiText(value);
|
||||
}
|
||||
}
|
||||
|
||||
export function redactCustomWidgetAiUrl(value: string): string {
|
||||
try {
|
||||
const url = new URL(value);
|
||||
url.username = "";
|
||||
url.password = "";
|
||||
url.search = "";
|
||||
url.hash = "";
|
||||
return url.toString();
|
||||
} catch {
|
||||
return "[REDACTED_URL]";
|
||||
}
|
||||
}
|
||||
|
||||
export function redactCustomWidgetAiText(value: string): string {
|
||||
return redactCustomWidgetCredentialLiterals(
|
||||
value.replace(/\bhttps?:\/\/[^\s"'<>]+/giu, (candidate) => redactCustomWidgetAiUrl(candidate)),
|
||||
);
|
||||
}
|
||||
|
||||
function isSchemaAuthenticationControl(path: DefinitionPath): boolean {
|
||||
return (
|
||||
path.length === 3 &&
|
||||
|
||||
@@ -36,8 +36,8 @@ export const customJsxExamples: readonly CustomJsxExample[] = [
|
||||
requests: { overview: { path: "/api/overview", cacheSeconds: 30 } },
|
||||
options: {},
|
||||
template: `<Stack gap="md" p="md">
|
||||
<Group justify="space-between" wrap="wrap"><Stack gap={2}><Text fw={700}>System overview</Text><Text size="xs" c="dimmed">Live service health</Text></Stack><RefreshButton label="Refresh service health" /></Group>
|
||||
{status.overview?.loading ? <Skeleton height={180} radius="lg" /> : status.overview?.error ? <Alert color="red" title="Could not load status">Service health is unavailable. Use Refresh service health to try again. {status.overview.error}</Alert> : <Paper withBorder p={{ base: "sm", sm: "md" }} radius="lg"><Stack gap="md"><SimpleGrid cols={{ base: 1, sm: 2, md: 4 }} spacing={{ base: "xs", sm: "lg" }}><Stack gap={2}><Text size="xs" c="dimmed">Services</Text><Text fw={700}>{data.overview?.services?.length ?? 0}</Text></Stack><Stack gap={2}><Text size="xs" c="dimmed">Online</Text><Text fw={700} c="green">{(data.overview?.services ?? []).filter(service => service.online).length}</Text></Stack><Stack gap={2}><Text size="xs" c="dimmed">Offline</Text><Text fw={700} c="red">{(data.overview?.services ?? []).filter(service => !service.online).length}</Text></Stack><Stack gap={2}><Text size="xs" c="dimmed">Last checked</Text><Text size="sm">{(data.overview?.checkedAt ?? data.overview?.lastCheckedAt) ? Date.toLocaleDateString(data.overview.checkedAt ?? data.overview.lastCheckedAt, "en-US") + " " + Date.toLocaleTimeString(data.overview.checkedAt ?? data.overview.lastCheckedAt, "en-US") : "Not reported"}</Text></Stack></SimpleGrid><Divider />{(data.overview?.services?.length ?? 0) > 0 ? <Stack gap={0}>{data.overview.services.map(service => <Group key={service.name} justify="space-between" wrap="wrap" py={{ base: "xs", sm: "sm" }}><Stack gap={2}><Text size="sm" fw={600}>{service.name}</Text><Text size="xs" c="dimmed">{service.latency != null ? service.latency + " ms" : "Latency unavailable"}</Text></Stack><Badge color={service.online ? "green" : "red"} variant="light">{service.online ? "Online" : "Offline"}</Badge></Group>)}</Stack> : <Alert color="gray" title="No services">No services were returned. Use Refresh service health to try again.</Alert>}</Stack></Paper>}
|
||||
<Group justify="space-between"><Stack gap={2}><Text fw={700}>System overview</Text><Text size="xs" c="dimmed">Live service health</Text></Stack><RefreshButton /></Group>
|
||||
{status.overview?.loading ? <Skeleton height={120} radius="lg" /> : status.overview?.error ? <Alert color="red" title="Could not load status">{status.overview.error}</Alert> : <SimpleGrid cols={{ base: 1, xs: 3 }}>{(data.overview?.services ?? []).map(service => <Paper key={service.name} withBorder p="sm" radius="md"><Group justify="space-between"><Text size="sm" fw={600}>{service.name}</Text><Badge color={service.online ? "green" : "red"} variant="light">{service.online ? "Online" : "Offline"}</Badge></Group><Text mt="xs" size="xl" fw={700}>{service.latency ?? "—"}<Text span size="xs" c="dimmed"> ms</Text></Text></Paper>)}</SimpleGrid>}
|
||||
</Stack>`,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { customJsxCatalogComponentByName } from "../core/component-catalog";
|
||||
import {
|
||||
customJsxBindableComponentNames,
|
||||
customJsxComponentByName,
|
||||
@@ -32,20 +31,6 @@ export function analyzeCustomJsxElement(
|
||||
const name = nameNode ? customJsxTagName(nameNode) : null;
|
||||
const resolvedName = name ? resolveCustomJsxComponentName(name) : null;
|
||||
const descriptor = resolvedName ? customJsxComponentByName.get(resolvedName) : undefined;
|
||||
const attributes = nodesOf(opening.attributes);
|
||||
if (resolvedName === "TablerIcon") {
|
||||
const attributeNames = new Set<string>();
|
||||
for (const attribute of attributes) {
|
||||
if (attribute.type !== "JSXAttribute") continue;
|
||||
const attributeName = nodeOf(attribute.name);
|
||||
if (attributeName?.type === "JSXIdentifier") attributeNames.add(String(attributeName.name));
|
||||
}
|
||||
for (const prop of customJsxCatalogComponentByName.get(resolvedName)?.props ?? []) {
|
||||
if (prop.required && !attributeNames.has(prop.name)) {
|
||||
context.add(opening, `MISSING_REQUIRED_PROP: '${prop.name}' on ${name} is required`);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (descriptor?.safety === "denied") {
|
||||
context.add(
|
||||
opening,
|
||||
@@ -61,7 +46,7 @@ export function analyzeCustomJsxElement(
|
||||
);
|
||||
}
|
||||
|
||||
for (const attribute of attributes) {
|
||||
for (const attribute of nodesOf(opening.attributes)) {
|
||||
if (attribute.type === "JSXSpreadAttribute") {
|
||||
const argument = nodeOf(attribute.argument);
|
||||
if (argument) context.visit(argument, depth + 1, bindings);
|
||||
@@ -86,11 +71,7 @@ export function analyzeCustomJsxElement(
|
||||
attributeName !== "bind" &&
|
||||
!customJsxSupportedPropsByName.get(resolvedName)?.has(attributeName)
|
||||
) {
|
||||
if (resolvedName === "TablerIcon") {
|
||||
context.add(attribute, `UNKNOWN_COMPONENT_PROP: '${attributeName}' on ${name} is not supported`);
|
||||
} else {
|
||||
context.add(attribute, `UNKNOWN_MANTINE_PROP: '${attributeName}' on ${name} will be passed through`, "warning");
|
||||
}
|
||||
context.add(attribute, `UNKNOWN_MANTINE_PROP: '${attributeName}' on ${name} will be passed through`, "warning");
|
||||
} else if (resolvedName && attributeName === "bind" && !customJsxBindableComponentNames.has(resolvedName)) {
|
||||
context.add(attribute, `BINDING_UNAVAILABLE: '${name}' does not have a declarative binding adapter`, "warning");
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import { Collapsible, PaginatedList, StatBar, TabPanel, TabsContainer, TypeBadge
|
||||
import { getScopedCustomJsxControlName, isSafeCustomJsxUrl } from "./runtime-component-policy";
|
||||
import { sanitizeCustomJsxProps } from "./safe-properties";
|
||||
|
||||
type Namespace = object;
|
||||
type Namespace = Readonly<Record<string, unknown>>;
|
||||
|
||||
function resolveExport(namespace: Namespace, name: string): ComponentType<never> | undefined {
|
||||
let value: unknown = namespace;
|
||||
@@ -26,7 +26,7 @@ function resolveExport(namespace: Namespace, name: string): ComponentType<never>
|
||||
if (!value || (typeof value !== "object" && typeof value !== "function") || !Object.hasOwn(value, segment)) {
|
||||
return undefined;
|
||||
}
|
||||
value = Reflect.get(value, segment);
|
||||
value = (value as Record<string, unknown>)[segment];
|
||||
}
|
||||
return typeof value === "function" || (typeof value === "object" && value !== null)
|
||||
? (value as ComponentType<never>)
|
||||
@@ -233,9 +233,9 @@ export interface CustomJsxComponentAdapters {
|
||||
|
||||
export function createCustomJsxComponents(adapters: CustomJsxComponentAdapters): Record<string, ComponentType<never>> {
|
||||
const namespaces: Record<string, Namespace> = {
|
||||
"@mantine/core": Core,
|
||||
"@mantine/charts": Charts,
|
||||
"@mantine/dates": Dates,
|
||||
"@mantine/core": Core as unknown as Namespace,
|
||||
"@mantine/charts": Charts as unknown as Namespace,
|
||||
"@mantine/dates": Dates as unknown as Namespace,
|
||||
};
|
||||
const components: Record<string, ComponentType<never>> = {};
|
||||
for (const descriptor of enabledCustomJsxComponents) {
|
||||
@@ -253,7 +253,7 @@ export function createCustomJsxComponents(adapters: CustomJsxComponentAdapters):
|
||||
components[descriptor.name] = wrap(descriptor.name, component, additions);
|
||||
}
|
||||
}
|
||||
const core: Namespace = Core;
|
||||
const core = Core as unknown as Namespace;
|
||||
for (const name of [
|
||||
"Notification",
|
||||
"LoadingOverlay",
|
||||
|
||||
@@ -146,24 +146,6 @@ describe("Custom Widget assistant live evaluation harness", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects a late example without reducing the existing component-document budget", () => {
|
||||
const testCase = CUSTOM_WIDGET_AI_EVALUATION_CASES.find(({ id }) => id === "fake-service-health");
|
||||
if (!testCase) throw new Error("Fake service-health case is missing");
|
||||
const state = createAssistantEvaluationState();
|
||||
|
||||
for (let index = 0; index < 8; index += 1) {
|
||||
executeAssistantEvaluationTool(testCase, state, "customWidget_getComponent", { name: "Text" });
|
||||
}
|
||||
expect(
|
||||
executeAssistantEvaluationTool(testCase, state, "customWidget_getExample", { name: "service-dashboard" }),
|
||||
).toEqual({
|
||||
error:
|
||||
"An example must be loaded before component documentation. Keep the existing component-document budget and continue to customWidget_validate.",
|
||||
});
|
||||
expect(state.calledTools).not.toContain("customWidget_getExample");
|
||||
expect(state.calledTools.filter((name) => name === "customWidget_getComponent")).toHaveLength(8);
|
||||
});
|
||||
|
||||
it("enforces explicit multi-iteration preview requests before persistence", () => {
|
||||
const baseCase = CUSTOM_WIDGET_AI_EVALUATION_CASES.find(({ id }) => id === "fake-service-health");
|
||||
if (!baseCase) throw new Error("Fake service-health case is missing");
|
||||
|
||||
@@ -226,38 +226,14 @@ describe("AI authoring evaluation", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("requires an excellent result without weak categories", () => {
|
||||
expect(
|
||||
judgePasses({
|
||||
...makeJudgeResult(85),
|
||||
categories: {
|
||||
...makeCategories(85),
|
||||
visualQuality: 76,
|
||||
dailyUsefulness: 76,
|
||||
complexityDiscipline: 80,
|
||||
},
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(judgePasses(makeJudgeResult(84))).toBe(false);
|
||||
expect(
|
||||
judgePasses({
|
||||
...makeJudgeResult(90),
|
||||
categories: { ...makeCategories(90), accessibility: 74 },
|
||||
}),
|
||||
).toBe(false);
|
||||
it("requires exceptional goal, design, practicality, and complexity scores", () => {
|
||||
expect(judgePasses(makeJudgeResult(90))).toBe(true);
|
||||
expect(
|
||||
judgePasses({
|
||||
...makeJudgeResult(92),
|
||||
categories: { ...makeCategories(92), goalFulfillment: 84 },
|
||||
categories: { ...makeCategories(92), dailyUsefulness: 84 },
|
||||
}),
|
||||
).toBe(false);
|
||||
expect(
|
||||
judgePasses({
|
||||
...makeJudgeResult(92),
|
||||
categories: { ...makeCategories(92), complexityDiscipline: 79 },
|
||||
}),
|
||||
).toBe(false);
|
||||
expect(judgePasses({ ...makeJudgeResult(92), dailyUseDecision: "promising-but-not-daily" })).toBe(false);
|
||||
expect(judgePasses({ ...makeJudgeResult(95), fatalProblems: ["A requested core action is missing."] })).toBe(false);
|
||||
});
|
||||
|
||||
@@ -281,20 +257,6 @@ describe("AI authoring evaluation", () => {
|
||||
expect(prompt).toContain(JSON.stringify(testCase.sampleResponse, null, 2));
|
||||
expect(prompt).toContain("# Bundled file: references/runtime.md");
|
||||
expect(prompt).toContain("does not prove API correctness, visual quality, usefulness, or accessibility");
|
||||
expect(prompt).toContain(
|
||||
"verified API notes and representative response fixtures are authoritative for endpoint paths, authentication requirements, and response shapes",
|
||||
);
|
||||
expect(prompt).toContain("Do not invent external endpoint or authentication objections from outside assumptions");
|
||||
expect(prompt).toContain(
|
||||
"Decorative icons paired with equivalent adjacent visible status text need no separate aria-label",
|
||||
);
|
||||
expect(prompt).toContain("A Badge containing explicit visible status text is not color-only");
|
||||
expect(prompt).toContain(
|
||||
"A readable absolute UTC date and time is valid; do not require relative or localized time without a documented safe helper",
|
||||
);
|
||||
expect(prompt).toContain(
|
||||
'A pass requires a weighted total of at least 85, every category at least 75, goalFulfillment at least 85, complexityDiscipline at least 80, no fatal problem, and dailyUseDecision="would-use-daily"',
|
||||
);
|
||||
});
|
||||
|
||||
it("computes the weighted score and refuses inflated advisory verdicts", () => {
|
||||
|
||||
@@ -53,46 +53,11 @@ describe("AI prompt", () => {
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("at most eight named component documents");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("at most four after loading a complete example");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("Treat preview data as the binding contract");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("freshness context");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("Make initial states actionable");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("compact narrow-tile rows");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("Label standalone icons");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("Prefer templateLines");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("Make one documentation tool call at a time");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("Never issue batched customWidget_getComponent calls");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain(
|
||||
"choose at most four component names total and never request a fifth",
|
||||
);
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain(
|
||||
"reject IIFEs, new, block callbacks or => {, and raw HTML tags such as span",
|
||||
);
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("concise human-readable absolute dates and times");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain(
|
||||
"do not compute relative time with Date, Date.now, or Date.parse unless the live docs provide a safe helper",
|
||||
);
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("one restrained accent for decorative chrome");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain(
|
||||
"operational, degraded, and down states retain distinct semantic colors",
|
||||
);
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("Do not wrap every metric or service row in Paper or Card");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain("one dominant surface with clearly separated service rows");
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain(
|
||||
"a one-column compact narrow layout, and an intentionally more spacious wide layout",
|
||||
);
|
||||
const orderedSteps = [
|
||||
"1. First call customWidget_getSkill",
|
||||
"2. Call customWidget_schema",
|
||||
"3. If a complete example is useful, call customWidget_getExample before any customWidget_getComponent call",
|
||||
"4. Before validation",
|
||||
"5. Call customWidget_previewCreate",
|
||||
"6. Call customWidget_previewQuery once for every query",
|
||||
"7. Call customWidget_createFromPreview",
|
||||
];
|
||||
for (const [index, step] of orderedSteps.entries()) {
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT).toContain(step);
|
||||
if (index === 0) continue;
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT.indexOf(orderedSteps[index - 1] ?? "")).toBeLessThan(
|
||||
CUSTOM_WIDGET_MCP_AUTHORING_PROMPT.indexOf(step),
|
||||
);
|
||||
}
|
||||
expect(CUSTOM_WIDGET_MCP_AUTHORING_PROMPT.indexOf("customWidget_previewQuery")).toBeLessThan(
|
||||
CUSTOM_WIDGET_MCP_AUTHORING_PROMPT.indexOf("customWidget_create"),
|
||||
);
|
||||
@@ -109,7 +74,7 @@ describe("AI prompt", () => {
|
||||
|
||||
it("preserves raw context and the final instruction when optional context is large", () => {
|
||||
const prompt = buildCustomWidgetAiPrompt(undefined, JSON.stringify({ data: "x".repeat(20_000) }), null, "Build it");
|
||||
expect(prompt).toContain('"data": "');
|
||||
expect(prompt).toContain('"data":"');
|
||||
expect(prompt.endsWith(CUSTOM_WIDGET_FINAL_OUTPUT_INSTRUCTION)).toBe(true);
|
||||
expect(prompt.length).toBeLessThanOrEqual(12_000);
|
||||
});
|
||||
@@ -137,25 +102,4 @@ describe("AI prompt", () => {
|
||||
|
||||
expect(prompt).toContain("Use compact cards and show the current latency");
|
||||
});
|
||||
|
||||
it("redacts credentials from widget context", () => {
|
||||
const prompt = buildCustomWidgetAiPrompt(
|
||||
undefined,
|
||||
JSON.stringify({ token: "sensitive" }),
|
||||
{
|
||||
requests: {
|
||||
status: {
|
||||
path: "/status?credential=Bearer-sk-secret-123456",
|
||||
headers: { "X-Auth": "Bearer sk-secret-123456", "X-Feature-Key": "dashboard-layout" },
|
||||
},
|
||||
},
|
||||
},
|
||||
"Use Authorization: Bearer sk-secret-123456",
|
||||
);
|
||||
|
||||
expect(prompt).not.toContain("sensitive");
|
||||
expect(prompt).not.toContain("sk-secret-123456");
|
||||
expect(prompt).toContain('"X-Auth": "[REDACTED]"');
|
||||
expect(prompt).toContain('"X-Feature-Key": "dashboard-layout"');
|
||||
});
|
||||
});
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
getCustomWidgetSkill,
|
||||
getCustomWidgetSkillContent,
|
||||
} from "../core/authoring-resources";
|
||||
import { validateCustomJsxTemplate } from "../jsx/analyzer";
|
||||
|
||||
const skillSourceDirectory = path.resolve(import.meta.dirname, "../../../../.agents/skills/homarr-custom-widget");
|
||||
|
||||
@@ -56,11 +55,6 @@ describe("authoring resources", () => {
|
||||
sources: { default: { baseUrl: "https://pokeapi.co" } },
|
||||
},
|
||||
});
|
||||
const serviceDashboard = getCustomWidgetExample("service-dashboard");
|
||||
if (!serviceDashboard) throw new Error("Service dashboard example is missing");
|
||||
expect(validateCustomJsxTemplate(serviceDashboard.widget.template)).toEqual([]);
|
||||
expect(serviceDashboard.widget.template.match(/<Paper/gu)).toHaveLength(1);
|
||||
expect(serviceDashboard.widget.template).toContain('RefreshButton label="Refresh service health"');
|
||||
expect(Buffer.byteLength(JSON.stringify(pokedex), "utf8")).toBeLessThan(16_000);
|
||||
expect(catalog.sharedProps).toMatchObject({
|
||||
count: expect.any(Number),
|
||||
|
||||
@@ -43,21 +43,6 @@ describe("shared Custom JSX policy", () => {
|
||||
expect(validateCustomJsxTemplate('<ThemeIcon><Icon name="brand-docker" /></ThemeIcon>')).toEqual([]);
|
||||
});
|
||||
|
||||
test("rejects TablerIcon without its required name prop", () => {
|
||||
expect(validateCustomJsxTemplate('<TablerIcon icon="IconHeartbeat" />')).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
severity: "error",
|
||||
message: expect.stringContaining("MISSING_REQUIRED_PROP: 'name' on TablerIcon"),
|
||||
}),
|
||||
expect.objectContaining({
|
||||
severity: "error",
|
||||
message: expect.stringContaining("UNKNOWN_COMPONENT_PROP: 'icon' on TablerIcon"),
|
||||
}),
|
||||
]),
|
||||
);
|
||||
});
|
||||
|
||||
test("accepts common bounded formatting and collection operations", () => {
|
||||
expect(
|
||||
validateCustomJsxTemplate(
|
||||
|
||||
@@ -277,8 +277,7 @@ function EditorLoader() {
|
||||
function formatCode(value: string, language: "jsx" | "json" | "css") {
|
||||
if (language === "json") {
|
||||
try {
|
||||
const parsed: unknown = JSON.parse(value);
|
||||
return `${JSON.stringify(parsed, null, 2)}\n`;
|
||||
return `${JSON.stringify(JSON.parse(value) as unknown, null, 2)}\n`;
|
||||
} catch {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
ALTER TABLE `user` ADD `header_preferences` text DEFAULT ('{"version":3,"visible":true,"searchDisplay":"input","logoDisplay":"logoAndText","zones":{"left":[{"type":"builtin","id":"logo"}],"center":[{"type":"builtin","id":"search"}],"right":[{"type":"builtin","id":"boardEdit"},{"type":"builtin","id":"boardSettings"},{"type":"builtin","id":"user"}]}}') NOT NULL;
|
||||
ALTER TABLE `user` ADD `header_preferences` text DEFAULT ('{"version":3,"visible":true,"searchDisplay":"input","logoDisplay":"logo","zones":{"left":[{"type":"builtin","id":"logo"}],"center":[{"type":"builtin","id":"search"}],"right":[{"type":"builtin","id":"boardEdit"},{"type":"builtin","id":"boardSettings"},{"type":"builtin","id":"user"}]}}') NOT NULL;
|
||||
--> statement-breakpoint
|
||||
INSERT IGNORE INTO `serverSetting` (`setting_key`, `value`)
|
||||
VALUES ('branding', '{"json":{"appName":"Homarr","greeting":"","logoImageUrl":null,"faviconImageUrl":null,"primaryColor":"#fa5252","secondaryColor":"#fd7e14","lockPrimaryColor":false,"signInBackgroundImageUrl":null,"signInBackgroundOverlay":0.55,"authBranding":{"showAppName":true,"showLogo":true,"showGreeting":true},"defaultRadius":"md"}}');
|
||||
@@ -2620,7 +2620,7 @@
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "('{\"version\":3,\"visible\":true,\"searchDisplay\":\"input\",\"logoDisplay\":\"logoAndText\",\"zones\":{\"left\":[{\"type\":\"builtin\",\"id\":\"logo\"}],\"center\":[{\"type\":\"builtin\",\"id\":\"search\"}],\"right\":[{\"type\":\"builtin\",\"id\":\"boardEdit\"},{\"type\":\"builtin\",\"id\":\"boardSettings\"},{\"type\":\"builtin\",\"id\":\"user\"}]}}')"
|
||||
"default": "('{\"version\":3,\"visible\":true,\"searchDisplay\":\"input\",\"logoDisplay\":\"logo\",\"zones\":{\"left\":[{\"type\":\"builtin\",\"id\":\"logo\"}],\"center\":[{\"type\":\"builtin\",\"id\":\"search\"}],\"right\":[{\"type\":\"builtin\",\"id\":\"boardEdit\"},{\"type\":\"builtin\",\"id\":\"boardSettings\"},{\"type\":\"builtin\",\"id\":\"user\"}]}}')"
|
||||
},
|
||||
"completed_manage_tour": {
|
||||
"name": "completed_manage_tour",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
ALTER TABLE "user" ADD COLUMN "header_preferences" text DEFAULT '{"version":3,"visible":true,"searchDisplay":"input","logoDisplay":"logoAndText","zones":{"left":[{"type":"builtin","id":"logo"}],"center":[{"type":"builtin","id":"search"}],"right":[{"type":"builtin","id":"boardEdit"},{"type":"builtin","id":"boardSettings"},{"type":"builtin","id":"user"}]}}' NOT NULL;
|
||||
ALTER TABLE "user" ADD COLUMN "header_preferences" text DEFAULT '{"version":3,"visible":true,"searchDisplay":"input","logoDisplay":"logo","zones":{"left":[{"type":"builtin","id":"logo"}],"center":[{"type":"builtin","id":"search"}],"right":[{"type":"builtin","id":"boardEdit"},{"type":"builtin","id":"boardSettings"},{"type":"builtin","id":"user"}]}}' NOT NULL;
|
||||
--> statement-breakpoint
|
||||
INSERT INTO "serverSetting" ("setting_key", "value")
|
||||
VALUES ('branding', '{"json":{"appName":"Homarr","greeting":"","logoImageUrl":null,"faviconImageUrl":null,"primaryColor":"#fa5252","secondaryColor":"#fd7e14","lockPrimaryColor":false,"signInBackgroundImageUrl":null,"signInBackgroundOverlay":0.55,"authBranding":{"showAppName":true,"showLogo":true,"showGreeting":true},"defaultRadius":"md"}}')
|
||||
|
||||
@@ -2485,7 +2485,7 @@
|
||||
"type": "text",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"default": "'{\"version\":3,\"visible\":true,\"searchDisplay\":\"input\",\"logoDisplay\":\"logoAndText\",\"zones\":{\"left\":[{\"type\":\"builtin\",\"id\":\"logo\"}],\"center\":[{\"type\":\"builtin\",\"id\":\"search\"}],\"right\":[{\"type\":\"builtin\",\"id\":\"boardEdit\"},{\"type\":\"builtin\",\"id\":\"boardSettings\"},{\"type\":\"builtin\",\"id\":\"user\"}]}}'"
|
||||
"default": "'{\"version\":3,\"visible\":true,\"searchDisplay\":\"input\",\"logoDisplay\":\"logo\",\"zones\":{\"left\":[{\"type\":\"builtin\",\"id\":\"logo\"}],\"center\":[{\"type\":\"builtin\",\"id\":\"search\"}],\"right\":[{\"type\":\"builtin\",\"id\":\"boardEdit\"},{\"type\":\"builtin\",\"id\":\"boardSettings\"},{\"type\":\"builtin\",\"id\":\"user\"}]}}'"
|
||||
},
|
||||
"completed_manage_tour": {
|
||||
"name": "completed_manage_tour",
|
||||
|
||||
@@ -730,168 +730,6 @@ const buildDemoWidgets = (appIds: string[], customWidgetDefinitionId: string): D
|
||||
{ kind: "notifications", xOffset: 3, yOffset: 9, width: 2, height: 2, needsIntegration: true },
|
||||
{ kind: "beszelAlerts", xOffset: 5, yOffset: 9, width: 4, height: 2, needsIntegration: true },
|
||||
|
||||
// Extended integrations
|
||||
{ kind: "mediaTranscoding", xOffset: 0, yOffset: 14, width: 4, height: 3, needsIntegration: true },
|
||||
{ kind: "beszelSystemTable", xOffset: 4, yOffset: 14, width: 4, height: 3, needsIntegration: true },
|
||||
{ kind: "networkControllerSummary", xOffset: 8, yOffset: 14, width: 4, height: 3, needsIntegration: true },
|
||||
{
|
||||
kind: "networkControllerStatus",
|
||||
xOffset: 0,
|
||||
yOffset: 17,
|
||||
width: 3,
|
||||
height: 2,
|
||||
needsIntegration: true,
|
||||
options: { content: "wifi" },
|
||||
},
|
||||
{ kind: "ups", xOffset: 3, yOffset: 17, width: 3, height: 2, needsIntegration: true },
|
||||
{
|
||||
kind: "smartHome-entityState",
|
||||
xOffset: 6,
|
||||
yOffset: 17,
|
||||
width: 3,
|
||||
height: 2,
|
||||
needsIntegration: true,
|
||||
options: { entityId: "sensor.homarr_demo", displayName: "Demo environment", entityUnit: "online" },
|
||||
},
|
||||
{
|
||||
kind: "smartHome-executeAutomation",
|
||||
xOffset: 9,
|
||||
yOffset: 17,
|
||||
width: 3,
|
||||
height: 2,
|
||||
needsIntegration: true,
|
||||
options: { automationId: "automation.homarr_demo", displayName: "Run demo routine" },
|
||||
},
|
||||
|
||||
// Everyday tools
|
||||
{ kind: "dnsHoleControls", xOffset: 0, yOffset: 19, width: 2, height: 2, needsIntegration: true },
|
||||
{
|
||||
kind: "bookmarks",
|
||||
xOffset: 2,
|
||||
yOffset: 19,
|
||||
width: 4,
|
||||
height: 2,
|
||||
needsIntegration: false,
|
||||
options: { title: "Launchpad", layout: "grid", items: appIds.slice(0, 6), openNewTab: true },
|
||||
},
|
||||
{
|
||||
kind: "countdown",
|
||||
xOffset: 6,
|
||||
yOffset: 19,
|
||||
width: 2,
|
||||
height: 2,
|
||||
needsIntegration: false,
|
||||
options: {
|
||||
events: [
|
||||
{
|
||||
id: "demo-new-year",
|
||||
label: "New year 2030",
|
||||
targetUtc: "2030-01-01T00:00:00.000Z",
|
||||
startUtc: "2026-01-01T00:00:00.000Z",
|
||||
timeZone: "Europe/Paris",
|
||||
recurrence: "none",
|
||||
},
|
||||
],
|
||||
showProgress: true,
|
||||
showSeconds: false,
|
||||
},
|
||||
},
|
||||
{ kind: "stockPrice", xOffset: 8, yOffset: 19, width: 2, height: 2, needsIntegration: false },
|
||||
{ kind: "releases", xOffset: 10, yOffset: 19, width: 2, height: 2, needsIntegration: false },
|
||||
{
|
||||
kind: "iframe",
|
||||
xOffset: 0,
|
||||
yOffset: 21,
|
||||
width: 4,
|
||||
height: 3,
|
||||
needsIntegration: false,
|
||||
options: {
|
||||
embedUrl: "https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/homarr.svg",
|
||||
allowScrolling: false,
|
||||
},
|
||||
},
|
||||
{
|
||||
kind: "video",
|
||||
xOffset: 4,
|
||||
yOffset: 21,
|
||||
width: 4,
|
||||
height: 3,
|
||||
needsIntegration: false,
|
||||
options: {
|
||||
feedUrl: "https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4",
|
||||
hasAutoPlay: false,
|
||||
isMuted: true,
|
||||
hasControls: true,
|
||||
},
|
||||
},
|
||||
{ kind: "minecraftServerStatus", xOffset: 8, yOffset: 21, width: 2, height: 3, needsIntegration: false },
|
||||
{
|
||||
kind: "timetable",
|
||||
xOffset: 10,
|
||||
yOffset: 21,
|
||||
width: 2,
|
||||
height: 3,
|
||||
needsIntegration: false,
|
||||
options: { baseUrl: "https://search.ch", station: { value: "8507000", label: "Bern" } },
|
||||
},
|
||||
|
||||
// Complete mock integration gallery
|
||||
{
|
||||
kind: "immich-albumCarousel",
|
||||
xOffset: 0,
|
||||
yOffset: 24,
|
||||
width: 3,
|
||||
height: 3,
|
||||
needsIntegration: true,
|
||||
options: { albumId: "demo-paris", rotationIntervalSeconds: 8, showPhotoInfo: true, randomizePhotos: false },
|
||||
},
|
||||
{ kind: "coolify", xOffset: 3, yOffset: 24, width: 3, height: 3, needsIntegration: true },
|
||||
{ kind: "systemResources", xOffset: 6, yOffset: 24, width: 3, height: 3, needsIntegration: true },
|
||||
{ kind: "systemDisks", xOffset: 9, yOffset: 24, width: 3, height: 3, needsIntegration: true },
|
||||
|
||||
{ kind: "immich-serverStats", xOffset: 0, yOffset: 27, width: 2, height: 3, needsIntegration: true },
|
||||
{ kind: "paperlessNgx", xOffset: 2, yOffset: 27, width: 2, height: 3, needsIntegration: true },
|
||||
{ kind: "patchmon", xOffset: 4, yOffset: 27, width: 2, height: 3, needsIntegration: true },
|
||||
{
|
||||
kind: "speedtestTracker",
|
||||
xOffset: 6,
|
||||
yOffset: 27,
|
||||
width: 4,
|
||||
height: 3,
|
||||
needsIntegration: true,
|
||||
options: { showLatestResult: true, showStats: true, showRecentResults: false, showPingGraph: false },
|
||||
},
|
||||
{ kind: "audioStats", xOffset: 10, yOffset: 27, width: 2, height: 3, needsIntegration: true },
|
||||
|
||||
{ kind: "uptimeKuma", xOffset: 0, yOffset: 30, width: 3, height: 2, needsIntegration: true },
|
||||
{ kind: "firewall", xOffset: 3, yOffset: 30, width: 3, height: 2, needsIntegration: true },
|
||||
{ kind: "vpn", xOffset: 6, yOffset: 30, width: 3, height: 2, needsIntegration: true },
|
||||
{ kind: "bazarr", xOffset: 9, yOffset: 30, width: 3, height: 2, needsIntegration: true },
|
||||
|
||||
{ kind: "archiveTeamWarrior", xOffset: 0, yOffset: 32, width: 3, height: 2, needsIntegration: true },
|
||||
{ kind: "wud", xOffset: 3, yOffset: 32, width: 3, height: 2, needsIntegration: true },
|
||||
{
|
||||
kind: "anchorNote",
|
||||
xOffset: 6,
|
||||
yOffset: 32,
|
||||
width: 2,
|
||||
height: 2,
|
||||
needsIntegration: true,
|
||||
options: { noteId: "homarr-demo-note", showTitle: true, showUpdatedAt: true },
|
||||
},
|
||||
{ kind: "tracearr", xOffset: 8, yOffset: 32, width: 4, height: 2, needsIntegration: true },
|
||||
|
||||
{ kind: "traefik", xOffset: 0, yOffset: 34, width: 6, height: 2, needsIntegration: true },
|
||||
{
|
||||
kind: "umami",
|
||||
xOffset: 6,
|
||||
yOffset: 34,
|
||||
width: 6,
|
||||
height: 2,
|
||||
needsIntegration: true,
|
||||
options: { websiteId: "homarr-demo", timeFrame: "24h", viewMode: "chart", chartType: "bar" },
|
||||
},
|
||||
|
||||
// Right app rail
|
||||
...appIds.map(
|
||||
(appId, index): DemoWidget => ({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
ALTER TABLE `user` ADD `header_preferences` text DEFAULT '{"version":3,"visible":true,"searchDisplay":"input","logoDisplay":"logoAndText","zones":{"left":[{"type":"builtin","id":"logo"}],"center":[{"type":"builtin","id":"search"}],"right":[{"type":"builtin","id":"boardEdit"},{"type":"builtin","id":"boardSettings"},{"type":"builtin","id":"user"}]}}' NOT NULL;
|
||||
ALTER TABLE `user` ADD `header_preferences` text DEFAULT '{"version":3,"visible":true,"searchDisplay":"input","logoDisplay":"logo","zones":{"left":[{"type":"builtin","id":"logo"}],"center":[{"type":"builtin","id":"search"}],"right":[{"type":"builtin","id":"boardEdit"},{"type":"builtin","id":"boardSettings"},{"type":"builtin","id":"user"}]}}' NOT NULL;
|
||||
--> statement-breakpoint
|
||||
INSERT INTO `serverSetting` (`setting_key`, `value`)
|
||||
VALUES ('branding', '{"json":{"appName":"Homarr","greeting":"","logoImageUrl":null,"faviconImageUrl":null,"primaryColor":"#fa5252","secondaryColor":"#fd7e14","lockPrimaryColor":false,"signInBackgroundImageUrl":null,"signInBackgroundOverlay":0.55,"authBranding":{"showAppName":true,"showLogo":true,"showGreeting":true},"defaultRadius":"md"}}')
|
||||
|
||||
@@ -2551,7 +2551,7 @@
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false,
|
||||
"default": "'{\"version\":3,\"visible\":true,\"searchDisplay\":\"input\",\"logoDisplay\":\"logoAndText\",\"zones\":{\"left\":[{\"type\":\"builtin\",\"id\":\"logo\"}],\"center\":[{\"type\":\"builtin\",\"id\":\"search\"}],\"right\":[{\"type\":\"builtin\",\"id\":\"boardEdit\"},{\"type\":\"builtin\",\"id\":\"boardSettings\"},{\"type\":\"builtin\",\"id\":\"user\"}]}}'"
|
||||
"default": "'{\"version\":3,\"visible\":true,\"searchDisplay\":\"input\",\"logoDisplay\":\"logo\",\"zones\":{\"left\":[{\"type\":\"builtin\",\"id\":\"logo\"}],\"center\":[{\"type\":\"builtin\",\"id\":\"search\"}],\"right\":[{\"type\":\"builtin\",\"id\":\"boardEdit\"},{\"type\":\"builtin\",\"id\":\"boardSettings\"},{\"type\":\"builtin\",\"id\":\"user\"}]}}'"
|
||||
},
|
||||
"completed_manage_tour": {
|
||||
"name": "completed_manage_tour",
|
||||
|
||||
@@ -7,7 +7,6 @@ import SuperJSON from "superjson";
|
||||
import { expect, test } from "vitest";
|
||||
|
||||
import { DB_CASING } from "@homarr/core/infrastructure/db/constants";
|
||||
import { widgetIntegrationSupport, widgetKinds } from "@homarr/definitions";
|
||||
|
||||
import type { Database } from "..";
|
||||
import { seedDataAsync } from "../migrations/seed";
|
||||
@@ -46,7 +45,7 @@ test("SQLite migrations seed the five disabled bundled custom widgets", async ()
|
||||
connection.close();
|
||||
});
|
||||
|
||||
test("SQLite migrations seed the complete demo widget gallery", async () => {
|
||||
test("SQLite migrations seed the redesigned demo dashboard", async () => {
|
||||
const previousDemoMode = process.env.DEMO_MODE;
|
||||
process.env.DEMO_MODE = "true";
|
||||
const connection = new BetterSqlite3(":memory:");
|
||||
@@ -66,7 +65,7 @@ test("SQLite migrations seed the complete demo widget gallery", async () => {
|
||||
with: {
|
||||
layouts: true,
|
||||
sections: { with: { collapseStates: true, layouts: true } },
|
||||
items: { with: { integrations: true, layouts: true } },
|
||||
items: { with: { layouts: true } },
|
||||
},
|
||||
});
|
||||
if (!board) throw new Error("Demo board was not seeded");
|
||||
@@ -127,18 +126,6 @@ test("SQLite migrations seed the complete demo widget gallery", async () => {
|
||||
expectItemLayout("notifications", 3, 9, 2, 2);
|
||||
expectItemLayout("beszelAlerts", 5, 9, 4, 2);
|
||||
|
||||
expect(new Set(board.items.map((item) => item.kind))).toEqual(new Set(widgetKinds));
|
||||
const mockIntegration = await database.query.integrations.findFirst({
|
||||
where: (table, { eq }) => eq(table.kind, "mock"),
|
||||
});
|
||||
if (!mockIntegration) throw new Error("Demo mock integration was not seeded");
|
||||
for (const item of board.items) {
|
||||
if (widgetIntegrationSupport[item.kind] === undefined) continue;
|
||||
expect(item.integrations).toEqual([
|
||||
expect.objectContaining({ integrationId: mockIntegration.id, itemId: item.id }),
|
||||
]);
|
||||
}
|
||||
|
||||
for (const kind of ["weather", "airQuality"]) {
|
||||
const item = itemByKind(kind);
|
||||
if (!item?.options) throw new Error(`Demo ${kind} options were not seeded`);
|
||||
|
||||
@@ -26,12 +26,6 @@ describe("native feature capability descriptor", () => {
|
||||
}
|
||||
});
|
||||
|
||||
test("supports the mock integration for every integration-backed widget", () => {
|
||||
for (const capability of Object.values(nativeFeatureCapabilities)) {
|
||||
expect(capability.integrations).toContain("mock");
|
||||
}
|
||||
});
|
||||
|
||||
test("derives optional connections and server selection limits", () => {
|
||||
expect(widgetKindsWithOptionalIntegrations).toEqual(new Set(["calendar"]));
|
||||
expect(widgetIntegrationLimits).toEqual({
|
||||
|
||||
@@ -41,32 +41,32 @@ export const nativeFeatureCapabilities = {
|
||||
(kind) => kind !== "patchmon" && kind !== "wud",
|
||||
),
|
||||
},
|
||||
firewall: { integrations: [...getIntegrationKindsByCategory("firewall"), "mock"] },
|
||||
firewall: { integrations: getIntegrationKindsByCategory("firewall") },
|
||||
notifications: { integrations: getIntegrationKindsByCategory("notifications") },
|
||||
mediaReleases: { integrations: ["mock", "emby", "jellyfin", "plex"] },
|
||||
systemResources: { integrations: ["dashDot", "openmediavault", "truenas", "unraid", "glances", "synology", "mock"] },
|
||||
systemDisks: { integrations: ["dashDot", "openmediavault", "truenas", "unraid", "synology", "mock"] },
|
||||
systemResources: { integrations: ["dashDot", "openmediavault", "truenas", "unraid", "glances", "synology"] },
|
||||
systemDisks: { integrations: ["dashDot", "openmediavault", "truenas", "unraid", "synology"] },
|
||||
beszelAlerts: { integrations: ["beszel", "mock"] },
|
||||
beszelSystemGrid: { integrations: ["beszel", "mock"] },
|
||||
beszelSystemStats: { integrations: ["beszel", "mock"] },
|
||||
beszelSystemTable: { integrations: ["beszel", "mock"] },
|
||||
coolify: { integrations: ["coolify", "mock"] },
|
||||
"immich-serverStats": { integrations: ["immich", "mock"], serverMaxIntegrations: 1 },
|
||||
"immich-albumCarousel": { integrations: ["immich", "mock"], serverMaxIntegrations: 1 },
|
||||
paperlessNgx: { integrations: ["paperlessNgx", "mock"], serverMaxIntegrations: 1 },
|
||||
patchmon: { integrations: ["patchmon", "mock"], serverMaxIntegrations: 1 },
|
||||
bazarr: { integrations: ["bazarr", "mock"], serverMaxIntegrations: 1 },
|
||||
tracearr: { integrations: ["tracearr", "mock"] },
|
||||
speedtestTracker: { integrations: ["speedtestTracker", "mock"] },
|
||||
uptimeKuma: { integrations: ["uptimeKuma", "mock"] },
|
||||
audioStats: { integrations: ["navidrome", "audiobookshelf", "mock"], serverMaxIntegrations: 1 },
|
||||
umami: { integrations: ["umami", "mock"], serverMaxIntegrations: 1 },
|
||||
vpn: { integrations: [...getIntegrationKindsByCategory("vpn"), "mock"] },
|
||||
coolify: { integrations: ["coolify"] },
|
||||
"immich-serverStats": { integrations: ["immich"], serverMaxIntegrations: 1 },
|
||||
"immich-albumCarousel": { integrations: ["immich"], serverMaxIntegrations: 1 },
|
||||
paperlessNgx: { integrations: ["paperlessNgx"], serverMaxIntegrations: 1 },
|
||||
patchmon: { integrations: ["patchmon"], serverMaxIntegrations: 1 },
|
||||
bazarr: { integrations: ["bazarr"], serverMaxIntegrations: 1 },
|
||||
tracearr: { integrations: ["tracearr"] },
|
||||
speedtestTracker: { integrations: ["speedtestTracker"] },
|
||||
uptimeKuma: { integrations: ["uptimeKuma"] },
|
||||
audioStats: { integrations: ["navidrome", "audiobookshelf"], serverMaxIntegrations: 1 },
|
||||
umami: { integrations: ["umami"], serverMaxIntegrations: 1 },
|
||||
vpn: { integrations: getIntegrationKindsByCategory("vpn") },
|
||||
ups: { integrations: getIntegrationKindsByCategory("ups") },
|
||||
archiveTeamWarrior: { integrations: ["archiveTeamWarrior", "mock"], serverMaxIntegrations: 1 },
|
||||
anchorNote: { integrations: ["anchor", "mock"], serverMaxIntegrations: 1 },
|
||||
traefik: { integrations: ["traefik", "mock"] },
|
||||
wud: { integrations: ["wud", "mock"], serverMaxIntegrations: 1 },
|
||||
archiveTeamWarrior: { integrations: ["archiveTeamWarrior"], serverMaxIntegrations: 1 },
|
||||
anchorNote: { integrations: ["anchor"], serverMaxIntegrations: 1 },
|
||||
traefik: { integrations: ["traefik"] },
|
||||
wud: { integrations: ["wud"], serverMaxIntegrations: 1 },
|
||||
} as const satisfies Partial<Record<WidgetKind, NativeFeatureCapabilityDescriptor>>;
|
||||
|
||||
const nativeFeatureCapabilityEntries = Object.entries(nativeFeatureCapabilities) as [
|
||||
|
||||
@@ -45,7 +45,6 @@ export { UmamiIntegration } from "./umami/umami-integration";
|
||||
export { PeaNutIntegration } from "./peanut/peanut-integration";
|
||||
export { BazarrIntegration } from "./bazarr/bazarr-integration";
|
||||
export { TraefikIntegration } from "./traefik/traefik-integration";
|
||||
export { mockWidgetData } from "./mock/widget-data";
|
||||
|
||||
// Types
|
||||
export type { IntegrationInput } from "./base/integration";
|
||||
|
||||
@@ -1,355 +0,0 @@
|
||||
import type { AnchorNote, AnchorNoteSummary } from "../anchor/anchor-types";
|
||||
import type { ArchiveTeamWarriorStatus } from "../archive-team-warrior/archive-team-warrior-types";
|
||||
import type { BazarrBadges } from "../bazarr/bazarr-types";
|
||||
import type { CoolifyInstanceInfo } from "../coolify/coolify-types";
|
||||
import type { ImmichAlbum, ImmichServerStats } from "../immich/immich-integration";
|
||||
import type { NavidromeDashboardData } from "../navidrome/navidrome-types";
|
||||
import type { PaperlessNgxStats } from "../paperless-ngx/paperless-ngx-types";
|
||||
import type { PatchMonStats } from "../patchmon/patchmon-types";
|
||||
import type { SpeedtestTrackerDashboardData } from "../speedtest-tracker/speedtest-tracker-types";
|
||||
import type { TracearrDashboardData } from "../tracearr/tracearr-types";
|
||||
import type { TraefikDashboardData } from "../traefik/traefik-types";
|
||||
import type { UmamiEventSeries, UmamiMetricItem, UmamiVisitorStats, UmamiWebsite } from "../umami/umami-types";
|
||||
import type { UptimeKumaDashboardData } from "../uptime-kuma/uptime-kuma-types";
|
||||
import type { WudStats } from "../wud/wud-types";
|
||||
import type {
|
||||
FirewallCpuSummary,
|
||||
FirewallInterfacesSummary,
|
||||
FirewallMemorySummary,
|
||||
FirewallVersionSummary,
|
||||
} from "../interfaces/firewall-summary/firewall-summary-types";
|
||||
import type { VpnSummary } from "../interfaces/vpn-summary/vpn-summary-types";
|
||||
|
||||
const demoTimestamp = "2026-08-24T12:00:00.000Z";
|
||||
|
||||
const anchorNote: AnchorNote = {
|
||||
id: "homarr-demo-note",
|
||||
title: "Homarr demo runbook",
|
||||
content: JSON.stringify({
|
||||
ops: [
|
||||
{ insert: "Welcome to the complete Homarr widget gallery.\n", attributes: { bold: true } },
|
||||
{ insert: "Every integration-backed card below is powered by safe mock data.\n" },
|
||||
],
|
||||
}),
|
||||
createdAt: demoTimestamp,
|
||||
updatedAt: demoTimestamp,
|
||||
isPinned: true,
|
||||
isArchived: false,
|
||||
tagIds: ["demo"],
|
||||
permission: "editor",
|
||||
background: null,
|
||||
userId: "demo",
|
||||
};
|
||||
|
||||
export const mockWidgetData = {
|
||||
timestamp: demoTimestamp,
|
||||
anchorNote,
|
||||
anchorNotes: [
|
||||
{
|
||||
id: anchorNote.id,
|
||||
title: anchorNote.title,
|
||||
updatedAt: anchorNote.updatedAt,
|
||||
isPinned: anchorNote.isPinned,
|
||||
tagIds: anchorNote.tagIds,
|
||||
permission: anchorNote.permission,
|
||||
},
|
||||
] satisfies AnchorNoteSummary[],
|
||||
archiveTeamWarrior: {
|
||||
status: "running",
|
||||
runnerStatus: "running",
|
||||
project: { id: "urlteam2", title: "URLTeam 2" },
|
||||
selectedProject: "urlteam2",
|
||||
broadcastMessage: "Archiving the open web, one URL at a time.",
|
||||
bandwidth: {
|
||||
received: 8_942_000_000,
|
||||
sent: 1_284_000_000,
|
||||
receiving: 4_800_000,
|
||||
sending: 720_000,
|
||||
session_id: "homarr-demo-session",
|
||||
},
|
||||
items: [
|
||||
{ id: "demo-1", name: "urls-20260824-01", status: "running", project: "urlteam2", startTime: 1_777_000_000 },
|
||||
{ id: "demo-2", name: "urls-20260824-00", status: "completed", project: "urlteam2" },
|
||||
],
|
||||
counts: { running: 1, completed: 284, failed: 2, canceled: 0 },
|
||||
updatedAt: demoTimestamp,
|
||||
} satisfies ArchiveTeamWarriorStatus,
|
||||
audioStats: { artistCount: 842, albumCount: 1_976, songCount: 24_681 } satisfies NavidromeDashboardData,
|
||||
bazarr: {
|
||||
episodes: 12,
|
||||
movies: 4,
|
||||
providers: 6,
|
||||
status: 0,
|
||||
sonarr_signalr: "connected",
|
||||
radarr_signalr: "connected",
|
||||
announcements: 1,
|
||||
} satisfies BazarrBadges,
|
||||
coolify: {
|
||||
version: "4.0.0-beta.420",
|
||||
servers: [
|
||||
{
|
||||
id: 1,
|
||||
uuid: "homarr-demo-edge",
|
||||
name: "Paris edge",
|
||||
ip: "10.0.0.20",
|
||||
is_reachable: true,
|
||||
is_usable: true,
|
||||
settings: { server_id: 1, is_build_server: true, is_reachable: true, is_usable: true },
|
||||
},
|
||||
],
|
||||
applications: [
|
||||
{
|
||||
id: 1,
|
||||
uuid: "homarr-demo-app",
|
||||
name: "Homarr",
|
||||
status: "running:healthy",
|
||||
fqdn: "https://homarr.dev",
|
||||
projectName: "Home cloud",
|
||||
environmentName: "Production",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
uuid: "media-demo-app",
|
||||
name: "Media stack",
|
||||
status: "running:healthy",
|
||||
fqdn: null,
|
||||
projectName: "Home cloud",
|
||||
environmentName: "Production",
|
||||
},
|
||||
],
|
||||
services: [
|
||||
{
|
||||
id: 3,
|
||||
uuid: "postgres-demo-service",
|
||||
name: "Postgres",
|
||||
status: "running:healthy",
|
||||
fqdn: null,
|
||||
applications: [],
|
||||
projectName: "Home cloud",
|
||||
environmentName: "Production",
|
||||
},
|
||||
],
|
||||
} satisfies CoolifyInstanceInfo,
|
||||
firewallCpu: { total: 23 } satisfies FirewallCpuSummary,
|
||||
firewallInterfaces: [
|
||||
{
|
||||
data: [
|
||||
{ name: "WAN", receive: 18_400_000, transmit: 4_200_000 },
|
||||
{ name: "LAN", receive: 46_700_000, transmit: 21_300_000 },
|
||||
],
|
||||
timestamp: new Date(demoTimestamp),
|
||||
},
|
||||
] satisfies FirewallInterfacesSummary[],
|
||||
firewallMemory: { used: 3_220_000_000, total: 8_590_000_000, percent: 37.5 } satisfies FirewallMemorySummary,
|
||||
firewallVersion: { version: "24.7.11" } satisfies FirewallVersionSummary,
|
||||
immichStats: {
|
||||
userCount: 4,
|
||||
photoCount: 48_392,
|
||||
videoCount: 2_418,
|
||||
totalLibraryUsageInBytes: 684_510_412_800,
|
||||
} satisfies ImmichServerStats,
|
||||
immichAlbums: [
|
||||
{ id: "demo-paris", albumName: "Paris weekend", assetCount: 128 },
|
||||
{ id: "demo-mountains", albumName: "Alpine trails", assetCount: 84 },
|
||||
],
|
||||
immichAlbum: {
|
||||
id: "demo-paris",
|
||||
albumName: "Paris weekend",
|
||||
assets: [
|
||||
{
|
||||
id: "demo-photo-1",
|
||||
thumbhash: null,
|
||||
fileModifiedAt: demoTimestamp,
|
||||
fileCreatedAt: demoTimestamp,
|
||||
updatedAt: demoTimestamp,
|
||||
type: "IMAGE",
|
||||
publicLink: "https://images.unsplash.com/photo-1502602898657-3e91760cbb34?auto=format&fit=crop&w=1200&q=80",
|
||||
},
|
||||
{
|
||||
id: "demo-photo-2",
|
||||
thumbhash: null,
|
||||
fileModifiedAt: demoTimestamp,
|
||||
fileCreatedAt: demoTimestamp,
|
||||
updatedAt: demoTimestamp,
|
||||
type: "IMAGE",
|
||||
publicLink: "https://images.unsplash.com/photo-1464822759023-fed622ff2c3b?auto=format&fit=crop&w=1200&q=80",
|
||||
},
|
||||
],
|
||||
} satisfies ImmichAlbum,
|
||||
paperlessNgx: {
|
||||
documentsTotal: 2_847,
|
||||
documentsInbox: 14,
|
||||
correspondentsCount: 96,
|
||||
tagsCount: 38,
|
||||
documentTypesCount: 12,
|
||||
} satisfies PaperlessNgxStats,
|
||||
patchmon: {
|
||||
totalHosts: 18,
|
||||
hostsNeedingUpdates: 5,
|
||||
securityUpdates: 7,
|
||||
upToDateHosts: 13,
|
||||
hostsWithSecurityUpdates: 3,
|
||||
recentUpdates24h: 11,
|
||||
totalOutdatedPackages: 26,
|
||||
totalRepos: 42,
|
||||
lastUpdated: demoTimestamp,
|
||||
osDistribution: [
|
||||
{ name: "Ubuntu 24.04", count: 9, osType: "linux", osVersion: "24.04" },
|
||||
{ name: "Debian 13", count: 6, osType: "linux", osVersion: "13" },
|
||||
{ name: "Fedora 42", count: 3, osType: "linux", osVersion: "42" },
|
||||
],
|
||||
} satisfies PatchMonStats,
|
||||
speedtestTracker: {
|
||||
latestResult: {
|
||||
id: 42,
|
||||
ping: 8.4,
|
||||
download_bits: 936_000_000,
|
||||
upload_bits: 487_000_000,
|
||||
healthy: true,
|
||||
created_at: new Date(demoTimestamp),
|
||||
},
|
||||
stats: {
|
||||
ping: { avg: 9.1, min: 6.8, max: 14.2 },
|
||||
download: { avg: 901, avg_bits: 901_000_000, min: 822, max: 948 },
|
||||
upload: { avg: 472, avg_bits: 472_000_000, min: 431, max: 495 },
|
||||
total_results: 128,
|
||||
},
|
||||
recentResults: [
|
||||
{
|
||||
id: 42,
|
||||
ping: 8.4,
|
||||
download_bits: 936_000_000,
|
||||
upload_bits: 487_000_000,
|
||||
healthy: true,
|
||||
created_at: new Date(demoTimestamp),
|
||||
},
|
||||
],
|
||||
} satisfies SpeedtestTrackerDashboardData,
|
||||
tracearr: {
|
||||
stats: { activeStreams: 2, totalUsers: 14, totalSessions: 1_248, recentViolations: 1, timestamp: demoTimestamp },
|
||||
streams: {
|
||||
data: [],
|
||||
summary: {
|
||||
total: 2,
|
||||
transcodes: 1,
|
||||
directStreams: 0,
|
||||
directPlays: 1,
|
||||
totalBitrate: "24.8 Mbps",
|
||||
byServer: [
|
||||
{
|
||||
serverId: "demo",
|
||||
serverName: "Homarr Media",
|
||||
total: 2,
|
||||
transcodes: 1,
|
||||
directStreams: 0,
|
||||
directPlays: 1,
|
||||
totalBitrate: "24.8 Mbps",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
violations: { data: [], meta: { total: 1, page: 1, pageSize: 10 } },
|
||||
recentActivity: { data: [], meta: { total: 1_248, page: 1, pageSize: 10 } },
|
||||
} satisfies TracearrDashboardData,
|
||||
traefik: {
|
||||
version: "3.5.0",
|
||||
entryPoints: ["web", "websecure", "metrics"],
|
||||
failedEndpoints: [],
|
||||
resources: [
|
||||
{ protocol: "http", type: "router", name: "homarr@docker", provider: "docker", status: "enabled" },
|
||||
{ protocol: "http", type: "service", name: "homarr@docker", provider: "docker", status: "enabled" },
|
||||
{ protocol: "http", type: "middleware", name: "secure-headers@file", provider: "file", status: "enabled" },
|
||||
],
|
||||
http: {
|
||||
routers: { total: 12, enabled: 12, warnings: 0, errors: 0 },
|
||||
services: { total: 10, enabled: 10, warnings: 0, errors: 0 },
|
||||
middlewares: { total: 8, enabled: 8, warnings: 0, errors: 0 },
|
||||
},
|
||||
tcp: {
|
||||
routers: { total: 2, enabled: 2, warnings: 0, errors: 0 },
|
||||
services: { total: 2, enabled: 2, warnings: 0, errors: 0 },
|
||||
middlewares: { total: 0, enabled: 0, warnings: 0, errors: 0 },
|
||||
},
|
||||
udp: {
|
||||
routers: { total: 1, enabled: 1, warnings: 0, errors: 0 },
|
||||
services: { total: 1, enabled: 1, warnings: 0, errors: 0 },
|
||||
},
|
||||
} satisfies TraefikDashboardData,
|
||||
umamiWebsites: [{ id: "homarr-demo", name: "Homarr demo", domain: "demo.homarr.dev" }] satisfies UmamiWebsite[],
|
||||
umamiVisitorStats: {
|
||||
domain: "demo.homarr.dev",
|
||||
websiteId: "homarr-demo",
|
||||
websiteName: "Homarr demo",
|
||||
totalVisitors: 8_429,
|
||||
totalPageviews: 21_384,
|
||||
totalVisits: 11_207,
|
||||
bounceRate: 32.4,
|
||||
avgDuration: 284,
|
||||
timeFrame: "24h",
|
||||
dataPoints: [
|
||||
{ timestamp: "2026-08-24T08:00:00.000Z", visitors: 280, events: 0 },
|
||||
{ timestamp: "2026-08-24T10:00:00.000Z", visitors: 410, events: 0 },
|
||||
{ timestamp: "2026-08-24T12:00:00.000Z", visitors: 536, events: 0 },
|
||||
],
|
||||
eventCount: 0,
|
||||
} satisfies UmamiVisitorStats,
|
||||
umamiEventNames: ["dashboard_opened", "widget_added", "board_shared"],
|
||||
umamiTopPages: [
|
||||
{ x: "/", y: 8_240 },
|
||||
{ x: "/boards/home", y: 5_812 },
|
||||
{ x: "/manage/integrations", y: 1_942 },
|
||||
] satisfies UmamiMetricItem[],
|
||||
umamiTopReferrers: [
|
||||
{ x: "github.com", y: 3_842 },
|
||||
{ x: "google.com", y: 2_106 },
|
||||
{ x: "docs.homarr.dev", y: 1_284 },
|
||||
] satisfies UmamiMetricItem[],
|
||||
umamiEventSeries: [
|
||||
{
|
||||
eventName: "dashboard_opened",
|
||||
dataPoints: [
|
||||
{ x: "2026-08-24T08:00:00.000Z", y: 92 },
|
||||
{ x: "2026-08-24T10:00:00.000Z", y: 134 },
|
||||
{ x: "2026-08-24T12:00:00.000Z", y: 188 },
|
||||
],
|
||||
},
|
||||
] satisfies UmamiEventSeries[],
|
||||
uptimeKuma: {
|
||||
totalMonitors: 6,
|
||||
upCount: 5,
|
||||
downCount: 1,
|
||||
pausedCount: 0,
|
||||
averageUptimePercent: 99.72,
|
||||
monitors: [
|
||||
{ id: 1, name: "Homarr", status: "up", uptimePercent24h: 100 },
|
||||
{ id: 2, name: "Media server", status: "up", uptimePercent24h: 99.98 },
|
||||
{ id: 3, name: "Home cloud", status: "up", uptimePercent24h: 99.91 },
|
||||
{ id: 4, name: "Backups", status: "up", uptimePercent24h: 99.62 },
|
||||
{ id: 5, name: "VPN", status: "up", uptimePercent24h: 99.8 },
|
||||
{ id: 6, name: "Lab service", status: "down", uptimePercent24h: 98.99 },
|
||||
],
|
||||
} satisfies UptimeKumaDashboardData,
|
||||
vpn: {
|
||||
vpnStatus: "running",
|
||||
dnsStatus: "running",
|
||||
publicIp: "198.51.100.42",
|
||||
country: "France",
|
||||
city: "Paris",
|
||||
vpnProvider: { protocol: "wireguard", provider: "Mullvad" },
|
||||
} satisfies VpnSummary,
|
||||
wud: {
|
||||
totalContainers: 24,
|
||||
updatesAvailable: 3,
|
||||
updates: [
|
||||
{
|
||||
id: "homarr",
|
||||
name: "Homarr",
|
||||
currentVersion: "v1.35.0",
|
||||
newVersion: "v1.36.0",
|
||||
link: "https://github.com/homarr-labs/homarr",
|
||||
},
|
||||
{ id: "postgres", name: "Postgres", currentVersion: "17.5", newVersion: "17.6", link: null },
|
||||
{ id: "redis", name: "Redis", currentVersion: "8.0.2", newVersion: "8.0.3", link: null },
|
||||
],
|
||||
} satisfies WudStats,
|
||||
} as const;
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { CSSProperties } from "react";
|
||||
import type { Icon123, IconProps } from "@tabler/icons-react";
|
||||
|
||||
export * from "./src";
|
||||
@@ -6,31 +5,3 @@ export * from "./src";
|
||||
export type TablerIcon = typeof Icon123;
|
||||
|
||||
export type TablerIconProps = IconProps;
|
||||
|
||||
/**
|
||||
* Icon sizes tied to Mantine's font-size scale instead of raw pixel
|
||||
* numbers, so icons stay legible under the board's CSS zoom scaling.
|
||||
* Pass as the `style` prop (not `size`) - tabler icons convert `size` into
|
||||
* raw SVG width/height attributes, and CSS `var()` isn't guaranteed to
|
||||
* resolve there (Firefox especially). `style` is real CSS, so it does.
|
||||
*/
|
||||
export const iconSizes = {
|
||||
xs: { width: "var(--mantine-font-size-xs)", height: "var(--mantine-font-size-xs)", flexShrink: 0 },
|
||||
sm: { width: "var(--mantine-font-size-sm)", height: "var(--mantine-font-size-sm)", flexShrink: 0 },
|
||||
md: { width: "var(--mantine-font-size-md)", height: "var(--mantine-font-size-md)", flexShrink: 0 },
|
||||
lg: { width: "var(--mantine-font-size-lg)", height: "var(--mantine-font-size-lg)", flexShrink: 0 },
|
||||
xl: { width: "var(--mantine-font-size-xl)", height: "var(--mantine-font-size-xl)", flexShrink: 0 },
|
||||
} as const satisfies Record<string, CSSProperties>;
|
||||
|
||||
/**
|
||||
* For icon/element sizes that don't fit one of `iconSizes`' fixed tokens (e.g. a deliberately
|
||||
* oversized icon). Same reasoning as `iconSizes`: pass as `style`, not a raw `size` number - a
|
||||
* bare pixel value never re-scales when the board's zoom level changes, so it renders at a
|
||||
* fraction of its intended size on any board that isn't at 100% zoom (which is most boards with
|
||||
* more than a couple of widgets).
|
||||
*/
|
||||
export const zoomCompensatedSize = (px: number): CSSProperties => ({
|
||||
width: `calc(${px}px * var(--board-canvas-ui-scale, 1))`,
|
||||
height: `calc(${px}px * var(--board-canvas-ui-scale, 1))`,
|
||||
flexShrink: 0,
|
||||
});
|
||||
@@ -104,7 +104,7 @@ export const headerPreferencesSchema = z
|
||||
version: z.literal(headerPreferencesVersion),
|
||||
visible: z.boolean(),
|
||||
searchDisplay: z.enum(headerSearchDisplayValues),
|
||||
logoDisplay: z.enum(headerLogoDisplayValues).default("logoAndText"),
|
||||
logoDisplay: z.enum(headerLogoDisplayValues).default("logo"),
|
||||
zones: headerZonesSchema,
|
||||
})
|
||||
.strict();
|
||||
@@ -154,7 +154,7 @@ const migrateLegacyItems = (
|
||||
version: headerPreferencesVersion,
|
||||
visible,
|
||||
searchDisplay: "input",
|
||||
logoDisplay: "logoAndText",
|
||||
logoDisplay: "logo",
|
||||
zones: {
|
||||
left: zones.left.map(createBuiltinHeaderItem),
|
||||
center: zones.center.map(createBuiltinHeaderItem),
|
||||
@@ -208,7 +208,7 @@ export const defaultHeaderPreferences = {
|
||||
version: headerPreferencesVersion,
|
||||
visible: true,
|
||||
searchDisplay: "input",
|
||||
logoDisplay: "logoAndText",
|
||||
logoDisplay: "logo",
|
||||
zones: {
|
||||
left: [createBuiltinHeaderItem("logo")],
|
||||
center: [createBuiltinHeaderItem("search")],
|
||||
|
||||
@@ -8,7 +8,7 @@ export const { definition, componentLoader } = createWidgetDefinition("anchorNot
|
||||
supportsAdvancedFocus: true,
|
||||
queryKey: [["widget", "anchorNotes"]],
|
||||
maxIntegrations: 1,
|
||||
supportedIntegrations: ["anchor", "mock"],
|
||||
supportedIntegrations: ["anchor"],
|
||||
createOptions() {
|
||||
return optionsBuilder.from((factory) => ({
|
||||
noteId: factory.anchorNote(),
|
||||
|
||||
@@ -14,5 +14,5 @@ export const { definition, componentLoader } = createWidgetDefinition("archiveTe
|
||||
}),
|
||||
}));
|
||||
},
|
||||
supportedIntegrations: ["archiveTeamWarrior", "mock"],
|
||||
supportedIntegrations: ["archiveTeamWarrior"],
|
||||
}).withDynamicImport(() => import("./component"));
|
||||
@@ -5,7 +5,6 @@ import { Text } from "@mantine/core";
|
||||
|
||||
import type { AudiobookshelfDashboardData, NavidromeDashboardData } from "@homarr/integrations/types";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import classes from "./component.module.css";
|
||||
import type { AudioStatsBackend, AudioStatsDisplayOptions } from "./shared";
|
||||
@@ -67,7 +66,7 @@ export function AudioStatsContent({
|
||||
>
|
||||
{visibleStats.map(({ optionKey, statKey, value, Icon }) => (
|
||||
<div key={optionKey} className={`${classes.statTile} ${statTileClassByCompact[compactKey]}`}>
|
||||
<Icon className={classes.statIcon} style={zoomCompensatedSize(iconSize)} stroke={1.5} />
|
||||
<Icon className={classes.statIcon} size={iconSize} stroke={1.5} />
|
||||
<span className={classes.statValue}>{value}</span>
|
||||
<span className={classes.statLabel}>{t(statKey as never)}</span>
|
||||
</div>
|
||||
|
||||
@@ -4,8 +4,7 @@ import { createWidgetDefinition, matchesWidgetRuntimeQuery } from "../definition
|
||||
import { optionsBuilder } from "../options";
|
||||
|
||||
const hideUnlessNavidrome = {
|
||||
shouldHide: (_: unknown, integrationKinds: string[]) =>
|
||||
!integrationKinds.includes("navidrome") && !integrationKinds.includes("mock"),
|
||||
shouldHide: (_: unknown, integrationKinds: string[]) => !integrationKinds.includes("navidrome"),
|
||||
};
|
||||
|
||||
const hideUnlessAudiobookshelf = {
|
||||
@@ -17,7 +16,7 @@ export const { definition, componentLoader } = createWidgetDefinition("audioStat
|
||||
supportsAdvancedFocus: true,
|
||||
queryKeys: [[["widget", "audioStats", "getStats"]], [["widget", "mediaServer", "getCurrentStreams"]]],
|
||||
queryMatcher: matchesWidgetRuntimeQuery,
|
||||
supportedIntegrations: ["navidrome", "audiobookshelf", "mock"],
|
||||
supportedIntegrations: ["navidrome", "audiobookshelf"],
|
||||
integrationsRequired: true,
|
||||
maxIntegrations: 1,
|
||||
createOptions() {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { IconAlertTriangle, IconBell, IconDeviceTv, IconMovie, IconPlugConnected
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { getIntegrationName } from "@homarr/definitions";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { WidgetEmptyState } from "../common/empty-state";
|
||||
import type { WidgetComponentProps } from "../definition";
|
||||
@@ -123,7 +122,7 @@ export default function BazarrWidget({
|
||||
|
||||
return (
|
||||
<div key={statKey} className={`${classes.statTile} ${isWarning ? classes.statTileWarning : ""}`}>
|
||||
<Icon className={classes.statIcon} style={zoomCompensatedSize(iconSize)} stroke={1.5} />
|
||||
<Icon className={classes.statIcon} size={iconSize} stroke={1.5} />
|
||||
<span className={`${classes.statValue} ${isWarning ? classes.statValueWarning : ""}`}>
|
||||
{typeof value === "string" && value.trim() === "" ? "—" : value}
|
||||
</span>
|
||||
|
||||
@@ -6,7 +6,7 @@ import { optionsBuilder } from "../options";
|
||||
export const { definition, componentLoader } = createWidgetDefinition("bazarr", {
|
||||
supportsAdvancedFocus: true,
|
||||
icon: IconBadgeCc,
|
||||
supportedIntegrations: ["bazarr", "mock"],
|
||||
supportedIntegrations: ["bazarr"],
|
||||
integrationsRequired: true,
|
||||
maxIntegrations: 1,
|
||||
createOptions() {
|
||||
|
||||
@@ -35,7 +35,6 @@ import { formatBytes } from "@homarr/common";
|
||||
import { invariantTechnicalLabels } from "@homarr/definitions";
|
||||
import { useModalAction } from "@homarr/modals";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import classes from "./component.module.css";
|
||||
|
||||
@@ -208,7 +207,7 @@ const metricRenderers: BeszelMetricRenderer[] = [
|
||||
render: (s: BeszelSystemRow, t: SystemCardProps["t"], sz: SizeConfig) => (
|
||||
<MetricRow
|
||||
key="cpu"
|
||||
icon={<Cpu style={zoomCompensatedSize(sz.iconSize)} />}
|
||||
icon={<Cpu size={sz.iconSize} />}
|
||||
label={invariantTechnicalLabels.cpu}
|
||||
value={formatPercent(s.cpu)}
|
||||
progress={{ value: s.cpu, color: thresholdColor(s.cpu) }}
|
||||
@@ -223,7 +222,7 @@ const metricRenderers: BeszelMetricRenderer[] = [
|
||||
render: (s: BeszelSystemRow, t: SystemCardProps["t"], sz: SizeConfig) => (
|
||||
<MetricRow
|
||||
key="mem"
|
||||
icon={<MemoryStick style={zoomCompensatedSize(sz.iconSize)} />}
|
||||
icon={<MemoryStick size={sz.iconSize} />}
|
||||
label={t("metric.memory")}
|
||||
value={formatPercent(s.memory)}
|
||||
progress={{ value: s.memory, color: thresholdColor(s.memory) }}
|
||||
@@ -237,7 +236,7 @@ const metricRenderers: BeszelMetricRenderer[] = [
|
||||
key: "showDisk",
|
||||
render: (s: BeszelSystemRow, t: SystemCardProps["t"], sz: SizeConfig) => (
|
||||
<Group key="disk" gap="xs" wrap="nowrap" justify="space-between" style={{ minHeight: sz.rowHeight }}>
|
||||
<HardDrive style={zoomCompensatedSize(sz.iconSize)} />
|
||||
<HardDrive size={sz.iconSize} />
|
||||
<Text size={sz.fontSize} c="dimmed" w={sz.labelMiw} style={{ whiteSpace: "nowrap", flexShrink: 0 }}>
|
||||
{t("metric.disk")}
|
||||
</Text>
|
||||
@@ -252,7 +251,7 @@ const metricRenderers: BeszelMetricRenderer[] = [
|
||||
render: (s: BeszelSystemRow, t: SystemCardProps["t"], sz: SizeConfig) => (
|
||||
<MetricRow
|
||||
key="gpu"
|
||||
icon={<Monitor style={zoomCompensatedSize(sz.iconSize)} />}
|
||||
icon={<Monitor size={sz.iconSize} />}
|
||||
label={invariantTechnicalLabels.gpu}
|
||||
value={formatPercent(s.gpu)}
|
||||
progress={{ value: s.gpu, color: thresholdColor(s.gpu) }}
|
||||
@@ -267,7 +266,7 @@ const metricRenderers: BeszelMetricRenderer[] = [
|
||||
render: (s: BeszelSystemRow, t: SystemCardProps["t"], sz: SizeConfig) => (
|
||||
<MetricRow
|
||||
key="la"
|
||||
icon={<Activity style={zoomCompensatedSize(sz.iconSize)} />}
|
||||
icon={<Activity size={sz.iconSize} />}
|
||||
label={t("metric.loadAvg")}
|
||||
value={formatLoadAvg(s.loadAvg)}
|
||||
size={sz}
|
||||
@@ -281,7 +280,7 @@ const metricRenderers: BeszelMetricRenderer[] = [
|
||||
render: (s: BeszelSystemRow, t: SystemCardProps["t"], sz: SizeConfig) => (
|
||||
<MetricRow
|
||||
key="net"
|
||||
icon={<Network style={zoomCompensatedSize(sz.iconSize)} />}
|
||||
icon={<Network size={sz.iconSize} />}
|
||||
label={t("metric.net")}
|
||||
value={formatByteRate(s.netBytes)}
|
||||
size={sz}
|
||||
@@ -295,7 +294,7 @@ const metricRenderers: BeszelMetricRenderer[] = [
|
||||
render: (s: BeszelSystemRow, t: SystemCardProps["t"], sz: SizeConfig) => (
|
||||
<MetricRow
|
||||
key="temp"
|
||||
icon={<Thermometer style={zoomCompensatedSize(sz.iconSize)} />}
|
||||
icon={<Thermometer size={sz.iconSize} />}
|
||||
label={t("metric.temp")}
|
||||
value={formatTemp(s.temp, false)}
|
||||
size={sz}
|
||||
@@ -312,7 +311,7 @@ const metricRenderers: BeszelMetricRenderer[] = [
|
||||
return (
|
||||
<MetricRow
|
||||
key="bat"
|
||||
icon={<Icon style={zoomCompensatedSize(sz.iconSize)} />}
|
||||
icon={<Icon size={sz.iconSize} />}
|
||||
label={t("metric.battery")}
|
||||
value={`${s.battery?.[0] ?? 0}%`}
|
||||
size={sz}
|
||||
@@ -327,7 +326,7 @@ const metricRenderers: BeszelMetricRenderer[] = [
|
||||
render: (s: BeszelSystemRow, _t: SystemCardProps["t"], sz: SizeConfig, tCommon: SystemCardProps["tCommon"]) => (
|
||||
<MetricRow
|
||||
key="svc"
|
||||
icon={<Server style={zoomCompensatedSize(sz.iconSize)} />}
|
||||
icon={<Server size={sz.iconSize} />}
|
||||
label={tCommon("services")}
|
||||
value={String(s.services)}
|
||||
size={sz}
|
||||
@@ -341,7 +340,7 @@ const metricRenderers: BeszelMetricRenderer[] = [
|
||||
render: (s: BeszelSystemRow, t: SystemCardProps["t"], sz: SizeConfig) => (
|
||||
<MetricRow
|
||||
key="up"
|
||||
icon={<Activity style={zoomCompensatedSize(sz.iconSize)} />}
|
||||
icon={<Activity size={sz.iconSize} />}
|
||||
label={t("metric.uptime")}
|
||||
value={formatUptime(s.uptime)}
|
||||
size={sz}
|
||||
@@ -355,7 +354,7 @@ const metricRenderers: BeszelMetricRenderer[] = [
|
||||
render: (s: BeszelSystemRow, t: SystemCardProps["t"], sz: SizeConfig) => (
|
||||
<MetricRow
|
||||
key="agent"
|
||||
icon={<Wifi style={zoomCompensatedSize(sz.iconSize)} />}
|
||||
icon={<Wifi size={sz.iconSize} />}
|
||||
label={t("metric.agent")}
|
||||
value={s.agentVersion}
|
||||
size={sz}
|
||||
@@ -488,7 +487,7 @@ export default function BeszelSystemGridWidget({
|
||||
</Group>
|
||||
<Center h="100%">
|
||||
<Stack align="center" gap="xs">
|
||||
<IconServerOff style={zoomCompensatedSize(28)} opacity={0.5} />
|
||||
<IconServerOff size={28} opacity={0.5} />
|
||||
<Text size="sm" c="dimmed">
|
||||
{t("empty.noSystems")}
|
||||
</Text>
|
||||
|
||||
@@ -11,7 +11,6 @@ import { constructBoardPermissions } from "@homarr/auth/shared";
|
||||
import { useOptionalBoard } from "@homarr/boards/context";
|
||||
import { showErrorNotification } from "@homarr/notifications";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { iconSizes, zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import classes from "./component.module.css";
|
||||
|
||||
@@ -148,7 +147,7 @@ export default function BeszelSystemStatsWidget({
|
||||
</Group>
|
||||
<Center h="100%">
|
||||
<Stack align="center" gap="xs">
|
||||
<IconServerOff style={zoomCompensatedSize(28)} opacity={0.5} />
|
||||
<IconServerOff size={28} opacity={0.5} />
|
||||
<Text size="sm" c="dimmed">
|
||||
{tBeszel("empty.noSystems")}
|
||||
</Text>
|
||||
@@ -162,7 +161,7 @@ export default function BeszelSystemStatsWidget({
|
||||
return (
|
||||
<Center h="100%">
|
||||
<Stack align="center" gap="sm" p="md">
|
||||
<IconQuestionMark style={zoomCompensatedSize(40)} />
|
||||
<IconQuestionMark size={40} />
|
||||
<Text size="sm" c="dimmed" ta="center">
|
||||
{t("error.systemNotFound")}
|
||||
</Text>
|
||||
@@ -200,7 +199,7 @@ export default function BeszelSystemStatsWidget({
|
||||
<Button
|
||||
variant="default"
|
||||
size="compact-xs"
|
||||
leftSection={<IconServer style={iconSizes.sm} />}
|
||||
leftSection={<IconServer size="var(--mantine-font-size-sm)" />}
|
||||
className={classes.beszelStatsSystemToggle}
|
||||
disabled={isSelectionSavePending}
|
||||
>
|
||||
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { useSession } from "@homarr/auth/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
import { constructBoardPermissions } from "@homarr/auth/shared";
|
||||
import { useOptionalBoard } from "@homarr/boards/context";
|
||||
import { formatBytes } from "@homarr/common";
|
||||
@@ -203,7 +202,7 @@ export default function BeszelSystemTableWidget({
|
||||
ellipsis: true,
|
||||
title: (
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<Server style={zoomCompensatedSize(size.iconSize)} />
|
||||
<Server size={size.iconSize} />
|
||||
<Text inherit>{tBeszel("metric.system")}</Text>
|
||||
</Group>
|
||||
),
|
||||
@@ -270,7 +269,7 @@ export default function BeszelSystemTableWidget({
|
||||
width: 140,
|
||||
title: (
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<Cpu style={zoomCompensatedSize(size.iconSize)} />
|
||||
<Cpu size={size.iconSize} />
|
||||
<Text inherit>{invariantTechnicalLabels.cpu}</Text>
|
||||
</Group>
|
||||
),
|
||||
@@ -282,7 +281,7 @@ export default function BeszelSystemTableWidget({
|
||||
width: 140,
|
||||
title: (
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<MemoryStick style={zoomCompensatedSize(size.iconSize)} />
|
||||
<MemoryStick size={size.iconSize} />
|
||||
<Text inherit>{tBeszel("metric.memory")}</Text>
|
||||
</Group>
|
||||
),
|
||||
@@ -294,7 +293,7 @@ export default function BeszelSystemTableWidget({
|
||||
width: 160,
|
||||
title: (
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<HardDrive style={zoomCompensatedSize(size.iconSize)} />
|
||||
<HardDrive size={size.iconSize} />
|
||||
<Text inherit>{tBeszel("metric.disk")}</Text>
|
||||
</Group>
|
||||
),
|
||||
@@ -314,7 +313,7 @@ export default function BeszelSystemTableWidget({
|
||||
width: 140,
|
||||
title: (
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<Monitor style={zoomCompensatedSize(size.iconSize)} />
|
||||
<Monitor size={size.iconSize} />
|
||||
<Text inherit>{invariantTechnicalLabels.gpu}</Text>
|
||||
</Group>
|
||||
),
|
||||
@@ -326,7 +325,7 @@ export default function BeszelSystemTableWidget({
|
||||
width: 100,
|
||||
title: (
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<Activity style={zoomCompensatedSize(size.iconSize)} />
|
||||
<Activity size={size.iconSize} />
|
||||
<Text inherit>{tBeszel("metric.loadAvg")}</Text>
|
||||
</Group>
|
||||
),
|
||||
@@ -348,7 +347,7 @@ export default function BeszelSystemTableWidget({
|
||||
width: 100,
|
||||
title: (
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<Network style={zoomCompensatedSize(size.iconSize)} />
|
||||
<Network size={size.iconSize} />
|
||||
<Text inherit>{tBeszel("metric.net")}</Text>
|
||||
</Group>
|
||||
),
|
||||
@@ -364,7 +363,7 @@ export default function BeszelSystemTableWidget({
|
||||
width: 80,
|
||||
title: (
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<Thermometer style={zoomCompensatedSize(size.iconSize)} />
|
||||
<Thermometer size={size.iconSize} />
|
||||
<Text inherit>{tBeszel("metric.temp")}</Text>
|
||||
</Group>
|
||||
),
|
||||
@@ -376,7 +375,7 @@ export default function BeszelSystemTableWidget({
|
||||
width: 70,
|
||||
title: (
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<Battery style={zoomCompensatedSize(size.iconSize)} />
|
||||
<Battery size={size.iconSize} />
|
||||
<Text inherit>{tBeszel("metric.battery")}</Text>
|
||||
</Group>
|
||||
),
|
||||
@@ -387,7 +386,7 @@ export default function BeszelSystemTableWidget({
|
||||
width: 80,
|
||||
title: (
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<Server style={zoomCompensatedSize(size.iconSize)} />
|
||||
<Server size={size.iconSize} />
|
||||
<Text inherit>{tCommon("services")}</Text>
|
||||
</Group>
|
||||
),
|
||||
@@ -399,7 +398,7 @@ export default function BeszelSystemTableWidget({
|
||||
width: 90,
|
||||
title: (
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<Activity style={zoomCompensatedSize(size.iconSize)} />
|
||||
<Activity size={size.iconSize} />
|
||||
<Text inherit>{tBeszel("metric.uptime")}</Text>
|
||||
</Group>
|
||||
),
|
||||
@@ -411,7 +410,7 @@ export default function BeszelSystemTableWidget({
|
||||
width: 90,
|
||||
title: (
|
||||
<Group gap={4} wrap="nowrap">
|
||||
<Wifi style={zoomCompensatedSize(size.iconSize)} />
|
||||
<Wifi size={size.iconSize} />
|
||||
<Text inherit>{tBeszel("metric.agent")}</Text>
|
||||
</Group>
|
||||
),
|
||||
|
||||
@@ -8,7 +8,6 @@ import { clientApi } from "@homarr/api/client";
|
||||
import { invariantTechnicalLabels } from "@homarr/definitions";
|
||||
import type { BeszelContainerStatsRecord, BeszelSystemStatsRecord } from "@homarr/integrations/types";
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { getUsableWidgetQueryData } from "../../common/query-state";
|
||||
import { containerColors } from "./colors";
|
||||
@@ -210,7 +209,7 @@ export function BeszelStatsView({
|
||||
return (
|
||||
<Center h={CHART_HEIGHT}>
|
||||
<Stack align="center" gap="sm" p="md">
|
||||
<IconPlugConnectedX style={zoomCompensatedSize(40)} />
|
||||
<IconPlugConnectedX size={40} />
|
||||
<Text size="sm" c="dimmed" ta="center">
|
||||
{t("error.liveConnectionFailed")}
|
||||
</Text>
|
||||
@@ -239,7 +238,7 @@ export function BeszelStatsView({
|
||||
return (
|
||||
<Center h={CHART_HEIGHT}>
|
||||
<Stack align="center" gap="xs">
|
||||
<IconServerOff style={zoomCompensatedSize(24)} opacity={0.5} />
|
||||
<IconServerOff size={24} opacity={0.5} />
|
||||
<Text size="sm" c="dimmed">
|
||||
{tBeszel("error.internalServerError")}
|
||||
</Text>
|
||||
|
||||
@@ -21,7 +21,6 @@ import { clientApi } from "@homarr/api/client";
|
||||
import { useRequiredBoard } from "@homarr/boards/context";
|
||||
import { useRegisterSpotlightContextResults } from "@homarr/spotlight";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { iconSizes, zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { getSafeAppHref, SAFE_NEW_TAB_REL } from "../common/application-url";
|
||||
import { getUsableWidgetQueryData, isInitialWidgetQueryPending } from "../common/query-state";
|
||||
@@ -142,7 +141,7 @@ export default function BookmarksWidget({
|
||||
<Center flex={1}>
|
||||
<Stack align="center" gap={6}>
|
||||
<ThemeIcon variant="light" size="lg" radius="xl">
|
||||
<IconBookmark style={iconSizes.xl} />
|
||||
<IconBookmark size={20} />
|
||||
</ThemeIcon>
|
||||
<Text size="sm" c="dimmed" ta="center">
|
||||
{t("empty")}
|
||||
@@ -263,7 +262,7 @@ const BookmarkCard = ({
|
||||
transition: reduceMotion ? undefined : "opacity 120ms ease, transform 120ms ease",
|
||||
}}
|
||||
>
|
||||
<IconArrowUpRight style={iconSizes.sm} />
|
||||
<IconArrowUpRight size={14} />
|
||||
</ThemeIcon>
|
||||
) : null}
|
||||
</Group>
|
||||
@@ -340,7 +339,7 @@ const BookmarkAvatar = ({ bookmark, iconUrl, size }: { bookmark: BookmarkItem; i
|
||||
imageProps={{ referrerPolicy: "no-referrer" }}
|
||||
styles={{ image: { objectFit: "contain" } }}
|
||||
>
|
||||
<IconLink style={zoomCompensatedSize(Math.max(14, size / 2))} />
|
||||
<IconLink size={Math.max(14, size / 2)} />
|
||||
</Avatar>
|
||||
);
|
||||
|
||||
|
||||
@@ -95,14 +95,7 @@ const NotificationIndicator = ({ events, size, visible }: NotificationIndicatorP
|
||||
>
|
||||
{notificationEvents.map((notificationEvent) => {
|
||||
return (
|
||||
<Box
|
||||
key={notificationEvent}
|
||||
bg={notificationEvent}
|
||||
h={size}
|
||||
w={size * 2}
|
||||
p={0}
|
||||
style={{ borderRadius: 999 }}
|
||||
/>
|
||||
<Box key={notificationEvent} bg={notificationEvent} h={size} w={size} p={0} style={{ borderRadius: 999 }} />
|
||||
);
|
||||
})}
|
||||
</Flex>
|
||||
|
||||
@@ -16,7 +16,6 @@ import { IconAlertTriangle, IconClock } from "@tabler/icons-react";
|
||||
import type { Dayjs } from "dayjs";
|
||||
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
import { iconSizes } from "@homarr/ui";
|
||||
|
||||
import { formatLocalizedDate, formatLocalizedTime } from "../common/locale";
|
||||
import type { WidgetComponentProps } from "../definition";
|
||||
@@ -103,7 +102,7 @@ const PrimaryClock = ({ now, options, primary }: Pick<ModeProps, "now" | "option
|
||||
<Stack gap={5} miw={0}>
|
||||
<Group gap="xs" wrap="nowrap">
|
||||
<ThemeIcon color={getPhaseColor(primary.phase)} variant="light" radius="xl" size="md">
|
||||
<IconClock style={iconSizes.md} />
|
||||
<IconClock size={16} />
|
||||
</ThemeIcon>
|
||||
<Title order={2} size="h4" fw={600}>
|
||||
{primary.label}
|
||||
|
||||
@@ -47,7 +47,7 @@ export default function ClockWidget({ options, width, height, displayMode }: Wid
|
||||
return (
|
||||
<Box className="clock-widget-container" h="100%" pos="relative">
|
||||
{showWeatherCorner && (
|
||||
<Box pos="absolute" top={2} left={4}>
|
||||
<Box pos="absolute" top={4} left={4}>
|
||||
<ClockWeatherSummary
|
||||
latitude={options.weatherLocation.latitude}
|
||||
longitude={options.weatherLocation.longitude}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Box, Group, Loader, Stack, Text } from "@mantine/core";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { isInitialWidgetQueryPending } from "../common/query-state";
|
||||
import { AnimatedWeatherIcon } from "../weather/animated-icon";
|
||||
@@ -47,35 +46,20 @@ export const ClockWeatherSummary = ({
|
||||
};
|
||||
|
||||
return (
|
||||
<Stack gap={detailed ? 3 : 2} align={detailed ? "flex-start" : "center"}>
|
||||
{detailed ? (
|
||||
<Group gap={5} wrap="nowrap">
|
||||
<AnimatedWeatherIcon
|
||||
animated={animateIcon}
|
||||
code={weather.current.weatherCode}
|
||||
isDay={weather.current.isDay}
|
||||
style={zoomCompensatedSize(28)}
|
||||
/>
|
||||
<Text size="sm" fw={600}>
|
||||
{Math.round(temperature)}
|
||||
{unit}
|
||||
</Text>
|
||||
<WeatherDescription weatherOnly weatherCode={weather.current.weatherCode} />
|
||||
</Group>
|
||||
) : (
|
||||
<Stack gap={1} align="center">
|
||||
<AnimatedWeatherIcon
|
||||
animated={animateIcon}
|
||||
code={weather.current.weatherCode}
|
||||
isDay={weather.current.isDay}
|
||||
style={zoomCompensatedSize(26)}
|
||||
/>
|
||||
<Text size="xs" c="dimmed">
|
||||
{Math.round(temperature)}
|
||||
{unit}
|
||||
</Text>
|
||||
</Stack>
|
||||
)}
|
||||
<Stack gap={detailed ? 3 : 0} align="flex-start">
|
||||
<Group gap={5} wrap="nowrap">
|
||||
<AnimatedWeatherIcon
|
||||
animated={animateIcon}
|
||||
code={weather.current.weatherCode}
|
||||
isDay={weather.current.isDay}
|
||||
size={detailed ? 28 : 22}
|
||||
/>
|
||||
<Text size={detailed ? "sm" : "xs"} fw={detailed ? 600 : undefined} c={detailed ? undefined : "dimmed"}>
|
||||
{Math.round(temperature)}
|
||||
{unit}
|
||||
</Text>
|
||||
{detailed && <WeatherDescription weatherOnly weatherCode={weather.current.weatherCode} />}
|
||||
</Group>
|
||||
{detailed && (
|
||||
<Box>
|
||||
<Text size="xs" fw={600} lineClamp={1}>
|
||||
|
||||
@@ -19,7 +19,7 @@ export const { definition, componentLoader } = createWidgetDefinition("coolify",
|
||||
}),
|
||||
}));
|
||||
},
|
||||
supportedIntegrations: ["coolify", "mock"],
|
||||
supportedIntegrations: ["coolify"],
|
||||
errors: {
|
||||
INTERNAL_SERVER_ERROR: {
|
||||
icon: IconServerOff,
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
} from "@tabler/icons-react";
|
||||
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import actionTargetClasses from "../common/action-target.module.css";
|
||||
import { getSafeApplicationUrl, SAFE_NEW_TAB_REL } from "../common/application-url";
|
||||
@@ -74,11 +73,7 @@ export function ResourceRow({ item, baseUrl, isTiny, resourceType }: ResourceRow
|
||||
return (
|
||||
<Stack gap={0}>
|
||||
<Group wrap="nowrap" gap={isTiny ? 4 : "xs"}>
|
||||
<StatusIcon
|
||||
aria-label={statusLabel}
|
||||
style={zoomCompensatedSize(isTiny ? 12 : 16)}
|
||||
color={`var(--mantine-color-${statusColor}-6)`}
|
||||
/>
|
||||
<StatusIcon aria-label={statusLabel} size={isTiny ? 12 : 16} color={`var(--mantine-color-${statusColor}-6)`} />
|
||||
{resourceUrl ? (
|
||||
<Anchor
|
||||
className={actionTargetClasses.root}
|
||||
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
import { IconBell, IconBellOff, IconHourglass } from "@tabler/icons-react";
|
||||
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
import { iconSizes } from "@homarr/ui";
|
||||
|
||||
import {
|
||||
claimBrowserAlertOccurrence,
|
||||
@@ -340,13 +339,7 @@ const AlertControls = ({
|
||||
disabled={disabled || notificationPermission === "unsupported" || notificationPermission === "denied"}
|
||||
onChange={(event) => void onNotificationsChange(event.currentTarget.checked)}
|
||||
label={t("notifications")}
|
||||
thumbIcon={
|
||||
preferences.notifications ? (
|
||||
<IconBell style={iconSizes.sm} />
|
||||
) : (
|
||||
<IconBellOff style={iconSizes.sm} />
|
||||
)
|
||||
}
|
||||
thumbIcon={preferences.notifications ? <IconBell size={12} /> : <IconBellOff size={12} />}
|
||||
/>
|
||||
{notificationPermission === "denied" && (
|
||||
<Text size="xs" c="dimmed" mt="xs">
|
||||
|
||||
@@ -7,7 +7,7 @@ import { IconAlertTriangle } from "@tabler/icons-react";
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { useSession } from "@homarr/auth/client";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { Link, zoomCompensatedSize } from "@homarr/ui";
|
||||
import { Link } from "@homarr/ui";
|
||||
|
||||
import type { WidgetComponentProps } from "../definition";
|
||||
import { isLegacyCustomWidgetMigrationError, isTerminalCustomWidgetDefinitionError } from "./migration-state";
|
||||
@@ -107,10 +107,7 @@ function Unavailable({
|
||||
return (
|
||||
<Center h="100%" p="sm">
|
||||
<Stack align="center" gap="xs">
|
||||
<IconAlertTriangle
|
||||
style={zoomCompensatedSize(32)}
|
||||
color={`var(--mantine-color-${danger ? "red" : "yellow"}-6)`}
|
||||
/>
|
||||
<IconAlertTriangle size={32} color={`var(--mantine-color-${danger ? "red" : "yellow"}-6)`} />
|
||||
<Text c="dimmed" size="sm" ta="center">
|
||||
{message}
|
||||
</Text>
|
||||
|
||||
@@ -26,7 +26,6 @@ import type { DnsHoleSummary } from "@homarr/integrations/types";
|
||||
import type { stringOrTranslation, TranslationFunction } from "@homarr/translation";
|
||||
import { translateIfNecessary } from "@homarr/translation";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
import type { TablerIcon } from "@homarr/ui";
|
||||
|
||||
import type { widgetKind } from ".";
|
||||
@@ -215,14 +214,7 @@ const StatCard = ({ item, data, usePiHoleColors, t }: StatCardProps) => {
|
||||
direction={isLong ? "row" : "column"}
|
||||
gap={0}
|
||||
>
|
||||
<item.icon
|
||||
className="summary-card-icon"
|
||||
style={{
|
||||
...zoomCompensatedSize(24),
|
||||
minWidth: "calc(24px * var(--board-canvas-ui-scale, 1))",
|
||||
minHeight: "calc(24px * var(--board-canvas-ui-scale, 1))",
|
||||
}}
|
||||
/>
|
||||
<item.icon className="summary-card-icon" size={24} style={{ minWidth: 24, minHeight: 24 }} />
|
||||
<Flex
|
||||
className="summary-card-texts"
|
||||
justify="center"
|
||||
|
||||
@@ -44,7 +44,6 @@ import { useModalAction } from "@homarr/modals";
|
||||
import { AddDockerAppToHomarr, useDockerContainerRemovalConfirmation } from "@homarr/modals-collection";
|
||||
import { showErrorNotification, showSuccessNotification } from "@homarr/notifications";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import type { WidgetComponentProps } from "../definition";
|
||||
import { getUsableWidgetQueryData } from "../common/query-state";
|
||||
@@ -83,7 +82,7 @@ const containerMenuWidth = 240;
|
||||
const rowActionButtonSize = 22;
|
||||
const rowActionIconVisualSize = 32;
|
||||
const footerRefreshButtonSize = 24;
|
||||
const footerRefreshIconVisualSize = 18;
|
||||
const footerRefreshIconVisualSize = 30;
|
||||
|
||||
const createContainerLogsPath = (container: Pick<DockerContainer, "endpointId" | "id" | "name">) =>
|
||||
`/manage/tools/docker/logs/${container.id}?name=${encodeURIComponent(container.name)}&endpointId=${encodeURIComponent(container.endpointId)}`;
|
||||
@@ -494,13 +493,8 @@ export default function DockerWidget({
|
||||
style={{ position: "relative", overflow: "visible" }}
|
||||
>
|
||||
<IconRefresh
|
||||
style={{
|
||||
...zoomCompensatedSize(footerRefreshIconVisualSize),
|
||||
position: "absolute",
|
||||
top: "50%",
|
||||
left: "50%",
|
||||
transform: "translate(-50%, -50%)",
|
||||
}}
|
||||
size={footerRefreshIconVisualSize}
|
||||
style={{ position: "absolute", top: "50%", left: "50%", transform: "translate(-50%, -50%)" }}
|
||||
/>
|
||||
</ActionIcon>
|
||||
</Tooltip>
|
||||
|
||||
@@ -5,7 +5,7 @@ import { useSession } from "@homarr/auth/client";
|
||||
import type { stringOrTranslation } from "@homarr/translation";
|
||||
import { translateIfNecessary } from "@homarr/translation";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { Link, zoomCompensatedSize } from "@homarr/ui";
|
||||
import { Link } from "@homarr/ui";
|
||||
import type { TablerIcon } from "@homarr/ui";
|
||||
|
||||
export interface BaseWidgetErrorProps {
|
||||
@@ -23,7 +23,7 @@ export const BaseWidgetError = (props: BaseWidgetErrorProps) => {
|
||||
|
||||
return (
|
||||
<Stack h="100%" align="center" justify="center" gap="md" data-homarr-widget-error>
|
||||
<props.icon style={zoomCompensatedSize(40)} />
|
||||
<props.icon size={40} />
|
||||
<Stack gap={0}>
|
||||
<Text ta="center">{translateIfNecessary(t, props.message)}</Text>
|
||||
{props.showLogsLink && session?.user.permissions.includes("other-view-logs") && (
|
||||
|
||||
@@ -22,7 +22,6 @@ import { clientApi } from "@homarr/api/client";
|
||||
import { invariantTechnicalLabels } from "@homarr/definitions";
|
||||
import type { FirewallInterfacesSummary } from "@homarr/integrations";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import type { WidgetComponentProps } from "../definition";
|
||||
import { calculateBandwidth, formatBitsPerSec } from "./bandwidth";
|
||||
@@ -330,7 +329,7 @@ const MetricRing = ({ value, icon: Icon, size, label, t }: MetricRingProps) => {
|
||||
label={
|
||||
<Center style={{ flexDirection: "column" }}>
|
||||
<Text size="xs">{safeValue.toFixed(1)}%</Text>
|
||||
{showIcon && <Icon style={zoomCompensatedSize(size < 96 ? 12 : 16)} />}
|
||||
{showIcon && <Icon size={size < 96 ? 12 : 16} />}
|
||||
{showStatus && <Text size="xs">{statusLabel}</Text>}
|
||||
</Center>
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export const { definition, componentLoader } = createWidgetDefinition("firewall"
|
||||
createOptions() {
|
||||
return optionsBuilder.from(() => ({}));
|
||||
},
|
||||
supportedIntegrations: [...getIntegrationKindsByCategory("firewall"), "mock"],
|
||||
supportedIntegrations: getIntegrationKindsByCategory("firewall"),
|
||||
errors: {
|
||||
INTERNAL_SERVER_ERROR: {
|
||||
icon: IconWallOff,
|
||||
|
||||
@@ -6,7 +6,6 @@ import { clientApi } from "@homarr/api/client";
|
||||
import { invariantTechnicalLabels } from "@homarr/definitions";
|
||||
import type { Resource } from "@homarr/integrations/types";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { WidgetEmptyState } from "../../common/empty-state";
|
||||
import { getUsableWidgetQueryData } from "../../common/query-state";
|
||||
@@ -186,7 +185,7 @@ const SummaryHeader = ({ cpu, memory, isTiny }: SummaryHeaderProps) => {
|
||||
thickness={isTiny ? 2 : 4}
|
||||
label={
|
||||
<Center>
|
||||
<IconCpu style={zoomCompensatedSize(isTiny ? 12 : 20)} />
|
||||
<IconCpu size={isTiny ? 12 : 20} />
|
||||
</Center>
|
||||
}
|
||||
sections={[{ value: cpu.value, color: cpu.value > 75 ? "orange" : "green" }]}
|
||||
@@ -209,7 +208,7 @@ const SummaryHeader = ({ cpu, memory, isTiny }: SummaryHeaderProps) => {
|
||||
thickness={isTiny ? 2 : 4}
|
||||
label={
|
||||
<Center>
|
||||
<IconBrain style={zoomCompensatedSize(isTiny ? 12 : 20)} />
|
||||
<IconBrain size={isTiny ? 12 : 20} />
|
||||
</Center>
|
||||
}
|
||||
sections={[{ value: memory.value, color: memory.value > 75 ? "orange" : "green" }]}
|
||||
|
||||
@@ -19,7 +19,6 @@ import duration from "dayjs/plugin/duration";
|
||||
import { capitalize, formatBytes, formatBytesPair } from "@homarr/common";
|
||||
import type { ComputeResource, Resource, StorageResource } from "@homarr/integrations/types";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
dayjs.extend(duration);
|
||||
|
||||
@@ -198,18 +197,17 @@ const StorageType = ({ item }: { item: StorageResource }) => {
|
||||
};
|
||||
|
||||
const ResourceIcon = ({ type, size }: { type: Resource["type"]; size: number }) => {
|
||||
const style = zoomCompensatedSize(size);
|
||||
switch (type) {
|
||||
case "node":
|
||||
return <IconServer style={style} />;
|
||||
return <IconServer size={size} />;
|
||||
case "lxc":
|
||||
return <IconDeviceLaptop style={style} />;
|
||||
return <IconDeviceLaptop size={size} />;
|
||||
case "qemu":
|
||||
return <IconDeviceLaptop style={style} />;
|
||||
return <IconDeviceLaptop size={size} />;
|
||||
case "storage":
|
||||
return <IconDatabase style={style} />;
|
||||
return <IconDatabase size={size} />;
|
||||
default:
|
||||
console.error(`Unknown resource type: ${type as string}`);
|
||||
return <IconQuestionMark style={style} />;
|
||||
return <IconQuestionMark size={size} />;
|
||||
}
|
||||
};
|
||||
@@ -1,8 +1,6 @@
|
||||
import { Center, RingProgress, Text } from "@mantine/core";
|
||||
import { IconCpu } from "@tabler/icons-react";
|
||||
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { progressColor } from "../system-health";
|
||||
|
||||
export const CpuRing = ({ cpuUtilization, isTiny }: { cpuUtilization: number; isTiny: boolean }) => {
|
||||
@@ -18,7 +16,7 @@ export const CpuRing = ({ cpuUtilization, isTiny }: { cpuUtilization: number; is
|
||||
className="health-monitoring-cpu-utilization-value"
|
||||
size={isTiny ? "8px" : "xs"}
|
||||
>{`${cpuUtilization.toFixed(2)}%`}</Text>
|
||||
<IconCpu className="health-monitoring-cpu-utilization-icon" style={zoomCompensatedSize(isTiny ? 8 : 16)} />
|
||||
<IconCpu className="health-monitoring-cpu-utilization-icon" size={isTiny ? 8 : 16} />
|
||||
</Center>
|
||||
}
|
||||
sections={[
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { Center, RingProgress, Text } from "@mantine/core";
|
||||
import { IconCpu } from "@tabler/icons-react";
|
||||
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { progressColor } from "../system-health";
|
||||
|
||||
export const CpuTempRing = ({
|
||||
@@ -29,7 +27,7 @@ export const CpuTempRing = ({
|
||||
<Text className="health-monitoring-cpu-temp-value" size={isTiny ? "8px" : "xs"}>
|
||||
{fahrenheit ? `${(cpuTemp * 1.8 + 32).toFixed(1)}°F` : `${cpuTemp.toFixed(1)}°C`}
|
||||
</Text>
|
||||
<IconCpu className="health-monitoring-cpu-temp-icon" style={zoomCompensatedSize(isTiny ? 8 : 16)} />
|
||||
<IconCpu className="health-monitoring-cpu-temp-icon" size={isTiny ? 8 : 16} />
|
||||
</Center>
|
||||
}
|
||||
sections={[
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { Center, RingProgress, Stack, Text, Tooltip } from "@mantine/core";
|
||||
import { IconDeviceDesktop } from "@tabler/icons-react";
|
||||
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { progressColor } from "../system-health";
|
||||
|
||||
interface GpuRingProps {
|
||||
@@ -51,10 +49,7 @@ export const GpuRing = ({ gpu, isTiny, fahrenheit }: GpuRingProps) => {
|
||||
className="health-monitoring-gpu-utilization-value"
|
||||
size={isTiny ? "8px" : "xs"}
|
||||
>{`${gpu.processorUtilization.toFixed(0)}%`}</Text>
|
||||
<IconDeviceDesktop
|
||||
className="health-monitoring-gpu-utilization-icon"
|
||||
style={zoomCompensatedSize(isTiny ? 8 : 16)}
|
||||
/>
|
||||
<IconDeviceDesktop className="health-monitoring-gpu-utilization-icon" size={isTiny ? 8 : 16} />
|
||||
</Center>
|
||||
}
|
||||
sections={[
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { Center, RingProgress, Text } from "@mantine/core";
|
||||
import { IconBrain } from "@tabler/icons-react";
|
||||
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { progressColor } from "../system-health";
|
||||
|
||||
export const MemoryRing = ({ available, used, isTiny }: { available: number; used: number; isTiny: boolean }) => {
|
||||
@@ -19,7 +17,7 @@ export const MemoryRing = ({ available, used, isTiny }: { available: number; use
|
||||
<Text className="health-monitoring-memory-value" size={isTiny ? "8px" : "xs"}>
|
||||
{memoryUsage.memUsed.GB}GiB
|
||||
</Text>
|
||||
<IconBrain className="health-monitoring-memory-icon" style={zoomCompensatedSize(isTiny ? 8 : 16)} />
|
||||
<IconBrain className="health-monitoring-memory-icon" size={isTiny ? 8 : 16} />
|
||||
</Center>
|
||||
}
|
||||
sections={[
|
||||
|
||||
@@ -40,7 +40,6 @@ import { useRequiredBoard } from "@homarr/boards/context";
|
||||
import { formatBytes } from "@homarr/common";
|
||||
import type { ScopedTranslationFunction } from "@homarr/translation";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { filterStorageVolumes, normalizeStorageDeviceName } from "../filter-storage-volumes";
|
||||
import { WidgetEmptyState } from "../common/empty-state";
|
||||
@@ -157,10 +156,7 @@ export const SystemHealthMonitoring = ({
|
||||
onClick={() => setOpenedIntegrationId(integrationId)}
|
||||
aria-label={t("popover.information")}
|
||||
>
|
||||
<IconInfoCircle
|
||||
className="health-monitoring-information-icon"
|
||||
style={zoomCompensatedSize(30)}
|
||||
/>
|
||||
<IconInfoCircle className="health-monitoring-information-icon" size={30} />
|
||||
</ActionIcon>
|
||||
</Indicator>
|
||||
<Modal
|
||||
@@ -288,76 +284,45 @@ const SystemInformationList = ({
|
||||
memoryUsage: ReturnType<typeof formatMemoryUsage>;
|
||||
t: ScopedTranslationFunction<"widget.healthMonitoring">;
|
||||
compact?: boolean;
|
||||
}) => {
|
||||
// compact is only true for the inline on-board card; the non-compact usage renders inside a portaled Modal,
|
||||
// which sits outside the zoomed canvas and must not be zoom-compensated.
|
||||
const iconSize = compact ? 18 : 30;
|
||||
const iconSizeProp = compact ? undefined : iconSize;
|
||||
const iconStyle = compact ? zoomCompensatedSize(iconSize) : undefined;
|
||||
return (
|
||||
<List
|
||||
className="health-monitoring-information-list"
|
||||
center
|
||||
spacing={compact ? 4 : "xs"}
|
||||
size={compact ? "sm" : undefined}
|
||||
>
|
||||
<List.Item
|
||||
className="health-monitoring-information-processor"
|
||||
icon={<IconCpu2 size={iconSizeProp} style={iconStyle} />}
|
||||
>
|
||||
{t("popover.processor", { cpuModelName: healthInfo.cpuModelName })}
|
||||
}) => (
|
||||
<List
|
||||
className="health-monitoring-information-list"
|
||||
center
|
||||
spacing={compact ? 4 : "xs"}
|
||||
size={compact ? "sm" : undefined}
|
||||
>
|
||||
<List.Item className="health-monitoring-information-processor" icon={<IconCpu2 size={compact ? 18 : 30} />}>
|
||||
{t("popover.processor", { cpuModelName: healthInfo.cpuModelName })}
|
||||
</List.Item>
|
||||
<List.Item className="health-monitoring-information-memory" icon={<IconBrain size={compact ? 18 : 30} />}>
|
||||
{t("popover.memory", { memory: memoryUsage.memTotal.GB })}
|
||||
</List.Item>
|
||||
<List.Item className="health-monitoring-information-memory" icon={<IconBrain size={compact ? 18 : 30} />}>
|
||||
{t("popover.memoryAvailable", {
|
||||
memoryAvailable: memoryUsage.memFree.GB,
|
||||
percent: String(memoryUsage.memFree.percent),
|
||||
})}
|
||||
</List.Item>
|
||||
<List.Item className="health-monitoring-information-version" icon={<IconVersions size={compact ? 18 : 30} />}>
|
||||
{t("popover.version", { version: healthInfo.version })}
|
||||
</List.Item>
|
||||
<List.Item className="health-monitoring-information-uptime" icon={<IconClock size={compact ? 18 : 30} />}>
|
||||
{formatUptime(healthInfo.uptime, t)}
|
||||
</List.Item>
|
||||
{healthInfo.loadAverage && (
|
||||
<List.Item className="health-monitoring-information-load-average" icon={<IconCpu size={compact ? 18 : 30} />}>
|
||||
{t("popover.loadAverage")}: {healthInfo.loadAverage["1min"]}% / {healthInfo.loadAverage["5min"]}% /{" "}
|
||||
{healthInfo.loadAverage["15min"]}%
|
||||
</List.Item>
|
||||
<List.Item
|
||||
className="health-monitoring-information-memory"
|
||||
icon={<IconBrain size={iconSizeProp} style={iconStyle} />}
|
||||
>
|
||||
{t("popover.memory", { memory: memoryUsage.memTotal.GB })}
|
||||
</List.Item>
|
||||
<List.Item
|
||||
className="health-monitoring-information-memory"
|
||||
icon={<IconBrain size={iconSizeProp} style={iconStyle} />}
|
||||
>
|
||||
{t("popover.memoryAvailable", {
|
||||
memoryAvailable: memoryUsage.memFree.GB,
|
||||
percent: String(memoryUsage.memFree.percent),
|
||||
})}
|
||||
</List.Item>
|
||||
<List.Item
|
||||
className="health-monitoring-information-version"
|
||||
icon={<IconVersions size={iconSizeProp} style={iconStyle} />}
|
||||
>
|
||||
{t("popover.version", { version: healthInfo.version })}
|
||||
</List.Item>
|
||||
<List.Item
|
||||
className="health-monitoring-information-uptime"
|
||||
icon={<IconClock size={iconSizeProp} style={iconStyle} />}
|
||||
>
|
||||
{formatUptime(healthInfo.uptime, t)}
|
||||
</List.Item>
|
||||
{healthInfo.loadAverage && (
|
||||
<List.Item
|
||||
className="health-monitoring-information-load-average"
|
||||
icon={<IconCpu size={iconSizeProp} style={iconStyle} />}
|
||||
>
|
||||
{t("popover.loadAverage")}: {healthInfo.loadAverage["1min"]}% / {healthInfo.loadAverage["5min"]}% /{" "}
|
||||
{healthInfo.loadAverage["15min"]}%
|
||||
</List.Item>
|
||||
)}
|
||||
<List.Item
|
||||
className="health-monitoring-information-updates"
|
||||
icon={<IconPackages size={iconSizeProp} style={iconStyle} />}
|
||||
>
|
||||
{t("popover.updatesAvailable", { count: healthInfo.availablePkgUpdates })}
|
||||
</List.Item>
|
||||
<List.Item
|
||||
className="health-monitoring-information-reboot"
|
||||
icon={<IconRefreshAlert size={iconSizeProp} style={iconStyle} />}
|
||||
>
|
||||
{healthInfo.rebootRequired ? t("popover.rebootRequired") : t("popover.rebootNotRequired")}
|
||||
</List.Item>
|
||||
</List>
|
||||
);
|
||||
};
|
||||
)}
|
||||
<List.Item className="health-monitoring-information-updates" icon={<IconPackages size={compact ? 18 : 30} />}>
|
||||
{t("popover.updatesAvailable", { count: healthInfo.availablePkgUpdates })}
|
||||
</List.Item>
|
||||
<List.Item className="health-monitoring-information-reboot" icon={<IconRefreshAlert size={compact ? 18 : 30} />}>
|
||||
{healthInfo.rebootRequired ? t("popover.rebootRequired") : t("popover.rebootNotRequired")}
|
||||
</List.Item>
|
||||
</List>
|
||||
);
|
||||
|
||||
export const formatUptime = (uptimeInSeconds: number, t: ScopedTranslationFunction<"widget.healthMonitoring">) => {
|
||||
const uptimeDuration = dayjs.duration(uptimeInSeconds, "seconds");
|
||||
|
||||
@@ -15,7 +15,6 @@ import {
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
import { iconSizes } from "@homarr/ui";
|
||||
|
||||
import { WidgetEmptyState } from "../../common/empty-state";
|
||||
import type { WidgetComponentProps } from "../../definition";
|
||||
@@ -258,7 +257,7 @@ function NoPhotosInAlbum() {
|
||||
return (
|
||||
<Center h="100%">
|
||||
<Stack align="center" gap="xs">
|
||||
<IconAlertCircle style={iconSizes.xl} />
|
||||
<IconAlertCircle size={32} />
|
||||
<Text size="sm" fw={500}>
|
||||
{t("noPhotos")}
|
||||
</Text>
|
||||
|
||||
@@ -62,7 +62,7 @@ export const { definition, componentLoader } = createWidgetDefinition("immich-al
|
||||
: undefined,
|
||||
}),
|
||||
refetchInterval: null,
|
||||
supportedIntegrations: ["immich", "mock"],
|
||||
supportedIntegrations: ["immich"],
|
||||
integrationsRequired: true,
|
||||
maxIntegrations: 1,
|
||||
contextActions: ({ widgetRuntimeRef }) => {
|
||||
|
||||
@@ -8,7 +8,6 @@ import { getQueryKey } from "@trpc/react-query";
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { formatBytes } from "@homarr/common";
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { WidgetEmptyState } from "../../common/empty-state";
|
||||
import type { WidgetComponentProps } from "../../definition";
|
||||
@@ -60,28 +59,28 @@ export default function ImmichServerStatsWidget({
|
||||
{
|
||||
key: "users",
|
||||
enabled: statVisibility.showUsers,
|
||||
icon: <IconUsers style={zoomCompensatedSize(statsLayout.dense ? 16 : 18)} />,
|
||||
icon: <IconUsers size={statsLayout.dense ? 16 : 18} />,
|
||||
label: t("users"),
|
||||
value: stats.userCount.toLocaleString(locale),
|
||||
},
|
||||
{
|
||||
key: "photos",
|
||||
enabled: statVisibility.showPhotos,
|
||||
icon: <IconPhoto style={zoomCompensatedSize(statsLayout.dense ? 16 : 18)} />,
|
||||
icon: <IconPhoto size={statsLayout.dense ? 16 : 18} />,
|
||||
label: t("photos"),
|
||||
value: stats.photoCount.toLocaleString(locale),
|
||||
},
|
||||
{
|
||||
key: "videos",
|
||||
enabled: statVisibility.showVideos,
|
||||
icon: <IconVideo style={zoomCompensatedSize(statsLayout.dense ? 16 : 18)} />,
|
||||
icon: <IconVideo size={statsLayout.dense ? 16 : 18} />,
|
||||
label: t("videos"),
|
||||
value: stats.videoCount.toLocaleString(locale),
|
||||
},
|
||||
{
|
||||
key: "storage",
|
||||
enabled: statVisibility.showStorage,
|
||||
icon: <IconDatabase style={zoomCompensatedSize(statsLayout.dense ? 16 : 18)} />,
|
||||
icon: <IconDatabase size={statsLayout.dense ? 16 : 18} />,
|
||||
label: t("storage"),
|
||||
value: formatBytes(stats.totalLibraryUsageInBytes),
|
||||
},
|
||||
|
||||
@@ -9,7 +9,7 @@ export const { definition, componentLoader } = createWidgetDefinition("immich-se
|
||||
queryKeys: [[["widget", "immich", "getServerStats"]], [["widget", "immich", "getAlbums"]]],
|
||||
queryMatcher: matchesWidgetRuntimeQuery,
|
||||
refetchInterval: null,
|
||||
supportedIntegrations: ["immich", "mock"],
|
||||
supportedIntegrations: ["immich"],
|
||||
integrationsRequired: true,
|
||||
maxIntegrations: 1,
|
||||
createOptions() {
|
||||
|
||||
@@ -24,7 +24,6 @@ import { getQueryKey } from "@trpc/react-query";
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import type { MissingMediaItem, QueuedMediaItem } from "@homarr/integrations/types";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { WidgetEmptyState } from "../common/empty-state";
|
||||
import { getSafeApplicationUrl, SAFE_NEW_TAB_REL } from "../common/application-url";
|
||||
@@ -262,11 +261,7 @@ const Poster = ({ src, type, density }: { src?: string | null; type: "movie" | "
|
||||
variant="light"
|
||||
color={type === "movie" ? "yellow" : "blue"}
|
||||
>
|
||||
{type === "movie" ? (
|
||||
<IconMovie style={zoomCompensatedSize(size * 0.5)} />
|
||||
) : (
|
||||
<IconVideo style={zoomCompensatedSize(size * 0.5)} />
|
||||
)}
|
||||
{type === "movie" ? <IconMovie size={size * 0.5} /> : <IconVideo size={size * 0.5} />}
|
||||
</ThemeIcon>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -6,7 +6,6 @@ import { IconCube, IconUsersGroup } from "@tabler/icons-react";
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { formatNumber } from "@homarr/common";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { WidgetEmptyState } from "../../common/empty-state";
|
||||
import type { WidgetComponentProps } from "../../definition";
|
||||
@@ -72,12 +71,7 @@ export default function MinecraftServerStatusWidget({
|
||||
showServerIcon &&
|
||||
(data.icon ? (
|
||||
<img
|
||||
style={{
|
||||
flex: 1,
|
||||
width: `calc(${iconSize}px * var(--board-canvas-ui-scale, 1))`,
|
||||
maxHeight: `calc(${iconSize}px * var(--board-canvas-ui-scale, 1))`,
|
||||
objectFit: "contain",
|
||||
}}
|
||||
style={{ flex: 1, width: iconSize, maxHeight: iconSize, objectFit: "contain" }}
|
||||
alt={`minecraft icon ${options.domain}`}
|
||||
src={data.icon}
|
||||
/>
|
||||
@@ -90,12 +84,12 @@ export default function MinecraftServerStatusWidget({
|
||||
justifyContent: "center",
|
||||
}}
|
||||
>
|
||||
<IconCube style={zoomCompensatedSize(iconSize)} color="var(--mantine-color-gray-5)" />
|
||||
<IconCube size={iconSize} color="var(--mantine-color-gray-5)" />
|
||||
</Box>
|
||||
))}
|
||||
<Stack gap={4} w={showCapacity ? "min(100%, 420px)" : "auto"} align="stretch">
|
||||
<Group gap={5} c="dimmed" align="center" justify="center">
|
||||
<IconUsersGroup style={zoomCompensatedSize(showMetadata ? 20 : 16)} />
|
||||
<IconUsersGroup size={showMetadata ? "1.25rem" : "1rem"} />
|
||||
<Text size={showMetadata ? "lg" : isDense ? "sm" : "md"}>
|
||||
{formatNumber(data.players.online, 1)} / {formatNumber(data.players.max, 1)}
|
||||
</Text>
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Center, Group, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||
import { IconWifi } from "@tabler/icons-react";
|
||||
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { iconSizes } from "@homarr/ui";
|
||||
|
||||
import { StatRow } from "./stat-row";
|
||||
|
||||
@@ -22,7 +21,7 @@ export const WifiVariant = ({
|
||||
<Stack h="100%" align="center" justify="center" gap={compact ? "sm" : "md"}>
|
||||
<Group gap="xs" wrap="nowrap" justify="center">
|
||||
<Center w={24} h={24}>
|
||||
<IconWifi style={iconSizes.xl} />
|
||||
<IconWifi size={20} />
|
||||
</Center>
|
||||
<Text size={"md"} fw={"bold"}>
|
||||
{t("variants.wifi.name")}
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Center, Group, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||
import { IconNetwork } from "@tabler/icons-react";
|
||||
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { iconSizes } from "@homarr/ui";
|
||||
|
||||
import { StatRow } from "./stat-row";
|
||||
|
||||
@@ -22,7 +21,7 @@ export const WiredVariant = ({
|
||||
<Stack h="100%" align="center" justify="center" gap={compact ? "sm" : "md"}>
|
||||
<Group gap="xs" wrap="nowrap" justify="center">
|
||||
<Center w={24} h={24}>
|
||||
<IconNetwork style={iconSizes.xl} />
|
||||
<IconNetwork size={20} />
|
||||
</Center>
|
||||
<Text size={"md"} fw={"bold"}>
|
||||
{t("variants.wired.name")}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
"use client";
|
||||
|
||||
import type { CSSProperties } from "react";
|
||||
import { Badge, Card, Center, Group, List, ScrollArea, SimpleGrid, Stack, Text, useMantineTheme } from "@mantine/core";
|
||||
import { IconCircleCheckFilled, IconCircleXFilled } from "@tabler/icons-react";
|
||||
import dayjs from "dayjs";
|
||||
@@ -11,7 +10,6 @@ import relativeTime from "dayjs/plugin/relativeTime";
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import type { ScopedTranslationFunction } from "@homarr/translation";
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
import { iconSizes } from "@homarr/ui";
|
||||
|
||||
import type { WidgetComponentProps } from "../../definition";
|
||||
import { IntegrationErrorIndicator } from "../../common/integration-error-indicator";
|
||||
@@ -189,7 +187,7 @@ export default function NetworkControllerSummaryWidget({
|
||||
<StatusIcon
|
||||
status={summary.wanStatus}
|
||||
label={statusLabels[getBinaryStatusKey(summary.wanStatus)]}
|
||||
style={isDense ? iconSizes.md : iconSizes.xl}
|
||||
size={isDense ? 16 : 20}
|
||||
/>
|
||||
}
|
||||
>
|
||||
@@ -200,7 +198,7 @@ export default function NetworkControllerSummaryWidget({
|
||||
<StatusIcon
|
||||
status={summary.www.status}
|
||||
label={statusLabels[getBinaryStatusKey(summary.www.status)]}
|
||||
style={isDense ? iconSizes.md : iconSizes.xl}
|
||||
size={isDense ? 16 : 20}
|
||||
/>
|
||||
}
|
||||
>
|
||||
@@ -216,7 +214,7 @@ export default function NetworkControllerSummaryWidget({
|
||||
<StatusIcon
|
||||
status={summary.wifi.status}
|
||||
label={statusLabels[getBinaryStatusKey(summary.wifi.status)]}
|
||||
style={isDense ? iconSizes.md : iconSizes.xl}
|
||||
size={isDense ? 16 : 20}
|
||||
/>
|
||||
}
|
||||
>
|
||||
@@ -229,7 +227,7 @@ export default function NetworkControllerSummaryWidget({
|
||||
<StatusIcon
|
||||
status={summary.lan.status}
|
||||
label={statusLabels[getBinaryStatusKey(summary.lan.status)]}
|
||||
style={isDense ? iconSizes.md : iconSizes.xl}
|
||||
size={isDense ? 16 : 20}
|
||||
/>
|
||||
}
|
||||
>
|
||||
@@ -241,7 +239,7 @@ export default function NetworkControllerSummaryWidget({
|
||||
<StatusIcon
|
||||
status={summary.vpn.status}
|
||||
label={statusLabels[getBinaryStatusKey(summary.vpn.status)]}
|
||||
style={isDense ? iconSizes.md : iconSizes.xl}
|
||||
size={isDense ? 16 : 20}
|
||||
/>
|
||||
}
|
||||
>
|
||||
@@ -287,19 +285,17 @@ const StatusIcon = ({
|
||||
status,
|
||||
label,
|
||||
size,
|
||||
style,
|
||||
}: {
|
||||
status?: "enabled" | "disabled";
|
||||
label: string;
|
||||
size?: number | string;
|
||||
style?: CSSProperties;
|
||||
size: number | string;
|
||||
}) => {
|
||||
const mantineTheme = useMantineTheme();
|
||||
if (status === "enabled") {
|
||||
return <IconCircleCheckFilled aria-label={label} size={size} style={style} color={mantineTheme.colors.green[6]} />;
|
||||
return <IconCircleCheckFilled aria-label={label} size={size} color={mantineTheme.colors.green[6]} />;
|
||||
}
|
||||
if (status === "disabled") {
|
||||
return <IconCircleXFilled aria-label={label} size={size} style={style} color={mantineTheme.colors.red[6]} />;
|
||||
return <IconCircleXFilled aria-label={label} size={size} color={mantineTheme.colors.red[6]} />;
|
||||
}
|
||||
return <IconCircleXFilled aria-label={label} size={size} style={style} color={mantineTheme.colors.gray[6]} />;
|
||||
return <IconCircleXFilled aria-label={label} size={size} color={mantineTheme.colors.gray[6]} />;
|
||||
};
|
||||
@@ -8,7 +8,6 @@ import { clientApi } from "@homarr/api/client";
|
||||
import { useRequiredBoard } from "@homarr/boards/context";
|
||||
import { useTimeAgo } from "@homarr/common";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { iconSizes } from "@homarr/ui";
|
||||
|
||||
import { getSafeApplicationUrl, SAFE_NEW_TAB_REL } from "../common/application-url";
|
||||
import { getUsableWidgetQueryData } from "../common/query-state";
|
||||
@@ -159,11 +158,7 @@ const InfoDisplay = ({ date, source, dense }: { date: Date; source?: string; den
|
||||
|
||||
return (
|
||||
<Group gap={5} align="center" wrap="nowrap">
|
||||
<IconClock
|
||||
aria-hidden
|
||||
style={dense ? iconSizes.xs : iconSizes.md}
|
||||
color="var(--mantine-color-dimmed)"
|
||||
/>
|
||||
<IconClock aria-hidden size={dense ? 12 : "1rem"} color="var(--mantine-color-dimmed)" />
|
||||
<Text size={dense ? "xs" : "sm"} c="dimmed">
|
||||
{timeAgo}
|
||||
</Text>
|
||||
|
||||
@@ -7,7 +7,6 @@ import { IconFileDescription, IconFileText, IconInbox, IconTag, IconUsers } from
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import { WidgetEmptyState } from "../common/empty-state";
|
||||
import type { WidgetComponentProps } from "../definition";
|
||||
@@ -185,7 +184,7 @@ export default function PaperlessNgxWidget({
|
||||
const Icon = statIcons[statKey];
|
||||
return (
|
||||
<div key={statKey} className={classes.statTile}>
|
||||
<Icon className={classes.statIcon} style={zoomCompensatedSize(iconSize)} stroke={1.5} />
|
||||
<Icon className={classes.statIcon} size={iconSize} stroke={1.5} />
|
||||
<span className={classes.statValue}>{statValues[statKey]}</span>
|
||||
<span className={classes.statLabel}>{t(statKey)}</span>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@ export const { definition, componentLoader } = createWidgetDefinition("paperless
|
||||
supportsAdvancedFocus: false,
|
||||
icon: IconFileText,
|
||||
refetchInterval: null,
|
||||
supportedIntegrations: ["paperlessNgx", "mock"],
|
||||
supportedIntegrations: ["paperlessNgx"],
|
||||
integrationsRequired: true,
|
||||
maxIntegrations: 1,
|
||||
createOptions() {
|
||||
|
||||
@@ -17,7 +17,6 @@ import relativeTime from "dayjs/plugin/relativeTime";
|
||||
|
||||
import { clientApi } from "@homarr/api/client";
|
||||
import { useI18n } from "@homarr/translation/client";
|
||||
import { iconSizes, zoomCompensatedSize } from "@homarr/ui";
|
||||
import type { TablerIcon } from "@homarr/ui";
|
||||
|
||||
import { WidgetEmptyState } from "../common/empty-state";
|
||||
@@ -235,12 +234,7 @@ export default function PatchMonWidget({
|
||||
style={{ "--stat-bg": severityToMantineBgColor(severity) } as CSSProperties}
|
||||
>
|
||||
{showIcons && (
|
||||
<Icon
|
||||
className={classes.statIcon}
|
||||
style={zoomCompensatedSize(iconSize)}
|
||||
stroke={1.5}
|
||||
color={severityToIconColor(severity)}
|
||||
/>
|
||||
<Icon className={classes.statIcon} size={iconSize} stroke={1.5} color={severityToIconColor(severity)} />
|
||||
)}
|
||||
<span className={classes.statValue}>
|
||||
<Text component="span" fw={700} size="inherit" c={severityToMantineColor(severity)}>
|
||||
@@ -450,7 +444,7 @@ function CompactStatGrid({
|
||||
{showIcon && (
|
||||
<Icon
|
||||
className={classes.statIcon}
|
||||
style={iconSizes.lg}
|
||||
size="var(--mantine-font-size-lg)"
|
||||
stroke={1.5}
|
||||
color={severityToIconColor(severity)}
|
||||
/>
|
||||
|
||||
@@ -9,7 +9,7 @@ import { patchmonOptionsSuperRefine } from "./threshold-validation";
|
||||
export const { definition, componentLoader } = createWidgetDefinition("patchmon", {
|
||||
supportsAdvancedFocus: true,
|
||||
icon: IconShieldCheck,
|
||||
supportedIntegrations: ["patchmon", "mock"],
|
||||
supportedIntegrations: ["patchmon"],
|
||||
integrationsRequired: true,
|
||||
maxIntegrations: 1,
|
||||
createOptions() {
|
||||
|
||||
@@ -19,7 +19,6 @@ import { clientApi } from "@homarr/api/client";
|
||||
import { useIntegrationsWithInteractAccess } from "@homarr/auth/client";
|
||||
import { useRegisterSpotlightContextActions } from "@homarr/spotlight";
|
||||
import { useCurrentIntlLocale, useI18n } from "@homarr/translation/client";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
|
||||
import type { WidgetComponentProps } from "../../definition";
|
||||
import { isSmartHomeTiny } from "../layout";
|
||||
@@ -127,7 +126,7 @@ export default function SmartHomeTriggerAutomationWidget({
|
||||
<Center w="100%" h="100%">
|
||||
<Stack align="center" gap={isTiny ? 6 : "md"} p="xs" maw="100%">
|
||||
<ThemeIcon variant="light" size={isTiny ? "md" : "xl"} radius="xl">
|
||||
<IconAutomation style={zoomCompensatedSize(isTiny ? 14 : 24)} />
|
||||
<IconAutomation size={isTiny ? 14 : 24} />
|
||||
</ThemeIcon>
|
||||
<Text ta="center" fw={600} fz={isTiny ? "xs" : "sm"} lineClamp={2} maw="100%">
|
||||
{options.displayName}
|
||||
|
||||
@@ -30,7 +30,7 @@ export const { definition, componentLoader } = createWidgetDefinition("speedtest
|
||||
},
|
||||
);
|
||||
},
|
||||
supportedIntegrations: ["speedtestTracker", "mock"],
|
||||
supportedIntegrations: ["speedtestTracker"],
|
||||
errors: {
|
||||
INTERNAL_SERVER_ERROR: {
|
||||
icon: IconServerOff,
|
||||
|
||||
@@ -4,7 +4,6 @@ import { Card, Flex, Text, Tooltip, VisuallyHidden } from "@mantine/core";
|
||||
import { useElementSize } from "@mantine/hooks";
|
||||
|
||||
import { useRequiredBoard } from "@homarr/boards/context";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
import type { TablerIcon } from "@homarr/ui";
|
||||
|
||||
export interface SpeedStatCardProps {
|
||||
@@ -46,7 +45,7 @@ export function SpeedStatCard({ icon: Icon, color, value, label, compact = false
|
||||
gap={isWide ? 8 : 4}
|
||||
style={{ minWidth: 0 }}
|
||||
>
|
||||
<Icon color={accentColor} style={zoomCompensatedSize(compact ? 16 : 20)} />
|
||||
<Icon size={compact ? 16 : 20} color={accentColor} style={{ flexShrink: 0 }} />
|
||||
<Flex direction="column" align={isWide ? "flex-start" : "center"} gap={0} style={{ minWidth: 0 }}>
|
||||
<Text size={compact ? "sm" : "md"} fw={700} ta="center" lh={1.1} truncate w="100%">
|
||||
{value}
|
||||
|
||||
@@ -9,7 +9,7 @@ export const { definition, componentLoader } = createWidgetDefinition("systemDis
|
||||
icon: IconServer2,
|
||||
queryKey: [["widget", "healthMonitoring"]],
|
||||
refetchInterval: 10,
|
||||
supportedIntegrations: ["dashDot", "openmediavault", "truenas", "unraid", "synology", "mock"],
|
||||
supportedIntegrations: ["dashDot", "openmediavault", "truenas", "unraid", "synology"],
|
||||
createOptions() {
|
||||
return optionsBuilder.from(
|
||||
(factory) => ({
|
||||
|
||||
@@ -7,7 +7,6 @@ import { useElementSize, useHover, useMergedRef } from "@mantine/hooks";
|
||||
import type { TooltipProps, YAxisProps } from "recharts";
|
||||
|
||||
import { useRequiredBoard } from "@homarr/boards/context";
|
||||
import { zoomCompensatedSize } from "@homarr/ui";
|
||||
import type { TablerIcon } from "@homarr/ui";
|
||||
|
||||
import type { LabelDisplayModeOption } from "..";
|
||||
@@ -70,7 +69,7 @@ export const CommonChart = ({
|
||||
style={{ zIndex: 2, pointerEvents: "none" }}
|
||||
align="center"
|
||||
>
|
||||
{showIcon && <Icon color={"var(--mantine-color-dimmed)"} style={zoomCompensatedSize(height > 100 ? 20 : 14)} stroke={1.5} />}
|
||||
{showIcon && <Icon color={"var(--mantine-color-dimmed)"} size={height > 100 ? 20 : 14} stroke={1.5} />}
|
||||
{showText && (
|
||||
<Text c={"dimmed"} size={height > 100 ? "md" : "xs"} fw={"bold"}>
|
||||
{title}
|
||||
@@ -93,7 +92,7 @@ export const CommonChart = ({
|
||||
{data.length <= 1 ? (
|
||||
<Center pos="absolute" w="100%" h="100%">
|
||||
<Stack px={"xs"} align={"center"} gap={4}>
|
||||
{showIcon && <Icon color={"var(--mantine-color-dimmed)"} style={zoomCompensatedSize(height > 100 ? 20 : 14)} stroke={1.5} />}
|
||||
{showIcon && <Icon color={"var(--mantine-color-dimmed)"} size={height > 100 ? 20 : 14} stroke={1.5} />}
|
||||
{showText && (
|
||||
<Text c={"dimmed"} size={height > 100 ? "md" : "xs"} fw={"bold"} ta="center">
|
||||
{title}
|
||||
|
||||
@@ -24,7 +24,7 @@ export const { definition, componentLoader } = createWidgetDefinition("systemRes
|
||||
supportsAdvancedFocus: true,
|
||||
queryKey: [["widget", "healthMonitoring"]],
|
||||
refetchInterval: 10,
|
||||
supportedIntegrations: ["dashDot", "openmediavault", "truenas", "unraid", "glances", "synology", "mock"],
|
||||
supportedIntegrations: ["dashDot", "openmediavault", "truenas", "unraid", "glances", "synology"],
|
||||
createOptions() {
|
||||
return optionsBuilder.from((factory) => ({
|
||||
hasShadow: factory.switch({ defaultValue: true }),
|
||||
|
||||
Loaded 100 of 115 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user