Merge advanced widget opt-in into mobile boards
This commit is contained in:
37 files changed
+151
-42
No files matched your search
@@ -18,7 +18,7 @@ Temporary inputs exist only while the tile is mounted. Homarr encrypts source cr
|
|||||||
|
|
||||||
Homarr does not send these credentials to the browser. Homarr does not include them in an export.
|
Homarr does not send these credentials to the browser. Homarr does not include them in an export.
|
||||||
|
|
||||||
<WidgetInteractionGuide />
|
<WidgetInteractionGuide advancedView={false} />
|
||||||
|
|
||||||
### Adding the widget
|
### Adding the widget
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,11 @@ const createSession = (userId: string): Session => ({
|
|||||||
expires: new Date(Date.now() + 60_000).toISOString(),
|
expires: new Date(Date.now() + 60_000).toISOString(),
|
||||||
});
|
});
|
||||||
|
|
||||||
async function setup(isPublic = true) {
|
async function setup(
|
||||||
|
isPublic = true,
|
||||||
|
customDefinition: HomarrCustomWidgetV2 = definition,
|
||||||
|
configuration: Record<string, unknown> = {},
|
||||||
|
) {
|
||||||
const db = createDb();
|
const db = createDb();
|
||||||
const ownerId = createId();
|
const ownerId = createId();
|
||||||
const boardId = createId();
|
const boardId = createId();
|
||||||
@@ -94,14 +98,14 @@ async function setup(isPublic = true) {
|
|||||||
await db.insert(boards).values({ id: boardId, name: createId(), creatorId: ownerId, isPublic });
|
await db.insert(boards).values({ id: boardId, name: createId(), creatorId: ownerId, isPublic });
|
||||||
await db.insert(customWidgetDefinitions).values({
|
await db.insert(customWidgetDefinitions).values({
|
||||||
id: definitionId,
|
id: definitionId,
|
||||||
...serializeCustomWidgetDefinition(definition),
|
...serializeCustomWidgetDefinition(customDefinition),
|
||||||
creatorId: ownerId,
|
creatorId: ownerId,
|
||||||
});
|
});
|
||||||
await db.insert(items).values({
|
await db.insert(items).values({
|
||||||
id: itemId,
|
id: itemId,
|
||||||
boardId,
|
boardId,
|
||||||
kind: "customApi",
|
kind: "customApi",
|
||||||
options: stringifySuperJson({ definitionId, configuration: {}, configurationVersion: 1 }),
|
options: stringifySuperJson({ definitionId, configuration, configurationVersion: 1 }),
|
||||||
});
|
});
|
||||||
return { db, ownerId, boardId, itemId, definitionId };
|
return { db, ownerId, boardId, itemId, definitionId };
|
||||||
}
|
}
|
||||||
@@ -122,6 +126,20 @@ describe("Custom JSX v2 board router", () => {
|
|||||||
expect(mocks.executeRequest).toHaveBeenCalledOnce();
|
expect(mocks.executeRequest).toHaveBeenCalledOnce();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("uses current defaults when an updated option no longer accepts the stored value", async () => {
|
||||||
|
const updatedDefinition: HomarrCustomWidgetV2 = {
|
||||||
|
...definition,
|
||||||
|
options: {
|
||||||
|
limit: { label: "Limit", control: "slider", default: 5, min: 1, max: 10 },
|
||||||
|
},
|
||||||
|
template: "<Text>{options.limit}</Text>",
|
||||||
|
};
|
||||||
|
const { db, itemId } = await setup(true, updatedDefinition, { limit: "5", removed: true });
|
||||||
|
const caller = customApiRouter.createCaller({ db, deviceType: undefined, session: null });
|
||||||
|
|
||||||
|
await expect(caller.getData({ itemId })).resolves.toMatchObject({ options: { limit: 5 } });
|
||||||
|
});
|
||||||
|
|
||||||
test("hides private boards and disabled definitions before executing a request", async () => {
|
test("hides private boards and disabled definitions before executing a request", async () => {
|
||||||
const privateSetup = await setup(false);
|
const privateSetup = await setup(false);
|
||||||
const anonymous = customApiRouter.createCaller({
|
const anonymous = customApiRouter.createCaller({
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import type { BoardPermission } from "@homarr/definitions";
|
|||||||
import {
|
import {
|
||||||
getCustomWidgetConfirmation,
|
getCustomWidgetConfirmation,
|
||||||
getCustomWidgetDefaultOptions,
|
getCustomWidgetDefaultOptions,
|
||||||
|
normalizeCustomWidgetOptions,
|
||||||
validateCustomWidgetOptions,
|
validateCustomWidgetOptions,
|
||||||
} from "@homarr/custom-widgets/core";
|
} from "@homarr/custom-widgets/core";
|
||||||
import type { CustomJsxRequest, CustomWidgetSource } from "@homarr/custom-widgets/core";
|
import type { CustomJsxRequest, CustomWidgetSource } from "@homarr/custom-widgets/core";
|
||||||
@@ -96,7 +97,10 @@ async function resolvePlacedDefinitionAsync(ctx: RouterContext, itemId: string)
|
|||||||
if (!stored.enabled) throw new TRPCError({ code: "FORBIDDEN", message: "Widget is disabled" });
|
if (!stored.enabled) throw new TRPCError({ code: "FORBIDDEN", message: "Widget is disabled" });
|
||||||
|
|
||||||
const definition = parseStoredCustomWidgetDefinition(stored);
|
const definition = parseStoredCustomWidgetDefinition(stored);
|
||||||
const configuration = { ...getCustomWidgetDefaultOptions(definition.options), ...itemOptions.configuration };
|
const configuration =
|
||||||
|
itemOptions.configurationVersion === stored.updatedAt.getTime()
|
||||||
|
? { ...getCustomWidgetDefaultOptions(definition.options), ...itemOptions.configuration }
|
||||||
|
: normalizeCustomWidgetOptions(definition.options, itemOptions.configuration);
|
||||||
const issues = validateCustomWidgetOptions(definition.options, configuration);
|
const issues = validateCustomWidgetOptions(definition.options, configuration);
|
||||||
if (issues.length > 0) {
|
if (issues.length > 0) {
|
||||||
throw new TRPCError({
|
throw new TRPCError({
|
||||||
|
|||||||
@@ -12,6 +12,18 @@ export function getCustomWidgetDefaultOptions(
|
|||||||
return Object.fromEntries(Object.entries(options).map(([name, option]) => [name, option.default]));
|
return Object.fromEntries(Object.entries(options).map(([name, option]) => [name, option.default]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function normalizeCustomWidgetOptions(
|
||||||
|
options: CustomWidgetOptions,
|
||||||
|
value: Record<string, unknown>,
|
||||||
|
): Record<string, unknown> {
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(options).map(([name, option]) => [
|
||||||
|
name,
|
||||||
|
getCustomWidgetOptionValueIssue(option, value[name]) ? option.default : value[name],
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export function validateCustomWidgetOptions(
|
export function validateCustomWidgetOptions(
|
||||||
options: CustomWidgetOptions,
|
options: CustomWidgetOptions,
|
||||||
value: Record<string, unknown>,
|
value: Record<string, unknown>,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
customWidgetOptionControls,
|
customWidgetOptionControls,
|
||||||
customWidgetOptionSchema,
|
customWidgetOptionSchema,
|
||||||
getCustomWidgetDefaultOptions,
|
getCustomWidgetDefaultOptions,
|
||||||
|
normalizeCustomWidgetOptions,
|
||||||
validateCustomWidgetOptions,
|
validateCustomWidgetOptions,
|
||||||
} from "../core";
|
} from "../core";
|
||||||
|
|
||||||
@@ -69,6 +70,29 @@ describe("lean Custom Widget options", () => {
|
|||||||
expect(validateCustomWidgetOptions(options, configuration)).toEqual([]);
|
expect(validateCustomWidgetOptions(options, configuration)).toEqual([]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("replaces stale values with current defaults", () => {
|
||||||
|
const options = customWidgetDefinitionSchema.parse({
|
||||||
|
$schema: "homarr-custom-widget-v2",
|
||||||
|
name: "Updated options",
|
||||||
|
sources: {},
|
||||||
|
requests: {},
|
||||||
|
options: {
|
||||||
|
limit: { label: "Limit", control: "slider", default: 5, min: 1, max: 10 },
|
||||||
|
label: { label: "Label", control: "text", default: "Default" },
|
||||||
|
},
|
||||||
|
template: "<Text>{options.limit}</Text>",
|
||||||
|
}).options;
|
||||||
|
|
||||||
|
const normalized = normalizeCustomWidgetOptions(options, {
|
||||||
|
limit: "5",
|
||||||
|
label: "Custom",
|
||||||
|
removed: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(normalized).toEqual({ limit: 5, label: "Custom" });
|
||||||
|
expect(validateCustomWidgetOptions(options, normalized)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
it("rejects duplicate static choice values", () => {
|
it("rejects duplicate static choice values", () => {
|
||||||
expect(
|
expect(
|
||||||
customWidgetOptionSchema.safeParse({
|
customWidgetOptionSchema.safeParse({
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ import { IconAlertTriangle } from "@tabler/icons-react";
|
|||||||
import { clientApi } from "@homarr/api/client";
|
import { clientApi } from "@homarr/api/client";
|
||||||
import { useOptionalBoard } from "@homarr/boards/context";
|
import { useOptionalBoard } from "@homarr/boards/context";
|
||||||
import type { CustomWidgetOption } from "@homarr/custom-widgets/core";
|
import type { CustomWidgetOption } from "@homarr/custom-widgets/core";
|
||||||
import { validateCustomWidgetOptions } from "@homarr/custom-widgets/core";
|
import { normalizeCustomWidgetOptions, validateCustomWidgetOptions } from "@homarr/custom-widgets/core";
|
||||||
import { CustomWidgetCodeEditor } from "@homarr/custom-widgets/workbench";
|
import { CustomWidgetCodeEditor } from "@homarr/custom-widgets/workbench";
|
||||||
import type { CustomWidgetEditorMessages } from "@homarr/custom-widgets/workbench";
|
import type { CustomWidgetEditorMessages } from "@homarr/custom-widgets/workbench";
|
||||||
import { IconPicker } from "@homarr/forms-collection";
|
import { IconPicker } from "@homarr/forms-collection";
|
||||||
@@ -45,10 +45,23 @@ export const WidgetCustomWidgetConfigurationInput = ({
|
|||||||
);
|
);
|
||||||
const definition = available.data?.find((candidate) => candidate.id === definitionId);
|
const definition = available.data?.find((candidate) => candidate.id === definitionId);
|
||||||
const options = isRecord(definition?.options) ? (definition.options as Record<string, CustomWidgetOption>) : null;
|
const options = isRecord(definition?.options) ? (definition.options as Record<string, CustomWidgetOption>) : null;
|
||||||
const issues = useMemo(
|
const definitionVersion = definition?.updatedAt instanceof Date ? definition.updatedAt.getTime() : undefined;
|
||||||
() => (options ? validateCustomWidgetOptions(options, configuration) : []),
|
const configurationVersion = form.values.options.configurationVersion;
|
||||||
[configuration, options],
|
const needsDefinitionRepair = definitionVersion !== undefined && configurationVersion !== definitionVersion;
|
||||||
|
const effectiveConfiguration = useMemo(
|
||||||
|
() => (options && needsDefinitionRepair ? normalizeCustomWidgetOptions(options, configuration) : configuration),
|
||||||
|
[configuration, needsDefinitionRepair, options],
|
||||||
);
|
);
|
||||||
|
const issues = useMemo(
|
||||||
|
() => (options ? validateCustomWidgetOptions(options, effectiveConfiguration) : []),
|
||||||
|
[effectiveConfiguration, options],
|
||||||
|
);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!needsDefinitionRepair || definitionVersion === undefined) return;
|
||||||
|
form.setFieldValue(`options.${property}`, effectiveConfiguration);
|
||||||
|
form.setFieldValue("options.configurationVersion", definitionVersion);
|
||||||
|
}, [definitionVersion, effectiveConfiguration, form, needsDefinitionRepair, property]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const path = `options.${property}`;
|
const path = `options.${property}`;
|
||||||
@@ -72,7 +85,7 @@ export const WidgetCustomWidgetConfigurationInput = ({
|
|||||||
key={`${definitionId}:${name}`}
|
key={`${definitionId}:${name}`}
|
||||||
option={option}
|
option={option}
|
||||||
path={`options.${property}.${name}`}
|
path={`options.${property}.${name}`}
|
||||||
configuration={configuration}
|
configuration={effectiveConfiguration}
|
||||||
definitionId={definitionId}
|
definitionId={definitionId}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
@@ -87,7 +100,7 @@ export const WidgetCustomWidgetConfigurationInput = ({
|
|||||||
key={`${definitionId}:${name}`}
|
key={`${definitionId}:${name}`}
|
||||||
option={option}
|
option={option}
|
||||||
path={`options.${property}.${name}`}
|
path={`options.${property}.${name}`}
|
||||||
configuration={configuration}
|
configuration={effectiveConfiguration}
|
||||||
definitionId={definitionId}
|
definitionId={definitionId}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -3,41 +3,44 @@ import { describe, expect, test } from "vitest";
|
|||||||
import { supportsAdvancedFocus } from "./definition";
|
import { supportsAdvancedFocus } from "./definition";
|
||||||
import { widgetImports } from ".";
|
import { widgetImports } from ".";
|
||||||
|
|
||||||
const compactOnlyWidgetKinds = [
|
const advancedFocusWidgetKinds = [
|
||||||
"app",
|
"anchorNote",
|
||||||
"bazarr",
|
"archiveTeamWarrior",
|
||||||
"beszelAlerts",
|
"audioStats",
|
||||||
"beszelSystemGrid",
|
"bookmarks",
|
||||||
"beszelSystemStats",
|
"calendar",
|
||||||
"beszelSystemTable",
|
"clock",
|
||||||
"coolify",
|
"dockerContainers",
|
||||||
"dnsHoleControls",
|
"downloads",
|
||||||
"dnsHoleSummary",
|
"firewall",
|
||||||
"iframe",
|
"healthMonitoring",
|
||||||
"indexerManager",
|
"immich-albumCarousel",
|
||||||
"mediaRequests-requestList",
|
"immich-serverStats",
|
||||||
"mediaRequests-requestStats",
|
"mediaMissing",
|
||||||
"minecraftServerStatus",
|
"mediaReleases",
|
||||||
"networkControllerSummary",
|
"mediaServer",
|
||||||
"notebook",
|
"mediaTranscoding",
|
||||||
"notifications",
|
"networkControllerStatus",
|
||||||
"paperlessNgx",
|
"smartHome-entityState",
|
||||||
"patchmon",
|
"smartHome-executeAutomation",
|
||||||
"releases",
|
"speedtestTracker",
|
||||||
"rssFeed",
|
"systemResources",
|
||||||
"stockPrice",
|
"timetable",
|
||||||
"systemDisks",
|
"tracearr",
|
||||||
"video",
|
"traefik",
|
||||||
"vpn",
|
"umami",
|
||||||
|
"ups",
|
||||||
|
"uptimeKuma",
|
||||||
|
"weather",
|
||||||
] as const;
|
] as const;
|
||||||
|
|
||||||
describe("advanced focus support", () => {
|
describe("advanced focus support", () => {
|
||||||
test("is reserved for widgets with a distinct advanced experience", () => {
|
test("is reserved for widgets with a distinct advanced experience", () => {
|
||||||
const actualCompactOnlyKinds = Object.entries(widgetImports)
|
const actualAdvancedFocusKinds = Object.entries(widgetImports)
|
||||||
.filter(([, widgetImport]) => !supportsAdvancedFocus(widgetImport.definition))
|
.filter(([, widgetImport]) => supportsAdvancedFocus(widgetImport.definition))
|
||||||
.map(([kind]) => kind)
|
.map(([kind]) => kind)
|
||||||
.toSorted();
|
.toSorted();
|
||||||
|
|
||||||
expect(actualCompactOnlyKinds).toEqual([...compactOnlyWidgetKinds].toSorted());
|
expect(actualAdvancedFocusKinds).toEqual([...advancedFocusWidgetKinds].toSorted());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -5,6 +5,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("anchorNote", {
|
export const { definition, componentLoader } = createWidgetDefinition("anchorNote", {
|
||||||
icon: IconNotes,
|
icon: IconNotes,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["widget", "anchorNotes"]],
|
queryKey: [["widget", "anchorNotes"]],
|
||||||
maxIntegrations: 1,
|
maxIntegrations: 1,
|
||||||
supportedIntegrations: ["anchor"],
|
supportedIntegrations: ["anchor"],
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("archiveTeamWarrior", {
|
export const { definition, componentLoader } = createWidgetDefinition("archiveTeamWarrior", {
|
||||||
icon: IconArchive,
|
icon: IconArchive,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
maxIntegrations: 1,
|
maxIntegrations: 1,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ const hideUnlessAudiobookshelf = {
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("audioStats", {
|
export const { definition, componentLoader } = createWidgetDefinition("audioStats", {
|
||||||
icon: IconHeadphones,
|
icon: IconHeadphones,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKeys: [[["widget", "audioStats", "getStats"]], [["widget", "mediaServer", "getCurrentStreams"]]],
|
queryKeys: [[["widget", "audioStats", "getStats"]], [["widget", "mediaServer", "getCurrentStreams"]]],
|
||||||
queryMatcher: matchesWidgetRuntimeQuery,
|
queryMatcher: matchesWidgetRuntimeQuery,
|
||||||
supportedIntegrations: ["navidrome", "audiobookshelf"],
|
supportedIntegrations: ["navidrome", "audiobookshelf"],
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { BookmarkAddButton } from "./add-button";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("bookmarks", {
|
export const { definition, componentLoader } = createWidgetDefinition("bookmarks", {
|
||||||
icon: IconBookmark,
|
icon: IconBookmark,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["app", "byIds"]],
|
queryKey: [["app", "byIds"]],
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("calendar", {
|
export const { definition, componentLoader } = createWidgetDefinition("calendar", {
|
||||||
icon: IconCalendar,
|
icon: IconCalendar,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["widget", "calendar", "findAllEvents"]],
|
queryKey: [["widget", "calendar", "findAllEvents"]],
|
||||||
queryMatcher: matchesWidgetRuntimeQuery,
|
queryMatcher: matchesWidgetRuntimeQuery,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("clock", {
|
export const { definition, componentLoader } = createWidgetDefinition("clock", {
|
||||||
icon: IconClock,
|
icon: IconClock,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["widget", "weather", "atLocation"]],
|
queryKey: [["widget", "weather", "atLocation"]],
|
||||||
queryMatcher: ({ input }, scope) => {
|
queryMatcher: ({ input }, scope) => {
|
||||||
const location = scope.options.weatherLocation;
|
const location = scope.options.weatherLocation;
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ import { describe, expect, test } from "vitest";
|
|||||||
import { definition as appDefinition } from "./app";
|
import { definition as appDefinition } from "./app";
|
||||||
import { definition as beszelSystemGridDefinition } from "./beszel-system-grid";
|
import { definition as beszelSystemGridDefinition } from "./beszel-system-grid";
|
||||||
import { definition as beszelSystemTableDefinition } from "./beszel-system-table";
|
import { definition as beszelSystemTableDefinition } from "./beszel-system-table";
|
||||||
|
import { definition as customApiDefinition } from "./custom-api";
|
||||||
import { getWidgetQueryKeys, supportsAdvancedFocus } from "./definition";
|
import { getWidgetQueryKeys, supportsAdvancedFocus } from "./definition";
|
||||||
|
import { definition as downloadsDefinition } from "./downloads";
|
||||||
|
|
||||||
describe("getWidgetQueryKeys", () => {
|
describe("getWidgetQueryKeys", () => {
|
||||||
test("falls back to the widget router namespace", () => {
|
test("falls back to the widget router namespace", () => {
|
||||||
@@ -24,10 +26,15 @@ describe("getWidgetQueryKeys", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("supportsAdvancedFocus", () => {
|
describe("supportsAdvancedFocus", () => {
|
||||||
test.each([appDefinition, beszelSystemGridDefinition, beszelSystemTableDefinition])(
|
test.each([appDefinition, beszelSystemGridDefinition, beszelSystemTableDefinition, customApiDefinition])(
|
||||||
"keeps non-enhanced widgets compact",
|
"keeps non-enhanced widgets compact",
|
||||||
(widgetDefinition) => {
|
(widgetDefinition) => {
|
||||||
expect(supportsAdvancedFocus(widgetDefinition)).toBe(false);
|
expect(supportsAdvancedFocus(widgetDefinition)).toBe(false);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
test("requires an explicit opt-in", () => {
|
||||||
|
expect(supportsAdvancedFocus({})).toBe(false);
|
||||||
|
expect(supportsAdvancedFocus(downloadsDefinition)).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
@@ -127,7 +127,7 @@ export interface WidgetDefinition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const supportsAdvancedFocus = (definition: object) =>
|
export const supportsAdvancedFocus = (definition: object) =>
|
||||||
!("supportsAdvancedFocus" in definition) || definition.supportsAdvancedFocus !== false;
|
"supportsAdvancedFocus" in definition && definition.supportsAdvancedFocus === true;
|
||||||
|
|
||||||
export const getWidgetQueryKeys = (
|
export const getWidgetQueryKeys = (
|
||||||
definition: {
|
definition: {
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ const columnTranslationKeyMap = {
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("dockerContainers", {
|
export const { definition, componentLoader } = createWidgetDefinition("dockerContainers", {
|
||||||
icon: IconBrandDocker,
|
icon: IconBrandDocker,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["docker", "getContainers"]],
|
queryKey: [["docker", "getContainers"]],
|
||||||
refetchInterval: 30,
|
refetchInterval: 30,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ const sortColumns = [
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("downloads", {
|
export const { definition, componentLoader } = createWidgetDefinition("downloads", {
|
||||||
icon: IconDownload,
|
icon: IconDownload,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["widget", "downloads", "getJobsAndStatuses"]],
|
queryKey: [["widget", "downloads", "getJobsAndStatuses"]],
|
||||||
queryMatcher: ({ input }, scope) =>
|
queryMatcher: ({ input }, scope) =>
|
||||||
widgetQueryInputMatches(input, {
|
widgetQueryInputMatches(input, {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("firewall", {
|
export const { definition, componentLoader } = createWidgetDefinition("firewall", {
|
||||||
icon: IconWall,
|
icon: IconWall,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
refetchInterval: 5,
|
refetchInterval: 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,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKeys: [[["integration", "byIds"]], [["widget", "healthMonitoring"]]],
|
queryKeys: [[["integration", "byIds"]], [["widget", "healthMonitoring"]]],
|
||||||
refetchInterval: 5,
|
refetchInterval: 5,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ const createOptions = () =>
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("immich-albumCarousel", {
|
export const { definition, componentLoader } = createWidgetDefinition("immich-albumCarousel", {
|
||||||
icon: IconPhoto,
|
icon: IconPhoto,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["widget", "immich", "getAlbum"]],
|
queryKey: [["widget", "immich", "getAlbum"]],
|
||||||
queryMatcher: ({ input }, scope) =>
|
queryMatcher: ({ input }, scope) =>
|
||||||
widgetQueryInputMatches(input, {
|
widgetQueryInputMatches(input, {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { optionsBuilder } from "../../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("immich-serverStats", {
|
export const { definition, componentLoader } = createWidgetDefinition("immich-serverStats", {
|
||||||
icon: IconGraphFilled,
|
icon: IconGraphFilled,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKeys: [[["widget", "immich", "getServerStats"]], [["widget", "immich", "getAlbums"]]],
|
queryKeys: [[["widget", "immich", "getServerStats"]], [["widget", "immich", "getAlbums"]]],
|
||||||
queryMatcher: matchesWidgetRuntimeQuery,
|
queryMatcher: matchesWidgetRuntimeQuery,
|
||||||
refetchInterval: null,
|
refetchInterval: null,
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ const pageSizeOptions = ["10", "20", "30", "50"] as const;
|
|||||||
|
|
||||||
export const { componentLoader, definition } = createWidgetDefinition("mediaMissing", {
|
export const { componentLoader, definition } = createWidgetDefinition("mediaMissing", {
|
||||||
icon: IconMovie,
|
icon: IconMovie,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["widget", "mediaOrganizer", "getData"]],
|
queryKey: [["widget", "mediaOrganizer", "getData"]],
|
||||||
queryMatcher: matchesWidgetRuntimeQuery,
|
queryMatcher: matchesWidgetRuntimeQuery,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("mediaReleases", {
|
export const { definition, componentLoader } = createWidgetDefinition("mediaReleases", {
|
||||||
icon: IconTicket,
|
icon: IconTicket,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["widget", "mediaRelease"]],
|
queryKey: [["widget", "mediaRelease"]],
|
||||||
refetchInterval: null,
|
refetchInterval: null,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { componentLoader, definition } = createWidgetDefinition("mediaServer", {
|
export const { componentLoader, definition } = createWidgetDefinition("mediaServer", {
|
||||||
icon: IconVideo,
|
icon: IconVideo,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["widget", "mediaServer", "getCurrentStreams"]],
|
queryKey: [["widget", "mediaServer", "getCurrentStreams"]],
|
||||||
queryMatcher: ({ input }, scope) =>
|
queryMatcher: ({ input }, scope) =>
|
||||||
widgetQueryInputMatches(input, {
|
widgetQueryInputMatches(input, {
|
||||||
|
|||||||
@@ -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,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["widget", "mediaTranscoding", "getDataAsync"]],
|
queryKey: [["widget", "mediaTranscoding", "getDataAsync"]],
|
||||||
queryMatcher: matchesWidgetRuntimeQuery,
|
queryMatcher: matchesWidgetRuntimeQuery,
|
||||||
maxIntegrations: 1,
|
maxIntegrations: 1,
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("networkControllerStatus", {
|
export const { definition, componentLoader } = createWidgetDefinition("networkControllerStatus", {
|
||||||
icon: IconTopologyFull,
|
icon: IconTopologyFull,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["widget", "networkController"]],
|
queryKey: [["widget", "networkController"]],
|
||||||
refetchInterval: null,
|
refetchInterval: null,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("smartHome-entityState", {
|
export const { definition, componentLoader } = createWidgetDefinition("smartHome-entityState", {
|
||||||
icon: IconBinaryTree,
|
icon: IconBinaryTree,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["widget", "smartHome"]],
|
queryKey: [["widget", "smartHome"]],
|
||||||
maxIntegrations: 1,
|
maxIntegrations: 1,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("smartHome-executeAutomation", {
|
export const { definition, componentLoader } = createWidgetDefinition("smartHome-executeAutomation", {
|
||||||
icon: IconBinaryTree,
|
icon: IconBinaryTree,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
maxIntegrations: 1,
|
maxIntegrations: 1,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("speedtestTracker", {
|
export const { definition, componentLoader } = createWidgetDefinition("speedtestTracker", {
|
||||||
icon: IconSpeedboat,
|
icon: IconSpeedboat,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
refetchInterval: null,
|
refetchInterval: null,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from(
|
return optionsBuilder.from(
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ const labelDisplayModeOptions = {
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("systemResources", {
|
export const { definition, componentLoader } = createWidgetDefinition("systemResources", {
|
||||||
icon: IconGraphFilled,
|
icon: IconGraphFilled,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["widget", "healthMonitoring"]],
|
queryKey: [["widget", "healthMonitoring"]],
|
||||||
refetchInterval: 5,
|
refetchInterval: 5,
|
||||||
supportedIntegrations: ["dashDot", "openmediavault", "truenas", "unraid", "glances", "synology"],
|
supportedIntegrations: ["dashDot", "openmediavault", "truenas", "unraid", "glances", "synology"],
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { componentLoader, definition } = createWidgetDefinition("timetable", {
|
export const { componentLoader, definition } = createWidgetDefinition("timetable", {
|
||||||
icon: IconBusStop,
|
icon: IconBusStop,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
errors: {
|
errors: {
|
||||||
BAD_REQUEST: {
|
BAD_REQUEST: {
|
||||||
icon: IconWorldOff,
|
icon: IconWorldOff,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("tracearr", {
|
export const { definition, componentLoader } = createWidgetDefinition("tracearr", {
|
||||||
icon: IconActivityHeartbeat,
|
icon: IconActivityHeartbeat,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
refetchInterval: 5,
|
refetchInterval: 5,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("traefik", {
|
export const { definition, componentLoader } = createWidgetDefinition("traefik", {
|
||||||
icon: IconRoute,
|
icon: IconRoute,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
createOptions() {
|
createOptions() {
|
||||||
return optionsBuilder.from((factory) => ({
|
return optionsBuilder.from((factory) => ({
|
||||||
showTcp: factory.switch({
|
showTcp: 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,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKeys: [
|
queryKeys: [
|
||||||
[["widget", "umami", "getVisitorStats"]],
|
[["widget", "umami", "getVisitorStats"]],
|
||||||
[["widget", "umami", "getActiveVisitors"]],
|
[["widget", "umami", "getActiveVisitors"]],
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import { optionsBuilder } from "../options";
|
|||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("ups", {
|
export const { definition, componentLoader } = createWidgetDefinition("ups", {
|
||||||
icon: IconBatteryCharging,
|
icon: IconBatteryCharging,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
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,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
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 { definition, componentLoader } = createWidgetDefinition("weather", {
|
export const { definition, componentLoader } = createWidgetDefinition("weather", {
|
||||||
icon: IconCloud,
|
icon: IconCloud,
|
||||||
|
supportsAdvancedFocus: true,
|
||||||
queryKey: [["widget", "weather", "atLocation"]],
|
queryKey: [["widget", "weather", "atLocation"]],
|
||||||
queryMatcher: ({ input }, scope) => {
|
queryMatcher: ({ input }, scope) => {
|
||||||
const location = scope.options.location;
|
const location = scope.options.location;
|
||||||
|
|||||||
Reference in new issue
Block a user