feat: rebuild board grid with dnd-kit

This commit is contained in:
Thomas Camlong authored and ajnart committed 2026-08-13 19:52:59 +02:00
1 parent 5bde4d3cc5
commit 1f5311e93b
107 files changed
+5628 -3209

No files matched your search

+21 -23
View File
@@ -917,18 +917,18 @@ export const boardRouter = createTRPCRouter({
addedSections.map((section) => ({
id: section.id,
kind: section.kind,
yOffset: section.kind !== "dynamic" ? section.yOffset : null,
xOffset: section.kind === "dynamic" ? null : section.xOffset,
yOffset: section.kind === "empty" ? section.yOffset : null,
xOffset: section.kind === "empty" ? section.xOffset : null,
options: section.kind === "empty" ? emptySuperJSON : superjson.stringify(section.options),
name: "name" in section ? section.name : null,
name: null,
boardId: dbBoard.id,
})),
);
if (addedSections.some((section) => section.kind === "dynamic")) {
if (addedSections.some((section) => section.kind === "container")) {
await transaction.insert(schema.sectionLayouts).values(
addedSections
.filter((section) => section.kind === "dynamic")
.filter((section) => section.kind === "container")
.flatMap((section) =>
section.layouts.map(
(sectionLayout): InferInsertModel<typeof schema.sectionLayouts> => ({
@@ -1039,18 +1039,17 @@ export const boardRouter = createTRPCRouter({
const updatedSections = filterUpdatedItems(input.sections, dbBoard.sections);
for (const section of updatedSections) {
const prev = dbBoard.sections.find((dbSection) => dbSection.id === section.id);
await transaction
.update(schema.sections)
.set({
yOffset: prev?.kind !== "dynamic" && "yOffset" in section ? section.yOffset : null,
xOffset: prev?.kind !== "dynamic" && "xOffset" in section ? section.xOffset : null,
yOffset: section.kind === "empty" ? section.yOffset : null,
xOffset: section.kind === "empty" ? section.xOffset : null,
options: section.kind === "empty" ? emptySuperJSON : superjson.stringify(section.options),
name: prev?.kind === "category" && "name" in section ? section.name : null,
name: null,
})
.where(eq(schema.sections.id, section.id));
if (section.kind !== "dynamic") continue;
if (section.kind !== "container") continue;
for (const sectionLayout of section.layouts) {
await transaction
@@ -1117,21 +1116,21 @@ export const boardRouter = createTRPCRouter({
addedSections.map((section) => ({
id: section.id,
kind: section.kind,
yOffset: section.kind !== "dynamic" ? section.yOffset : null,
xOffset: section.kind === "dynamic" ? null : section.xOffset,
yOffset: section.kind === "empty" ? section.yOffset : null,
xOffset: section.kind === "empty" ? section.xOffset : null,
options: section.kind === "empty" ? emptySuperJSON : superjson.stringify(section.options),
name: "name" in section ? section.name : null,
name: null,
boardId: dbBoard.id,
})),
)
.run();
if (addedSections.some((section) => section.kind === "dynamic")) {
if (addedSections.some((section) => section.kind === "container")) {
transaction
.insert(sectionLayouts)
.values(
addedSections
.filter((section) => section.kind === "dynamic")
.filter((section) => section.kind === "container")
.flatMap((section) =>
section.layouts.map(
(sectionLayout): InferInsertModel<typeof sectionLayouts> => ({
@@ -1249,19 +1248,18 @@ export const boardRouter = createTRPCRouter({
const updatedSections = filterUpdatedItems(input.sections, dbBoard.sections);
for (const section of updatedSections) {
const prev = dbBoard.sections.find((dbSection) => dbSection.id === section.id);
transaction
.update(sections)
.set({
yOffset: prev?.kind !== "dynamic" && "yOffset" in section ? section.yOffset : null,
xOffset: prev?.kind !== "dynamic" && "xOffset" in section ? section.xOffset : null,
yOffset: section.kind === "empty" ? section.yOffset : null,
xOffset: section.kind === "empty" ? section.xOffset : null,
options: section.kind === "empty" ? emptySuperJSON : superjson.stringify(section.options),
name: prev?.kind === "category" && "name" in section ? section.name : null,
name: null,
})
.where(eq(sections.id, section.id))
.run();
if (section.kind !== "dynamic") continue;
if (section.kind !== "container") continue;
for (const sectionLayout of section.layouts) {
transaction
@@ -1772,7 +1770,7 @@ const getUpdatedBoardLayout = (
});
const sectionLayoutsCollection = board.sections.flatMap((section): InferInsertModel<typeof sectionLayouts>[] => {
if (section.kind !== "dynamic") return [];
if (section.kind !== "container") return [];
const currentElement = updatedElementById.get(section.id);
if (!currentElement || currentElement.type !== "section") return [];
@@ -1815,7 +1813,7 @@ const getRootSectionForLane = (
const getElementsForLayout = (board: Awaited<ReturnType<typeof getFullBoardWithWhereAsync>>, layoutId: string) => {
const sectionElements = board.sections
.filter((section) => section.kind === "dynamic")
.filter((section) => section.kind === "container")
.map((section) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const clonedLayout = section.layouts.find((sectionLayout) => sectionLayout.layoutId === layoutId)!;
@@ -1926,7 +1924,7 @@ const getFullBoardWithWhereAsync = async (db: Database, where: SQL<unknown>, use
parentSectionId: layout.parentSectionId,
layoutId: layout.layoutId,
})),
collapsed: collapseStates.at(0)?.collapsed ?? section.kind === "category",
collapsed: collapseStates.at(0)?.collapsed ?? false,
}),
),
items: items
@@ -42,18 +42,18 @@ export const generateResponsiveGridFor = ({
const newItems: GridAlgorithmItem[] = [];
// Fix height of dynamic sections
const dynamicSectionHeightMap = new Map<string, number>();
const dynamicSectionsOfCurrentSection = normalizedItems.filter((item) => item.type === "section");
for (const dynamicSection of dynamicSectionsOfCurrentSection) {
// A container must remain tall enough for its recursively reflowed contents.
const containerHeightMap = new Map<string, number>();
const containersOfCurrentSection = normalizedItems.filter((item) => item.type === "section");
for (const container of containersOfCurrentSection) {
const result = generateResponsiveGridFor({
items,
previousWidth: dynamicSection.previousWidth,
width: dynamicSection.width,
sectionId: dynamicSection.id,
previousWidth: container.previousWidth,
width: container.width,
sectionId: container.id,
});
newItems.push(...result.items);
dynamicSectionHeightMap.set(dynamicSection.id, result.height);
containerHeightMap.set(container.id, result.height);
}
// Return same positions for items in the current section
@@ -69,7 +69,7 @@ export const generateResponsiveGridFor = ({
for (const item of normalizedItems) {
const itemWithHeight = {
...item,
height: item.type === "section" ? Math.max(dynamicSectionHeightMap.get(item.id) ?? 1, item.height) : item.height,
height: item.type === "section" ? Math.max(containerHeightMap.get(item.id) ?? 1, item.height) : item.height,
};
const position = nextFreeSpot(occupied2d, itemWithHeight, width);
if (!position) throw new Error("No free spot available");
@@ -25,34 +25,34 @@ describe("Grid Algorithm", () => {
expect(output).toBe(item.output);
});
test.each(dynamicSectionTests)(
"should convert a grid with dynamic sections from 16 columns to %i columns",
test.each(containerTests)(
"should convert a grid with nested containers from 16 columns to %i columns",
(_, testInput) => {
const outerDynamicSectionId = "b";
const innerDynamicSectionId = "f";
const outerContainerId = "b";
const innerContainerId = "f";
const items = [
algoItem({ id: "a", width: 2, height: 2 }),
algoItem({ id: outerDynamicSectionId, type: "section", width: 12, height: 3, yOffset: 2 }),
algoItem({ id: "a", width: 2, sectionId: outerDynamicSectionId }),
algoItem({ id: "b", width: 4, sectionId: outerDynamicSectionId, xOffset: 2 }),
algoItem({ id: "c", width: 2, sectionId: outerDynamicSectionId, xOffset: 6 }),
algoItem({ id: "d", width: 1, sectionId: outerDynamicSectionId, xOffset: 8 }),
algoItem({ id: "e", width: 3, sectionId: outerDynamicSectionId, xOffset: 9 }),
algoItem({ id: outerContainerId, type: "section", width: 12, height: 3, yOffset: 2 }),
algoItem({ id: "a", width: 2, sectionId: outerContainerId }),
algoItem({ id: "b", width: 4, sectionId: outerContainerId, xOffset: 2 }),
algoItem({ id: "c", width: 2, sectionId: outerContainerId, xOffset: 6 }),
algoItem({ id: "d", width: 1, sectionId: outerContainerId, xOffset: 8 }),
algoItem({ id: "e", width: 3, sectionId: outerContainerId, xOffset: 9 }),
algoItem({
id: innerDynamicSectionId,
id: innerContainerId,
type: "section",
width: 8,
height: 2,
yOffset: 1,
sectionId: outerDynamicSectionId,
sectionId: outerContainerId,
}),
algoItem({ id: "a", width: 2, sectionId: innerDynamicSectionId }),
algoItem({ id: "b", width: 5, xOffset: 2, sectionId: innerDynamicSectionId }),
algoItem({ id: "c", width: 1, height: 2, xOffset: 7, sectionId: innerDynamicSectionId }),
algoItem({ id: "d", width: 7, yOffset: 1, sectionId: innerDynamicSectionId }),
algoItem({ id: "g", width: 4, yOffset: 1, sectionId: outerDynamicSectionId, xOffset: 8 }),
algoItem({ id: "h", width: 3, yOffset: 2, sectionId: outerDynamicSectionId, xOffset: 8 }),
algoItem({ id: "i", width: 1, yOffset: 2, sectionId: outerDynamicSectionId, xOffset: 11 }),
algoItem({ id: "a", width: 2, sectionId: innerContainerId }),
algoItem({ id: "b", width: 5, xOffset: 2, sectionId: innerContainerId }),
algoItem({ id: "c", width: 1, height: 2, xOffset: 7, sectionId: innerContainerId }),
algoItem({ id: "d", width: 7, yOffset: 1, sectionId: innerContainerId }),
algoItem({ id: "g", width: 4, yOffset: 1, sectionId: outerContainerId, xOffset: 8 }),
algoItem({ id: "h", width: 3, yOffset: 2, sectionId: outerContainerId, xOffset: 8 }),
algoItem({ id: "i", width: 1, yOffset: 2, sectionId: outerContainerId, xOffset: 11 }),
algoItem({ id: "c", width: 5, yOffset: 5 }),
];
@@ -64,10 +64,10 @@ describe("Grid Algorithm", () => {
});
const rootItems = newItems.items.filter((item) => item.sectionId === ROOT_SECTION_ID);
const outerSection = items.find((item) => item.id === outerDynamicSectionId);
const outerItems = newItems.items.filter((item) => item.sectionId === outerDynamicSectionId);
const innerSection = items.find((item) => item.id === innerDynamicSectionId);
const innerItems = newItems.items.filter((item) => item.sectionId === innerDynamicSectionId);
const outerSection = items.find((item) => item.id === outerContainerId);
const outerItems = newItems.items.filter((item) => item.sectionId === outerContainerId);
const innerSection = items.find((item) => item.id === innerContainerId);
const innerItems = newItems.items.filter((item) => item.sectionId === innerContainerId);
expect(generateOutputText(rootItems, testInput.outputColumns)).toBe(testInput.root);
expect(generateOutputText(outerItems, Math.min(testInput.outputColumns, outerSection?.width ?? 999))).toBe(
@@ -192,7 +192,7 @@ const itemTests = [
},
].map((item) => [item.inputColumnCount, item.outputColumnCount, item] as const);
const dynamicSectionTests = [
const containerTests = [
{
outputColumns: 16,
root: `
@@ -5,7 +5,7 @@ import { z } from "zod/v4";
import { and, eq } from "@homarr/db";
import { sectionCollapseStates, sections } from "@homarr/db/schema";
import { emptySuperJSON } from "@homarr/definitions";
import { categorySectionOptionsSchema, dynamicSectionOptionsSchema } from "@homarr/validation/shared";
import { containerSectionOptionsSchema } from "@homarr/validation/shared";
import { createTRPCRouter, protectedProcedure } from "../../trpc";
@@ -34,7 +34,7 @@ export const sectionRouter = createTRPCRouter({
});
}
if (section.kind === "empty") {
if (section.kind !== "container") {
throw new TRPCError({
code: "BAD_REQUEST",
message: `Section cannot be collapsed id=${input.sectionId}`,
@@ -42,10 +42,7 @@ export const sectionRouter = createTRPCRouter({
}
const rawOptions = superjson.parse(section.options ?? emptySuperJSON);
const parsedOptions =
section.kind === "category"
? categorySectionOptionsSchema.safeParse(rawOptions)
: dynamicSectionOptionsSchema.safeParse(rawOptions);
const parsedOptions = containerSectionOptionsSchema.safeParse(rawOptions);
if (!parsedOptions.success || !parsedOptions.data.collapsible) {
throw new TRPCError({
+186 -120
View File
@@ -572,31 +572,34 @@ describe("getBoardByName should return board by name", () => {
expect(spy).toHaveBeenCalledWith(expect.anything(), expect.anything(), "view");
});
it("normalizes legacy category behavior options in the response", async () => {
it("returns configured container behavior", async () => {
const db = createDb();
const caller = boardRouter.createCaller({ db, deviceType: undefined, session: defaultSession });
const { boardId, sectionId } = await createFullBoardAsync(db, "default");
await db
.update(sections)
.set({
kind: "category",
name: "Media",
})
.where(eq(sections.id, sectionId));
const result = await caller.getBoardByName({ name: "default" });
const section = expectToBeDefined(result.sections[0]);
expect(result.id).toBe(boardId);
expect(section.kind).toBe("category");
if (section.kind === "category") {
expect(section.collapsed).toBe(true);
expect(section.options).toEqual({
showLabel: true,
const { boardId, sectionId: rootSectionId, layoutId } = await createFullBoardAsync(db, "default");
const sectionId = await addContainerAsync(db, {
boardId,
layoutId,
parentSectionId: rootSectionId,
options: {
title: "Media",
showLabel: false,
collapsible: true,
showOpenAll: true,
},
});
const result = await caller.getBoardByName({ name: "default" });
const section = expectToBeDefined(result.sections.find((candidate) => candidate.id === sectionId));
expect(result.id).toBe(boardId);
expect(section.kind).toBe("container");
if (section.kind === "container") {
expect(section.collapsed).toBe(false);
expect(section.options).toMatchObject({
title: "Media",
showLabel: false,
collapsible: true,
showOpenAll: true,
railPlacement: "main",
columnCount: 2,
});
}
});
@@ -857,83 +860,92 @@ describe("saveBoard should save full board", () => {
expect(integration).toBeUndefined();
expect(spy).toHaveBeenCalledWith(expect.anything(), expect.anything(), "modify");
});
it.each([[{ kind: "empty" as const }], [{ kind: "category" as const, collapsed: false, name: "My first category" }]])(
"should add section when present in input",
async (partialSection) => {
const spy = vi.spyOn(boardAccess, "throwIfActionForbiddenAsync");
const db = createDb();
const caller = boardRouter.createCaller({ db, deviceType: undefined, session: defaultSession });
const { boardId, sectionId } = await createFullBoardAsync(db, "default");
const newSectionId = createId();
await caller.saveBoard({
id: boardId,
sections: [
{
id: newSectionId,
xOffset: 0,
yOffset: 1,
...partialSection,
},
{
id: sectionId,
kind: "empty",
xOffset: 0,
yOffset: 0,
},
],
items: [],
});
const board = await db.query.boards.findFirst({
where: eq(boards.id, boardId),
with: {
sections: true,
},
});
const section = await db.query.sections.findFirst({
where: eq(sections.id, newSectionId),
});
const definedBoard = expectToBeDefined(board);
expect(definedBoard.sections.length).toBe(2);
const addedSection = expectToBeDefined(definedBoard.sections.find((section) => section.id === newSectionId));
expect(addedSection).toBeDefined();
expect(addedSection.id).toBe(newSectionId);
expect(addedSection.kind).toBe(partialSection.kind);
expect(addedSection.yOffset).toBe(1);
if ("name" in partialSection) {
expect(addedSection.name).toBe(partialSection.name);
}
expect(section).toBeDefined();
expect(spy).toHaveBeenCalledWith(expect.anything(), expect.anything(), "modify");
},
);
it("should add and update category behavior options", async () => {
it("should add root section when present in input", async () => {
const spy = vi.spyOn(boardAccess, "throwIfActionForbiddenAsync");
const db = createDb();
const caller = boardRouter.createCaller({ db, deviceType: undefined, session: defaultSession });
const { boardId } = await createFullBoardAsync(db, "default");
const sectionId = createId();
const { boardId, sectionId } = await createFullBoardAsync(db, "default");
const newSectionId = createId();
await caller.saveBoard({
id: boardId,
sections: [
{
id: newSectionId,
kind: "empty",
xOffset: 0,
yOffset: 1,
},
{
id: sectionId,
kind: "empty",
xOffset: 0,
yOffset: 0,
},
],
items: [],
});
const board = await db.query.boards.findFirst({
where: eq(boards.id, boardId),
with: {
sections: true,
},
});
const section = await db.query.sections.findFirst({
where: eq(sections.id, newSectionId),
});
const definedBoard = expectToBeDefined(board);
expect(definedBoard.sections.length).toBe(2);
const addedSection = expectToBeDefined(definedBoard.sections.find((section) => section.id === newSectionId));
expect(addedSection).toBeDefined();
expect(addedSection.id).toBe(newSectionId);
expect(addedSection.kind).toBe("empty");
expect(addedSection.yOffset).toBe(1);
expect(addedSection.name).toBeNull();
expect(section).toBeDefined();
expect(spy).toHaveBeenCalledWith(expect.anything(), expect.anything(), "modify");
});
it("should add and update container behavior options", async () => {
const db = createDb();
const caller = boardRouter.createCaller({ db, deviceType: undefined, session: defaultSession });
const { boardId, layoutId, sectionId: rootSectionId } = await createFullBoardAsync(db, "default");
const containerId = createId();
await caller.saveBoard({
id: boardId,
sections: [
{
id: sectionId,
kind: "category",
name: "Navigation",
id: rootSectionId,
kind: "empty",
xOffset: 0,
yOffset: 0,
},
{
id: containerId,
kind: "container",
collapsed: false,
options: {
title: "Navigation",
customCssClasses: ["pinned"],
borderColor: "#123456",
showLabel: true,
collapsible: true,
showOpenAll: true,
railPlacement: "left",
columnCount: 3,
},
layouts: [
{
layoutId,
parentSectionId: rootSectionId,
xOffset: 1,
yOffset: 2,
width: 3,
height: 4,
},
],
},
],
items: [],
@@ -943,34 +955,60 @@ describe("saveBoard should save full board", () => {
id: boardId,
sections: [
{
id: sectionId,
kind: "category",
name: "Navigation",
id: rootSectionId,
kind: "empty",
xOffset: 0,
yOffset: 0,
},
{
id: containerId,
kind: "container",
collapsed: false,
options: {
title: "Operations",
customCssClasses: ["dense"],
borderColor: "#654321",
showLabel: false,
collapsible: false,
showOpenAll: false,
railPlacement: "right",
columnCount: 4,
},
layouts: [
{
layoutId,
parentSectionId: rootSectionId,
xOffset: 2,
yOffset: 3,
width: 4,
height: 5,
},
],
},
],
items: [],
});
const section = await db.query.sections.findFirst({
where: eq(sections.id, sectionId),
where: eq(sections.id, containerId),
});
expect(SuperJSON.parse(section?.options ?? "")).toEqual({
title: "Operations",
customCssClasses: ["dense"],
borderColor: "#654321",
showLabel: false,
collapsible: false,
showOpenAll: false,
railPlacement: "right",
columnCount: 4,
});
expect(
await db.query.sectionLayouts.findFirst({
where: and(eq(sectionLayouts.sectionId, containerId), eq(sectionLayouts.layoutId, layoutId)),
}),
).toMatchObject({
parentSectionId: rootSectionId,
xOffset: 2,
yOffset: 3,
width: 4,
height: 5,
});
});
it("should add item when present in input", async () => {
@@ -1118,15 +1156,22 @@ describe("saveBoard should save full board", () => {
const db = createDb();
const caller = boardRouter.createCaller({ db, deviceType: undefined, session: defaultSession });
const { boardId, sectionId } = await createFullBoardAsync(db, "default");
const newSectionId = createId();
const { boardId, sectionId, layoutId } = await createFullBoardAsync(db, "default");
const containerId = createId();
await db.insert(sections).values({
id: newSectionId,
kind: "category",
name: "Before",
yOffset: 1,
xOffset: 0,
id: containerId,
kind: "container",
boardId,
options: SuperJSON.stringify({ title: "Before" }),
});
await db.insert(sectionLayouts).values({
sectionId: containerId,
layoutId,
parentSectionId: sectionId,
xOffset: 0,
yOffset: 0,
width: 2,
height: 2,
});
await caller.saveBoard({
@@ -1134,19 +1179,32 @@ describe("saveBoard should save full board", () => {
sections: [
{
id: sectionId,
kind: "category",
kind: "empty",
yOffset: 1,
xOffset: 0,
name: "Test",
collapsed: true,
},
{
id: newSectionId,
kind: "category",
name: "After",
yOffset: 0,
xOffset: 0,
id: containerId,
kind: "container",
collapsed: false,
options: {
title: "After",
customCssClasses: ["dense"],
borderColor: "#123456",
showLabel: false,
collapsible: true,
showOpenAll: true,
},
layouts: [
{
layoutId,
parentSectionId: sectionId,
xOffset: 1,
yOffset: 2,
width: 3,
height: 4,
},
],
},
],
items: [],
@@ -1166,11 +1224,17 @@ describe("saveBoard should save full board", () => {
expect(firstSection.kind).toBe("empty");
expect(firstSection.yOffset).toBe(1);
expect(firstSection.name).toBe(null);
const secondSection = expectToBeDefined(definedBoard.sections.find((section) => section.id === newSectionId));
expect(secondSection.id).toBe(newSectionId);
expect(secondSection.kind).toBe("category");
expect(secondSection.yOffset).toBe(0);
expect(secondSection.name).toBe("After");
const secondSection = expectToBeDefined(definedBoard.sections.find((section) => section.id === containerId));
expect(secondSection.id).toBe(containerId);
expect(secondSection.kind).toBe("container");
expect(secondSection.yOffset).toBeNull();
expect(secondSection.name).toBeNull();
expect(SuperJSON.parse(secondSection.options ?? "")).toMatchObject({ title: "After", collapsible: true });
expect(
await db.query.sectionLayouts.findFirst({
where: and(eq(sectionLayouts.sectionId, containerId), eq(sectionLayouts.layoutId, layoutId)),
}),
).toMatchObject({ xOffset: 1, yOffset: 2, width: 3, height: 4, parentSectionId: sectionId });
});
it("should update item when present in input", async () => {
const spy = vi.spyOn(boardAccess, "throwIfActionForbiddenAsync");
@@ -1456,7 +1520,7 @@ describe("saveLayouts should save layout changes", () => {
expect(definedLayout.columnCount).toBe(newLayout.columnCount);
expect(definedLayout.breakpoint).toBe(newLayout.breakpoint);
});
test("should add items and dynamic sections generated from grid-algorithm when new layout is added", async () => {
test("should add items and containers generated from grid-algorithm when new layout is added", async () => {
// Arrange
const db = createDb();
const caller = boardRouter.createCaller({ db, deviceType: undefined, session: defaultSession });
@@ -1485,7 +1549,7 @@ describe("saveLayouts should save layout changes", () => {
a: itemId,
});
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
await expectLayoutForDynamicSectionAsync(db, assignments.inRoot.f, layout!.id, assignments.inDynamicSection);
await expectLayoutForContainerAsync(db, assignments.inRoot.f, layout!.id, assignments.inContainer);
});
test("should update layout when present in input", async () => {
// Arrange
@@ -1538,7 +1602,7 @@ describe("saveLayouts should save layout changes", () => {
...assignments.inRoot,
a: itemId,
});
await expectLayoutForDynamicSectionAsync(db, assignments.inRoot.f, layoutId, assignments.inDynamicSection);
await expectLayoutForContainerAsync(db, assignments.inRoot.f, layoutId, assignments.inContainer);
});
test("should reserve gutter columns and return gutter contents to the canvas when disabled", async () => {
const db = createDb();
@@ -1806,19 +1870,21 @@ const addItemAsync = async (
return itemId;
};
const addDynamicSectionAsync = async (
const addContainerAsync = async (
db: Database,
section: Partial<Pick<InferInsertModel<typeof sectionLayouts>, "xOffset" | "yOffset" | "width" | "height">> & {
parentSectionId: string;
boardId: string;
layoutId: string;
options?: Record<string, unknown>;
},
) => {
const sectionId = createId();
await db.insert(sections).values({
id: sectionId,
kind: "dynamic",
kind: "container",
boardId: section.boardId,
options: SuperJSON.stringify(section.options ?? {}),
});
await db.insert(sectionLayouts).values({
parentSectionId: section.parentSectionId,
@@ -1860,7 +1926,7 @@ const createItemsAndSectionsAsync = async (
const itemC = await addItemAsync(db, { boardId, layoutId, sectionId, xOffset: 6, width: 2, height: 2 });
const itemD = await addItemAsync(db, { boardId, layoutId, sectionId, xOffset: 8, width: 2, height: 3 });
const itemE = await addItemAsync(db, { boardId, layoutId, sectionId, yOffset: 1, height: 3 });
const sectionF = await addDynamicSectionAsync(db, {
const sectionF = await addContainerAsync(db, {
yOffset: 1,
xOffset: 1,
width: 5,
@@ -1869,7 +1935,7 @@ const createItemsAndSectionsAsync = async (
boardId,
layoutId,
});
const sectionG = await addDynamicSectionAsync(db, {
const sectionG = await addContainerAsync(db, {
yOffset: 2,
xOffset: 6,
width: 2,
@@ -1900,7 +1966,7 @@ const createItemsAndSectionsAsync = async (
f: sectionF,
g: sectionG,
},
inDynamicSection: {
inContainer: {
h: itemH,
i: itemI,
j: itemJ,
@@ -1936,7 +2002,7 @@ gg`,
);
};
const expectLayoutForDynamicSectionAsync = async (
const expectLayoutForContainerAsync = async (
db: Database,
sectionId: string,
layoutId: string,
+7 -13
View File
@@ -42,33 +42,27 @@ const createCallerAsync = async () => {
};
describe("changeCollapsed", () => {
it("preserves collapse support for legacy categories", async () => {
it("rejects a root section", async () => {
const { boardId, caller, db } = await createCallerAsync();
const sectionId = createId();
await db.insert(sections).values({
id: sectionId,
boardId,
kind: "category",
name: "Media",
kind: "empty",
xOffset: 0,
yOffset: 0,
});
await caller.changeCollapsed({ sectionId, collapsed: true });
const state = await db.query.sectionCollapseStates.findFirst({
where: eq(sectionCollapseStates.sectionId, sectionId),
});
expect(state?.collapsed).toBe(true);
await expect(caller.changeCollapsed({ sectionId, collapsed: true })).rejects.toThrow("Section cannot be collapsed");
});
it("creates and updates collapse state for an enabled dynamic section", async () => {
it("creates and updates collapse state for an enabled container", async () => {
const { boardId, caller, db } = await createCallerAsync();
const sectionId = createId();
await db.insert(sections).values({
id: sectionId,
boardId,
kind: "dynamic",
kind: "container",
options: stringify({ collapsible: true }),
});
@@ -82,13 +76,13 @@ describe("changeCollapsed", () => {
expect(states[0]?.collapsed).toBe(false);
});
it("rejects a dynamic section when collapsing is disabled", async () => {
it("rejects a container when collapsing is disabled", async () => {
const { boardId, caller, db } = await createCallerAsync();
const sectionId = createId();
await db.insert(sections).values({
id: sectionId,
boardId,
kind: "dynamic",
kind: "container",
});
await expect(caller.changeCollapsed({ sectionId, collapsed: true })).rejects.toThrow("Section cannot be collapsed");
@@ -7,7 +7,7 @@ import { createId } from "@homarr/common";
import type { Database } from "@homarr/db";
import { and, eq } from "@homarr/db";
import { createDb } from "@homarr/db/test";
import { categorySectionOptionsSchema, dynamicSectionOptionsSchema } from "@homarr/validation/shared";
import { containerSectionOptionsSchema } from "@homarr/validation/shared";
import {
boards,
@@ -19,10 +19,10 @@ import {
sections,
users,
} from "../../schema";
import { migrateCategoriesToUnifiedSectionsAsync } from "./0004_unify_sections_and_gutters";
import { migrateLegacySectionsToContainersAsync } from "./0004_unify_sections_and_gutters";
describe("unified section migration", () => {
test("converts a rail category into a resizable section inside a board gutter", async () => {
describe("legacy section migration", () => {
test("converts a rail category into a resizable container inside a board gutter", async () => {
const db = createDb();
const userId = createId();
const boardId = createId();
@@ -39,16 +39,17 @@ describe("unified section migration", () => {
{
id: categoryId,
boardId,
kind: "category",
kind: "category" as never,
name: "Pinned apps",
xOffset: 0,
yOffset: 1,
options: stringify(
categorySectionOptionsSchema.parse({
railPlacement: "left",
columnCount: 2,
}),
),
options: stringify({
showLabel: false,
collapsible: true,
showOpenAll: true,
railPlacement: "left",
columnCount: 2,
}),
},
]);
await db.insert(items).values({ id: itemId, boardId, kind: "clock" });
@@ -68,7 +69,7 @@ describe("unified section migration", () => {
height: 1,
});
await migrateCategoriesToUnifiedSectionsAsync(db as unknown as Database);
await migrateLegacySectionsToContainersAsync(db as unknown as Database);
const migratedLayout = await db.query.layouts.findFirst({ where: eq(layouts.id, layoutId) });
expect(migratedLayout?.leftGutterColumnCount).toBe(2);
@@ -79,8 +80,15 @@ describe("unified section migration", () => {
expect(gutterRoot).toBeDefined();
const migratedCategory = await db.query.sections.findFirst({ where: eq(sections.id, categoryId) });
expect(migratedCategory?.kind).toBe("dynamic");
expect(dynamicSectionOptionsSchema.parse(parse(migratedCategory?.options ?? "{}")).title).toBe("Pinned apps");
expect(migratedCategory?.kind).toBe("container");
expect(containerSectionOptionsSchema.parse(parse(migratedCategory?.options ?? "{}"))).toEqual({
title: "Pinned apps",
customCssClasses: [],
borderColor: "",
showLabel: false,
collapsible: true,
showOpenAll: true,
});
const migratedCollapseState = await db.query.sectionCollapseStates.findFirst({
where: and(eq(sectionCollapseStates.sectionId, categoryId), eq(sectionCollapseStates.userId, userId)),
});
@@ -100,4 +108,61 @@ describe("unified section migration", () => {
});
expect(nestedItem?.sectionId).toBe(categoryId);
});
test("renames a dynamic section and preserves all container options and geometry", async () => {
const db = createDb();
const userId = createId();
const boardId = createId();
const layoutId = createId();
const rootId = createId();
const sectionId = createId();
const options = {
title: "Operations",
customCssClasses: ["dense", "accent"],
borderColor: "#123456",
showLabel: false,
collapsible: true,
showOpenAll: true,
};
await db.insert(users).values({ id: userId });
await db.insert(boards).values({ id: boardId, name: "dynamic-migration", creatorId: userId });
await db.insert(layouts).values({ id: layoutId, name: "Base", boardId, columnCount: 8, breakpoint: 0 });
await db.insert(sections).values([
{ id: rootId, boardId, kind: "empty", xOffset: 0, yOffset: 0 },
{
id: sectionId,
boardId,
kind: "dynamic" as never,
options: stringify(options),
},
]);
await db.insert(sectionLayouts).values({
sectionId,
layoutId,
parentSectionId: rootId,
xOffset: 2,
yOffset: 3,
width: 4,
height: 5,
});
await migrateLegacySectionsToContainersAsync(db as unknown as Database);
await migrateLegacySectionsToContainersAsync(db as unknown as Database);
const migrated = await db.query.sections.findFirst({ where: eq(sections.id, sectionId) });
expect(migrated?.kind).toBe("container");
expect(containerSectionOptionsSchema.parse(parse(migrated?.options ?? "{}"))).toEqual(options);
expect(
await db.query.sectionLayouts.findFirst({
where: and(eq(sectionLayouts.sectionId, sectionId), eq(sectionLayouts.layoutId, layoutId)),
}),
).toMatchObject({
parentSectionId: rootId,
xOffset: 2,
yOffset: 3,
width: 4,
height: 5,
});
});
});
@@ -1,9 +1,10 @@
import { parse, stringify } from "superjson";
import { z } from "zod/v4";
import { createId } from "@homarr/common";
import type { BoardLane } from "@homarr/definitions";
import { emptySuperJSON, getRootSectionLane, rootSectionOffsets } from "@homarr/definitions";
import { categorySectionOptionsSchema, dynamicSectionOptionsSchema } from "@homarr/validation/shared";
import { containerSectionOptionsSchema } from "@homarr/validation/shared";
import { and, eq, handleTransactionsAsync, inArray } from "../..";
import type { Database } from "../..";
@@ -50,13 +51,30 @@ interface MigrationOperation {
applySync(db: HomarrDatabase): void;
}
const legacyCategoryOptionsDefaults = {
showLabel: true,
collapsible: true,
showOpenAll: true,
railPlacement: "main",
columnCount: 2,
} as const;
const legacyCategoryOptionsSchema = z
.object({
showLabel: z.boolean().default(legacyCategoryOptionsDefaults.showLabel),
collapsible: z.boolean().default(legacyCategoryOptionsDefaults.collapsible),
showOpenAll: z.boolean().default(legacyCategoryOptionsDefaults.showOpenAll),
railPlacement: z.enum(["main", "left", "right"]).default(legacyCategoryOptionsDefaults.railPlacement),
columnCount: z.number().int().min(1).max(24).default(legacyCategoryOptionsDefaults.columnCount),
})
.default(legacyCategoryOptionsDefaults);
/**
* Categories and dynamic sections used to be separate concepts. Categories
* were full-width roots and also doubled as side rails. Convert every category
* into the same resizable section used by the canvas, and create internal
* gutter roots for the board-level left/right sidebar settings.
* Convert legacy categories and dynamic sections into durable containers.
* Categories were full-width roots and also doubled as side rails, so they
* additionally need placement and gutter migration.
*/
export async function migrateCategoriesToUnifiedSectionsAsync(db: Database) {
export async function migrateLegacySectionsToContainersAsync(db: Database) {
const existingBoards = await db.query.boards.findMany({
with: {
layouts: true,
@@ -74,15 +92,37 @@ export async function migrateCategoriesToUnifiedSectionsAsync(db: Database) {
},
});
let migratedCategoryCount = 0;
let migratedSectionCount = 0;
for (const board of existingBoards) {
const categories = board.sections.filter((section) => section.kind === "category");
if (categories.length === 0) continue;
const categories = board.sections.filter((section) => (section.kind as string) === "category");
const legacyContainers = board.sections.filter((section) => (section.kind as string) === "dynamic");
if (categories.length === 0 && legacyContainers.length === 0) continue;
const operations: MigrationOperation[] = [];
const appendLegacyContainerOperations = () => {
for (const section of legacyContainers) {
operations.push(
updateSectionOperation(section.id, {
kind: "container",
xOffset: null,
yOffset: null,
name: null,
options: stringify(containerSectionOptionsSchema.parse(parse(section.options ?? emptySuperJSON))),
}),
);
migratedSectionCount += 1;
}
};
if (categories.length === 0) {
appendLegacyContainerOperations();
await executeBoardMigrationOperationsAsync(db, operations);
continue;
}
const categoryDetails = categories.map((category) => {
const options = categorySectionOptionsSchema.parse(parse(category.options ?? emptySuperJSON));
const options = legacyCategoryOptionsSchema.parse(parse(category.options ?? emptySuperJSON));
return {
category,
lane: options.railPlacement as BoardLane,
@@ -247,12 +287,12 @@ export async function migrateCategoriesToUnifiedSectionsAsync(db: Database) {
operations.push(
updateSectionOperation(category.id, {
kind: "dynamic",
kind: "container",
xOffset: null,
yOffset: null,
name: null,
options: stringify(
dynamicSectionOptionsSchema.parse({
containerSectionOptionsSchema.parse({
title: (category.name ?? "").slice(0, 64),
customCssClasses: [],
borderColor: "",
@@ -263,9 +303,11 @@ export async function migrateCategoriesToUnifiedSectionsAsync(db: Database) {
),
}),
);
migratedCategoryCount += 1;
migratedSectionCount += 1;
}
appendLegacyContainerOperations();
const retainedRootIds = new Set(Array.from(rootByLane.values(), (root) => root.id));
const obsoleteRootIds = emptyRoots.filter((root) => !retainedRootIds.has(root.id)).map((root) => root.id);
if (obsoleteRootIds.length > 0) {
@@ -275,8 +317,8 @@ export async function migrateCategoriesToUnifiedSectionsAsync(db: Database) {
await executeBoardMigrationOperationsAsync(db, operations);
}
if (migratedCategoryCount > 0) {
console.log(`Migrated categories to unified sections count="${migratedCategoryCount}"`);
if (migratedSectionCount > 0) {
console.log(`Migrated legacy sections to containers count="${migratedSectionCount}"`);
}
}
@@ -299,7 +341,7 @@ const getDirectPlacements = (board: MigrationBoard, layoutId: string, sectionId:
: [];
}),
...board.sections.flatMap((section) => {
if (section.kind !== "dynamic") return [];
if (section.kind !== "dynamic" && section.kind !== "container") return [];
const layout = section.layouts.find(
(candidate) => candidate.layoutId === layoutId && candidate.parentSectionId === sectionId,
);
+2 -2
View File
@@ -3,12 +3,12 @@ import { migrateReleaseWidgetProviderToOptionsAsync } from "./0000_release_widge
import { migrateOpnsenseCredentialsAsync } from "./0001_opnsense_credentials";
import { migrateAppWidgetShowDescriptionTooltipToDisplayModeAsync } from "./0002_app_widget_show_description_tooltip_to_display_mode";
import { migrateWidgetOnlyIntegrationsToOptionsAsync } from "./0003_remove_widget_only_integrations";
import { migrateCategoriesToUnifiedSectionsAsync } from "./0004_unify_sections_and_gutters";
import { migrateLegacySectionsToContainersAsync } from "./0004_unify_sections_and_gutters";
export const applyCustomMigrationsAsync = async (db: Database) => {
await migrateReleaseWidgetProviderToOptionsAsync(db);
await migrateOpnsenseCredentialsAsync(db);
await migrateAppWidgetShowDescriptionTooltipToDisplayModeAsync(db);
await migrateWidgetOnlyIntegrationsToOptionsAsync(db);
await migrateCategoriesToUnifiedSectionsAsync(db);
await migrateLegacySectionsToContainersAsync(db);
};
+1 -1
View File
@@ -1,4 +1,4 @@
export const sectionKinds = ["category", "empty", "dynamic"] as const;
export const sectionKinds = ["empty", "container"] as const;
export type SectionKind = (typeof sectionKinds)[number];
export const boardLanes = ["left", "main", "right"] as const;
@@ -1,51 +0,0 @@
import { createId } from "@homarr/common";
import { createLogger } from "@homarr/core/infrastructure/logs";
import type { Database } from "@homarr/db";
import { sections } from "@homarr/db/schema";
import type { OldmarrConfig } from "@homarr/old-schema";
const logger = createLogger({ module: "importSections" });
export const insertSectionsAsync = async (
db: Database,
categories: OldmarrConfig["categories"],
wrappers: OldmarrConfig["wrappers"],
boardId: string,
) => {
logger.info("Importing old homarr sections", { boardId, categories: categories.length, wrappers: wrappers.length });
const wrapperIds = wrappers.map((section) => section.id);
const categoryIds = categories.map((section) => section.id);
const idMaps = new Map<string, string>([...wrapperIds, ...categoryIds].map((id) => [id, createId()]));
const wrappersToInsert = wrappers.map((section) => ({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
id: idMaps.get(section.id)!,
boardId,
xOffset: 0,
yOffset: section.position,
kind: "empty" as const,
}));
const categoriesToInsert = categories.map((section) => ({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
id: idMaps.get(section.id)!,
boardId,
xOffset: 0,
yOffset: section.position,
kind: "category" as const,
name: section.name,
}));
if (wrappersToInsert.length > 0) {
await db.insert(sections).values(wrappersToInsert);
}
if (categoriesToInsert.length > 0) {
await db.insert(sections).values(categoriesToInsert);
}
logger.info("Imported sections", { count: wrappersToInsert.length + categoriesToInsert.length });
return idMaps;
};
@@ -12,7 +12,7 @@ import { mapColumnCount } from "../../mappers/map-column-count";
import { moveWidgetsAndAppsIfMerge } from "../../move-widgets-and-apps-merge";
import { prepareItems } from "../../prepare/prepare-items";
import type { prepareMultipleImports } from "../../prepare/prepare-multiple";
import { prepareSections } from "../../prepare/prepare-sections";
import { placePreparedSections, prepareSections } from "../../prepare/prepare-sections";
import type { InitialOldmarrImportSettings } from "../../settings";
const logger = createLogger({ module: "boardCollection" });
@@ -26,6 +26,7 @@ export const createBoardInsertCollection = (
"boards",
"layouts",
"sections",
"sectionLayouts",
"items",
"itemLayouts",
]);
@@ -87,21 +88,18 @@ export const createBoardInsertCollection = (
{} as Record<BoardSize, string>,
);
insertCollection.layouts.push(
...boardSizes.map((size) => ({
id: layoutMapping[size],
boardId: mappedBoard.id,
columnCount: mapColumnCount(board.config.settings.customization.gridstack, size),
breakpoint: mapBreakpoint(size),
name: getBoardSizeName(size),
})),
);
const preparedLayouts = boardSizes.map((size) => ({
id: layoutMapping[size],
boardId: mappedBoard.id,
columnCount: mapColumnCount(board.config.settings.customization.gridstack, size),
breakpoint: mapBreakpoint(size),
name: getBoardSizeName(size),
}));
insertCollection.layouts.push(...preparedLayouts);
const preparedSections = prepareSections(mappedBoard.id, { wrappers, categories });
for (const section of preparedSections.values()) {
insertCollection.sections.push(section);
}
insertCollection.sections.push(...preparedSections.sections);
logger.debug("Added sections to board insert collection", { count: insertCollection.sections.length });
const preparedItems = prepareItems(
@@ -111,10 +109,11 @@ export const createBoardInsertCollection = (
settings: board.config.settings,
},
appsMap,
preparedSections,
preparedSections.byLegacyId,
layoutMapping,
mappedBoard.id,
);
insertCollection.sectionLayouts.push(...placePreparedSections(preparedSections, preparedItems, preparedLayouts));
preparedItems.forEach(({ layouts, ...item }) => {
insertCollection.items.push(item);
insertCollection.itemLayouts.push(...layouts);
+23 -9
View File
@@ -1,24 +1,38 @@
import { stringify } from "superjson";
import { createId } from "@homarr/common";
import type { InferInsertModel } from "@homarr/db";
import type { sections } from "@homarr/db/schema";
import type { OldmarrCategorySection, OldmarrEmptySection } from "@homarr/old-schema";
import { emptySuperJSON, rootSectionOffsets } from "@homarr/definitions";
import type { OldmarrCategorySection } from "@homarr/old-schema";
import { containerSectionOptionsSchema } from "@homarr/validation/shared";
export const mapCategorySection = (
export const mapLegacyCategoryContainer = (
boardId: string,
category: OldmarrCategorySection,
): InferInsertModel<typeof sections> => ({
id: createId(),
boardId,
kind: "category",
xOffset: 0,
yOffset: category.position,
name: category.name,
kind: "container",
xOffset: null,
yOffset: null,
name: null,
options: stringify(
containerSectionOptionsSchema.parse({
title: category.name.slice(0, 64),
showLabel: true,
collapsible: true,
showOpenAll: true,
}),
),
});
export const mapEmptySection = (boardId: string, wrapper: OldmarrEmptySection): InferInsertModel<typeof sections> => ({
export const mapMainRootSection = (boardId: string): InferInsertModel<typeof sections> => ({
id: createId(),
boardId,
kind: "empty",
xOffset: 0,
yOffset: wrapper.position,
xOffset: rootSectionOffsets.main,
yOffset: 0,
name: null,
options: emptySuperJSON,
});
@@ -0,0 +1,87 @@
import { parse } from "superjson";
import { describe, expect, test } from "vitest";
import { placePreparedSections, prepareSections } from "./prepare-sections";
describe("prepareSections", () => {
test("maps legacy blocks into one root and durable containers", () => {
const prepared = prepareSections("board", {
categories: [{ id: "category", name: "Media", position: 1 }],
wrappers: [{ id: "wrapper", position: 0 }],
});
const root = prepared.sections.find((section) => section.kind === "empty");
const container = prepared.sections.find((section) => section.kind === "container");
if (!root || !container) throw new Error("Expected a root and a container");
expect(prepared.sections).toHaveLength(2);
expect(root).toMatchObject({ boardId: "board", xOffset: 0, yOffset: 0 });
expect(container).toMatchObject({ boardId: "board", xOffset: null, yOffset: null, name: null });
expect(parse(container.options ?? "{}")).toMatchObject({
title: "Media",
showLabel: true,
collapsible: true,
showOpenAll: true,
});
expect(prepared.byLegacyId.get("category")?.id).toBe(container.id);
expect(prepared.byLegacyId.get("wrapper")?.id).not.toBe(root.id);
});
test("places root content and containers in legacy order for every layout", () => {
const prepared = prepareSections("board", {
categories: [{ id: "category", name: "Media", position: 1 }],
wrappers: [{ id: "wrapper", position: 0 }],
});
const wrapperPlacementId = prepared.byLegacyId.get("wrapper")?.id;
const containerId = prepared.byLegacyId.get("category")?.id;
if (!wrapperPlacementId || !containerId) throw new Error("Expected mapped section ids");
const preparedItems = [
{
layouts: [
{
itemId: "root-item",
layoutId: "layout",
sectionId: wrapperPlacementId,
xOffset: 1,
yOffset: 0,
width: 2,
height: 2,
},
],
},
{
layouts: [
{
itemId: "container-item",
layoutId: "layout",
sectionId: containerId,
xOffset: 0,
yOffset: 1,
width: 3,
height: 2,
},
],
},
];
const layouts = placePreparedSections(prepared, preparedItems, [{ id: "layout", columnCount: 12 }]);
expect(preparedItems[0]?.layouts[0]).toMatchObject({
sectionId: prepared.mainRootId,
xOffset: 1,
yOffset: 0,
});
expect(preparedItems[1]?.layouts[0]).toMatchObject({ sectionId: containerId, yOffset: 1 });
expect(layouts).toEqual([
{
sectionId: containerId,
layoutId: "layout",
parentSectionId: prepared.mainRootId,
xOffset: 0,
yOffset: 2,
width: 12,
height: 3,
},
]);
});
});
@@ -1,13 +1,115 @@
import { createId } from "@homarr/common";
import type { InferInsertModel } from "@homarr/db";
import type { itemLayouts, sectionLayouts, sections } from "@homarr/db/schema";
import type { OldmarrConfig } from "@homarr/old-schema";
import { mapCategorySection, mapEmptySection } from "../mappers/map-section";
import { mapLegacyCategoryContainer, mapMainRootSection } from "../mappers/map-section";
interface PreparedSectionBlock {
id: string;
legacyId: string;
position: number;
type: "container" | "root-content";
}
interface PreparedSections {
blocks: PreparedSectionBlock[];
byLegacyId: Map<string, { id: string }>;
mainRootId: string;
sections: InferInsertModel<typeof sections>[];
}
interface PreparedItemWithLayouts {
layouts: InferInsertModel<typeof itemLayouts>[];
}
export const prepareSections = (
boardId: string,
{ categories, wrappers }: Pick<OldmarrConfig, "categories" | "wrappers">,
) =>
new Map(
categories
.map((category) => [category.id, mapCategorySection(boardId, category)] as const)
.concat(wrappers.map((wrapper) => [wrapper.id, mapEmptySection(boardId, wrapper)] as const)),
);
): PreparedSections => {
const mainRoot = mapMainRootSection(boardId);
const containers = categories.map((category) => ({
category,
section: mapLegacyCategoryContainer(boardId, category),
}));
const rootContent = wrappers.map((wrapper) => ({ wrapper, id: createId() }));
return {
mainRootId: mainRoot.id,
sections: [mainRoot, ...containers.map(({ section }) => section)],
byLegacyId: new Map([
...containers.map(({ category, section }) => [category.id, { id: section.id }] as const),
...rootContent.map(({ wrapper, id }) => [wrapper.id, { id }] as const),
]),
blocks: [
...containers.map(({ category, section }) => ({
id: section.id,
legacyId: category.id,
position: category.position,
type: "container" as const,
})),
...rootContent.map(({ wrapper, id }) => ({
id,
legacyId: wrapper.id,
position: wrapper.position,
type: "root-content" as const,
})),
].toSorted(
(first, second) =>
first.position - second.position ||
(first.type === second.type
? first.legacyId.localeCompare(second.legacyId)
: first.type === "container"
? -1
: 1),
),
};
};
/**
* Old Homarr stored each top-level block in its own coordinate space. The
* current model has one main root and places labelled containers inside it.
* This compacts those blocks in their legacy order without changing the
* coordinates of content inside a container.
*/
export const placePreparedSections = (
preparedSections: PreparedSections,
preparedItems: PreparedItemWithLayouts[],
preparedLayouts: { id: string; columnCount: number }[],
): InferInsertModel<typeof sectionLayouts>[] => {
const result: InferInsertModel<typeof sectionLayouts>[] = [];
for (const layout of preparedLayouts) {
let nextRow = 0;
for (const block of preparedSections.blocks) {
const content = preparedItems.flatMap((item) =>
item.layouts.filter((itemLayout) => itemLayout.layoutId === layout.id && itemLayout.sectionId === block.id),
);
const contentHeight = Math.max(0, ...content.map((itemLayout) => itemLayout.yOffset + itemLayout.height));
if (block.type === "container") {
const height = Math.max(1, contentHeight);
result.push({
sectionId: block.id,
layoutId: layout.id,
parentSectionId: preparedSections.mainRootId,
xOffset: 0,
yOffset: nextRow,
width: layout.columnCount,
height,
});
nextRow += height;
continue;
}
for (const itemLayout of content) {
itemLayout.sectionId = preparedSections.mainRootId;
itemLayout.yOffset += nextRow;
}
nextRow += contentHeight;
}
}
return result;
};
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Nova secció dinàmica",
"remove": "Elimina la secció dinàmica"
@@ -1569,46 +1569,6 @@
"title": "Elimina la secció dinàmica",
"message": "Esteu segur que voleu eliminar aquesta secció dinàmica? Els elements es mouran a la mateixa ubicació dins la secció pare."
}
},
"category": {
"field": {
"name": {
"label": "Nom"
}
},
"action": {
"create": "Nova categoria",
"edit": "Canvia el nom de la categoria",
"remove": "Elimina la categoria",
"moveUp": "Mou cap amunt",
"moveDown": "Mou cap avall",
"createAbove": "Nova categoria a sobre",
"createBelow": "Nova categoria a sota",
"openAllInNewTabs": "Obrir-ho tot en pestanyes"
},
"create": {
"title": "Nova categoria",
"submit": "Afegeix categoria"
},
"remove": {
"title": "Elimina la categoria",
"message": "Esteu segur que voleu eliminar la categoria {name}?"
},
"edit": {
"title": "Canvia el nom de la categoria",
"submit": "Canvia el nom de la categoria"
},
"menu": {
"label": {
"create": "Nova categoria",
"changePosition": "Canvia la posició",
"settings": ""
}
},
"openAllInNewTabs": {
"title": "Obrir-ho tot en pestanyes",
"text": "Alguns navegadors poden bloquejar l'obertura massiva de pestanyes per motius de seguretat. Homarr no ha pogut obrir totes les finestres perquè el teu navegador ha bloquejat aquesta acció. Si us plau, permet \"Obrir finestres emergents\" i torna-ho a intentar."
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "新建动态部分",
"remove": "删除动态部分"
@@ -1569,46 +1569,6 @@
"title": "删除动态部分",
"message": "你确定你要删除这个动态部分?项目将被移动到父节的相同位置。"
}
},
"category": {
"field": {
"name": {
"label": "名称"
}
},
"action": {
"create": "新建分类",
"edit": "重命名分类",
"remove": "删除分类",
"moveUp": "上移",
"moveDown": "下移",
"createAbove": "上方新建分类",
"createBelow": "下方新建分类",
"openAllInNewTabs": "在标签中打开全部"
},
"create": {
"title": "新建分类",
"submit": "添加分类"
},
"remove": {
"title": "删除分类",
"message": "您确定要删除分类 {name} 吗?"
},
"edit": {
"title": "重命名分类",
"submit": "重命名分类"
},
"menu": {
"label": {
"create": "新建分类",
"changePosition": "换位",
"settings": "设置"
}
},
"openAllInNewTabs": {
"title": "在标签中打开全部",
"text": "某些浏览器可能出于安全原因阻止大批打开标签页。 Homarr 无法打开所有窗口,因为您的浏览器屏蔽了此操作。请允许“打开弹出窗口”并重试。"
}
}
},
"item": {
+1 -41
View File
@@ -1398,7 +1398,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "crwdns650:0crwdne650:0",
"remove": "crwdns652:0crwdne652:0"
@@ -1418,46 +1418,6 @@
"title": "crwdns654:0crwdne654:0",
"message": "crwdns656:0crwdne656:0"
}
},
"category": {
"field": {
"name": {
"label": "crwdns658:0crwdne658:0"
}
},
"action": {
"create": "crwdns660:0crwdne660:0",
"edit": "crwdns662:0crwdne662:0",
"remove": "crwdns664:0crwdne664:0",
"moveUp": "crwdns666:0crwdne666:0",
"moveDown": "crwdns668:0crwdne668:0",
"createAbove": "crwdns670:0crwdne670:0",
"createBelow": "crwdns672:0crwdne672:0",
"openAllInNewTabs": "crwdns2730:0crwdne2730:0"
},
"create": {
"title": "crwdns674:0crwdne674:0",
"submit": "crwdns676:0crwdne676:0"
},
"remove": {
"title": "crwdns678:0crwdne678:0",
"message": "crwdns680:0{name}crwdne680:0"
},
"edit": {
"title": "crwdns682:0crwdne682:0",
"submit": "crwdns684:0crwdne684:0"
},
"menu": {
"label": {
"create": "crwdns686:0crwdne686:0",
"changePosition": "crwdns688:0crwdne688:0",
"settings": "crwdns4259:0crwdne4259:0"
}
},
"openAllInNewTabs": {
"title": "crwdns2732:0crwdne2732:0",
"text": "crwdns2734:0crwdne2734:0"
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Nová dynamická sekce",
"remove": "Odstranit dynamickou sekci"
@@ -1569,46 +1569,6 @@
"title": "Odstranit dynamickou sekci",
"message": "Jste si jisti, že chcete odstranit tuto dynamickou sekci? Položky budou přesunuty na stejné místo v nadřazené sekci."
}
},
"category": {
"field": {
"name": {
"label": "Název"
}
},
"action": {
"create": "Nová kategorie",
"edit": "Přejmenovat kategorii",
"remove": "Odstranit kategorii",
"moveUp": "Posunout nahoru",
"moveDown": "Posunout dolů",
"createAbove": "Nová kategorie nad",
"createBelow": "Nová kategorie pod",
"openAllInNewTabs": ""
},
"create": {
"title": "Nová kategorie",
"submit": "Přidat kategorii"
},
"remove": {
"title": "Odstranit kategorii",
"message": "Jste si jisti, že chcete odstranit kategorii {name}?"
},
"edit": {
"title": "Přejmenovat kategorii",
"submit": "Přejmenovat kategorii"
},
"menu": {
"label": {
"create": "Nová kategorie",
"changePosition": "Změnit pozici",
"settings": "Nastavení"
}
},
"openAllInNewTabs": {
"title": "",
"text": ""
}
}
},
"item": {
+1 -41
View File
@@ -1344,7 +1344,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Ny dynamisk sektion",
"remove": "Fjern dynamisk sektion"
@@ -1364,46 +1364,6 @@
"title": "Fjern dynamisk sektion",
"message": "Er du sikker på at du vil fjerne dette dynamiske afsnit? Elementer vil blive flyttet på samme sted i det overordnede afsnit."
}
},
"category": {
"field": {
"name": {
"label": "Navn"
}
},
"action": {
"create": "Ny kategori",
"edit": "Omdøb kategori",
"remove": "Fjern kategori",
"moveUp": "Flyt op",
"moveDown": "Flyt ned",
"createAbove": "Ny kategori ovenover",
"createBelow": "Ny kategori nedenunder",
"openAllInNewTabs": "Åbn alt i faneblade"
},
"create": {
"title": "Ny kategori",
"submit": "Tilføj kategori"
},
"remove": {
"title": "Fjern kategori",
"message": "Er du sikker på, at du vil fjerne kategorien {name}?"
},
"edit": {
"title": "Omdøb kategori",
"submit": "Omdøb kategori"
},
"menu": {
"label": {
"create": "Ny kategori",
"changePosition": "Ændre placering",
"settings": "Indstillinger"
}
},
"openAllInNewTabs": {
"title": "Åbn alt i faneblade",
"text": "Nogle browsere kan blokere bulk-åbning af faner af sikkerhedsmæssige årsager. Homarr kunne ikke åbne alle vinduer, fordi din browser blokerede denne handling. Tillad venligst \"Åbn pop op-vinduer\" og prøv igen."
}
}
},
"item": {
+1 -41
View File
@@ -1344,7 +1344,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Neuer dynamischer Abschnitt",
"remove": "Dynamischen Abschnitt entfernen"
@@ -1364,46 +1364,6 @@
"title": "Dynamischen Abschnitt entfernen",
"message": "Möchten Sie diesen dynamischen Abschnitt wirklich entfernen? Die Elemente werden an die gleiche Position im übergeordneten Abschnitt verschoben."
}
},
"category": {
"field": {
"name": {
"label": ""
}
},
"action": {
"create": "Neue Kategorie",
"edit": "Kategorie umbenennen",
"remove": "Kategorie entfernen",
"moveUp": "Nach oben bewegen",
"moveDown": "Nach unten bewegen",
"createAbove": "Neue Kategorie oben",
"createBelow": "Neue Kategorie unten",
"openAllInNewTabs": "Alle in Tabs öffnen"
},
"create": {
"title": "Neue Kategorie",
"submit": "Kategorie hinzufügen"
},
"remove": {
"title": "Kategorie entfernen",
"message": "Möchten Sie die Kategorie {name} wirklich entfernen?"
},
"edit": {
"title": "Kategorie umbenennen",
"submit": "Kategorie umbenennen"
},
"menu": {
"label": {
"create": "Neue Kategorie",
"changePosition": "Position wechseln",
"settings": ""
}
},
"openAllInNewTabs": {
"title": "Alle in tabs öffnen",
"text": "Einige Browser können aus Sicherheitsgründen das Öffnen von mehreren Tabs aufeinmal blockieren. Homarr konnte nicht alle Fenster öffnen, weil Ihr Browser diese Aktion blockiert hat. Bitte erlauben Sie \"Pop-up Fenster öffnen\" und versuchen Sie es erneut."
}
}
},
"item": {
+1 -41
View File
@@ -1398,7 +1398,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Neuer dynamischer Abschnitt",
"remove": "Dynamischen Abschnitt entfernen"
@@ -1418,46 +1418,6 @@
"title": "Dynamischen Abschnitt entfernen",
"message": "Möchten Sie diesen dynamischen Abschnitt wirklich entfernen? Die Elemente werden an die gleiche Position im übergeordneten Abschnitt verschoben."
}
},
"category": {
"field": {
"name": {
"label": "Name"
}
},
"action": {
"create": "Neue Kategorie",
"edit": "Kategorie umbenennen",
"remove": "Kategorie entfernen",
"moveUp": "Nach oben bewegen",
"moveDown": "Nach unten bewegen",
"createAbove": "Neue Kategorie oben",
"createBelow": "Neue Kategorie unten",
"openAllInNewTabs": "Alle in Tabs öffnen"
},
"create": {
"title": "Neue Kategorie",
"submit": "Kategorie hinzufügen"
},
"remove": {
"title": "Kategorie entfernen",
"message": "Möchten Sie die Kategorie {name} wirklich entfernen?"
},
"edit": {
"title": "Kategorie umbenennen",
"submit": "Kategorie umbenennen"
},
"menu": {
"label": {
"create": "Neue Kategorie",
"changePosition": "Position wechseln",
"settings": "Einstellungen"
}
},
"openAllInNewTabs": {
"title": "Alle in tabs öffnen",
"text": "Einige Browser können aus Sicherheitsgründen das gleichzeitige Öffnen von mehreren Tabs blockieren. Homarr konnte nicht alle Fenster öffnen, weil Ihr Browser diese Aktion blockiert hat. Bitte erlauben Sie \"Pop-up Fenster öffnen\" und versuchen Sie es erneut."
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "",
"remove": ""
@@ -1569,46 +1569,6 @@
"title": "",
"message": ""
}
},
"category": {
"field": {
"name": {
"label": "Όνομα"
}
},
"action": {
"create": "Νέα κατηγορία",
"edit": "Μετονομασία κατηγορίας",
"remove": "Αφαίρεση κατηγορίας",
"moveUp": "Μετακίνηση επάνω",
"moveDown": "Μετακίνηση κάτω",
"createAbove": "Νέα κατηγορία επάνω",
"createBelow": "Νέα κατηγορία κάτω",
"openAllInNewTabs": ""
},
"create": {
"title": "Νέα κατηγορία",
"submit": "Προσθήκη κατηγορίας"
},
"remove": {
"title": "Αφαίρεση κατηγορίας",
"message": ""
},
"edit": {
"title": "Μετονομασία κατηγορίας",
"submit": "Μετονομασία κατηγορίας"
},
"menu": {
"label": {
"create": "Νέα κατηγορία",
"changePosition": "Αλλαγή θέσης",
"settings": "Ρυθμίσεις"
}
},
"openAllInNewTabs": {
"title": "",
"text": ""
}
}
},
"item": {
+5 -45
View File
@@ -1549,10 +1549,10 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Create a new dynamic section",
"remove": "Delete dynamic section"
"create": "Create a new container",
"remove": "Delete container"
},
"option": {
"title": {
@@ -1566,48 +1566,8 @@
}
},
"remove": {
"title": "Remove dynamic section",
"message": "Are you certain that you want to remove this dynamic section? All items inside will be moved to the same location within the parent section."
}
},
"category": {
"field": {
"name": {
"label": "Name"
}
},
"action": {
"create": "New category",
"edit": "Rename category",
"remove": "Remove category",
"moveUp": "Move upwards",
"moveDown": "Move downwards",
"createAbove": "Create new category above",
"createBelow": "Create new category below",
"openAllInNewTabs": "Open all in new tabs"
},
"create": {
"title": "New category",
"submit": "Add category"
},
"remove": {
"title": "Remove category",
"message": "Are you sure you want to remove the category {name}?"
},
"edit": {
"title": "Rename category",
"submit": "Rename category"
},
"menu": {
"label": {
"create": "New category",
"changePosition": "Change position",
"settings": "Settings"
}
},
"openAllInNewTabs": {
"title": "Open all in tabs",
"text": "Some browsers may block the bulk-opening of tabs for security reasons. Homarr was unable to open all windows, because your browser blocked this action. Please allow \"Open pop-up windows\" and re-try."
"title": "Remove container",
"message": "Are you certain that you want to remove this container? All items inside will be moved to the same location within the parent section."
}
}
},
+1 -41
View File
@@ -1344,7 +1344,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Nueva sección dinámica",
"remove": "Eliminar sección dinámica"
@@ -1364,46 +1364,6 @@
"title": "Eliminar sección dinámica",
"message": "¿Estás seguro de que deseas eliminar esta sección dinámica? Los artículos se mantendrán en la misma ubicación."
}
},
"category": {
"field": {
"name": {
"label": "Nombre"
}
},
"action": {
"create": "Nueva Categoría",
"edit": "Renombrar categoría",
"remove": "Eliminar categoría",
"moveUp": "Mover hacia arriba",
"moveDown": "Mover hacia abajo",
"createAbove": "Nueva categoría arriba",
"createBelow": "Nueva categoría abajo",
"openAllInNewTabs": "Abrir todo en nuevas pestañas"
},
"create": {
"title": "Nueva Categoría",
"submit": "Añadir categoría"
},
"remove": {
"title": "Eliminar categoría",
"message": "¿Estás seguro de que deseas eliminar la categoría {name}?"
},
"edit": {
"title": "Renombrar categoría",
"submit": "Renombrar categoría"
},
"menu": {
"label": {
"create": "Nueva Categoría",
"changePosition": "Cambiar posición",
"settings": ""
}
},
"openAllInNewTabs": {
"title": "Abrir todo en nuevas pestañas",
"text": "Algunos navegadores pueden bloquear la apertura masiva de nuevas pestañas por razones de seguridad. Homarr no pudo abrir todas las ventanas, porque tu navegador bloqueó esta acción. Por favor, permite \"Abrir ventanas emergentes\" y vuelve a intentarlo."
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Uus dünaamiline sektsioon",
"remove": "Eemalda dünaamiline sektsioon"
@@ -1569,46 +1569,6 @@
"title": "Eemalda dünaamiline sektsioon",
"message": "Kas oled kindel, et soovid selle dünaamilise sektsiooni eemaldada? Üksused teisaldatakse ülemsektsiooni samasse asukohta."
}
},
"category": {
"field": {
"name": {
"label": "Nimi"
}
},
"action": {
"create": "Uus kategooria",
"edit": "Nimeta kategooria ümber",
"remove": "Eemalda kategooria",
"moveUp": "Liiguta üles",
"moveDown": "Liiguta alla",
"createAbove": "Uus kategooria ülal",
"createBelow": "Uus kategooria all",
"openAllInNewTabs": ""
},
"create": {
"title": "Uus kategooria",
"submit": "Lisa kategooria"
},
"remove": {
"title": "Eemalda kategooria",
"message": "Kas oled kindel, et soovid eemaldada kategooria {name}?"
},
"edit": {
"title": "Nimeta kategooria ümber",
"submit": "Nimeta kategooria ümber"
},
"menu": {
"label": {
"create": "Uus kategooria",
"changePosition": "Muuda asukohta",
"settings": ""
}
},
"openAllInNewTabs": {
"title": "",
"text": ""
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Uusi dynaaminen osio",
"remove": ""
@@ -1569,46 +1569,6 @@
"title": "",
"message": "Haluatko varmasti poistaa tämän dynaamisen osion? Kohteet siirretään samaan paikkaan yläosiossa."
}
},
"category": {
"field": {
"name": {
"label": ""
}
},
"action": {
"create": "Uusi kategoria",
"edit": "",
"remove": "",
"moveUp": "",
"moveDown": "",
"createAbove": "",
"createBelow": "",
"openAllInNewTabs": ""
},
"create": {
"title": "",
"submit": ""
},
"remove": {
"title": "",
"message": "Haluatko varmasti poistaa kategorian {name}?"
},
"edit": {
"title": "",
"submit": ""
},
"menu": {
"label": {
"create": "",
"changePosition": "",
"settings": "Asetukset"
}
},
"openAllInNewTabs": {
"title": "",
"text": "Jotkin selaimet voivat turvallisuussyistä estää välilehtien massa-avaamisen. Homarr ei voinut avata kaikkia ikkunoita, koska selaimesi esti toimenpiteen. Salli ponnahdusikkunoiden avaaminen ja yritä uudelleen."
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Nouvelle section dynamique",
"remove": "Supprimer la section dynamique"
@@ -1569,46 +1569,6 @@
"title": "Supprimer la section dynamique",
"message": "Êtes-vous sûr de vouloir supprimer cette section dynamique ? Les éléments seront déplacés au même emplacement dans la section parente."
}
},
"category": {
"field": {
"name": {
"label": "Nom"
}
},
"action": {
"create": "Nouvelle catégorie",
"edit": "Renommer la catégorie",
"remove": "Supprimer la catégorie",
"moveUp": "Monter",
"moveDown": "Descendre",
"createAbove": "Nouvelle catégorie au-dessus",
"createBelow": "Nouvelle catégorie en dessous",
"openAllInNewTabs": "Tout ouvrir dans des onglets"
},
"create": {
"title": "Nouvelle catégorie",
"submit": "Ajouter une catégorie"
},
"remove": {
"title": "Supprimer la catégorie",
"message": "Êtes-vous sûr de vouloir supprimer la catégorie {name}?"
},
"edit": {
"title": "Renommer la catégorie",
"submit": "Renommer la catégorie"
},
"menu": {
"label": {
"create": "Nouvelle catégorie",
"changePosition": "Modifier la position",
"settings": "Réglages"
}
},
"openAllInNewTabs": {
"title": "Tout ouvrir dans des onglets",
"text": "Certains navigateurs peuvent bloquer l'ouverture en masse d'onglets pour des raisons de sécurité. Homarr n'a pas pu ouvrir toutes les fenêtres, car votre navigateur a bloqué cette action. Veuillez autoriser \"Ouvrir les fenêtres pop-ups\" et réessayer."
}
}
},
"item": {
+1 -41
View File
@@ -1344,7 +1344,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "מדור דינמי חדש",
"remove": "הסר קטע דינמי"
@@ -1364,46 +1364,6 @@
"title": "הסר קטע דינמי",
"message": "האם אתה בטוח שברצונך להסיר את הקטע הדינמי הזה? פריטים יועברו לאותו מיקום במדור האב."
}
},
"category": {
"field": {
"name": {
"label": "שם"
}
},
"action": {
"create": "קטגוריה חדשה",
"edit": "שנה את שם הקטגוריה",
"remove": "הסר קטגוריה",
"moveUp": "הזזה למעלה",
"moveDown": "הזזה למטה",
"createAbove": "קטגוריה חדשה למעלה",
"createBelow": "קטגוריה חדשה למטה",
"openAllInNewTabs": "פתח הכל בכרטיסיות"
},
"create": {
"title": "קטגוריה חדשה",
"submit": "הוסף קטגוריה"
},
"remove": {
"title": "הסר קטגוריה",
"message": "האם אתה בטוח שברצונך להסיר את הקטגוריה {name}?"
},
"edit": {
"title": "שנה את שם הקטגוריה",
"submit": "שנה את שם הקטגוריה"
},
"menu": {
"label": {
"create": "קטגוריה חדשה",
"changePosition": "שנה מיקום",
"settings": ""
}
},
"openAllInNewTabs": {
"title": "פתח הכל בכרטיסיות",
"text": "דפדפנים מסוימים עשויים לחסום פתיחה בכמות גדולה של כרטיסיות מסיבות אבטחה. Homarr לא הצליח לפתוח את כל החלונות, מכיוון שהדפדפן שלך חסם את הפעולה הזו. אפשר \"פתח חלונות קופצים\" ונסה שוב."
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Nova dinamička sekcija",
"remove": "Ukloni dinamičku sekciju"
@@ -1569,46 +1569,6 @@
"title": "Ukloni dinamičku sekciju",
"message": "Jeste li sigurni da želite ukloniti ovu dinamičku sekciju? Stavke će biti premještene na isto mjesto u nadređenoj sekciji."
}
},
"category": {
"field": {
"name": {
"label": "Naziv"
}
},
"action": {
"create": "Nova kategorija",
"edit": "Preimenuj kategoriju",
"remove": "Ukloni kategoriju",
"moveUp": "Pomakni se gore",
"moveDown": "Pomicati prema dolje",
"createAbove": "Nova kategorija iznad",
"createBelow": "Nova kategorija ispod",
"openAllInNewTabs": ""
},
"create": {
"title": "Nova kategorija",
"submit": "Dodaj kategoriju"
},
"remove": {
"title": "Ukloni kategoriju",
"message": "Jeste li sigurni da želite ukloniti kategoriju {name}?"
},
"edit": {
"title": "Preimenuj kategoriju",
"submit": "Preimenuj kategoriju"
},
"menu": {
"label": {
"create": "Nova kategorija",
"changePosition": "Promijenjen položaj",
"settings": "Postavke"
}
},
"openAllInNewTabs": {
"title": "",
"text": ""
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Új dinamikus szakasz",
"remove": "A dinamikus szakasz eltávolítása"
@@ -1569,46 +1569,6 @@
"title": "Dinamikus szakasz eltávolítása",
"message": "Biztosan el akarja távolítani ezt a dinamikus részt? Az elemek a szülő rész ugyanazon helyére kerülnek át."
}
},
"category": {
"field": {
"name": {
"label": "Név"
}
},
"action": {
"create": "Új kategória",
"edit": "Kategória átnevezése",
"remove": "Kategória eltávolítása",
"moveUp": "Felfelé mozgatás",
"moveDown": "Mozgatás le",
"createAbove": "Új kategória fent",
"createBelow": "Új kategória alább",
"openAllInNewTabs": "Mindet lapokban megnyitni"
},
"create": {
"title": "Új kategória",
"submit": "Kategória hozzáadása"
},
"remove": {
"title": "Kategória eltávolítása",
"message": "Biztosan el akarja távolítani a {name} kategóriát?"
},
"edit": {
"title": "Kategória átnevezése",
"submit": "Kategória átnevezése"
},
"menu": {
"label": {
"create": "Új kategória",
"changePosition": "Pozíció módosítása",
"settings": "Beállítások"
}
},
"openAllInNewTabs": {
"title": "Mindet lapokban megnyitni",
"text": "Bizonyos böngészők biztonsági okokból megakadályozhatják a lapok tömeges megnyitását. A Homarr nem tudta megnyitni az összes ablakot, mert a böngészője letiltotta ezt a műveletet. Kérjük, engedélyezze a „Felugró ablakok megnyitása” opciót, majd próbálja meg újra."
}
}
},
"item": {
+1 -41
View File
@@ -1398,7 +1398,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Nuova sezione dinamica",
"remove": "Rimuovi sezione dinamica"
@@ -1418,46 +1418,6 @@
"title": "Rimuovi sezione dinamica",
"message": "Vuoi davvero rimuovere questa sezione dinamica? Gli elementi verranno spostati nella stessa posizione nella sezione padre."
}
},
"category": {
"field": {
"name": {
"label": "Nome"
}
},
"action": {
"create": "Nuova categoria",
"edit": "Rinomina categoria",
"remove": "Rimuovi categoria",
"moveUp": "Sposta in alto",
"moveDown": "Sposta in basso",
"createAbove": "Nuova categoria sopra",
"createBelow": "Nuova categoria sotto",
"openAllInNewTabs": "Apri tutto in schede"
},
"create": {
"title": "Nuova categoria",
"submit": "Aggiungi categoria"
},
"remove": {
"title": "Rimuovi categoria",
"message": "Sei sicuro di voler rimuovere la categoria {name}?"
},
"edit": {
"title": "Rinomina categoria",
"submit": "Rinomina categoria"
},
"menu": {
"label": {
"create": "Nuova categoria",
"changePosition": "Cambia posizione",
"settings": "Impostazioni"
}
},
"openAllInNewTabs": {
"title": "Apri tutto in schede",
"text": "Alcuni browser potrebbero bloccare l'apertura multipla delle schede per motivi di sicurezza. Homarr non è riuscito ad aprire tutte le finestre perché il browser ha bloccato questa azione. Consenti l'apertura di finestre pop-up e riprova."
}
}
},
"item": {
+1 -41
View File
@@ -1344,7 +1344,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "新しいダイナミックセクション",
"remove": "ダイナミックセクションを削除する"
@@ -1364,46 +1364,6 @@
"title": "ダイナミックセクションの削除",
"message": "この動的セクションを削除してもよろしいですか?アイテムは親セクションの同じ場所に移動されます。"
}
},
"category": {
"field": {
"name": {
"label": "名称"
}
},
"action": {
"create": "新しいカテゴリー",
"edit": "カテゴリー名の変更",
"remove": "カテゴリーを削除",
"moveUp": "上に移動",
"moveDown": "下へ移動",
"createAbove": "上に新しいカテゴリー",
"createBelow": "下に新しいカテゴリ",
"openAllInNewTabs": "すべてのタブを開く"
},
"create": {
"title": "新しいカテゴリー",
"submit": "カテゴリーを追加"
},
"remove": {
"title": "カテゴリーの削除",
"message": "カテゴリー {name} を削除してもよろしいですか?"
},
"edit": {
"title": "カテゴリー名変更",
"submit": "カテゴリー名を変更"
},
"menu": {
"label": {
"create": "新しいカテゴリー",
"changePosition": "ポジションを変更する",
"settings": ""
}
},
"openAllInNewTabs": {
"title": "すべてのタブを開く",
"text": "一部のブラウザーはセキュリティ上の理由からタブの一括開封をブロックすることがあります。 あなたのブラウザがこの操作をブロックしたため、Homarr はすべてのウィンドウを開くことができませんでした。「ポップアップウィンドウを開く」を許可して再試行してください。"
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "새 동적 섹션",
"remove": "동적 섹션 제거"
@@ -1569,46 +1569,6 @@
"title": "동적 섹션 제거",
"message": "이 동적 섹션을 제거하시겠습니까? 항목은 상위 섹션의 동일한 위치로 이동합니다."
}
},
"category": {
"field": {
"name": {
"label": "이름"
}
},
"action": {
"create": "새 카테고리",
"edit": "카테고리 이름 변경",
"remove": "카테고리 제거",
"moveUp": "위로 이동",
"moveDown": "아래로 이동",
"createAbove": "위에 새 카테고리 생성",
"createBelow": "아래 새 카테고리 생성",
"openAllInNewTabs": "탭에서 모두 열기"
},
"create": {
"title": "새 카테고리",
"submit": "카테고리 추가"
},
"remove": {
"title": "카테고리 제거",
"message": "{name} 카테고리를 제거하시겠습니까?"
},
"edit": {
"title": "카테고리 이름 변경",
"submit": "카테고리 이름 변경"
},
"menu": {
"label": {
"create": "새 카테고리",
"changePosition": "위치 변경",
"settings": "설정"
}
},
"openAllInNewTabs": {
"title": "탭에서 모두 열기",
"text": "일부 브라우저는 보안상의 이유로 탭의 대량 열기를 차단할 수 있습니다. 브라우저가 이 작업을 차단했기 때문에 Homarr가 모든 창을 열지 못했습니다. \"팝업 창 열기\"를 허용한 후 다시 시도해 주십시오."
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Nauja dinaminė sekcija",
"remove": "Pašalinti dinaminę sekciją"
@@ -1569,46 +1569,6 @@
"title": "Pašalinti dinaminę sekciją",
"message": "Ar tikrai norite pašalinti šią dinaminę sekciją? Elementai bus perkelti į tą pačią vietą pirminėje sekcijoje."
}
},
"category": {
"field": {
"name": {
"label": "Pavadinimas"
}
},
"action": {
"create": "Nauja kategorija",
"edit": "Pervardyti kategoriją",
"remove": "Pašalinti kategoriją",
"moveUp": "Pakelti aukštyn",
"moveDown": "Perkelti žemyn",
"createAbove": "Nauja kategorija aukščiau",
"createBelow": "Nauja kategorija žemiau",
"openAllInNewTabs": ""
},
"create": {
"title": "Nauja kategorija",
"submit": "Pridėti kategoriją"
},
"remove": {
"title": "Pašalinti kategoriją",
"message": "Ar tikrai norite pašalinti kategoriją {name}?"
},
"edit": {
"title": "Pervardyti kategoriją",
"submit": "Pervardyti kategoriją"
},
"menu": {
"label": {
"create": "Nauja kategorija",
"changePosition": "Keisti poziciją",
"settings": "Nustatymai"
}
},
"openAllInNewTabs": {
"title": "",
"text": ""
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Jauna dinamiskā sadaļa",
"remove": "Noņemt dinamisko sadaļu"
@@ -1569,46 +1569,6 @@
"title": "Noņemt dinamisko sadaļu",
"message": "Vai esat pārliecināts, ka vēlaties noņemt šo dinamisko sadaļu? Vienumi tiks pārvietoti uz to pašu atrašanās vietu vecāku sadaļā."
}
},
"category": {
"field": {
"name": {
"label": "Nosaukums"
}
},
"action": {
"create": "Jauna kategorija",
"edit": "Pārdēvēt kategoriju",
"remove": "Noņemt kategoriju",
"moveUp": "Virzīt augšup",
"moveDown": "Virzīt lejup",
"createAbove": "Jauna kategorija augšā",
"createBelow": "Jauna kategorija apakšā",
"openAllInNewTabs": ""
},
"create": {
"title": "Jauna kategorija",
"submit": "Pievienot kategoriju"
},
"remove": {
"title": "Noņemt kategoriju",
"message": "Vai esat pārliecināts, ka vēlaties noņemt kategoriju {name}?"
},
"edit": {
"title": "Pārdēvēt kategoriju",
"submit": "Pārdēvēt kategoriju"
},
"menu": {
"label": {
"create": "Jauna kategorija",
"changePosition": "Mainīt pozīciju",
"settings": "Iestatījumi"
}
},
"openAllInNewTabs": {
"title": "",
"text": ""
}
}
},
"item": {
+1 -41
View File
@@ -1344,7 +1344,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Nieuwe dynamische sectie",
"remove": "Dynamische sectie verwijderen"
@@ -1364,46 +1364,6 @@
"title": "Dynamische sectie verwijderen",
"message": "Weet je zeker dat je deze dynamische sectie wilt verwijderen? Items worden verplaatst naar dezelfde locatie in de bovenliggende sectie."
}
},
"category": {
"field": {
"name": {
"label": "Naam"
}
},
"action": {
"create": "Nieuwe categorie",
"edit": "Categorie hernoemen",
"remove": "Categorie verwijderen",
"moveUp": "Omhoog",
"moveDown": "Omlaag",
"createAbove": "Nieuwe categorie hierboven",
"createBelow": "Nieuwe categorie hieronder",
"openAllInNewTabs": "Alles openen in tabbladen"
},
"create": {
"title": "Nieuwe categorie",
"submit": "Categorie toevoegen"
},
"remove": {
"title": "Categorie verwijderen",
"message": "Weet je zeker dat je de categorie {name} wilt verwijderen?"
},
"edit": {
"title": "Categorie hernoemen",
"submit": "Categorie hernoemen"
},
"menu": {
"label": {
"create": "Nieuwe categorie",
"changePosition": "Positie wijzigen",
"settings": "Instellingen"
}
},
"openAllInNewTabs": {
"title": "Alles openen in tabbladen",
"text": "Sommige browsers blokkeren om veiligheidsredenen het bulk openen van tabbladen. Homarr kon niet alle vensters openen, omdat je browser deze actie blokkeerde. Sta \"Pop-upvensters openen\" toe en probeer het opnieuw."
}
}
},
"item": {
+1 -41
View File
@@ -1344,7 +1344,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Ny dynamisk seksjon",
"remove": "Fjern dynamisk seksjon"
@@ -1364,46 +1364,6 @@
"title": "Fjern dynamisk seksjon",
"message": "Er du sikker på at du vil fjerne denne dynamiske delen? Elementer vil bli flyttet til samme sted i overordnet seksjon."
}
},
"category": {
"field": {
"name": {
"label": "Navn"
}
},
"action": {
"create": "Ny kategori",
"edit": "Endre kategorinavn",
"remove": "Fjern kategori",
"moveUp": "Flytte opp",
"moveDown": "Flytt ned",
"createAbove": "Ny kategori over",
"createBelow": "Ny kategori under",
"openAllInNewTabs": "Åpne alle i faner"
},
"create": {
"title": "Ny kategori",
"submit": "Legg til kategori"
},
"remove": {
"title": "Fjern kategori",
"message": "Er du sikker på at du vil slette kategorien {name}?"
},
"edit": {
"title": "Endre kategorinavn",
"submit": "Endre kategorinavn"
},
"menu": {
"label": {
"create": "Ny kategori",
"changePosition": "Endre posisjon",
"settings": ""
}
},
"openAllInNewTabs": {
"title": "Åpne alle i faner",
"text": "Noen nettlesere kan blokkere åpning av faner av sikkerhetsgrunner. Homarr kunne ikke åpne alle vinduer, fordi nettleseren din blokkerte denne handlingen. Vennligst tillat \"Åpne pop-up vinduer\" og prøv på nytt."
}
}
},
"item": {
+1 -41
View File
@@ -1398,7 +1398,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Nowa sekcja dynamiczna",
"remove": "Usuń sekcję dynamiczną"
@@ -1418,46 +1418,6 @@
"title": "Usuń sekcję dynamiczną",
"message": "Czy na pewno chcesz usunąć tę sekcję dynamiczną? Elementy zostaną przeniesione w tej samej lokalizacji w sekcji nadrzędnej."
}
},
"category": {
"field": {
"name": {
"label": "Nazwa"
}
},
"action": {
"create": "Nowa kategoria",
"edit": "Zmień nazwę kategorii",
"remove": "Usuń kategorię",
"moveUp": "Przenieś w górę",
"moveDown": "Przenieś w dół",
"createAbove": "Nowa kategoria powyżej",
"createBelow": "Nowa kategoria poniżej",
"openAllInNewTabs": "Otwórz wszystkie w kartach"
},
"create": {
"title": "Nowa kategoria",
"submit": "Dodaj kategorię"
},
"remove": {
"title": "Usuń kategorię",
"message": "Czy na pewno chcesz usunąć kategorię {name}?"
},
"edit": {
"title": "Zmień nazwę kategorii",
"submit": "Zmień nazwę kategorii"
},
"menu": {
"label": {
"create": "Nowa kategoria",
"changePosition": "Zmiana pozycji",
"settings": "Ustawienia"
}
},
"openAllInNewTabs": {
"title": "Otwórz wszystkie w kartach",
"text": "Niektóre przeglądarki mogą blokować masowe otwieranie kart ze względów bezpieczeństwa. Homarr nie był w stanie otworzyć wszystkich okien, ponieważ Twoja przeglądarka zablokowała tę akcję. Proszę zezwolić na \"Otwórz wyskakujące okna\" i spróbować ponownie."
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Nova seção dinâmica",
"remove": "Remover seção dinâmica"
@@ -1569,46 +1569,6 @@
"title": "Remover seção dinâmica",
"message": "Tem certeza de que deseja remover esta seção dinâmica? Os itens serão movidos para o mesmo local na seção pai."
}
},
"category": {
"field": {
"name": {
"label": "Nome"
}
},
"action": {
"create": "Nova categoria",
"edit": "Renomear categoria",
"remove": "Remover categoria",
"moveUp": "Subir",
"moveDown": "Mover para baixo",
"createAbove": "Nova categoria acima",
"createBelow": "Nova categoria abaixo",
"openAllInNewTabs": "Abrir tudo em abas"
},
"create": {
"title": "Nova categoria",
"submit": "Adicionar categoria"
},
"remove": {
"title": "Remover categoria",
"message": "Tem certeza que deseja deletar a categoria {name}?"
},
"edit": {
"title": "Renomear categoria",
"submit": "Renomear categoria"
},
"menu": {
"label": {
"create": "Nova categoria",
"changePosition": "Mudar de posição",
"settings": "Configurações"
}
},
"openAllInNewTabs": {
"title": "Abrir tudo em abas",
"text": "Alguns navegadores podem bloquear a abertura em massa de abas por motivos de segurança. O Homarr não conseguiu abrir todas as janelas porque seu navegador bloqueou esta ação. Por favor, permita \"Abrir janelas pop-up\" e tente novamente."
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Nova seção dinâmica",
"remove": "Remover seção dinâmica"
@@ -1569,46 +1569,6 @@
"title": "Remover seção dinâmica",
"message": "Tem certeza de que deseja remover esta seção dinâmica? Os itens serão movidos para o mesmo local na seção pai."
}
},
"category": {
"field": {
"name": {
"label": "Nome"
}
},
"action": {
"create": "Nova categoria",
"edit": "Renomear categoria",
"remove": "Remover categoria",
"moveUp": "Subir",
"moveDown": "Mover para baixo",
"createAbove": "Nova categoria acima",
"createBelow": "Nova categoria abaixo",
"openAllInNewTabs": ""
},
"create": {
"title": "Nova categoria",
"submit": "Adicionar categoria"
},
"remove": {
"title": "Remover categoria",
"message": "Tem certeza que deseja deletar a categoria {name}?"
},
"edit": {
"title": "Renomear categoria",
"submit": "Renomear categoria"
},
"menu": {
"label": {
"create": "Nova categoria",
"changePosition": "Mudar de posição",
"settings": "Configurações"
}
},
"openAllInNewTabs": {
"title": "",
"text": ""
}
}
},
"item": {
+1 -41
View File
@@ -1344,7 +1344,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "",
"remove": ""
@@ -1364,46 +1364,6 @@
"title": "",
"message": ""
}
},
"category": {
"field": {
"name": {
"label": "Nume"
}
},
"action": {
"create": "",
"edit": "",
"remove": "",
"moveUp": "Mută în sus",
"moveDown": "Mută în jos",
"createAbove": "",
"createBelow": "",
"openAllInNewTabs": ""
},
"create": {
"title": "",
"submit": ""
},
"remove": {
"title": "",
"message": ""
},
"edit": {
"title": "",
"submit": ""
},
"menu": {
"label": {
"create": "",
"changePosition": "Schimbă locația",
"settings": "Setări"
}
},
"openAllInNewTabs": {
"title": "",
"text": ""
}
}
},
"item": {
+1 -41
View File
@@ -1344,7 +1344,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Новый динамический элемент",
"remove": "Удалить динамический элемент"
@@ -1364,46 +1364,6 @@
"title": "Удалить динамический элемент",
"message": "Вы уверены, что хотите удалить этот динамический элемент? Содержимое будет перемещено в то же место в родительском элементе."
}
},
"category": {
"field": {
"name": {
"label": "Название"
}
},
"action": {
"create": "Новая категория",
"edit": "Переименовать категорию",
"remove": "Удалить категорию",
"moveUp": "Переместить вверх",
"moveDown": "Переместить вниз",
"createAbove": "Создать категорию выше",
"createBelow": "Создать категорию ниже",
"openAllInNewTabs": "Открыть всё в новых вкладках"
},
"create": {
"title": "Новая категория",
"submit": "Добавить категорию"
},
"remove": {
"title": "Удалить категорию",
"message": "Вы уверены, что хотите удалить категорию {name}?"
},
"edit": {
"title": "Переименовать категорию",
"submit": "Переименовать категорию"
},
"menu": {
"label": {
"create": "Новая категория",
"changePosition": "Изменить позицию",
"settings": "Настройки"
}
},
"openAllInNewTabs": {
"title": "Открыть всё в новых вкладках",
"text": "Некоторые браузеры могут блокировать массовое открытие вкладок из соображений безопасности. Homarr не смог открыть все окна, поскольку ваш браузер заблокировал это действие. Пожалуйста, разрешите \"Открывать всплывающие окна\" и повторите попытку."
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Nová dynamická sekcia",
"remove": "Nová dynamická sekcia"
@@ -1569,46 +1569,6 @@
"title": "Nová dynamická sekcia",
"message": "Naozaj chcete odstrániť túto dynamickú sekciu? Položky sa presunú na rovnaké miesto v nadradenej sekcii."
}
},
"category": {
"field": {
"name": {
"label": "Názov"
}
},
"action": {
"create": "Nová kategória",
"edit": "Premenovať kategóriu",
"remove": "Odstrániť kategóriu",
"moveUp": "Posunúť nahor",
"moveDown": "Posunúť nadol",
"createAbove": "Nová kategória vyššie",
"createBelow": "Nová kategória nižšie",
"openAllInNewTabs": "Otvoriť všetko na kartách"
},
"create": {
"title": "Nová kategória",
"submit": "Pridať kategóriu"
},
"remove": {
"title": "Odstrániť kategóriu",
"message": "Naozaj chcete odstrániť kategóriu {name}?"
},
"edit": {
"title": "Premenovať kategóriu",
"submit": "Premenovať kategóriu"
},
"menu": {
"label": {
"create": "Nová kategória",
"changePosition": "Zmeniť pozíciu",
"settings": "Nastavenia"
}
},
"openAllInNewTabs": {
"title": "Otvoriť všetko na kartách",
"text": "Niektoré prehliadače môžu z bezpečnostných dôvodov blokovať hromadné otváranie kariet. Homarr nemohol otvoriť všetky okná, pretože váš prehliadač túto akciu zablokoval. Povoľte možnosť „Otvoriť kontextové okná“ a skúste to znova."
}
}
},
"item": {
+1 -41
View File
@@ -1344,7 +1344,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Nova dinamična vsebina",
"remove": "Odstrani dinamični odsek"
@@ -1364,46 +1364,6 @@
"title": "Odstrani dinamični odsek",
"message": "Ali ste prepričani, da želite odstraniti ta dinamični odsek? Elementi bodo premaknjeni na isto mesto v nadrejenem odseku."
}
},
"category": {
"field": {
"name": {
"label": "Ime"
}
},
"action": {
"create": "Nova kategorija",
"edit": "Preimenuj kategorijo",
"remove": "Odstrani kategorijo",
"moveUp": "Premaknite se navzgor",
"moveDown": "Premaknite se navzdol",
"createAbove": "Nova kategorija zgoraj",
"createBelow": "Nova kategorija spodaj",
"openAllInNewTabs": ""
},
"create": {
"title": "Nova kategorija",
"submit": "Dodaj kategorijo"
},
"remove": {
"title": "Odstrani kategorijo",
"message": "Ali ste prepričani, da želite odstraniti kategorijo {name}?"
},
"edit": {
"title": "Preimenuj kategorijo",
"submit": "Preimenuj kategorijo"
},
"menu": {
"label": {
"create": "Nova kategorija",
"changePosition": "Spremeni položaj",
"settings": "Nastavitve"
}
},
"openAllInNewTabs": {
"title": "",
"text": ""
}
}
},
"item": {
+1 -41
View File
@@ -1344,7 +1344,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Ny dynamisk sektion",
"remove": ""
@@ -1364,46 +1364,6 @@
"title": "",
"message": ""
}
},
"category": {
"field": {
"name": {
"label": "Namn"
}
},
"action": {
"create": "Ny kategori",
"edit": "",
"remove": "",
"moveUp": "Flytta uppåt",
"moveDown": "Flytta nedåt",
"createAbove": "",
"createBelow": "",
"openAllInNewTabs": ""
},
"create": {
"title": "",
"submit": "Lägg till kategori"
},
"remove": {
"title": "",
"message": "Är du säker du vill ta bort kategorin {name}?"
},
"edit": {
"title": "",
"submit": ""
},
"menu": {
"label": {
"create": "",
"changePosition": "Ändra position",
"settings": "Inställningar"
}
},
"openAllInNewTabs": {
"title": "",
"text": ""
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Yeni Dinamik Bölüm",
"remove": "Dinamik bölümü kaldır"
@@ -1569,46 +1569,6 @@
"title": "Dinamik bölümü kaldır",
"message": "Bu dinamik bölümü kaldırmak istediğinizden emin misiniz? Öğeler üst bölümdeki aynı konuma taşınacaktır."
}
},
"category": {
"field": {
"name": {
"label": "İsim"
}
},
"action": {
"create": "Yeni Kategori",
"edit": "Kategoriyi Yeniden Adlandır",
"remove": "Kategoriyi kaldır",
"moveUp": "Yukarı taşı",
"moveDown": "Aşağı taşı",
"createAbove": "Yukarı Yeni Kategori",
"createBelow": "Aşağı Yeni Kategori",
"openAllInNewTabs": "Tümünü sekmelerde aç"
},
"create": {
"title": "Yeni Kategori",
"submit": "Kategori ekle"
},
"remove": {
"title": "Kategoriyi kaldır",
"message": "{name} kategorisini kaldırmak istediğinizden emin misiniz?"
},
"edit": {
"title": "Kategoriyi Yeniden Adlandır",
"submit": "Kategoriyi Yeniden Adlandır"
},
"menu": {
"label": {
"create": "Yeni Kategori",
"changePosition": "Pozisyonu değiştir",
"settings": "Ayarlar"
}
},
"openAllInNewTabs": {
"title": "Tümünü sekmelerde aç",
"text": "Bazı tarayıcılar güvenlik nedeniyle sekmelerin toplu olarak açılmasını engelleyebilir. Homarr tüm pencereleri açamadı, çünkü tarayıcınız bu eylemi engelledi. Lütfen \"Açılır pencereleri aç\"a izin verin ve tekrar deneyin."
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Нова динамічна секція",
"remove": "Видалити динамічну секцію"
@@ -1569,46 +1569,6 @@
"title": "Видалити динамічний розділ",
"message": "Ви впевнені, що хочете видалити цей динамічний розділ? Елементи будуть переміщені в те саме місце в батьківському розділі."
}
},
"category": {
"field": {
"name": {
"label": "Ім’я"
}
},
"action": {
"create": "Нова категорія",
"edit": "Перейменувати категорію",
"remove": "Видалити категорію",
"moveUp": "Перемістити вгору",
"moveDown": "Перемістити вниз",
"createAbove": "Нові категорії зверху",
"createBelow": "Нова категорія знизу",
"openAllInNewTabs": "Відкрити все у вкладках"
},
"create": {
"title": "Нова категорія",
"submit": "Додати категорію"
},
"remove": {
"title": "Видалити категорію",
"message": "Ви впевнені, що хочете видалити категорію {name}?"
},
"edit": {
"title": "Перейменувати категорію",
"submit": "Перейменувати категорію"
},
"menu": {
"label": {
"create": "Нова категорія",
"changePosition": "Змінити положення",
"settings": "Налаштування"
}
},
"openAllInNewTabs": {
"title": "Відкрити все у вкладках",
"text": "Деякі браузери можуть блокувати маркове відкриття вкладок з міркувань безпеки. Homarr не може відкрити всі вікна, тому що ваш браузер заблокував цю дію. Будь ласка, дозвольте \"Відкрити виринаючі вік\" і спробуйте ще раз."
}
}
},
"item": {
+1 -41
View File
@@ -1344,7 +1344,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "Phần động mới",
"remove": "Xóa phần động"
@@ -1364,46 +1364,6 @@
"title": "Xóa phần động",
"message": "Bạn có chắc chắn muốn xóa phần động này không? Các mục sẽ được chuyển đến cùng vị trí trong phần cha."
}
},
"category": {
"field": {
"name": {
"label": "Tên"
}
},
"action": {
"create": "Danh mục mới",
"edit": "Đổi tên danh mục",
"remove": "Xóa danh mục",
"moveUp": "Đi lên",
"moveDown": "Đi xuống",
"createAbove": "Danh mục mới phía trên",
"createBelow": "Danh mục mới phía dưới",
"openAllInNewTabs": ""
},
"create": {
"title": "Danh mục mới",
"submit": "Thêm danh mục"
},
"remove": {
"title": "Xóa danh mục",
"message": "Bạn có chắc chắn muốn xóa danh mục {name} không?"
},
"edit": {
"title": "Đổi tên danh mục",
"submit": "Đổi tên danh mục"
},
"menu": {
"label": {
"create": "Danh mục mới",
"changePosition": "Đổi vị trí",
"settings": "Cài đặt"
}
},
"openAllInNewTabs": {
"title": "",
"text": ""
}
}
},
"item": {
+1 -41
View File
@@ -1549,7 +1549,7 @@
}
},
"section": {
"dynamic": {
"container": {
"action": {
"create": "創建動態區段",
"remove": "移除動態區段"
@@ -1569,46 +1569,6 @@
"title": "移除動態區段",
"message": "確認要移除此動態區段嗎?項目將移動到父區段的相同位置"
}
},
"category": {
"field": {
"name": {
"label": "名稱"
}
},
"action": {
"create": "創建分類",
"edit": "移除分類",
"remove": "移除分類",
"moveUp": "上移",
"moveDown": "下移",
"createAbove": "新分類之上",
"createBelow": "新分類之下",
"openAllInNewTabs": "於分頁中開啟全部"
},
"create": {
"title": "創建分類",
"submit": "創建分類"
},
"remove": {
"title": "移除分類",
"message": "確認移除分類 {name} 嗎?"
},
"edit": {
"title": "重新命名分類",
"submit": "重新命名分類"
},
"menu": {
"label": {
"create": "創建分類",
"changePosition": "變更位置",
"settings": "設定"
}
},
"openAllInNewTabs": {
"title": "於分頁中開啟全部",
"text": "某些瀏覽器可能會因安全性考量而阻止批量開啟分頁,Homarr 無法開啟所有視窗,因為您的瀏覽器已封鎖此操作,請允許「開啟彈出式視窗」,然後重試"
}
}
},
"item": {
+38 -42
View File
@@ -1,31 +1,32 @@
import { describe, expect, it } from "vitest";
import { categorySectionOptionsDefaults, dynamicSectionOptionsDefaults, sectionSchema } from "./shared";
import { containerSectionOptionsDefaults, sectionSchema } from "./shared";
describe("section behavior validation", () => {
it("normalizes a legacy category to the current behavior defaults", () => {
it("normalizes a container to the current behavior defaults", () => {
const result = sectionSchema.parse({
id: "category",
name: "Media",
kind: "category",
yOffset: 0,
xOffset: 0,
id: "container",
kind: "container",
layouts: [],
});
expect(result).toMatchObject({
collapsed: true,
options: categorySectionOptionsDefaults,
collapsed: false,
options: containerSectionOptionsDefaults,
});
});
it("normalizes a legacy dynamic section to the current behavior defaults", () => {
it("preserves configured container behavior", () => {
const result = sectionSchema.parse({
id: "dynamic",
kind: "dynamic",
id: "container",
kind: "container",
options: {
title: "Media",
customCssClasses: [],
borderColor: "",
title: "Operations",
customCssClasses: ["dense"],
borderColor: "#123456",
showLabel: false,
collapsible: true,
showOpenAll: true,
},
layouts: [],
});
@@ -33,37 +34,32 @@ describe("section behavior validation", () => {
expect(result).toMatchObject({
collapsed: false,
options: {
...dynamicSectionOptionsDefaults,
title: "Media",
title: "Operations",
customCssClasses: ["dense"],
borderColor: "#123456",
showLabel: false,
collapsible: true,
showOpenAll: true,
},
});
});
it("accepts a configured category rail", () => {
const result = sectionSchema.parse({
id: "category",
name: "Navigation",
kind: "category",
yOffset: 0,
xOffset: 0,
collapsed: false,
options: {
showLabel: false,
collapsible: false,
showOpenAll: false,
railPlacement: "left",
columnCount: 3,
},
});
it.each(["category", "dynamic"])("rejects the legacy %s kind", (kind) => {
expect(() => sectionSchema.parse({ id: "legacy", kind, layouts: [] })).toThrow();
});
expect(result).toMatchObject({
options: {
showLabel: false,
collapsible: false,
showOpenAll: false,
railPlacement: "left",
columnCount: 3,
},
});
it.each([
{ xOffset: 0.5, yOffset: 0, width: 1, height: 1 },
{ xOffset: -1, yOffset: 0, width: 1, height: 1 },
{ xOffset: 0, yOffset: 0, width: 0, height: 1 },
{ xOffset: 0, yOffset: 0, width: 1, height: 0 },
])("rejects invalid container grid geometry: %o", (layout) => {
expect(() =>
sectionSchema.parse({
id: "container",
kind: "container",
layouts: [{ layoutId: "layout", parentSectionId: "root", ...layout }],
}),
).toThrow();
});
});
+26 -55
View File
@@ -21,15 +21,18 @@ export const itemAdvancedOptionsSchema = z.object({
export type BoardItemAdvancedOptions = z.infer<typeof itemAdvancedOptionsSchema>;
const gridOffsetSchema = z.number().int().min(0).max(32767);
const gridSizeSchema = z.number().int().min(1).max(32767);
export const sharedItemSchema = z.object({
id: z.string(),
layouts: z.array(
z.object({
layoutId: z.string(),
yOffset: z.number(),
xOffset: z.number(),
width: z.number(),
height: z.number(),
yOffset: gridOffsetSchema,
xOffset: gridOffsetSchema,
width: gridSizeSchema,
height: gridSizeSchema,
sectionId: z.string(),
}),
),
@@ -44,46 +47,14 @@ export const commonItemSchema = z
})
.and(sharedItemSchema);
export const sectionRailPlacements = ["main", "left", "right"] as const;
export const categorySectionOptionsDefaults = {
showLabel: true,
collapsible: true,
showOpenAll: true,
railPlacement: "main",
columnCount: 2,
} as const;
export const categorySectionOptionsSchema = z
.object({
showLabel: z.boolean().default(categorySectionOptionsDefaults.showLabel),
collapsible: z.boolean().default(categorySectionOptionsDefaults.collapsible),
showOpenAll: z.boolean().default(categorySectionOptionsDefaults.showOpenAll),
railPlacement: z.enum(sectionRailPlacements).default(categorySectionOptionsDefaults.railPlacement),
columnCount: z.number().int().min(1).max(24).default(categorySectionOptionsDefaults.columnCount),
})
.default(categorySectionOptionsDefaults);
export type CategorySectionOptions = z.infer<typeof categorySectionOptionsSchema>;
const categorySectionSchema = z.object({
id: z.string(),
name: z.string(),
kind: z.literal("category"),
yOffset: z.number(),
xOffset: z.number(),
collapsed: z.boolean().default(true),
options: categorySectionOptionsSchema,
});
const emptySectionSchema = z.object({
id: z.string(),
kind: z.literal("empty"),
yOffset: z.number(),
xOffset: z.number(),
yOffset: z.number().int(),
xOffset: z.number().int(),
});
export const dynamicSectionOptionsDefaults = {
export const containerSectionOptionsDefaults = {
title: "",
customCssClasses: [] as string[],
borderColor: "",
@@ -92,34 +63,34 @@ export const dynamicSectionOptionsDefaults = {
showOpenAll: false,
} as const;
export const dynamicSectionOptionsSchema = z
export const containerSectionOptionsSchema = z
.object({
title: z.string().max(64).default(dynamicSectionOptionsDefaults.title),
title: z.string().max(64).default(containerSectionOptionsDefaults.title),
customCssClasses: z.array(z.string()).default([]),
borderColor: z.string().default(dynamicSectionOptionsDefaults.borderColor),
showLabel: z.boolean().default(dynamicSectionOptionsDefaults.showLabel),
collapsible: z.boolean().default(dynamicSectionOptionsDefaults.collapsible),
showOpenAll: z.boolean().default(dynamicSectionOptionsDefaults.showOpenAll),
borderColor: z.string().default(containerSectionOptionsDefaults.borderColor),
showLabel: z.boolean().default(containerSectionOptionsDefaults.showLabel),
collapsible: z.boolean().default(containerSectionOptionsDefaults.collapsible),
showOpenAll: z.boolean().default(containerSectionOptionsDefaults.showOpenAll),
})
.default(dynamicSectionOptionsDefaults);
.default(containerSectionOptionsDefaults);
export type DynamicSectionOptions = z.infer<typeof dynamicSectionOptionsSchema>;
export type ContainerSectionOptions = z.infer<typeof containerSectionOptionsSchema>;
const dynamicSectionSchema = z.object({
const containerSectionSchema = z.object({
id: z.string(),
kind: z.literal("dynamic"),
options: dynamicSectionOptionsSchema,
kind: z.literal("container"),
options: containerSectionOptionsSchema,
collapsed: z.boolean().default(false),
layouts: z.array(
z.object({
layoutId: z.string(),
yOffset: z.number(),
xOffset: z.number(),
width: z.number(),
height: z.number(),
yOffset: gridOffsetSchema,
xOffset: gridOffsetSchema,
width: gridSizeSchema,
height: gridSizeSchema,
parentSectionId: z.string(),
}),
),
});
export const sectionSchema = z.union([categorySectionSchema, emptySectionSchema, dynamicSectionSchema]);
export const sectionSchema = z.union([emptySectionSchema, containerSectionSchema]);