style: auto-fix lint and format

This commit is contained in:
ajnart authored and github-actions[bot] committed 2026-06-24 13:11:34 +00:00
1 parent 18d6013f3f
commit a164c951ce
38 files changed
+57 -82

No files matched your search

@@ -22,7 +22,12 @@ import { TRPCClientError } from "@trpc/client";
import type { AppRouter } from "@homarr/api"; import type { AppRouter } from "@homarr/api";
import { clientApi } from "@homarr/api/client"; import { clientApi } from "@homarr/api/client";
import { isPersistableWidgetQueryKey, queryCacheDefaultGcTimeMs, queryCacheDefaultRefetchIntervalMs, queryCacheDefaultStaleTimeMs } from "@homarr/api/query-cache"; import {
isPersistableWidgetQueryKey,
queryCacheDefaultGcTimeMs,
queryCacheDefaultRefetchIntervalMs,
queryCacheDefaultStaleTimeMs,
} from "@homarr/api/query-cache";
import { createHeadersCallbackForSource, getTrpcUrl } from "@homarr/api/shared"; import { createHeadersCallbackForSource, getTrpcUrl } from "@homarr/api/shared";
import { env } from "@homarr/common/env"; import { env } from "@homarr/common/env";
import { showWarningNotification } from "@homarr/notifications"; import { showWarningNotification } from "@homarr/notifications";
@@ -164,17 +164,21 @@ export function DockerTable({ containers, timestamp }: RouterOutputs["docker"]["
const [isPending, setIsPending] = useState(false); const [isPending, setIsPending] = useState(false);
const mutate = useCallback(() => { const mutate = useCallback(() => {
setIsPending(true); setIsPending(true);
void utils.docker.getContainers.invalidate().then(() => { void utils.docker.getContainers
showSuccessNotification({ .invalidate()
title: tDocker("action.refresh.notification.success.title"), .then(() => {
message: tDocker("action.refresh.notification.success.message"), showSuccessNotification({
}); title: tDocker("action.refresh.notification.success.title"),
}).catch(() => { message: tDocker("action.refresh.notification.success.message"),
showErrorNotification({ });
title: tDocker("action.refresh.notification.error.title"), })
message: tDocker("action.refresh.notification.error.message"), .catch(() => {
}); showErrorNotification({
}).finally(() => setIsPending(false)); title: tDocker("action.refresh.notification.error.title"),
message: tDocker("action.refresh.notification.error.message"),
});
})
.finally(() => setIsPending(false));
}, [utils, tDocker]); }, [utils, tDocker]);
const table = useTranslatedMantineReactTable({ const table = useTranslatedMantineReactTable({
+1 -1
View File
@@ -34,7 +34,7 @@ export const rssFeedRouter = createTRPCRouter({
return rssFeeds return rssFeeds
.flatMap((rssFeed) => rssFeed.data.entries) .flatMap((rssFeed) => rssFeed.data.entries)
.slice(0, input.maximumAmountPosts) .slice(0, input.maximumAmountPosts)
.sort((entryA, entryB) => { .toSorted((entryA, entryB) => {
return entryA.published && entryB.published return entryA.published && entryB.published
? new Date(entryB.published).getTime() - new Date(entryA.published).getTime() ? new Date(entryB.published).getTime() - new Date(entryA.published).getTime()
: 0; : 0;
+1 -1
View File
@@ -147,7 +147,7 @@ export const umamiRouter = createTRPCRouter({
.concat(createOneIntegrationMiddleware("query", "umami")) .concat(createOneIntegrationMiddleware("query", "umami"))
.query(async ({ ctx, input }) => { .query(async ({ ctx, input }) => {
try { try {
const sortedNames = [...input.eventNames].sort(); const sortedNames = [...input.eventNames].toSorted();
const innerHandler = umamiMultiEventRequestHandler.handler(ctx.integration, { const innerHandler = umamiMultiEventRequestHandler.handler(ctx.integration, {
websiteId: input.websiteId, websiteId: input.websiteId,
timeFrame: input.timeFrame, timeFrame: input.timeFrame,
+17 -3
View File
@@ -6,7 +6,11 @@ import { createId } from "@homarr/common";
import type { Database } from "@homarr/db"; import type { Database } from "@homarr/db";
import { boards, users } from "@homarr/db/schema"; import { boards, users } from "@homarr/db/schema";
import { createDb } from "@homarr/db/test"; import { createDb } from "@homarr/db/test";
import { isPersistableWidgetQueryKey, queryCacheDefaultStaleTimeMs, queryCacheMaxValueBytes } from "@homarr/api/query-cache"; import {
isPersistableWidgetQueryKey,
queryCacheDefaultStaleTimeMs,
queryCacheMaxValueBytes,
} from "@homarr/api/query-cache";
import { queryCacheRouter } from "../router/query-cache"; import { queryCacheRouter } from "../router/query-cache";
@@ -81,7 +85,12 @@ describe("queryCacheRouter", () => {
await expect(caller.setItem({ boardId: "board-1", value: "cached-value" })).resolves.toEqual({ await expect(caller.setItem({ boardId: "board-1", value: "cached-value" })).resolves.toEqual({
stored: true, stored: true,
}); });
expect(redisMock.setQueryCacheAsync).toHaveBeenCalledWith(session.user.id, "board-1", "cached-value", expect.any(Number)); expect(redisMock.setQueryCacheAsync).toHaveBeenCalledWith(
session.user.id,
"board-1",
"cached-value",
expect.any(Number),
);
await caller.removeItem({ boardId: "board-1" }); await caller.removeItem({ boardId: "board-1" });
expect(redisMock.removeQueryCacheAsync).toHaveBeenCalledWith(session.user.id, "board-1"); expect(redisMock.removeQueryCacheAsync).toHaveBeenCalledWith(session.user.id, "board-1");
@@ -108,7 +117,12 @@ describe("queryCacheRouter", () => {
await caller.setItem({ boardId: "board-1", value: "cached-value" }); await caller.setItem({ boardId: "board-1", value: "cached-value" });
expect(redisMock.setQueryCacheAsync).toHaveBeenCalledWith("anonymous", "board-1", "cached-value", expect.any(Number)); expect(redisMock.setQueryCacheAsync).toHaveBeenCalledWith(
"anonymous",
"board-1",
"cached-value",
expect.any(Number),
);
}); });
test("rejects oversized values", async () => { test("rejects oversized values", async () => {
-3
View File
@@ -3,7 +3,6 @@ import superjson from "superjson";
import { createId } from "@homarr/common"; import { createId } from "@homarr/common";
import { createLogger } from "@homarr/core/infrastructure/logs"; import { createLogger } from "@homarr/core/infrastructure/logs";
import { ChannelSubscriptionTracker } from "./channel-subscription-tracker"; import { ChannelSubscriptionTracker } from "./channel-subscription-tracker";
import { createRedisConnection } from "./connection"; import { createRedisConnection } from "./connection";
@@ -226,7 +225,6 @@ export const createCacheChannel = <TData>(name: string, cacheDurationMs: number
}; };
}; };
/** /**
* Invalidates all cached data for a given integration by deleting every Redis key * Invalidates all cached data for a given integration by deleting every Redis key
* that starts with `integration:${integrationId}:` as well as the integration's * that starts with `integration:${integrationId}:` as well as the integration's
@@ -257,7 +255,6 @@ export const invalidateIntegrationCacheAsync = async (integrationId: string): Pr
} }
}; };
export const createChannelEventHistory = <TData>(channelName: string, maxElements = 32) => { export const createChannelEventHistory = <TData>(channelName: string, maxElements = 32) => {
return { return {
subscribe: (callback: (data: TData) => void) => { subscribe: (callback: (data: TData) => void) => {
+6 -9
View File
@@ -1,4 +1,3 @@
import type { AnchorNote, AnchorNotesListInput, AnchorNoteSummary } from "@homarr/integrations"; import type { AnchorNote, AnchorNotesListInput, AnchorNoteSummary } from "@homarr/integrations";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
@@ -16,12 +15,10 @@ export const anchorNotesListRequestHandler = createIntegrationRequestHandler<
}, },
}); });
export const anchorNoteRequestHandler = createIntegrationRequestHandler<AnchorNote, "anchor", { noteId: string }>( export const anchorNoteRequestHandler = createIntegrationRequestHandler<AnchorNote, "anchor", { noteId: string }>({
{ queryKey: "anchorNote",
queryKey: "anchorNote", async requestAsync(integration, input) {
async requestAsync(integration, input) { const instance = await createIntegrationAsync(integration);
const instance = await createIntegrationAsync(integration); return instance.getNoteAsync(input.noteId);
return instance.getNoteAsync(input.noteId);
},
}, },
); });
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import type { ArchiveTeamWarriorStatus } from "@homarr/integrations"; import type { ArchiveTeamWarriorStatus } from "@homarr/integrations";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
@@ -1,4 +1,3 @@
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { AudiobookshelfDashboardData } from "@homarr/integrations/types"; import type { AudiobookshelfDashboardData } from "@homarr/integrations/types";
-1
View File
@@ -1,4 +1,3 @@
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { CoolifyInstanceInfo } from "@homarr/integrations/types"; import type { CoolifyInstanceInfo } from "@homarr/integrations/types";
-1
View File
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { DnsHoleSummary } from "@homarr/integrations/types"; import type { DnsHoleSummary } from "@homarr/integrations/types";
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import type { DownloadClientJobsAndStatus } from "@homarr/integrations"; import type { DownloadClientJobsAndStatus } from "@homarr/integrations";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
-1
View File
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { import type {
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { ProxmoxClusterInfo, SystemHealthMonitoring } from "@homarr/integrations/types"; import type { ProxmoxClusterInfo, SystemHealthMonitoring } from "@homarr/integrations/types";
-1
View File
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { ImmichAlbum, ImmichServerStats } from "@homarr/integrations"; import type { ImmichAlbum, ImmichServerStats } from "@homarr/integrations";
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { Indexer } from "@homarr/integrations/types"; import type { Indexer } from "@homarr/integrations/types";
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { MediaRelease } from "@homarr/integrations/types"; import type { MediaRelease } from "@homarr/integrations/types";
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { MediaRequest } from "@homarr/integrations/types"; import type { MediaRequest } from "@homarr/integrations/types";
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { MediaRequestStats } from "@homarr/integrations/types"; import type { MediaRequestStats } from "@homarr/integrations/types";
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import type { StreamSession } from "@homarr/integrations"; import type { StreamSession } from "@homarr/integrations";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { TdarrQueue, TdarrStatistics, TdarrWorker } from "@homarr/integrations"; import type { TdarrQueue, TdarrStatistics, TdarrWorker } from "@homarr/integrations";
@@ -1,4 +1,3 @@
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { NavidromeDashboardData } from "@homarr/integrations/types"; import type { NavidromeDashboardData } from "@homarr/integrations/types";
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { NetworkControllerSummary } from "@homarr/integrations/types"; import type { NetworkControllerSummary } from "@homarr/integrations/types";
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import type { Notification } from "@homarr/integrations"; import type { Notification } from "@homarr/integrations";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
@@ -1,4 +1,3 @@
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { PaperlessNgxStats } from "@homarr/integrations"; import type { PaperlessNgxStats } from "@homarr/integrations";
-1
View File
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import type { ReleaseResponse, ReleasesRepository } from "@homarr/integrations"; import type { ReleaseResponse, ReleasesRepository } from "@homarr/integrations";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
@@ -1,4 +1,3 @@
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { SpeedtestTrackerDashboardData } from "@homarr/integrations/types"; import type { SpeedtestTrackerDashboardData } from "@homarr/integrations/types";
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { Station, Timetable } from "@homarr/integrations/types"; import type { Station, Timetable } from "@homarr/integrations/types";
-1
View File
@@ -1,4 +1,3 @@
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { TracearrDashboardData } from "@homarr/integrations/types"; import type { TracearrDashboardData } from "@homarr/integrations/types";
+1 -6
View File
@@ -1,4 +1,3 @@
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { UmamiEventSeries, UmamiMetricItem, UmamiVisitorStats } from "@homarr/integrations/types"; import type { UmamiEventSeries, UmamiMetricItem, UmamiVisitorStats } from "@homarr/integrations/types";
@@ -16,11 +15,7 @@ export const umamiRequestHandler = createIntegrationRequestHandler<
queryKey: "umamiVisitorStats", queryKey: "umamiVisitorStats",
}); });
export const umamiEventNamesRequestHandler = createIntegrationRequestHandler< export const umamiEventNamesRequestHandler = createIntegrationRequestHandler<string[], "umami", { websiteId: string }>({
string[],
"umami",
{ websiteId: string }
>({
async requestAsync(integration, input) { async requestAsync(integration, input) {
const integrationInstance = await createIntegrationAsync(integration); const integrationInstance = await createIntegrationAsync(integration);
return await integrationInstance.getEventNamesAsync(input.websiteId); return await integrationInstance.getEventNamesAsync(input.websiteId);
-1
View File
@@ -1,4 +1,3 @@
import type { IntegrationKindByCategory } from "@homarr/definitions"; import type { IntegrationKindByCategory } from "@homarr/definitions";
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { UpsSummary } from "@homarr/integrations/types"; import type { UpsSummary } from "@homarr/integrations/types";
@@ -1,4 +1,3 @@
import { createIntegrationAsync } from "@homarr/integrations"; import { createIntegrationAsync } from "@homarr/integrations";
import type { UptimeKumaDashboardData } from "@homarr/integrations/types"; import type { UptimeKumaDashboardData } from "@homarr/integrations/types";
@@ -11,10 +11,7 @@ interface PingIndicatorProps {
export const PingIndicator = ({ appId }: PingIndicatorProps) => { export const PingIndicator = ({ appId }: PingIndicatorProps) => {
const t = useI18n(); const t = useI18n();
const { data: pingResult } = clientApi.widget.app.ping.useQuery( const { data: pingResult } = clientApi.widget.app.ping.useQuery({ id: appId }, { refetchOnMount: false });
{ id: appId },
{ refetchOnMount: false },
);
if (!pingResult) return <PingDot icon={IconMinus} color="gray" tooltip={`${t("common.action.loading")}…`} />; if (!pingResult) return <PingDot icon={IconMinus} color="gray" tooltip={`${t("common.action.loading")}…`} />;
@@ -41,11 +41,7 @@ export default function BeszelAlertsWidget({
() => ({ integrationIds, includeHistory: options.showHistory, maxHistoryItems: options.maxHistoryItems }), () => ({ integrationIds, includeHistory: options.showHistory, maxHistoryItems: options.maxHistoryItems }),
[integrationIds, options.showHistory, options.maxHistoryItems], [integrationIds, options.showHistory, options.maxHistoryItems],
); );
const { const { data: results = [], error: alertsError, isPending } = clientApi.widget.beszel.getAlerts.useQuery(alertsInput);
data: results = [],
error: alertsError,
isPending,
} = clientApi.widget.beszel.getAlerts.useQuery(alertsInput);
const systemNameMap = useMemo(() => { const systemNameMap = useMemo(() => {
const map: Record<string, string> = {}; const map: Record<string, string> = {};
@@ -28,10 +28,7 @@ export const { definition, componentLoader } = createWidgetDefinition("beszelSys
data = [], data = [],
isPending, isPending,
isError, isError,
} = clientApi.widget.beszel.getSystems.useQuery( } = clientApi.widget.beszel.getSystems.useQuery({ integrationIds }, { enabled: integrationIds.length > 0 });
{ integrationIds },
{ enabled: integrationIds.length > 0 },
);
const selectData = data.flatMap((r) => r.systems.map((s) => ({ value: s.id, label: s.name }))); const selectData = data.flatMap((r) => r.systems.map((s) => ({ value: s.id, label: s.name })));
return { data: selectData, isPending, isError }; return { data: selectData, isPending, isError };
}, },
@@ -36,14 +36,12 @@ export const BeszelSystemStatsModal = createModal<BeszelSystemStatsModalProps>((
const t = useScopedI18n("widget.beszelSystemStats"); const t = useScopedI18n("widget.beszelSystemStats");
const [timePeriod, setTimePeriod] = useState<BeszelTimePeriod>("1h"); const [timePeriod, setTimePeriod] = useState<BeszelTimePeriod>("1h");
const { data } = clientApi.widget.beszel.getSystemStats.useQuery( const { data } = clientApi.widget.beszel.getSystemStats.useQuery({
{ integrationIds: [innerProps.integrationId],
integrationIds: [innerProps.integrationId], systemId: innerProps.systemId,
systemId: innerProps.systemId, timePeriod,
timePeriod, includeDocker: false,
includeDocker: false, });
},
);
const mappers = useMemo( const mappers = useMemo(
() => ({ () => ({
+1 -1
View File
@@ -198,7 +198,7 @@ export default function DockerWidget({ options, width, isEditMode }: WidgetCompo
acc.memory += safeValue(container.memoryUsage); acc.memory += safeValue(container.memoryUsage);
return acc; return acc;
}, },
{ cpu: 0, memory: 0 } { cpu: 0, memory: 0 },
); );
}, [containers]); }, [containers]);