Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e18a040686 | ||
|
|
789e71096e |
No files matched your search
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import type { PropsWithChildren } from "react";
|
import type { PropsWithChildren } from "react";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
import type { QueryKey } from "@tanstack/react-query";
|
||||||
import { QueryClient } from "@tanstack/react-query";
|
import { QueryClient } from "@tanstack/react-query";
|
||||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
||||||
import { ReactQueryStreamedHydration } from "@tanstack/react-query-next-experimental";
|
import { ReactQueryStreamedHydration } from "@tanstack/react-query-next-experimental";
|
||||||
@@ -33,6 +34,7 @@ import {
|
|||||||
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";
|
||||||
|
import { widgetImports } from "@homarr/widgets";
|
||||||
|
|
||||||
import { createWidgetQueryPersister } from "./query-cache-persister";
|
import { createWidgetQueryPersister } from "./query-cache-persister";
|
||||||
|
|
||||||
@@ -90,6 +92,12 @@ export function TRPCReactProvider(props: PropsWithChildren) {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
client.setQueryDefaults([["widget"]], { refetchInterval: queryCacheDefaultRefetchIntervalMs });
|
client.setQueryDefaults([["widget"]], { refetchInterval: queryCacheDefaultRefetchIntervalMs });
|
||||||
|
for (const { definition } of Object.values(widgetImports)) {
|
||||||
|
const def = definition as { refetchIntervalSeconds?: number; queryKey?: QueryKey; kind: string };
|
||||||
|
if (!def.refetchIntervalSeconds) continue;
|
||||||
|
const key = def.queryKey ?? [["widget", def.kind]];
|
||||||
|
client.setQueryDefaults(key, { refetchInterval: def.refetchIntervalSeconds * 1000 });
|
||||||
|
}
|
||||||
return client;
|
return client;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,17 +1,9 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import type { MutableRefObject, ReactNode } from "react";
|
import type { MutableRefObject, ReactNode } from "react";
|
||||||
import { useCallback, useMemo } from "react";
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||||
import { Group, Loader, Menu, Switch, Text, Tooltip } from "@mantine/core";
|
import { Group, Loader, Menu, Switch, Text } from "@mantine/core";
|
||||||
import {
|
import { IconCopy, IconLayoutKanban, IconRefresh, IconSettings, IconTrash } from "@tabler/icons-react";
|
||||||
IconAlertTriangle,
|
|
||||||
IconCircleCheck,
|
|
||||||
IconCopy,
|
|
||||||
IconLayoutKanban,
|
|
||||||
IconRefresh,
|
|
||||||
IconSettings,
|
|
||||||
IconTrash,
|
|
||||||
} from "@tabler/icons-react";
|
|
||||||
import type { QueryClient, QueryKey } from "@tanstack/react-query";
|
import type { QueryClient, QueryKey } from "@tanstack/react-query";
|
||||||
import { useIsFetching, useQueryClient } from "@tanstack/react-query";
|
import { useIsFetching, useQueryClient } from "@tanstack/react-query";
|
||||||
|
|
||||||
@@ -19,12 +11,10 @@ import { clientApi } from "@homarr/api/client";
|
|||||||
import { useSession } from "@homarr/auth/client";
|
import { useSession } from "@homarr/auth/client";
|
||||||
import { useRequiredBoard } from "@homarr/boards/context";
|
import { useRequiredBoard } from "@homarr/boards/context";
|
||||||
import { useEditMode } from "@homarr/boards/edit-mode";
|
import { useEditMode } from "@homarr/boards/edit-mode";
|
||||||
import { useTimeAgo } from "@homarr/common";
|
|
||||||
import { useConfirmModal, useModalAction } from "@homarr/modals";
|
import { useConfirmModal, useModalAction } from "@homarr/modals";
|
||||||
import { useSettings } from "@homarr/settings";
|
import { useSettings } from "@homarr/settings";
|
||||||
import { translateIfNecessary } from "@homarr/translation";
|
import { translateIfNecessary } from "@homarr/translation";
|
||||||
import { useI18n, useScopedI18n } from "@homarr/translation/client";
|
import { useI18n, useScopedI18n } from "@homarr/translation/client";
|
||||||
import type { TranslationFunction } from "@homarr/translation";
|
|
||||||
import type { WidgetContextMenuAction } from "@homarr/widgets";
|
import type { WidgetContextMenuAction } from "@homarr/widgets";
|
||||||
import { reduceWidgetOptionsWithDefaultValues, widgetImports } from "@homarr/widgets";
|
import { reduceWidgetOptionsWithDefaultValues, widgetImports } from "@homarr/widgets";
|
||||||
import { WidgetEditModal } from "@homarr/widgets/modals";
|
import { WidgetEditModal } from "@homarr/widgets/modals";
|
||||||
@@ -242,14 +232,11 @@ export const WidgetContextMenu = ({ item, widgetStateRef, children }: WidgetCont
|
|||||||
onClick={handleRefetch}
|
onClick={handleRefetch}
|
||||||
disabled={isWidgetFetching}
|
disabled={isWidgetFetching}
|
||||||
>
|
>
|
||||||
<Group justify="space-between" wrap="nowrap" gap="sm">
|
<Group justify="space-between" wrap="nowrap">
|
||||||
{tMenu("refresh")}
|
{tMenu("refresh")}
|
||||||
<WidgetQueryStatus
|
<Text size="xs" c="dimmed">
|
||||||
queryClient={queryClient}
|
<WidgetCacheAge queryClient={queryClient} queryKey={widgetQueryKey} isFetching={isWidgetFetching} />
|
||||||
queryKey={widgetQueryKey}
|
</Text>
|
||||||
isFetching={isWidgetFetching}
|
|
||||||
t={t}
|
|
||||||
/>
|
|
||||||
</Group>
|
</Group>
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
<Menu.Item
|
<Menu.Item
|
||||||
@@ -286,65 +273,34 @@ export const WidgetContextMenu = ({ item, widgetStateRef, children }: WidgetCont
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface WidgetQueryStatusProps {
|
const WidgetCacheAge = ({
|
||||||
|
queryClient,
|
||||||
|
queryKey,
|
||||||
|
isFetching,
|
||||||
|
}: {
|
||||||
queryClient: QueryClient;
|
queryClient: QueryClient;
|
||||||
queryKey: QueryKey;
|
queryKey: QueryKey;
|
||||||
isFetching: boolean;
|
isFetching: boolean;
|
||||||
t: TranslationFunction;
|
}) => {
|
||||||
}
|
// 1s tick for "just now" → "1s ago" label transition; isFetching prop handles refetch reactivity
|
||||||
|
const [, setTick] = useState(0);
|
||||||
|
useEffect(() => {
|
||||||
|
const id = setInterval(() => setTick((n) => n + 1), 1000);
|
||||||
|
return () => clearInterval(id);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const WidgetQueryStatus = ({ queryClient, queryKey, isFetching, t }: WidgetQueryStatusProps) => {
|
if (isFetching) return <Loader size={12} />;
|
||||||
const queries = queryClient.getQueryCache().findAll({ queryKey });
|
|
||||||
const timestamps = queries.map((query) => query.state.dataUpdatedAt).filter(Boolean);
|
|
||||||
const latest = timestamps.length > 0 ? Math.max(...timestamps) : 0;
|
|
||||||
const ageLabel = useTimeAgo(new Date(latest));
|
|
||||||
|
|
||||||
if (isFetching) {
|
const timestamps = queryClient
|
||||||
return (
|
.getQueryCache()
|
||||||
<Group gap={4} wrap="nowrap">
|
.findAll({ queryKey })
|
||||||
<Loader size={12} />
|
.map((q) => q.state.dataUpdatedAt)
|
||||||
<Text size="xs" c="dimmed">
|
.filter(Boolean);
|
||||||
{t("item.menu.status.loading")}
|
if (timestamps.length === 0) return null;
|
||||||
</Text>
|
|
||||||
</Group>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (queries.length === 0) {
|
const latest = Math.max(...timestamps);
|
||||||
return (
|
const seconds = Math.floor((Date.now() - latest) / 1000);
|
||||||
<Text size="xs" c="dimmed">
|
if (seconds < 5) return "just now";
|
||||||
{t("item.menu.status.idle")}
|
if (seconds < 60) return `${seconds}s ago`;
|
||||||
</Text>
|
return `${Math.floor(seconds / 60)}m ago`;
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasError = queries.some((q) => q.state.status === "error");
|
|
||||||
|
|
||||||
if (hasError) {
|
|
||||||
const errorQuery = queries.find((q) => q.state.status === "error");
|
|
||||||
const errorMessage =
|
|
||||||
errorQuery?.state.error instanceof Error
|
|
||||||
? errorQuery.state.error.message
|
|
||||||
: String(errorQuery?.state.error ?? "Unknown error");
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Tooltip label={errorMessage} multiline position="left" w={250}>
|
|
||||||
<Group gap={4} wrap="nowrap">
|
|
||||||
<IconAlertTriangle size={12} color="var(--mantine-color-red-6)" />
|
|
||||||
<Text size="xs" c="red.6">
|
|
||||||
{t("item.menu.status.error")} · {ageLabel}
|
|
||||||
</Text>
|
|
||||||
</Group>
|
|
||||||
</Tooltip>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Group gap={4} wrap="nowrap">
|
|
||||||
<IconCircleCheck size={12} color="var(--mantine-color-green-6)" />
|
|
||||||
<Text size="xs" c="dimmed">
|
|
||||||
{t("item.menu.status.success")} · {ageLabel}
|
|
||||||
</Text>
|
|
||||||
</Group>
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
@@ -153,9 +153,9 @@ export class OverseerrIntegration
|
|||||||
);
|
);
|
||||||
} else if (pendingResults.length > 0) requests = pendingResults;
|
} else if (pendingResults.length > 0) requests = pendingResults;
|
||||||
else if (allResults.length > 0) requests = allResults;
|
else if (allResults.length > 0) requests = allResults;
|
||||||
else return [];
|
else return Promise.all([]);
|
||||||
|
|
||||||
const settled = await Promise.allSettled(
|
return await Promise.all(
|
||||||
requests.map(async (request): Promise<MediaRequest> => {
|
requests.map(async (request): Promise<MediaRequest> => {
|
||||||
const information = await this.getItemInformationAsync(request.media.tmdbId, request.type);
|
const information = await this.getItemInformationAsync(request.media.tmdbId, request.type);
|
||||||
|
|
||||||
@@ -184,10 +184,6 @@ export class OverseerrIntegration
|
|||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
return settled
|
|
||||||
.filter((result): result is PromiseFulfilledResult<MediaRequest> => result.status === "fulfilled")
|
|
||||||
.map((result) => result.value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected mapRequestStatus(status: UpstreamMediaRequestStatus): MediaRequestStatus {
|
protected mapRequestStatus(status: UpstreamMediaRequestStatus): MediaRequestStatus {
|
||||||
@@ -305,10 +301,6 @@ export class OverseerrIntegration
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error(`Failed to fetch ${type} information for id ${id}: ${response.status} ${response.statusText}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type === "tv") {
|
if (type === "tv") {
|
||||||
const series = (await response.json()) as TvInformation;
|
const series = (await response.json()) as TvInformation;
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ type IntegrationOfKind<TKind extends IntegrationKind> = Omit<Integration, "kind"
|
|||||||
interface Options<TData, TKind extends IntegrationKind, TInput extends Record<string, unknown>> {
|
interface Options<TData, TKind extends IntegrationKind, TInput extends Record<string, unknown>> {
|
||||||
requestAsync: (integration: IntegrationOfKind<TKind>, input: TInput) => Promise<TData>;
|
requestAsync: (integration: IntegrationOfKind<TKind>, input: TInput) => Promise<TData>;
|
||||||
cacheTtlMs?: number;
|
cacheTtlMs?: number;
|
||||||
fallbackToStaleOnError?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const createIntegrationRequestHandler = <
|
export const createIntegrationRequestHandler = <
|
||||||
@@ -33,7 +32,6 @@ export const createIntegrationRequestHandler = <
|
|||||||
return options.requestAsync(integration, input.options);
|
return options.requestAsync(integration, input.options);
|
||||||
},
|
},
|
||||||
cacheTtlMs: options.cacheTtlMs,
|
cacheTtlMs: options.cacheTtlMs,
|
||||||
fallbackToStaleOnError: options.fallbackToStaleOnError,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
interface Options<TData, TInput extends Record<string, unknown>> {
|
interface Options<TData, TInput extends Record<string, unknown>> {
|
||||||
requestAsync: (input: TInput) => Promise<TData>;
|
requestAsync: (input: TInput) => Promise<TData>;
|
||||||
cacheTtlMs?: number;
|
cacheTtlMs?: number;
|
||||||
fallbackToStaleOnError?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type CacheEntry<TData> = { data: TData; timestamp: Date; expiresAt: number };
|
type CacheEntry<TData> = { data: TData; timestamp: Date; expiresAt: number };
|
||||||
@@ -36,6 +35,7 @@ export const createRequestHandler = <TData, TInput extends Record<string, unknow
|
|||||||
if (cached && Date.now() < cached.expiresAt) {
|
if (cached && Date.now() < cached.expiresAt) {
|
||||||
return { data: cached.data, timestamp: cached.timestamp };
|
return { data: cached.data, timestamp: cached.timestamp };
|
||||||
}
|
}
|
||||||
|
if (cached) cache.delete(key);
|
||||||
|
|
||||||
const existing = inflight.get(key);
|
const existing = inflight.get(key);
|
||||||
if (existing) return existing;
|
if (existing) return existing;
|
||||||
@@ -55,9 +55,6 @@ export const createRequestHandler = <TData, TInput extends Record<string, unknow
|
|||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
inflight.delete(key);
|
inflight.delete(key);
|
||||||
if (options.fallbackToStaleOnError && cached) {
|
|
||||||
return cached;
|
|
||||||
}
|
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,4 @@ export const mediaRequestListRequestHandler = createIntegrationRequestHandler<
|
|||||||
const integrationInstance = await createIntegrationAsync(integration);
|
const integrationInstance = await createIntegrationAsync(integration);
|
||||||
return await integrationInstance.getRequestsAsync();
|
return await integrationInstance.getRequestsAsync();
|
||||||
},
|
},
|
||||||
cacheTtlMs: 60_000,
|
|
||||||
fallbackToStaleOnError: true,
|
|
||||||
});
|
});
|
||||||
@@ -1598,16 +1598,10 @@
|
|||||||
},
|
},
|
||||||
"menu": {
|
"menu": {
|
||||||
"label": {
|
"label": {
|
||||||
"settings": "",
|
"settings": "Settings",
|
||||||
"refresh": "",
|
"refresh": "",
|
||||||
"options": "",
|
"options": "",
|
||||||
"actions": ""
|
"actions": ""
|
||||||
},
|
|
||||||
"status": {
|
|
||||||
"success": "",
|
|
||||||
"error": "",
|
|
||||||
"loading": "",
|
|
||||||
"idle": ""
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"create": {
|
"create": {
|
||||||
|
|||||||
@@ -1622,12 +1622,6 @@
|
|||||||
"refresh": "Refresh",
|
"refresh": "Refresh",
|
||||||
"options": "Options",
|
"options": "Options",
|
||||||
"actions": "Actions"
|
"actions": "Actions"
|
||||||
},
|
|
||||||
"status": {
|
|
||||||
"success": "OK",
|
|
||||||
"error": "Error",
|
|
||||||
"loading": "Loading",
|
|
||||||
"idle": "Idle"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"create": {
|
"create": {
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("anchorNote", {
|
export const { definition, componentLoader } = createWidgetDefinition("anchorNote", {
|
||||||
icon: IconNotes,
|
icon: IconNotes,
|
||||||
|
queryKey: [["widget", "anchorNotes"]],
|
||||||
|
refetchIntervalSeconds: 15,
|
||||||
supportedIntegrations: ["anchor"],
|
supportedIntegrations: ["anchor"],
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("archiveTeamWarrior", {
|
export const { definition, componentLoader } = createWidgetDefinition("archiveTeamWarrior", {
|
||||||
icon: IconArchive,
|
icon: IconArchive,
|
||||||
|
refetchIntervalSeconds: 300,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
showBroadcastMessage: factory.switch({
|
showBroadcastMessage: factory.switch({
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ const hideUnlessAudiobookshelf = {
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("audioStats", {
|
export const { definition, componentLoader } = createWidgetDefinition("audioStats", {
|
||||||
icon: IconHeadphones,
|
icon: IconHeadphones,
|
||||||
|
refetchIntervalSeconds: 600,
|
||||||
supportedIntegrations: ["navidrome", "audiobookshelf"],
|
supportedIntegrations: ["navidrome", "audiobookshelf"],
|
||||||
integrationsRequired: true,
|
integrationsRequired: true,
|
||||||
maxIntegrations: 1,
|
maxIntegrations: 1,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("calendar", {
|
export const { definition, componentLoader } = createWidgetDefinition("calendar", {
|
||||||
icon: IconCalendar,
|
icon: IconCalendar,
|
||||||
|
refetchIntervalSeconds: 60,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
releaseType: factory.multiSelect({
|
releaseType: factory.multiSelect({
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("coolify", {
|
export const { definition, componentLoader } = createWidgetDefinition("coolify", {
|
||||||
icon: IconCloud,
|
icon: IconCloud,
|
||||||
|
refetchIntervalSeconds: 30,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
showServers: factory.switch({
|
showServers: factory.switch({
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ export const createWidgetDefinition = <TKind extends WidgetKind, TDefinition ext
|
|||||||
export interface WidgetDefinition {
|
export interface WidgetDefinition {
|
||||||
icon: TablerIcon;
|
icon: TablerIcon;
|
||||||
queryKey?: QueryKey;
|
queryKey?: QueryKey;
|
||||||
|
refetchIntervalSeconds?: number;
|
||||||
supportedIntegrations?: IntegrationKind[];
|
supportedIntegrations?: IntegrationKind[];
|
||||||
integrationsRequired?: boolean;
|
integrationsRequired?: boolean;
|
||||||
maxIntegrations?: number;
|
maxIntegrations?: number;
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ export const widgetKind = "dnsHoleControls";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition(widgetKind, {
|
export const { definition, componentLoader } = createWidgetDefinition(widgetKind, {
|
||||||
icon: IconDeviceGamepad,
|
icon: IconDeviceGamepad,
|
||||||
|
queryKey: [["widget", "dnsHole"]],
|
||||||
|
refetchIntervalSeconds: 5,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
showToggleAllButtons: factory.switch({
|
showToggleAllButtons: factory.switch({
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ export const widgetKind = "dnsHoleSummary";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition(widgetKind, {
|
export const { definition, componentLoader } = createWidgetDefinition(widgetKind, {
|
||||||
icon: IconAd,
|
icon: IconAd,
|
||||||
|
queryKey: [["widget", "dnsHole"]],
|
||||||
|
refetchIntervalSeconds: 5,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
usePiHoleColors: factory.switch({
|
usePiHoleColors: factory.switch({
|
||||||
|
|||||||
@@ -184,13 +184,7 @@ export default function DockerWidget({ options, width, isEditMode }: WidgetCompo
|
|||||||
const t = useScopedI18n("docker");
|
const t = useScopedI18n("docker");
|
||||||
const isTiny = width <= 256;
|
const isTiny = width <= 256;
|
||||||
|
|
||||||
const {
|
const { data, refetch, isFetching } = clientApi.docker.getContainers.useQuery(undefined, {});
|
||||||
data,
|
|
||||||
refetch,
|
|
||||||
isFetching,
|
|
||||||
} = clientApi.docker.getContainers.useQuery(undefined, {
|
|
||||||
refetchInterval: 30_000,
|
|
||||||
});
|
|
||||||
const containers = data?.containers ?? [];
|
const containers = data?.containers ?? [];
|
||||||
const timestamp = useMemo(() => data?.timestamp ?? new Date(), [data?.timestamp]);
|
const timestamp = useMemo(() => data?.timestamp ?? new Date(), [data?.timestamp]);
|
||||||
const relativeTime = useTimeAgo(timestamp);
|
const relativeTime = useTimeAgo(timestamp);
|
||||||
@@ -304,9 +298,7 @@ export default function DockerWidget({ options, width, isEditMode }: WidgetCompo
|
|||||||
{t("table.totalMemory", { memory: formatBytes(totals.memory) })}
|
{t("table.totalMemory", { memory: formatBytes(totals.memory) })}
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
<Tooltip
|
<Tooltip label={t("table.refresh.lastUpdated", { when: relativeTime })}>
|
||||||
label={t("table.refresh.lastUpdated", { when: relativeTime })}
|
|
||||||
>
|
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
size="sm"
|
size="sm"
|
||||||
variant="transparent"
|
variant="transparent"
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ const columnTranslationKeyMap = {
|
|||||||
export const { definition, componentLoader } = createWidgetDefinition("dockerContainers", {
|
export const { definition, componentLoader } = createWidgetDefinition("dockerContainers", {
|
||||||
icon: IconBrandDocker,
|
icon: IconBrandDocker,
|
||||||
queryKey: [["docker", "getContainers"]],
|
queryKey: [["docker", "getContainers"]],
|
||||||
|
refetchIntervalSeconds: 20,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
columns: factory.multiSelect({
|
columns: factory.multiSelect({
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ const columnsSort = columnsList.filter((column) =>
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("downloads", {
|
export const { definition, componentLoader } = createWidgetDefinition("downloads", {
|
||||||
icon: IconDownload,
|
icon: IconDownload,
|
||||||
|
refetchIntervalSeconds: 5,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from(
|
return optionsBuilder.from(
|
||||||
(factory) => ({
|
(factory) => ({
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("firewall", {
|
export const { definition, componentLoader } = createWidgetDefinition("firewall", {
|
||||||
icon: IconWall,
|
icon: IconWall,
|
||||||
|
refetchIntervalSeconds: 5,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from(() => ({}));
|
return optionsBuilder.from(() => ({}));
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { createStorageVolumeMultiSelectOptions } from "../storage-volume-options
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("healthMonitoring", {
|
export const { definition, componentLoader } = createWidgetDefinition("healthMonitoring", {
|
||||||
icon: IconHeartRateMonitor,
|
icon: IconHeartRateMonitor,
|
||||||
|
refetchIntervalSeconds: 5,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from(
|
return optionsBuilder.from(
|
||||||
(factory) => ({
|
(factory) => ({
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import { optionsBuilder } from "../../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("immich-albumCarousel", {
|
export const { definition, componentLoader } = createWidgetDefinition("immich-albumCarousel", {
|
||||||
icon: IconPhoto,
|
icon: IconPhoto,
|
||||||
|
queryKey: [["widget", "immich"]],
|
||||||
|
refetchIntervalSeconds: 900,
|
||||||
supportedIntegrations: ["immich"],
|
supportedIntegrations: ["immich"],
|
||||||
integrationsRequired: true,
|
integrationsRequired: true,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import { optionsBuilder } from "../../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("immich-serverStats", {
|
export const { definition, componentLoader } = createWidgetDefinition("immich-serverStats", {
|
||||||
icon: IconGraphFilled,
|
icon: IconGraphFilled,
|
||||||
|
queryKey: [["widget", "immich"]],
|
||||||
|
refetchIntervalSeconds: 900,
|
||||||
supportedIntegrations: ["immich"],
|
supportedIntegrations: ["immich"],
|
||||||
integrationsRequired: true,
|
integrationsRequired: true,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("indexerManager", {
|
export const { definition, componentLoader } = createWidgetDefinition("indexerManager", {
|
||||||
icon: IconReportSearch,
|
icon: IconReportSearch,
|
||||||
|
refetchIntervalSeconds: 300,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
openIndexerSiteInNewTab: factory.switch({
|
openIndexerSiteInNewTab: factory.switch({
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("mediaReleases", {
|
export const { definition, componentLoader } = createWidgetDefinition("mediaReleases", {
|
||||||
icon: IconTicket,
|
icon: IconTicket,
|
||||||
|
queryKey: [["widget", "mediaRelease"]],
|
||||||
|
refetchIntervalSeconds: 300,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
layout: factory.select({
|
layout: factory.select({
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import { optionsBuilder } from "../../options";
|
|||||||
|
|
||||||
export const { componentLoader, definition } = createWidgetDefinition("mediaRequests-requestList", {
|
export const { componentLoader, definition } = createWidgetDefinition("mediaRequests-requestList", {
|
||||||
icon: IconZoomQuestion,
|
icon: IconZoomQuestion,
|
||||||
|
queryKey: [["widget", "mediaRequests"]],
|
||||||
|
refetchIntervalSeconds: 60,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
linksTargetNewTab: factory.switch({
|
linksTargetNewTab: factory.switch({
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import { createWidgetDefinition } from "../../definition";
|
|||||||
|
|
||||||
export const { componentLoader, definition } = createWidgetDefinition("mediaRequests-requestStats", {
|
export const { componentLoader, definition } = createWidgetDefinition("mediaRequests-requestStats", {
|
||||||
icon: IconChartBar,
|
icon: IconChartBar,
|
||||||
|
queryKey: [["widget", "mediaRequests"]],
|
||||||
|
refetchIntervalSeconds: 60,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { componentLoader, definition } = createWidgetDefinition("mediaServer", {
|
export const { componentLoader, definition } = createWidgetDefinition("mediaServer", {
|
||||||
icon: IconVideo,
|
icon: IconVideo,
|
||||||
|
refetchIntervalSeconds: 5,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
showOnlyPlaying: factory.switch({ defaultValue: true, withDescription: true }),
|
showOnlyPlaying: factory.switch({ defaultValue: true, withDescription: true }),
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export const views = ["workers", "queue", "statistics"] as const;
|
|||||||
|
|
||||||
export const { componentLoader, definition } = createWidgetDefinition("mediaTranscoding", {
|
export const { componentLoader, definition } = createWidgetDefinition("mediaTranscoding", {
|
||||||
icon: IconTransform,
|
icon: IconTransform,
|
||||||
|
refetchIntervalSeconds: 300,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
defaultView: factory.select({
|
defaultView: factory.select({
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { optionsBuilder } from "../../options";
|
|||||||
|
|
||||||
export const { componentLoader, definition } = createWidgetDefinition("minecraftServerStatus", {
|
export const { componentLoader, definition } = createWidgetDefinition("minecraftServerStatus", {
|
||||||
icon: IconBrandMinecraft,
|
icon: IconBrandMinecraft,
|
||||||
|
refetchIntervalSeconds: 300,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
title: factory.text({ defaultValue: "" }),
|
title: factory.text({ defaultValue: "" }),
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import { optionsBuilder } from "../../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("networkControllerStatus", {
|
export const { definition, componentLoader } = createWidgetDefinition("networkControllerStatus", {
|
||||||
icon: IconTopologyFull,
|
icon: IconTopologyFull,
|
||||||
|
queryKey: [["widget", "networkController"]],
|
||||||
|
refetchIntervalSeconds: 300,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
content: factory.select({
|
content: factory.select({
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("networkControllerSummary", {
|
export const { definition, componentLoader } = createWidgetDefinition("networkControllerSummary", {
|
||||||
icon: IconTopologyFull,
|
icon: IconTopologyFull,
|
||||||
|
refetchIntervalSeconds: 300,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from(() => ({}));
|
return optionsBuilder.from(() => ({}));
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { componentLoader, definition } = createWidgetDefinition("notifications", {
|
export const { componentLoader, definition } = createWidgetDefinition("notifications", {
|
||||||
icon: IconMessage,
|
icon: IconMessage,
|
||||||
|
refetchIntervalSeconds: 300,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
hideLogos: factory.switch({ defaultValue: false }),
|
hideLogos: factory.switch({ defaultValue: false }),
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("paperlessNgx", {
|
export const { definition, componentLoader } = createWidgetDefinition("paperlessNgx", {
|
||||||
icon: IconFileText,
|
icon: IconFileText,
|
||||||
|
refetchIntervalSeconds: 900,
|
||||||
supportedIntegrations: ["paperlessNgx"],
|
supportedIntegrations: ["paperlessNgx"],
|
||||||
integrationsRequired: true,
|
integrationsRequired: true,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ const relativeDateSchema = z
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("releases", {
|
export const { definition, componentLoader } = createWidgetDefinition("releases", {
|
||||||
icon: IconRocket,
|
icon: IconRocket,
|
||||||
|
refetchIntervalSeconds: 300,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
newReleaseWithin: factory.text({
|
newReleaseWithin: factory.text({
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { optionsBuilder } from "../options";
|
|||||||
*/
|
*/
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("rssFeed", {
|
export const { definition, componentLoader } = createWidgetDefinition("rssFeed", {
|
||||||
icon: IconRss,
|
icon: IconRss,
|
||||||
|
refetchIntervalSeconds: 300,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
feedUrls: factory.multiText({
|
feedUrls: factory.multiText({
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import { optionsBuilder } from "../../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("smartHome-entityState", {
|
export const { definition, componentLoader } = createWidgetDefinition("smartHome-entityState", {
|
||||||
icon: IconBinaryTree,
|
icon: IconBinaryTree,
|
||||||
|
queryKey: [["widget", "smartHome"]],
|
||||||
|
refetchIntervalSeconds: 60,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
entityId: factory.text({
|
entityId: factory.text({
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("speedtestTracker", {
|
export const { definition, componentLoader } = createWidgetDefinition("speedtestTracker", {
|
||||||
icon: IconSpeedboat,
|
icon: IconSpeedboat,
|
||||||
|
refetchIntervalSeconds: 600,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from(
|
return optionsBuilder.from(
|
||||||
(factory) => ({
|
(factory) => ({
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ const timeIntervalOptions = stockPriceTimeFrames.interval;
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("stockPrice", {
|
export const { definition, componentLoader } = createWidgetDefinition("stockPrice", {
|
||||||
icon: IconBuildingBank,
|
icon: IconBuildingBank,
|
||||||
|
refetchIntervalSeconds: 300,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
stock: factory.text({
|
stock: factory.text({
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import { createStorageVolumeMultiSelectOptions } from "../storage-volume-options
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("systemDisks", {
|
export const { definition, componentLoader } = createWidgetDefinition("systemDisks", {
|
||||||
icon: IconServer2,
|
icon: IconServer2,
|
||||||
|
queryKey: [["widget", "healthMonitoring"]],
|
||||||
|
refetchIntervalSeconds: 5,
|
||||||
supportedIntegrations: ["dashDot", "openmediavault", "truenas", "unraid", "synology"],
|
supportedIntegrations: ["dashDot", "openmediavault", "truenas", "unraid", "synology"],
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from(
|
return optionsBuilder.from(
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ const labelDisplayModeOptions = {
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("systemResources", {
|
export const { definition, componentLoader } = createWidgetDefinition("systemResources", {
|
||||||
icon: IconGraphFilled,
|
icon: IconGraphFilled,
|
||||||
|
queryKey: [["widget", "healthMonitoring"]],
|
||||||
|
refetchIntervalSeconds: 5,
|
||||||
supportedIntegrations: ["dashDot", "openmediavault", "truenas", "unraid", "glances", "synology"],
|
supportedIntegrations: ["dashDot", "openmediavault", "truenas", "unraid", "glances", "synology"],
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { componentLoader, definition } = createWidgetDefinition("timetable", {
|
export const { componentLoader, definition } = createWidgetDefinition("timetable", {
|
||||||
icon: IconBusStop,
|
icon: IconBusStop,
|
||||||
|
refetchIntervalSeconds: 60,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
baseUrl: factory.text({
|
baseUrl: factory.text({
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("tracearr", {
|
export const { definition, componentLoader } = createWidgetDefinition("tracearr", {
|
||||||
icon: IconActivityHeartbeat,
|
icon: IconActivityHeartbeat,
|
||||||
|
refetchIntervalSeconds: 5,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
showStreams: factory.switch({
|
showStreams: factory.switch({
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ export const timeFrameValues = ["today", "24h", "7d", "30d", "month", "lastMonth
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("umami", {
|
export const { definition, componentLoader } = createWidgetDefinition("umami", {
|
||||||
icon: IconChartBar,
|
icon: IconChartBar,
|
||||||
|
refetchIntervalSeconds: 300,
|
||||||
supportedIntegrations: ["umami"],
|
supportedIntegrations: ["umami"],
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from(
|
return optionsBuilder.from(
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("ups", {
|
export const { definition, componentLoader } = createWidgetDefinition("ups", {
|
||||||
icon: IconBatteryCharging,
|
icon: IconBatteryCharging,
|
||||||
|
refetchIntervalSeconds: 60,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
showBattery: factory.switch({
|
showBattery: factory.switch({
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("uptimeKuma", {
|
export const { definition, componentLoader } = createWidgetDefinition("uptimeKuma", {
|
||||||
icon: IconHeartbeat,
|
icon: IconHeartbeat,
|
||||||
|
refetchIntervalSeconds: 60,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
showAverageUptime: factory.switch({
|
showAverageUptime: factory.switch({
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { componentLoader, definition } = createWidgetDefinition("vpn", {
|
export const { componentLoader, definition } = createWidgetDefinition("vpn", {
|
||||||
icon: IconShieldLock,
|
icon: IconShieldLock,
|
||||||
|
refetchIntervalSeconds: 300,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from(() => ({}));
|
return optionsBuilder.from(() => ({}));
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("weather", {
|
export const { definition, componentLoader } = createWidgetDefinition("weather", {
|
||||||
icon: IconCloud,
|
icon: IconCloud,
|
||||||
|
refetchIntervalSeconds: 60,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from(
|
return optionsBuilder.from(
|
||||||
(factory) => ({
|
(factory) => ({
|
||||||
|
|||||||
Reference in new issue
Block a user