Compare commits
40
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6ec705db4a | ||
|
|
f6ca2a40c5 | ||
|
|
85c6eef016 | ||
|
|
f0cb7ab3c8 | ||
|
|
6bf37756b8 | ||
|
|
32f315b37c | ||
|
|
37365daccb | ||
|
|
7c3aee944d | ||
|
|
c3a5e92947 | ||
|
|
3d4bb25f49 | ||
|
|
df48246001 | ||
|
|
a2a22a89bc | ||
|
|
ea049066e1 | ||
|
|
70b868544f | ||
|
|
88a6f44d0d | ||
|
|
5226138186 | ||
|
|
5c71c1aede | ||
|
|
5acf6cef32 | ||
|
|
32aa26db65 | ||
|
|
47cfc5be6c | ||
|
|
27686e00f3 | ||
|
|
d21d67fc59 | ||
|
|
30e2e084a4 | ||
|
|
7f7af15fc5 | ||
|
|
6dffa4d2df | ||
|
|
0963885764 | ||
|
|
d53de7c641 | ||
|
|
9edf6ca99b | ||
|
|
fc0da8dedf | ||
|
|
b004186183 | ||
|
|
1706289124 | ||
|
|
dd23de7aaa | ||
|
|
f1602f67d4 | ||
|
|
c03cd97d3a | ||
|
|
a8e9a074d3 | ||
|
|
1e9d3e0656 | ||
|
|
01e0f3612d | ||
|
|
0015a6d88d | ||
|
|
77dc317da2 | ||
|
|
6aeda3faaf |
No files matched your search
@@ -0,0 +1,622 @@
|
|||||||
|
# Migrating Tables from mantine-react-table to mantine-datatable
|
||||||
|
|
||||||
|
This document captures every pattern, fix, and decision from the downloads widget rework (PR #6430). Use it as a playbook when porting other tables.
|
||||||
|
|
||||||
|
## Migration Candidates
|
||||||
|
|
||||||
|
Current `mantine-react-table` consumers that could be migrated:
|
||||||
|
|
||||||
|
**Widgets (in `packages/widgets/`):**
|
||||||
|
- `docker/component.tsx` — Docker container table
|
||||||
|
- `media-server/component.tsx` — Media server sessions
|
||||||
|
|
||||||
|
**Admin pages (in `apps/nextjs/src/app/[locale]/manage/`):**
|
||||||
|
- `tools/docker/docker-table.tsx`
|
||||||
|
- `tools/tasks/_components/tasks-table.tsx`
|
||||||
|
- `tools/api/components/api-keys.tsx`
|
||||||
|
- `users/_components/user-list.tsx`
|
||||||
|
- `users/invites/_components/invite-list.tsx`
|
||||||
|
- `tools/kubernetes/` — 8 Kubernetes resource tables
|
||||||
|
|
||||||
|
**Modals:**
|
||||||
|
- `packages/modals-collection/src/search-engines/request-media-modal.tsx`
|
||||||
|
|
||||||
|
**Shared hook to remove once all migrated:**
|
||||||
|
- `packages/ui/src/hooks/use-translated-mantine-react-table.ts`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. Core Migration: mantine-react-table → mantine-datatable
|
||||||
|
|
||||||
|
### Import changes
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// BEFORE
|
||||||
|
import { MantineReactTable, useMantineReactTable } from "mantine-react-table";
|
||||||
|
import type { MRT_ColumnDef } from "mantine-react-table";
|
||||||
|
|
||||||
|
// AFTER
|
||||||
|
import { DataTable, useDataTableColumns } from "mantine-datatable";
|
||||||
|
import type { DataTableColumn, DataTableSortStatus } from "mantine-datatable";
|
||||||
|
```
|
||||||
|
|
||||||
|
### Column definition shape
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// BEFORE (MRT)
|
||||||
|
const columns: MRT_ColumnDef<MyRow>[] = [
|
||||||
|
{
|
||||||
|
accessorKey: "name",
|
||||||
|
header: "Name",
|
||||||
|
size: 200,
|
||||||
|
enableSorting: true,
|
||||||
|
Cell: ({ row }) => <Text>{row.original.name}</Text>,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
// AFTER (mantine-datatable)
|
||||||
|
const columns: DataTableColumn<MyRow>[] = [
|
||||||
|
{
|
||||||
|
accessor: "name", // not accessorKey
|
||||||
|
title: "Name", // not header
|
||||||
|
width: 200, // not size
|
||||||
|
sortable: true, // not enableSorting
|
||||||
|
render: (record) => <Text>{record.name}</Text>, // not Cell
|
||||||
|
},
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
|
Key differences:
|
||||||
|
- `accessorKey` → `accessor`
|
||||||
|
- `header` → `title`
|
||||||
|
- `size` → `width`
|
||||||
|
- `Cell: ({ row }) =>` → `render: (record) =>`
|
||||||
|
- `enableSorting` → `sortable`
|
||||||
|
- `enableColumnActions` → does not exist (no column action menus)
|
||||||
|
- `mantineTableBodyCellProps` → `cellsStyle` in `defaultColumnProps`
|
||||||
|
|
||||||
|
### Table component
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// BEFORE
|
||||||
|
const table = useTranslatedMantineReactTable({ columns, data, ... });
|
||||||
|
return <MantineReactTable table={table} />;
|
||||||
|
|
||||||
|
// AFTER
|
||||||
|
return (
|
||||||
|
<DataTable
|
||||||
|
records={data}
|
||||||
|
columns={columns}
|
||||||
|
sortStatus={sortStatus}
|
||||||
|
onSortStatusChange={setSortStatus}
|
||||||
|
...
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sorting is manual
|
||||||
|
|
||||||
|
mantine-datatable does NOT sort for you. You must sort the data yourself:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const [sortStatus, setSortStatus] = useState<DataTableSortStatus<MyRow>>({
|
||||||
|
columnAccessor: "name",
|
||||||
|
direction: "asc",
|
||||||
|
});
|
||||||
|
|
||||||
|
const sortedData = useMemo(() => {
|
||||||
|
const mult = sortStatus.direction === "desc" ? -1 : 1;
|
||||||
|
return [...data].toSorted((a, b) => {
|
||||||
|
const aVal = a[sortStatus.columnAccessor];
|
||||||
|
const bVal = b[sortStatus.columnAccessor];
|
||||||
|
if (typeof aVal === "string") return aVal.localeCompare(bVal as string) * mult;
|
||||||
|
return ((aVal as number) - (bVal as number)) * mult;
|
||||||
|
});
|
||||||
|
}, [data, sortStatus]);
|
||||||
|
|
||||||
|
// Pass sortedData to records, not data
|
||||||
|
<DataTable records={sortedData} sortStatus={sortStatus} onSortStatusChange={setSortStatus} />
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. Making Tables Transparent (Widget Context)
|
||||||
|
|
||||||
|
Widgets sit inside board cards that have user-controlled opacity. The table must be fully transparent so the card background shows through. mantine-datatable defaults to `var(--mantine-color-body)` which is opaque.
|
||||||
|
|
||||||
|
Create a CSS file alongside the component:
|
||||||
|
|
||||||
|
```css
|
||||||
|
/* styles.css */
|
||||||
|
.my-table,
|
||||||
|
.my-table .mantine-datatable-table,
|
||||||
|
.my-table .mantine-datatable-table thead,
|
||||||
|
.my-table .mantine-datatable-table tbody,
|
||||||
|
.my-table .mantine-datatable-table tfoot,
|
||||||
|
.my-table th,
|
||||||
|
.my-table td {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.my-table .mantine-datatable-table tr {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hover: translucent instead of opaque */
|
||||||
|
.my-table .mantine-datatable-table tbody tr:hover {
|
||||||
|
background-color: color-mix(in srgb, var(--mantine-color-default-hover) 40%, transparent) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Headers: frosted glass effect */
|
||||||
|
.my-table th {
|
||||||
|
white-space: nowrap;
|
||||||
|
background-color: color-mix(in srgb, var(--mantine-color-body) 60%, transparent) !important;
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cell overflow */
|
||||||
|
.my-table td {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Hide sort icon until hover */
|
||||||
|
.my-table .mantine-datatable-header-cell-sortable-icon {
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 150ms;
|
||||||
|
}
|
||||||
|
.my-table th:hover .mantine-datatable-header-cell-sortable-icon {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Row expansion area */
|
||||||
|
.my-table .mantine-datatable-row-expansion-cell {
|
||||||
|
background-color: color-mix(in srgb, var(--mantine-color-body) 40%, transparent) !important;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Import it: `import "./styles.css";` and apply via `className="my-table"`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Responsive Column Visibility
|
||||||
|
|
||||||
|
Use a lookup table of width breakpoints instead of media queries. The widget receives `width` as a prop.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface SizeConfig {
|
||||||
|
fontSize: "xs" | "sm";
|
||||||
|
iconSize: number;
|
||||||
|
cellPadding: number;
|
||||||
|
showSpeedColumns: boolean;
|
||||||
|
showTimeColumn: boolean;
|
||||||
|
showStateColumn: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
const SIZE_BREAKPOINTS: { maxWidth: number; config: SizeConfig }[] = [
|
||||||
|
{ maxWidth: 300, config: { fontSize: "xs", iconSize: 12, cellPadding: 2, showSpeedColumns: false, showTimeColumn: false, showStateColumn: false } },
|
||||||
|
{ maxWidth: 500, config: { fontSize: "xs", iconSize: 14, cellPadding: 4, showSpeedColumns: false, showTimeColumn: true, showStateColumn: false } },
|
||||||
|
];
|
||||||
|
|
||||||
|
const DEFAULT_SIZE_CONFIG: SizeConfig = { fontSize: "sm", iconSize: 14, cellPadding: 4, showSpeedColumns: true, showTimeColumn: true, showStateColumn: true };
|
||||||
|
|
||||||
|
function getSizeConfig(width: number): SizeConfig {
|
||||||
|
for (const { maxWidth, config } of SIZE_BREAKPOINTS) {
|
||||||
|
if (width < maxWidth) return config;
|
||||||
|
}
|
||||||
|
return DEFAULT_SIZE_CONFIG;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Usage: memoize it
|
||||||
|
const size = useMemo(() => getSizeConfig(width), [width]);
|
||||||
|
```
|
||||||
|
|
||||||
|
Then use a visibility check lookup table for columns:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const columnVisibilityChecks: Partial<Record<string, (ctx: ColumnContext) => boolean>> = {
|
||||||
|
upSpeed: (ctx) => ctx.hasTorrents && ctx.size.showSpeedColumns,
|
||||||
|
downSpeed: (ctx) => ctx.size.showSpeedColumns,
|
||||||
|
time: (ctx) => ctx.size.showTimeColumn,
|
||||||
|
state: (ctx) => ctx.size.showStateColumn,
|
||||||
|
};
|
||||||
|
|
||||||
|
function shouldIncludeColumn(accessor: string, ctx: ColumnContext): boolean {
|
||||||
|
if (!ctx.optionsColumnSet.has(accessor)) return false;
|
||||||
|
const check = columnVisibilityChecks[accessor];
|
||||||
|
if (check && !check(ctx)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Column Persistence (Drag/Resize → Server)
|
||||||
|
|
||||||
|
`useDataTableColumns` stores column order and widths in localStorage by default. For widgets, this must persist server-side so it works across devices.
|
||||||
|
|
||||||
|
### Hidden widget options
|
||||||
|
|
||||||
|
In `index.ts`, add hidden text options:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
columnOrder: factory.text({ defaultValue: "" }),
|
||||||
|
columnWidths: factory.text({ defaultValue: "" }),
|
||||||
|
```
|
||||||
|
|
||||||
|
With visibility override:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
{
|
||||||
|
columnOrder: { shouldHide: () => true },
|
||||||
|
columnWidths: { shouldHide: () => true },
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Translation keys required
|
||||||
|
|
||||||
|
Even hidden options need translation keys or the translation test fails:
|
||||||
|
|
||||||
|
```json
|
||||||
|
"widget.mywidget.option.columnOrder.label": "Column order",
|
||||||
|
"widget.mywidget.option.columnWidths.label": "Column widths"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Old-import mappings
|
||||||
|
|
||||||
|
Add to `packages/old-import/src/widgets/options.ts`:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
columnOrder: () => undefined,
|
||||||
|
columnWidths: () => undefined,
|
||||||
|
```
|
||||||
|
|
||||||
|
### Dynamic storeKey
|
||||||
|
|
||||||
|
Use a key that includes `itemId` and sorted column names. This prevents cross-widget localStorage bleeding:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const storeKey = `mytable-${itemId ?? "preview"}-${[...options.columns].toSorted().join(",")}`;
|
||||||
|
```
|
||||||
|
|
||||||
|
### Hydration from server → localStorage
|
||||||
|
|
||||||
|
On mount, seed `useDataTableColumns` with server-persisted values. Use a `hydrated` ref to prevent the persist effect from immediately writing defaults back:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const { effectiveColumns, columnsOrder, columnsWidth, setColumnsOrder, setMultipleColumnWidths } =
|
||||||
|
useDataTableColumns<MyRow>({ key: storeKey, columns });
|
||||||
|
|
||||||
|
const lastStoreKey = useRef(storeKey);
|
||||||
|
const hydrated = useRef(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (lastStoreKey.current !== storeKey) {
|
||||||
|
lastStoreKey.current = storeKey;
|
||||||
|
hydrated.current = false;
|
||||||
|
}
|
||||||
|
if (hydrated.current) return;
|
||||||
|
if (savedOrder.length > 0) setColumnsOrder(savedOrder);
|
||||||
|
if (Object.keys(savedWidths).length > 0) {
|
||||||
|
setMultipleColumnWidths(
|
||||||
|
Object.entries(savedWidths).map(([accessor, w]) => ({ accessor, width: w })),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
requestAnimationFrame(() => { hydrated.current = true; });
|
||||||
|
}, [storeKey, savedOrder, savedWidths, setColumnsOrder, setMultipleColumnWidths]);
|
||||||
|
```
|
||||||
|
|
||||||
|
### Persist localStorage → server
|
||||||
|
|
||||||
|
Watch for changes and write back:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const prevOrder = useRef(columnsOrder);
|
||||||
|
const prevWidths = useRef(columnsWidth);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!hydrated.current) return;
|
||||||
|
const orderChanged = JSON.stringify(columnsOrder) !== JSON.stringify(prevOrder.current);
|
||||||
|
const widthsChanged = JSON.stringify(columnsWidth) !== JSON.stringify(prevWidths.current);
|
||||||
|
prevOrder.current = columnsOrder;
|
||||||
|
prevWidths.current = columnsWidth;
|
||||||
|
|
||||||
|
if (!orderChanged && !widthsChanged) return;
|
||||||
|
|
||||||
|
if (orderChanged) persistOption({ columnOrder: JSON.stringify(columnsOrder) });
|
||||||
|
if (widthsChanged) {
|
||||||
|
const widthMap: Record<string, number> = {};
|
||||||
|
for (const entry of columnsWidth) {
|
||||||
|
const key = Object.keys(entry)[0];
|
||||||
|
if (!key) continue;
|
||||||
|
const w = entry[key as keyof typeof entry];
|
||||||
|
if (typeof w === "number") widthMap[key] = w;
|
||||||
|
else if (typeof w === "string" && w.endsWith("px")) widthMap[key] = parseInt(w, 10);
|
||||||
|
}
|
||||||
|
persistOption({ columnWidths: JSON.stringify(widthMap) });
|
||||||
|
}
|
||||||
|
}, [columnsOrder, columnsWidth, persistOption]);
|
||||||
|
```
|
||||||
|
|
||||||
|
The `persistOption` helper calls both `setOptions` (local state) and `saveItemOptions` (server mutation).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. Context Menu (Right-Click)
|
||||||
|
|
||||||
|
Do NOT install `mantine-contextmenu`. Use Mantine's `Menu` + `Portal` directly:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface ContextMenuState {
|
||||||
|
x: number;
|
||||||
|
y: number;
|
||||||
|
item: MyRow;
|
||||||
|
}
|
||||||
|
|
||||||
|
const [contextMenu, setContextMenu] = useState<ContextMenuState | null>(null);
|
||||||
|
|
||||||
|
const handleContextMenu = useCallback(
|
||||||
|
({ record, event }: { record: MyRow; event: React.MouseEvent }) => {
|
||||||
|
event.preventDefault();
|
||||||
|
setContextMenu({ x: event.clientX, y: event.clientY, item: record });
|
||||||
|
},
|
||||||
|
[],
|
||||||
|
);
|
||||||
|
|
||||||
|
// On DataTable:
|
||||||
|
<DataTable onRowContextMenu={handleContextMenu} />
|
||||||
|
|
||||||
|
// Render:
|
||||||
|
{contextMenu && <RowContextMenu state={contextMenu} onClose={closeContextMenu} />}
|
||||||
|
```
|
||||||
|
|
||||||
|
The menu component uses `Portal` for correct z-index:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
function RowContextMenu({ state, onClose }: { state: ContextMenuState; onClose: () => void }) {
|
||||||
|
return (
|
||||||
|
<Portal>
|
||||||
|
<Menu opened onClose={onClose} closeOnItemClick={false} position="right-start" offset={0}>
|
||||||
|
<Menu.Target>
|
||||||
|
<Box style={{ position: "fixed", left: state.x, top: state.y, width: 0, height: 0 }} />
|
||||||
|
</Menu.Target>
|
||||||
|
<Menu.Dropdown>
|
||||||
|
<Menu.Item onClick={() => { /* action */ onClose(); }}>Action</Menu.Item>
|
||||||
|
</Menu.Dropdown>
|
||||||
|
</Menu>
|
||||||
|
</Portal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Key fix:** Use `closeOnItemClick={false}` if any menu item needs a two-step confirmation (like delete → confirm). Close the menu on scroll: `onScroll={() => { if (contextMenu) closeContextMenu(); }}`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Row Expansion
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
<DataTable
|
||||||
|
rowExpansion={{
|
||||||
|
trigger: "click",
|
||||||
|
allowMultiple: true,
|
||||||
|
collapseProps: {
|
||||||
|
transitionDuration: 200,
|
||||||
|
animateOpacity: true,
|
||||||
|
transitionTimingFunction: "ease-out",
|
||||||
|
},
|
||||||
|
content: ({ record, collapse }) => <ExpandedRow item={record} collapse={collapse} />,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
|
**Critical:** Do NOT set `onRowClick` when using `rowExpansion` with `trigger: "click"`. They conflict and the expansion won't work.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Common Pitfalls & Fixes
|
||||||
|
|
||||||
|
### Status indicator dots
|
||||||
|
|
||||||
|
Don't use `<Badge variant="dot" />` without children — it renders a pill with empty space. Use a plain `Box`:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
<Box
|
||||||
|
w={8}
|
||||||
|
h={8}
|
||||||
|
style={{
|
||||||
|
borderRadius: "50%",
|
||||||
|
backgroundColor: `var(--mantine-color-${color}-filled)`,
|
||||||
|
flexShrink: 0,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
|
### Tooltip overflow on long text columns
|
||||||
|
|
||||||
|
When a column has `ellipsis: true`, the tooltip target element can still extend beyond the cell bounds if inner elements don't clip. Fix:
|
||||||
|
|
||||||
|
```tsx
|
||||||
|
<Tooltip position="bottom-start" ...>
|
||||||
|
<Group style={{ overflow: "hidden" }}>
|
||||||
|
...
|
||||||
|
</Group>
|
||||||
|
</Tooltip>
|
||||||
|
```
|
||||||
|
|
||||||
|
Use `position="bottom-start"` instead of `position="right"` so the tooltip never escapes the widget horizontally.
|
||||||
|
|
||||||
|
### Dark mode tooltips
|
||||||
|
|
||||||
|
Mantine tooltips default to the theme's tooltip color which may be white in light mode and stay white in dark mode. Always set `color="dark"` on informational tooltips inside widgets.
|
||||||
|
|
||||||
|
### Division by zero
|
||||||
|
|
||||||
|
Guard all ratio calculations:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
if (item.size > 0) ratio = item.sent / item.size;
|
||||||
|
if (totalDown > 0) ratio = totalUp / totalDown;
|
||||||
|
```
|
||||||
|
|
||||||
|
### Composite idAccessor
|
||||||
|
|
||||||
|
When rows can come from multiple integrations, IDs may collide. Use a composite key:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
idAccessor={(record) => `${record.integration.id}:${record.id}`}
|
||||||
|
```
|
||||||
|
|
||||||
|
### JSON option parsing
|
||||||
|
|
||||||
|
Always wrap in try/catch:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
function parseJsonOption<T>(value: string | undefined, fallback: T): T {
|
||||||
|
if (!value) return fallback;
|
||||||
|
try { return JSON.parse(value) as T; }
|
||||||
|
catch { return fallback; }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Clipboard API
|
||||||
|
|
||||||
|
`navigator.clipboard.writeText()` can throw in non-HTTPS contexts. Always catch:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
void navigator.clipboard.writeText(text).catch(() => {});
|
||||||
|
```
|
||||||
|
|
||||||
|
### Sync sortStatus with widget options
|
||||||
|
|
||||||
|
If the widget has configurable default sort, sync it:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
useEffect(() => {
|
||||||
|
setSortStatus({ columnAccessor: options.defaultSort, direction: defaultSortDirection });
|
||||||
|
}, [options.defaultSort, defaultSortDirection]);
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 8. Accessibility
|
||||||
|
|
||||||
|
- All `ActionIcon` components need `aria-label`
|
||||||
|
- Filter toggles (client badges, status badges) need `aria-pressed={isActive}`
|
||||||
|
- `textSelectionDisabled` on DataTable prevents accidental text selection during drag/resize
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 9. Error Handling
|
||||||
|
|
||||||
|
- Every mutation needs an `onError` callback with `showErrorNotification`
|
||||||
|
- The `saveItemOptions` mutation (column persistence) also needs `onError`
|
||||||
|
- Check `isError` on the main query and show a fallback UI
|
||||||
|
- Use a shared `mutationOptions` object to avoid repeating `onSettled`/`onError`:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const mutationOptions = {
|
||||||
|
onSettled: () => void utils.myQuery.invalidate(),
|
||||||
|
onError: () => showErrorNotification({ title: t("errors.actionFailed"), message: t("errors.actionFailedMessage") }),
|
||||||
|
};
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 10. i18n
|
||||||
|
|
||||||
|
- No hardcoded strings. Every user-visible string goes through `useScopedI18n`
|
||||||
|
- Column titles: `t("items.{accessor}.columnTitle")`
|
||||||
|
- Detail labels: `t("items.{accessor}.detailsTitle")`
|
||||||
|
- States: `t("states.{state}")`
|
||||||
|
- Actions: `t("actions.{action}")`
|
||||||
|
- Errors: `t("errors.{errorKey}")`
|
||||||
|
- Hidden options still need `.label` translation keys
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 11. Edit Mode
|
||||||
|
|
||||||
|
Disable pointer events on the table during edit mode to prevent conflicts with the board's drag-and-drop:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
let tablePointerEvents: React.CSSProperties["pointerEvents"];
|
||||||
|
if (isEditMode) tablePointerEvents = "none";
|
||||||
|
|
||||||
|
let rowContextMenuHandler = handleContextMenu;
|
||||||
|
if (isEditMode) rowContextMenuHandler = undefined;
|
||||||
|
|
||||||
|
<DataTable style={{ pointerEvents: tablePointerEvents }} />
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 12. DataTable Props Reference (Commonly Used)
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
<DataTable
|
||||||
|
records={sortedData}
|
||||||
|
columns={effectiveColumns}
|
||||||
|
storeColumnsKey={storeKey}
|
||||||
|
withTableBorder={false}
|
||||||
|
borderRadius={0}
|
||||||
|
highlightOnHover
|
||||||
|
striped="odd"
|
||||||
|
stripedColor={{ dark: "dark.7", light: "gray.0" }}
|
||||||
|
highlightOnHoverColor={{ dark: "dark.5", light: "gray.1" }}
|
||||||
|
verticalAlign="center"
|
||||||
|
fetching={isFetching && data.length === 0}
|
||||||
|
loaderBackgroundBlur={2}
|
||||||
|
fz={size.fontSize}
|
||||||
|
textSelectionDisabled
|
||||||
|
sortStatus={sortStatus}
|
||||||
|
onSortStatusChange={setSortStatus}
|
||||||
|
noRecordsText={t("errors.noItems")}
|
||||||
|
idAccessor={(record) => record.uniqueKey}
|
||||||
|
height="100%"
|
||||||
|
className="my-table"
|
||||||
|
defaultColumnProps={{
|
||||||
|
noWrap: true,
|
||||||
|
draggable: true,
|
||||||
|
resizable: true,
|
||||||
|
cellsStyle: () => ({ padding: `${size.cellPadding}px 8px` }),
|
||||||
|
}}
|
||||||
|
scrollAreaProps={{ type: "auto", scrollbarSize: 6 }}
|
||||||
|
rowBackgroundColor={(record) => conditionalBgMap[record.state]}
|
||||||
|
onRowContextMenu={handleContextMenu}
|
||||||
|
rowExpansion={{ ... }}
|
||||||
|
onScroll={() => { if (contextMenu) closeContextMenu(); }}
|
||||||
|
/>
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 13. Layout Stability
|
||||||
|
|
||||||
|
- Don't use `table-layout: fixed` — it fights mantine-datatable's resize logic
|
||||||
|
- Give non-name columns explicit `width` values so only the name column flexes
|
||||||
|
- Use `ellipsis: true` on the name column — it handles `text-overflow: ellipsis` internally
|
||||||
|
- Names should truncate at the cell boundary, not a character count, so the layout is stable regardless of content length
|
||||||
|
- `flexShrink: 0` on badges/icons prevents them from being squeezed by long names
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 14. Checklist for Each Migration
|
||||||
|
|
||||||
|
1. Replace imports (`mantine-react-table` → `mantine-datatable`)
|
||||||
|
2. Convert column definitions (`accessorKey` → `accessor`, `header` → `title`, `Cell` → `render`, etc.)
|
||||||
|
3. Implement manual sorting with `useState` + `useMemo`
|
||||||
|
4. Add CSS file for transparent backgrounds (if widget context)
|
||||||
|
5. Add responsive column visibility (if widget context)
|
||||||
|
6. Add hidden options + hydration logic (if column persistence needed)
|
||||||
|
7. Add old-import mappings for new options
|
||||||
|
8. Add translation keys (including hidden option labels)
|
||||||
|
9. Add context menu if row actions exist
|
||||||
|
10. Add row expansion if detail view exists
|
||||||
|
11. Add error handling on all mutations
|
||||||
|
12. Add accessibility attributes
|
||||||
|
13. Test at multiple widget widths
|
||||||
|
14. Update docs in `apps/docs/docs/widgets/` if applicable
|
||||||
|
15. Run `pnpm turbo typecheck` — catches old-import mismatches
|
||||||
|
16. Run translation spec — catches missing keys
|
||||||
@@ -60,7 +60,7 @@ jobs:
|
|||||||
TURBO_PLATFORM: linux/amd64
|
TURBO_PLATFORM: linux/amd64
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v7
|
- uses: actions/checkout@v7
|
||||||
if: '!env.ACT'
|
if: "!env.ACT"
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
@@ -91,7 +91,7 @@ jobs:
|
|||||||
run: pnpm test
|
run: pnpm test
|
||||||
|
|
||||||
container:
|
container:
|
||||||
name: Container, E2E, and memory
|
name: Container and E2E
|
||||||
needs: fast-gate
|
needs: fast-gate
|
||||||
if: |
|
if: |
|
||||||
github.event_name == 'merge_group' ||
|
github.event_name == 'merge_group' ||
|
||||||
@@ -104,7 +104,7 @@ jobs:
|
|||||||
packages: write
|
packages: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v7
|
- uses: actions/checkout@v7
|
||||||
if: '!env.ACT'
|
if: "!env.ACT"
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || '' }}
|
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || '' }}
|
||||||
@@ -113,11 +113,11 @@ jobs:
|
|||||||
uses: ./tooling/github/setup
|
uses: ./tooling/github/setup
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
if: '!env.ACT'
|
if: "!env.ACT"
|
||||||
uses: docker/setup-buildx-action@v4
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
- name: Build container once
|
- name: Build container once
|
||||||
if: '!env.ACT'
|
if: "!env.ACT"
|
||||||
uses: docker/build-push-action@v7
|
uses: docker/build-push-action@v7
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@@ -158,7 +158,7 @@ jobs:
|
|||||||
--tag homarr-ci --tag homarr-e2e "${secret_args[@]}" .
|
--tag homarr-ci --tag homarr-e2e "${secret_args[@]}" .
|
||||||
|
|
||||||
- name: Cache Playwright browsers
|
- name: Cache Playwright browsers
|
||||||
if: '!env.ACT'
|
if: "!env.ACT"
|
||||||
id: playwright-cache
|
id: playwright-cache
|
||||||
uses: actions/cache@v6
|
uses: actions/cache@v6
|
||||||
with:
|
with:
|
||||||
@@ -184,82 +184,6 @@ jobs:
|
|||||||
path: e2e/test-results/
|
path: e2e/test-results/
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
- name: Run memory regression test
|
|
||||||
env:
|
|
||||||
CONTAINER_NAME: homarr-mem-${{ github.run_id }}-${{ github.run_attempt }}
|
|
||||||
SECRET_ENCRYPTION_KEY: 0000000000000000000000000000000000000000000000000000000000000000
|
|
||||||
run: |
|
|
||||||
docker run -d --name "$CONTAINER_NAME" -p 127.0.0.1::7575 \
|
|
||||||
-e NO_EXTERNAL_CONNECTION=true \
|
|
||||||
-e SECRET_ENCRYPTION_KEY="$SECRET_ENCRYPTION_KEY" \
|
|
||||||
homarr-ci
|
|
||||||
PORT=$(docker port "$CONTAINER_NAME" 7575/tcp | sed 's/.*://')
|
|
||||||
[[ "$PORT" =~ ^[0-9]+$ ]] || { echo "ERROR: invalid port mapping: '$PORT'"; exit 1; }
|
|
||||||
URL="http://127.0.0.1:${PORT}"
|
|
||||||
|
|
||||||
healthy=false
|
|
||||||
for i in $(seq 1 30); do
|
|
||||||
if curl -sf "$URL/api/health/ready" >/dev/null 2>&1; then
|
|
||||||
echo "Container healthy after $((i * 2))s"
|
|
||||||
healthy=true
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ "$healthy" != "true" ]; then
|
|
||||||
echo "ERROR: Container never became healthy"
|
|
||||||
docker logs "$CONTAINER_NAME" --tail 100
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
warmup_ok=0
|
|
||||||
for _ in $(seq 1 5); do
|
|
||||||
curl -sf "$URL/" >/dev/null 2>&1 && warmup_ok=$((warmup_ok + 1))
|
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
if [ "$warmup_ok" -eq 0 ]; then
|
|
||||||
echo "ERROR: All warmup requests failed"
|
|
||||||
docker logs "$CONTAINER_NAME" --tail 50
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
docker inspect -f '{{.State.Running}}' "$CONTAINER_NAME" | grep -qx true || {
|
|
||||||
echo "ERROR: Container died before memory measurement"
|
|
||||||
docker logs "$CONTAINER_NAME" --tail 100
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
RAW_MEMORY=$(docker stats --no-stream --format '{{.MemUsage}}' "$CONTAINER_NAME" | sed 's| /.*||')
|
|
||||||
MEMORY_MB=$(echo "$RAW_MEMORY" | awk '
|
|
||||||
/GiB/ { gsub(/GiB/, ""); print $1 * 1024; next }
|
|
||||||
/MiB/ { gsub(/MiB/, ""); print $1; next }
|
|
||||||
/KiB/ { gsub(/KiB/, ""); print $1 / 1024; next }
|
|
||||||
{ print $1 / 1048576 }
|
|
||||||
')
|
|
||||||
|
|
||||||
echo "Memory usage: ${MEMORY_MB} MB (${RAW_MEMORY})"
|
|
||||||
[[ "$MEMORY_MB" =~ ^[0-9]+(\.[0-9]+)?$ ]] || {
|
|
||||||
echo "ERROR: non-numeric memory value: '$MEMORY_MB' (raw: '$RAW_MEMORY')"
|
|
||||||
docker logs "$CONTAINER_NAME" --tail 100
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
if awk "BEGIN { exit !($MEMORY_MB < 50) }"; then
|
|
||||||
echo "ERROR: Memory suspiciously low (${MEMORY_MB} MB) — container may have crashed"
|
|
||||||
docker logs "$CONTAINER_NAME" --tail 100
|
|
||||||
exit 1
|
|
||||||
elif awk "BEGIN { exit !($MEMORY_MB > 700) }"; then
|
|
||||||
echo "ERROR: Memory usage ${MEMORY_MB} MB exceeds 700 MB"
|
|
||||||
docker logs "$CONTAINER_NAME" --tail 100
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Clean up memory test container
|
|
||||||
if: always()
|
|
||||||
env:
|
|
||||||
CONTAINER_NAME: homarr-mem-${{ github.run_id }}-${{ github.run_attempt }}
|
|
||||||
run: docker rm -f "$CONTAINER_NAME" >/dev/null 2>&1 || true
|
|
||||||
|
|
||||||
- name: Determine preview tag
|
- name: Determine preview tag
|
||||||
id: preview
|
id: preview
|
||||||
if: |
|
if: |
|
||||||
@@ -309,7 +233,7 @@ jobs:
|
|||||||
run: test -n "$PR_NUMBER" || { echo "pr_number is required for cleanup"; exit 1; }
|
run: test -n "$PR_NUMBER" || { echo "pr_number is required for cleanup"; exit 1; }
|
||||||
|
|
||||||
- name: Delete GHCR package version
|
- name: Delete GHCR package version
|
||||||
if: '!env.ACT'
|
if: "!env.ACT"
|
||||||
uses: actions/github-script@v8
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
|
|||||||
@@ -50,12 +50,11 @@ import { immichServerStatsWidget } from '../../widgets/immich-server-stats';
|
|||||||
<code>user.read</code>,{" "}
|
<code>user.read</code>,{" "}
|
||||||
<code>user.update</code>,{" "}
|
<code>user.update</code>,{" "}
|
||||||
<code>asset.read</code>,{" "}
|
<code>asset.read</code>,{" "}
|
||||||
|
<code>asset.view</code>,{" "}
|
||||||
<code>asset.download</code>,{" "}
|
<code>asset.download</code>,{" "}
|
||||||
<code>asset.statistics</code>,{" "}
|
<code>asset.statistics</code>,{" "}
|
||||||
<code>server.statistics</code>,{" "}
|
<code>server.statistics</code>,{" "}
|
||||||
<code>server.about</code>.
|
<code>server.about</code>.
|
||||||
<br />
|
|
||||||
Additional permissions may be required depending on your Immich version. If you encounter authorization errors, grant any missing permissions requested by the server.
|
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
),
|
),
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 210 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 122 KiB |
@@ -4,6 +4,7 @@ description: 'Allows you to view and manage your Downloads from both Torrent and
|
|||||||
hide_title: true
|
hide_title: true
|
||||||
---
|
---
|
||||||
|
|
||||||
|
import { aria2Integration } from '@site/docs/integrations/aria2';
|
||||||
import { delugeIntegration } from '@site/docs/integrations/deluge';
|
import { delugeIntegration } from '@site/docs/integrations/deluge';
|
||||||
import { nzbgetIntegration } from '@site/docs/integrations/nzbget';
|
import { nzbgetIntegration } from '@site/docs/integrations/nzbget';
|
||||||
import { qBittorentIntegration } from '@site/docs/integrations/q-bittorent';
|
import { qBittorentIntegration } from '@site/docs/integrations/q-bittorent';
|
||||||
@@ -14,9 +15,6 @@ import { AddingWidget } from '@site/src/components/widgets/adding';
|
|||||||
import { WidgetConfig } from '@site/src/components/widgets/configuration';
|
import { WidgetConfig } from '@site/src/components/widgets/configuration';
|
||||||
import { WidgetHeader } from '@site/src/components/widgets/header';
|
import { WidgetHeader } from '@site/src/components/widgets/header';
|
||||||
import { WidgetIntegrations } from '@site/src/components/widgets/integrations';
|
import { WidgetIntegrations } from '@site/src/components/widgets/integrations';
|
||||||
import { IconAd } from "@tabler/icons-react";
|
|
||||||
import TabItem from '@theme/TabItem';
|
|
||||||
import Tabs from '@theme/Tabs';
|
|
||||||
import { downloadsWidget } from '.';
|
import { downloadsWidget } from '.';
|
||||||
|
|
||||||
|
|
||||||
@@ -25,16 +23,37 @@ import { downloadsWidget } from '.';
|
|||||||
categories={['Torrent client', 'Usenet client', 'Downloads']}
|
categories={['Torrent client', 'Usenet client', 'Downloads']}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
This widget displays a list of torrents or usenet-articles that are currently being downloaded, along with their progress and other relevant information.
|
This widget displays a list of torrents or usenet-articles that are currently being downloaded, along with their progress and other relevant information. It supports 7 download client integrations and provides a rich, responsive table interface.
|
||||||
|
|
||||||
### Screenshots
|
### Screenshots
|
||||||
|
|
||||||
import downloadsCard from './img/screenshot.png';
|
import downloadsCard from './img/screenshot.png';
|
||||||
|
import contextMenuImg from './img/context-menu.png';
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<img src={downloadsCard} alt="downloads" width={128 * 4} />
|
<img src={downloadsCard} alt="Downloads widget showing torrent and usenet items" width={128 * 4} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
#### Right-click context menu
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<img src={contextMenuImg} alt="Downloads widget context menu with pause, delete, and copy actions" width={128 * 4} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
- **Responsive table** — columns automatically adapt to widget width, hiding less important columns at smaller sizes
|
||||||
|
- **Sortable columns** — click any column header to sort ascending/descending
|
||||||
|
- **Column customization** — choose which columns to display via the widget options panel
|
||||||
|
- **Right-click context menu** — pause, resume, delete downloads, or copy download names directly from the context menu
|
||||||
|
- **Row expansion** — click any row to see full details inline without opening a separate modal
|
||||||
|
- **Hover tooltips** — hover a download name to see size, speeds, ETA, ratio, and category
|
||||||
|
- **Global stats bar** — toggle a summary bar showing queue progress, total size, speeds, ratio, and per-state counts
|
||||||
|
- **Client filtering** — filter downloads by integration or status using the footer filter panel
|
||||||
|
- **Global controls** — pause/resume all downloads across all clients from the footer bar
|
||||||
|
- **Status indicators** — color-coded badges show download state at a glance
|
||||||
|
- **Speed overview** — total download and upload speeds displayed in the footer
|
||||||
|
|
||||||
### Supported Integrations
|
### Supported Integrations
|
||||||
|
|
||||||
<WidgetIntegrations items={[{
|
<WidgetIntegrations items={[{
|
||||||
@@ -52,16 +71,23 @@ import downloadsCard from './img/screenshot.png';
|
|||||||
}, {
|
}, {
|
||||||
integration: qBittorentIntegration,
|
integration: qBittorentIntegration,
|
||||||
note: "Torrent client"
|
note: "Torrent client"
|
||||||
|
}, {
|
||||||
|
integration: aria2Integration,
|
||||||
|
note: "Multi-protocol download client"
|
||||||
}, {
|
}, {
|
||||||
integration: slskdIntegration,
|
integration: slskdIntegration,
|
||||||
note: "Soulseek client"
|
note: "Soulseek client (read-only)"
|
||||||
}]} />
|
}]} />
|
||||||
|
|
||||||
### Interactions
|
### Interactions
|
||||||
|
|
||||||
- Pause / Resume one download by clicking on the according icon.
|
- **Right-click** any download to open a context menu with pause/resume, delete, and copy actions
|
||||||
- Delete one download by clicking on the trash icon. (Can also delete the files)
|
- **Click** any row to expand it and see full download details inline
|
||||||
- Pause / Resume all downloads by using the bottom button.
|
- **Hover** a download name for a quick stats tooltip
|
||||||
|
- **Stats toggle** — show or hide the global stats bar from the footer
|
||||||
|
- **Pause / Resume** all downloads using the footer controls
|
||||||
|
- **Filter** by integration or status using the filter button in the footer
|
||||||
|
- **Sort** by clicking column headers (with persistent sort direction)
|
||||||
|
|
||||||
### Adding the widget
|
### Adding the widget
|
||||||
|
|
||||||
|
|||||||
@@ -2,26 +2,23 @@ import { WidgetDefinition } from "@site/src/types";
|
|||||||
import { IconDownload } from "@tabler/icons-react";
|
import { IconDownload } from "@tabler/icons-react";
|
||||||
|
|
||||||
const columnsList = [
|
const columnsList = [
|
||||||
"id",
|
|
||||||
"actions",
|
|
||||||
"added",
|
|
||||||
"category",
|
|
||||||
"downSpeed",
|
|
||||||
"index",
|
|
||||||
"integration",
|
|
||||||
"name",
|
"name",
|
||||||
"progress",
|
"progress",
|
||||||
|
"size",
|
||||||
|
"downSpeed",
|
||||||
|
"upSpeed",
|
||||||
|
"time",
|
||||||
|
"state",
|
||||||
|
"added",
|
||||||
"ratio",
|
"ratio",
|
||||||
"received",
|
"received",
|
||||||
"sent",
|
"sent",
|
||||||
"size",
|
"category",
|
||||||
"state",
|
"integration",
|
||||||
"time",
|
"index",
|
||||||
"type",
|
"type",
|
||||||
"upSpeed",
|
|
||||||
];
|
];
|
||||||
const sortingExclusion = ["actions", "id", "state"];
|
const sortColumns = columnsList.filter((c) => !["state", "category", "integration"].includes(c));
|
||||||
const columnsSort = columnsList.filter((column) => !sortingExclusion.some((exclusion) => exclusion === column));
|
|
||||||
|
|
||||||
export const downloadsWidget: WidgetDefinition = {
|
export const downloadsWidget: WidgetDefinition = {
|
||||||
icon: IconDownload,
|
icon: IconDownload,
|
||||||
@@ -32,25 +29,20 @@ export const downloadsWidget: WidgetDefinition = {
|
|||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
name: "Columns to show",
|
name: "Columns to show",
|
||||||
description: "Select the columns you want to display in the widget.",
|
description:
|
||||||
|
"Select the columns you want to display in the widget. Columns automatically hide/show based on widget width.",
|
||||||
values: `List of columns: ${columnsList.join(", ")}`,
|
values: `List of columns: ${columnsList.join(", ")}`,
|
||||||
defaultValue: ["integration", "name", "progress", "time", "actions"].join(", "),
|
defaultValue: ["name", "progress", "downSpeed", "time", "state"].join(", "),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Enable items sorting",
|
name: "Default sort column",
|
||||||
description: "Enables the sorting in the table.",
|
description: "The column used for initial sorting when the widget loads.",
|
||||||
values: { type: "boolean" },
|
defaultValue: "progress",
|
||||||
defaultValue: "no",
|
values: `List of columns: ${sortColumns.join(", ")}`,
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "Column used for sorting by default",
|
|
||||||
description: "By default it will sort by this column.",
|
|
||||||
defaultValue: "type",
|
|
||||||
values: `List of columns: ${columnsSort.join(", ")}`,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Invert sorting",
|
name: "Invert sorting",
|
||||||
description: "This will invert the sorting order of the table.",
|
description: "This will invert the default sorting order.",
|
||||||
values: { type: "boolean" },
|
values: { type: "boolean" },
|
||||||
defaultValue: "no",
|
defaultValue: "no",
|
||||||
},
|
},
|
||||||
@@ -76,13 +68,13 @@ export const downloadsWidget: WidgetDefinition = {
|
|||||||
name: "Hide completed torrent under this threshold (in kiB/s)",
|
name: "Hide completed torrent under this threshold (in kiB/s)",
|
||||||
description:
|
description:
|
||||||
"This will hide completed torrent entries that have a download speed below the specified threshold.",
|
"This will hide completed torrent entries that have a download speed below the specified threshold.",
|
||||||
values: "Any number above 1, 0 to disable",
|
values: "Any number above 0, 0 to disable",
|
||||||
defaultValue: "0",
|
defaultValue: "0",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Categories/names to filter",
|
name: "Categories/labels to filter",
|
||||||
description: "You can filter the items by categories or names. Use a comma to separate multiple values.",
|
description: "You can filter the items by categories or labels. Use a comma to separate multiple values.",
|
||||||
values: "Comma-separated list of categories or names",
|
values: "Comma-separated list of categories or labels",
|
||||||
defaultValue: "-",
|
defaultValue: "-",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -94,13 +86,13 @@ export const downloadsWidget: WidgetDefinition = {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Use filter to calculate Ratio",
|
name: "Use filter to calculate Ratio",
|
||||||
description: "This will use the filter to calculate the ratio of items shown in the widget.",
|
description: "This will use the category filter when calculating the global torrent ratio.",
|
||||||
values: { type: "boolean" },
|
values: { type: "boolean" },
|
||||||
defaultValue: "yes",
|
defaultValue: "yes",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "Limit items per integration",
|
name: "Limit items per integration",
|
||||||
description: "This will limit the number of items shown per integration, not globally",
|
description: "This will limit the number of items shown per integration, not globally.",
|
||||||
values: "Any number above 1",
|
values: "Any number above 1",
|
||||||
defaultValue: "50",
|
defaultValue: "50",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,19 +1,25 @@
|
|||||||
import { notFound } from "next/navigation";
|
|
||||||
|
|
||||||
import { ImageProxy } from "@homarr/image-proxy";
|
import { ImageProxy } from "@homarr/image-proxy";
|
||||||
|
|
||||||
export const GET = async (_request: Request, props: { params: Promise<{ id: string }> }) => {
|
export const GET = async (_request: Request, props: { params: Promise<{ id: string }> }) => {
|
||||||
const { id } = await props.params;
|
const { id } = await props.params;
|
||||||
|
|
||||||
const imageProxy = new ImageProxy();
|
const imageProxy = new ImageProxy();
|
||||||
const image = await imageProxy.forwardImageAsync(id);
|
const result = await imageProxy.forwardImageAsync(id);
|
||||||
if (!image) {
|
|
||||||
notFound();
|
if ("error" in result) {
|
||||||
|
const status = result.error === "upstream-error" ? result.statusCode : result.error === "fetch-error" ? 502 : 404;
|
||||||
|
return new Response(null, {
|
||||||
|
status,
|
||||||
|
headers: {
|
||||||
|
"X-Homarr-Image-Proxy-Error": result.error,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Response(image, {
|
return new Response(result.image, {
|
||||||
headers: {
|
headers: {
|
||||||
"Cache-Control": "public, max-age=3600, immutable", // Cache for 1 hour
|
"Cache-Control": "public, max-age=3600, immutable", // Cache for 1 hour
|
||||||
|
...(result.contentType ? { "Content-Type": result.contentType } : {}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=24.18.0",
|
"node": ">=24.18.0",
|
||||||
"pnpm": ">=11.11.0"
|
"pnpm": ">=11.13.1"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@11.11.0"
|
"packageManager": "pnpm@11.13.1"
|
||||||
}
|
}
|
||||||
+2
-2
@@ -69,7 +69,7 @@
|
|||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=24.18.0",
|
"node": ">=24.18.0",
|
||||||
"pnpm": ">=11.11.0"
|
"pnpm": ">=11.13.1"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@11.11.0"
|
"packageManager": "pnpm@11.13.1"
|
||||||
}
|
}
|
||||||
@@ -37,5 +37,5 @@ describe("Mysql Migration", () => {
|
|||||||
|
|
||||||
connection.end();
|
connection.end();
|
||||||
await mysqlContainer.stop();
|
await mysqlContainer.stop();
|
||||||
}, 40_000);
|
}, 120_000);
|
||||||
});
|
});
|
||||||
@@ -467,7 +467,6 @@ export const integrationDefs = {
|
|||||||
iconUrl: "https://cdn.jsdelivr.net/gh/selfhst/icons/png/archiveteam-warrior.png",
|
iconUrl: "https://cdn.jsdelivr.net/gh/selfhst/icons/png/archiveteam-warrior.png",
|
||||||
category: ["archiving"],
|
category: ["archiving"],
|
||||||
documentationUrl: null,
|
documentationUrl: null,
|
||||||
defaultUrl: "http://localhost:8001",
|
|
||||||
},
|
},
|
||||||
// This integration only returns mock data, it is used during development (but can also be used in production by directly going to the create page)
|
// This integration only returns mock data, it is used during development (but can also be used in production by directly going to the create page)
|
||||||
mock: {
|
mock: {
|
||||||
|
|||||||
@@ -19,6 +19,12 @@ const createUrlByIdChannel = (id: string) =>
|
|||||||
headers: `${string}.${string}`;
|
headers: `${string}.${string}`;
|
||||||
}>(`image-proxy:url:${id}`);
|
}>(`image-proxy:url:${id}`);
|
||||||
|
|
||||||
|
export type ForwardImageResult =
|
||||||
|
| { image: ArrayBuffer; contentType: string | null }
|
||||||
|
| { error: "not-found" }
|
||||||
|
| { error: "upstream-error"; statusCode: number }
|
||||||
|
| { error: "fetch-error" };
|
||||||
|
|
||||||
export class ImageProxy {
|
export class ImageProxy {
|
||||||
private static hmacKey: Buffer<ArrayBuffer> | null = null;
|
private static hmacKey: Buffer<ArrayBuffer> | null = null;
|
||||||
|
|
||||||
@@ -47,17 +53,34 @@ export class ImageProxy {
|
|||||||
return this.createImageUrl(id);
|
return this.createImageUrl(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async forwardImageAsync(id: string): Promise<ArrayBuffer | null> {
|
public async forwardImageAsync(id: string): Promise<ForwardImageResult> {
|
||||||
const urlAndHeaders = await this.getImageUrlAndHeadersAsync(id);
|
const urlAndHeaders = await this.getImageUrlAndHeadersAsync(id);
|
||||||
if (!urlAndHeaders) {
|
if (!urlAndHeaders) {
|
||||||
return null;
|
return { error: "not-found" };
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await fetchWithTrustedCertificatesAsync(urlAndHeaders.url, {
|
|
||||||
headers: urlAndHeaders.headers ?? {},
|
|
||||||
});
|
|
||||||
|
|
||||||
const proxyUrl = this.createImageUrl(id);
|
const proxyUrl = this.createImageUrl(id);
|
||||||
|
let response: Awaited<ReturnType<typeof fetchWithTrustedCertificatesAsync>>;
|
||||||
|
try {
|
||||||
|
response = await fetchWithTrustedCertificatesAsync(urlAndHeaders.url, {
|
||||||
|
headers: urlAndHeaders.headers ?? {},
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
logger.error(
|
||||||
|
new ErrorWithMetadata(
|
||||||
|
"Failed to connect to image source",
|
||||||
|
{
|
||||||
|
id,
|
||||||
|
url: this.redactUrl(urlAndHeaders.url),
|
||||||
|
headers: this.redactHeaders(urlAndHeaders.headers),
|
||||||
|
proxyUrl,
|
||||||
|
},
|
||||||
|
{ cause: error },
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return { error: "fetch-error" };
|
||||||
|
}
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
logger.error(
|
logger.error(
|
||||||
new ErrorWithMetadata("Failed to fetch image", {
|
new ErrorWithMetadata("Failed to fetch image", {
|
||||||
@@ -68,7 +91,7 @@ export class ImageProxy {
|
|||||||
statusCode: response.status,
|
statusCode: response.status,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
return null;
|
return { error: "upstream-error", statusCode: response.status };
|
||||||
}
|
}
|
||||||
|
|
||||||
const arrayBuffer = await response.arrayBuffer();
|
const arrayBuffer = await response.arrayBuffer();
|
||||||
@@ -80,7 +103,7 @@ export class ImageProxy {
|
|||||||
size: `${(arrayBuffer.byteLength / 1024).toFixed(1)}KB`,
|
size: `${(arrayBuffer.byteLength / 1024).toFixed(1)}KB`,
|
||||||
});
|
});
|
||||||
|
|
||||||
return arrayBuffer;
|
return { image: arrayBuffer, contentType: response.headers.get("content-type") };
|
||||||
}
|
}
|
||||||
|
|
||||||
private createImageUrl(id: string): string {
|
private createImageUrl(id: string): string {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export class QBitTorrentIntegration extends Integration implements IDownloadClie
|
|||||||
public async getClientJobsAndStatusAsync(input: { limit: number }): Promise<DownloadClientJobsAndStatus> {
|
public async getClientJobsAndStatusAsync(input: { limit: number }): Promise<DownloadClientJobsAndStatus> {
|
||||||
const type = "torrent";
|
const type = "torrent";
|
||||||
const client = await this.getClientAsync();
|
const client = await this.getClientAsync();
|
||||||
const torrents = await client.listTorrents({ limit: input.limit, sort: "progress", reverse: false });
|
const torrents = await client.listTorrents({ limit: input.limit });
|
||||||
const rates = torrents.reduce(
|
const rates = torrents.reduce(
|
||||||
({ down, up }, { dlspeed, upspeed }) => ({ down: down + dlspeed, up: up + upspeed }),
|
({ down, up }, { dlspeed, upspeed }) => ({ down: down + dlspeed, up: up + upspeed }),
|
||||||
{ down: 0, up: 0 },
|
{ down: 0, up: 0 },
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
AssetMediaSize,
|
||||||
getAlbumInfo,
|
getAlbumInfo,
|
||||||
getAllAlbums,
|
getAllAlbums,
|
||||||
getMyUser,
|
getMyUser,
|
||||||
@@ -75,7 +76,9 @@ export class ImmichIntegration extends Integration {
|
|||||||
assets: await Promise.all(
|
assets: await Promise.all(
|
||||||
albumAssets.map(async (asset) => {
|
albumAssets.map(async (asset) => {
|
||||||
const publicLink = await imageProxy.createImageAsync(
|
const publicLink = await imageProxy.createImageAsync(
|
||||||
this.url(`/api/assets/${asset.id}/original`).toString(),
|
// This is the URL generated by the SDK's viewAsset call. Preview images are
|
||||||
|
// browser-compatible while avoiding the large original asset download.
|
||||||
|
this.url(`/api/assets/${asset.id}/thumbnail`, { size: AssetMediaSize.Preview }).toString(),
|
||||||
{
|
{
|
||||||
"x-api-key": this.getSecretValue("apiKey"),
|
"x-api-key": this.getSecretValue("apiKey"),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -74,15 +74,16 @@ const optionMapping: OptionMapping = {
|
|||||||
categoryFilter: (oldOptions) => ("labelFilter" in oldOptions ? oldOptions.labelFilter : undefined),
|
categoryFilter: (oldOptions) => ("labelFilter" in oldOptions ? oldOptions.labelFilter : undefined),
|
||||||
filterIsWhitelist: (oldOptions) =>
|
filterIsWhitelist: (oldOptions) =>
|
||||||
"labelFilterIsWhitelist" in oldOptions ? oldOptions.labelFilterIsWhitelist : undefined,
|
"labelFilterIsWhitelist" in oldOptions ? oldOptions.labelFilterIsWhitelist : undefined,
|
||||||
enableRowSorting: (oldOptions) => ("rowSorting" in oldOptions ? oldOptions.rowSorting : undefined),
|
|
||||||
showCompletedTorrent: (oldOptions) =>
|
showCompletedTorrent: (oldOptions) =>
|
||||||
"displayCompletedTorrents" in oldOptions ? oldOptions.displayCompletedTorrents : undefined,
|
"displayCompletedTorrents" in oldOptions ? oldOptions.displayCompletedTorrents : undefined,
|
||||||
columns: () => ["integration", "name", "progress", "time", "actions"],
|
columns: () => ["integration", "name", "progress", "time", "state"],
|
||||||
defaultSort: () => "type",
|
defaultSort: () => "progress",
|
||||||
descendingDefaultSort: () => false,
|
descendingDefaultSort: () => false,
|
||||||
showCompletedUsenet: () => true,
|
showCompletedUsenet: () => true,
|
||||||
showCompletedHttp: () => true,
|
showCompletedHttp: () => true,
|
||||||
limitPerIntegration: () => undefined,
|
limitPerIntegration: () => undefined,
|
||||||
|
columnOrder: () => undefined,
|
||||||
|
columnWidths: () => undefined,
|
||||||
},
|
},
|
||||||
weather: {
|
weather: {
|
||||||
forecastDayCount: (oldOptions) => oldOptions.forecastDays,
|
forecastDayCount: (oldOptions) => oldOptions.forecastDays,
|
||||||
|
|||||||
@@ -3068,11 +3068,20 @@
|
|||||||
"limitPerIntegration": {
|
"limitPerIntegration": {
|
||||||
"label": "Limit items per integration",
|
"label": "Limit items per integration",
|
||||||
"description": "This will limit the number of items shown per integration, not globally"
|
"description": "This will limit the number of items shown per integration, not globally"
|
||||||
|
},
|
||||||
|
"columnOrder": {
|
||||||
|
"label": "Column order"
|
||||||
|
},
|
||||||
|
"columnWidths": {
|
||||||
|
"label": "Column widths"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"errors": {
|
"errors": {
|
||||||
"noColumns": "Select Columns in Items",
|
"noColumns": "Select Columns in Items",
|
||||||
"noCommunications": "Can't load data from integration"
|
"noCommunications": "Can't load data from integration",
|
||||||
|
"noItems": "No downloads found",
|
||||||
|
"actionFailed": "Action failed",
|
||||||
|
"actionFailedMessage": "The action could not be completed. Please try again."
|
||||||
},
|
},
|
||||||
"items": {
|
"items": {
|
||||||
"actions": {
|
"actions": {
|
||||||
@@ -3095,7 +3104,8 @@
|
|||||||
"detailsTitle": "Current index within client"
|
"detailsTitle": "Current index within client"
|
||||||
},
|
},
|
||||||
"id": {
|
"id": {
|
||||||
"columnTitle": "Id"
|
"columnTitle": "Id",
|
||||||
|
"detailsTitle": "Item ID"
|
||||||
},
|
},
|
||||||
"integration": {
|
"integration": {
|
||||||
"columnTitle": "Integration"
|
"columnTitle": "Integration"
|
||||||
@@ -3129,7 +3139,8 @@
|
|||||||
},
|
},
|
||||||
"time": {
|
"time": {
|
||||||
"columnTitle": "Finish time",
|
"columnTitle": "Finish time",
|
||||||
"detailsTitle": "Time since/to completion"
|
"detailsTitle": "Time since/to completion",
|
||||||
|
"eta": "ETA"
|
||||||
},
|
},
|
||||||
"type": {
|
"type": {
|
||||||
"columnTitle": "Type",
|
"columnTitle": "Type",
|
||||||
@@ -3173,7 +3184,23 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"globalRatio": "Global Ratio"
|
"globalRatio": "Global Ratio",
|
||||||
|
"contextMenu": {
|
||||||
|
"copyName": "Copy name",
|
||||||
|
"copyId": "Copy ID",
|
||||||
|
"clearFilters": "Clear filters"
|
||||||
|
},
|
||||||
|
"footer": {
|
||||||
|
"filter": "Filter downloads"
|
||||||
|
},
|
||||||
|
"stats": {
|
||||||
|
"show": "Show global stats",
|
||||||
|
"hide": "Hide global stats",
|
||||||
|
"overallProgress": "Overall queue progress",
|
||||||
|
"totalSize": "Total queue size",
|
||||||
|
"clients": "{count, plural, one {# client} other {# clients}}"
|
||||||
|
},
|
||||||
|
"disconnected": "(disconnected)"
|
||||||
},
|
},
|
||||||
"mediaReleases": {
|
"mediaReleases": {
|
||||||
"name": "Media releases",
|
"name": "Media releases",
|
||||||
|
|||||||
File diff suppressed because it is too large.
Load diff
@@ -8,28 +8,37 @@ import { createWidgetDefinition } from "../definition";
|
|||||||
import { optionsBuilder } from "../options";
|
import { optionsBuilder } from "../options";
|
||||||
|
|
||||||
const columnsList = [
|
const columnsList = [
|
||||||
"id",
|
|
||||||
"actions",
|
|
||||||
"added",
|
|
||||||
"category",
|
|
||||||
"downSpeed",
|
|
||||||
"index",
|
|
||||||
"integration",
|
|
||||||
"name",
|
"name",
|
||||||
"progress",
|
"progress",
|
||||||
|
"size",
|
||||||
|
"downSpeed",
|
||||||
|
"upSpeed",
|
||||||
|
"time",
|
||||||
|
"state",
|
||||||
|
"added",
|
||||||
"ratio",
|
"ratio",
|
||||||
"received",
|
"received",
|
||||||
"sent",
|
"sent",
|
||||||
"size",
|
"category",
|
||||||
"state",
|
"integration",
|
||||||
"time",
|
"index",
|
||||||
"type",
|
"type",
|
||||||
"upSpeed",
|
|
||||||
] as const satisfies (keyof ExtendedDownloadClientItem)[];
|
] as const satisfies (keyof ExtendedDownloadClientItem)[];
|
||||||
const sortingExclusion = ["actions", "id", "state"] as const satisfies readonly (typeof columnsList)[number][];
|
|
||||||
const columnsSort = columnsList.filter((column) =>
|
const sortColumns = [
|
||||||
sortingExclusion.every((exclusion) => exclusion !== column),
|
"name",
|
||||||
) as Exclude<typeof columnsList, (typeof sortingExclusion)[number]>;
|
"progress",
|
||||||
|
"size",
|
||||||
|
"downSpeed",
|
||||||
|
"upSpeed",
|
||||||
|
"time",
|
||||||
|
"added",
|
||||||
|
"ratio",
|
||||||
|
"received",
|
||||||
|
"sent",
|
||||||
|
"index",
|
||||||
|
"type",
|
||||||
|
] as const satisfies readonly (typeof columnsList)[number][];
|
||||||
|
|
||||||
export const { definition, componentLoader } = createWidgetDefinition("downloads", {
|
export const { definition, componentLoader } = createWidgetDefinition("downloads", {
|
||||||
icon: IconDownload,
|
icon: IconDownload,
|
||||||
@@ -38,19 +47,16 @@ export const { definition, componentLoader } = createWidgetDefinition("downloads
|
|||||||
return optionsBuilder.from(
|
return optionsBuilder.from(
|
||||||
(factory) => ({
|
(factory) => ({
|
||||||
columns: factory.multiSelect({
|
columns: factory.multiSelect({
|
||||||
defaultValue: ["integration", "name", "progress", "time", "actions"],
|
defaultValue: ["name", "progress", "downSpeed", "time", "state"],
|
||||||
options: columnsList.map((value) => ({
|
options: columnsList.map((value) => ({
|
||||||
value,
|
value,
|
||||||
label: (t) => t(`widget.downloads.items.${value}.columnTitle`),
|
label: (t) => t(`widget.downloads.items.${value}.columnTitle`),
|
||||||
})),
|
})),
|
||||||
searchable: true,
|
searchable: true,
|
||||||
}),
|
}),
|
||||||
enableRowSorting: factory.switch({
|
|
||||||
defaultValue: false,
|
|
||||||
}),
|
|
||||||
defaultSort: factory.select({
|
defaultSort: factory.select({
|
||||||
defaultValue: "type",
|
defaultValue: "progress",
|
||||||
options: columnsSort.map((value) => ({
|
options: sortColumns.map((value) => ({
|
||||||
value,
|
value,
|
||||||
label: (t) => t(`widget.downloads.items.${value}.columnTitle`),
|
label: (t) => t(`widget.downloads.items.${value}.columnTitle`),
|
||||||
})),
|
})),
|
||||||
@@ -68,7 +74,6 @@ export const { definition, componentLoader } = createWidgetDefinition("downloads
|
|||||||
defaultValue: true,
|
defaultValue: true,
|
||||||
}),
|
}),
|
||||||
activeTorrentThreshold: factory.number({
|
activeTorrentThreshold: factory.number({
|
||||||
//in KiB/s
|
|
||||||
validate: z.number().min(0),
|
validate: z.number().min(0),
|
||||||
defaultValue: 0,
|
defaultValue: 0,
|
||||||
step: 1,
|
step: 1,
|
||||||
@@ -88,14 +93,12 @@ export const { definition, componentLoader } = createWidgetDefinition("downloads
|
|||||||
validate: z.number().min(1),
|
validate: z.number().min(1),
|
||||||
withDescription: true,
|
withDescription: true,
|
||||||
}),
|
}),
|
||||||
|
columnOrder: factory.text({ defaultValue: "" }),
|
||||||
|
columnWidths: factory.text({ defaultValue: "" }),
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
defaultSort: {
|
columnOrder: { shouldHide: () => true },
|
||||||
shouldHide: (options) => !options.enableRowSorting,
|
columnWidths: { shouldHide: () => true },
|
||||||
},
|
|
||||||
descendingDefaultSort: {
|
|
||||||
shouldHide: (options) => !options.enableRowSorting,
|
|
||||||
},
|
|
||||||
showCompletedUsenet: {
|
showCompletedUsenet: {
|
||||||
shouldHide: (_, integrationKinds) =>
|
shouldHide: (_, integrationKinds) =>
|
||||||
!getIntegrationKindsByCategory("usenet").some((kinds) => integrationKinds.includes(kinds)),
|
!getIntegrationKindsByCategory("usenet").some((kinds) => integrationKinds.includes(kinds)),
|
||||||
|
|||||||
@@ -1,12 +1,52 @@
|
|||||||
/* Make the MantineReactTable transparent so the board card's opacity-controlled
|
/* Make the DataTable transparent so the board card's opacity-controlled
|
||||||
background shows through. MRT defaults to var(--mantine-color-body) which is opaque. */
|
background shows through. The mantine-datatable defaults to
|
||||||
.downloads-widget-table,
|
var(--mantine-color-body) which is opaque. */
|
||||||
.downloads-widget-table .mantine-Table-table,
|
.downloads-table,
|
||||||
.downloads-widget-table .mantine-Table-thead,
|
.downloads-table .mantine-datatable-table,
|
||||||
.downloads-widget-table .mantine-Table-tbody,
|
.downloads-table .mantine-datatable-table thead,
|
||||||
.downloads-widget-table .mantine-Table-tfoot,
|
.downloads-table .mantine-datatable-table tbody,
|
||||||
.downloads-widget-table .mantine-Table-tr,
|
.downloads-table .mantine-datatable-table tfoot,
|
||||||
.downloads-widget-table th,
|
.downloads-table th,
|
||||||
.downloads-widget-table td {
|
.downloads-table td {
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.downloads-table .mantine-datatable-table tr {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.downloads-table .mantine-datatable-table tbody tr:hover {
|
||||||
|
background-color: color-mix(in srgb, var(--mantine-color-default-hover) 40%, transparent) !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.downloads-table th {
|
||||||
|
white-space: nowrap;
|
||||||
|
background-color: color-mix(in srgb, var(--mantine-color-body) 60%, transparent) !important;
|
||||||
|
backdrop-filter: blur(8px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.downloads-table td {
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
|
||||||
|
.downloads-table td .mantine-Text-root,
|
||||||
|
.downloads-table td .mantine-Group-root {
|
||||||
|
white-space: nowrap;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.downloads-table .mantine-datatable-header-cell-sortable-icon {
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 150ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.downloads-table th:hover .mantine-datatable-header-cell-sortable-icon {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Row expansion styling */
|
||||||
|
.downloads-table .mantine-datatable-row-expansion-cell {
|
||||||
|
background-color: color-mix(in srgb, var(--mantine-color-body) 40%, transparent) !important;
|
||||||
|
}
|
||||||
@@ -66,10 +66,12 @@ export default function MediaServerWidget({ options, integrationIds }: WidgetCom
|
|||||||
const currentlyPlaying = row.original.currentlyPlaying;
|
const currentlyPlaying = row.original.currentlyPlaying;
|
||||||
if (!currentlyPlaying) return null;
|
if (!currentlyPlaying) return null;
|
||||||
|
|
||||||
const isPaused = currentlyPlaying.playback.state === "paused";
|
const playback = currentlyPlaying.playback;
|
||||||
|
const isPaused = playback?.state === "paused";
|
||||||
const Icon = isPaused ? IconPlayerPause : mediaTypeIconMap[currentlyPlaying.type];
|
const Icon = isPaused ? IconPlayerPause : mediaTypeIconMap[currentlyPlaying.type];
|
||||||
|
|
||||||
const { positionMs, durationMs } = currentlyPlaying.playback;
|
const positionMs = playback?.positionMs ?? null;
|
||||||
|
const durationMs = playback?.durationMs ?? null;
|
||||||
const progressPercent =
|
const progressPercent =
|
||||||
positionMs !== null && durationMs !== null && durationMs > 0
|
positionMs !== null && durationMs !== null && durationMs > 0
|
||||||
? Math.min(100, Math.round((positionMs / durationMs) * 100))
|
? Math.min(100, Math.round((positionMs / durationMs) * 100))
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
[{"login":"ajnart","avatar_url":"https://avatars.githubusercontent.com/u/49837342?v=4"},{"login":"manuel-rw","avatar_url":"https://avatars.githubusercontent.com/u/30572287?v=4"},{"login":"Meierschlumpf","avatar_url":"https://avatars.githubusercontent.com/u/63781622?v=4"},{"login":"SeDemal","avatar_url":"https://avatars.githubusercontent.com/u/26098587?v=4"},{"login":"lammersbjorn","avatar_url":"https://avatars.githubusercontent.com/u/71191962?v=4"},{"login":"LarveyOfficial","avatar_url":"https://avatars.githubusercontent.com/u/39219859?v=4"},{"login":"c00ldude1oo","avatar_url":"https://avatars.githubusercontent.com/u/15677803?v=4"},{"login":"InterN0te","avatar_url":"https://avatars.githubusercontent.com/u/10882916?v=4"},{"login":"Aimsucks","avatar_url":"https://avatars.githubusercontent.com/u/1828486?v=4"},{"login":"JannesV","avatar_url":"https://avatars.githubusercontent.com/u/5984244?v=4"},{"login":"MauriceNino","avatar_url":"https://avatars.githubusercontent.com/u/18658092?v=4"},{"login":"hillaliy","avatar_url":"https://avatars.githubusercontent.com/u/950010?v=4"},{"login":"Skeeww","avatar_url":"https://avatars.githubusercontent.com/u/9639992?v=4"},{"login":"RichyHBM","avatar_url":"https://avatars.githubusercontent.com/u/5472275?v=4"},{"login":"Bonfire","avatar_url":"https://avatars.githubusercontent.com/u/5704760?v=4"},{"login":"wieli99","avatar_url":"https://avatars.githubusercontent.com/u/46794825?v=4"},{"login":"ishaanparlikar","avatar_url":"https://avatars.githubusercontent.com/u/43013132?v=4"},{"login":"Zareix","avatar_url":"https://avatars.githubusercontent.com/u/29818713?v=4"},{"login":"tuggan","avatar_url":"https://avatars.githubusercontent.com/u/4325608?v=4"},{"login":"Spillebulle","avatar_url":"https://avatars.githubusercontent.com/u/46653946?v=4"},{"login":"marektancak0106","avatar_url":"https://avatars.githubusercontent.com/u/25422667?v=4"},{"login":"spkesDE","avatar_url":"https://avatars.githubusercontent.com/u/1682314?v=4"},{"login":"j3lte","avatar_url":"https://avatars.githubusercontent.com/u/2557568?v=4"},{"login":"dslatt","avatar_url":"https://avatars.githubusercontent.com/u/5211001?v=4"},{"login":"Malong11-007","avatar_url":"https://avatars.githubusercontent.com/u/40298510?v=4"},{"login":"StefanB7","avatar_url":"https://avatars.githubusercontent.com/u/22056509?v=4"},{"login":"souravghosh01","avatar_url":"https://avatars.githubusercontent.com/u/37548139?v=4"},{"login":"SR3u","avatar_url":"https://avatars.githubusercontent.com/u/2380522?v=4"},{"login":"Rikpat","avatar_url":"https://avatars.githubusercontent.com/u/33869814?v=4"},{"login":"NormanJS","avatar_url":"https://avatars.githubusercontent.com/u/83409549?v=4"},{"login":"No-Maines-Land","avatar_url":"https://avatars.githubusercontent.com/u/20687725?v=4"},{"login":"stark1tty","avatar_url":"https://avatars.githubusercontent.com/u/69326376?v=4"},{"login":"Momcilo42","avatar_url":"https://avatars.githubusercontent.com/u/10118137?v=4"},{"login":"marius-arch","avatar_url":"https://avatars.githubusercontent.com/u/72494359?v=4"},{"login":"Lumilias","avatar_url":"https://avatars.githubusercontent.com/u/10852161?v=4"},{"login":"Havock94","avatar_url":"https://avatars.githubusercontent.com/u/7635248?v=4"},{"login":"Lollyde","avatar_url":"https://avatars.githubusercontent.com/u/11347524?v=4"},{"login":"krishnamuppaneni","avatar_url":"https://avatars.githubusercontent.com/u/4703366?v=4"},{"login":"devtobi","avatar_url":"https://avatars.githubusercontent.com/u/28538704?v=4"},{"login":"TyxTang","avatar_url":"https://avatars.githubusercontent.com/u/90897955?v=4"},{"login":"beanbag420","avatar_url":"https://avatars.githubusercontent.com/u/19630511?v=4"},{"login":"WillyJL","avatar_url":"https://avatars.githubusercontent.com/u/49810075?v=4"},{"login":"anonysoul","avatar_url":"https://avatars.githubusercontent.com/u/105715150?v=4"},{"login":"cospeedster","avatar_url":"https://avatars.githubusercontent.com/u/52749645?v=4"},{"login":"diederbert","avatar_url":"https://avatars.githubusercontent.com/u/162878798?v=4"},{"login":"digdilem","avatar_url":"https://avatars.githubusercontent.com/u/4052275?v=4"},{"login":"dinghino","avatar_url":"https://avatars.githubusercontent.com/u/14729459?v=4"},{"login":"gfomichev","avatar_url":"https://avatars.githubusercontent.com/u/1596146?v=4"},{"login":"gnattu","avatar_url":"https://avatars.githubusercontent.com/u/12995396?v=4"},{"login":"tuxpizza","avatar_url":"https://avatars.githubusercontent.com/u/84710786?v=4"},{"login":"xmarkurion","avatar_url":"https://avatars.githubusercontent.com/u/46654687?v=4"},{"login":"huanga","avatar_url":"https://avatars.githubusercontent.com/u/732970?v=4"},{"login":"taos15","avatar_url":"https://avatars.githubusercontent.com/u/122130728?v=4"},{"login":"arghyadipchak","avatar_url":"https://avatars.githubusercontent.com/u/32430374?v=4"},{"login":"AuthorShin","avatar_url":"https://avatars.githubusercontent.com/u/4959043?v=4"},{"login":"benniblot","avatar_url":"https://avatars.githubusercontentLine truncated
|
[{"login":"ajnart","avatar_url":"https://avatars.githubusercontent.com/u/49837342?v=4"},{"login":"manuel-rw","avatar_url":"https://avatars.githubusercontent.com/u/30572287?v=4"},{"login":"Meierschlumpf","avatar_url":"https://avatars.githubusercontent.com/u/63781622?v=4"},{"login":"SeDemal","avatar_url":"https://avatars.githubusercontent.com/u/26098587?v=4"},{"login":"lammersbjorn","avatar_url":"https://avatars.githubusercontent.com/u/71191962?v=4"},{"login":"LarveyOfficial","avatar_url":"https://avatars.githubusercontent.com/u/39219859?v=4"},{"login":"c00ldude1oo","avatar_url":"https://avatars.githubusercontent.com/u/15677803?v=4"},{"login":"InterN0te","avatar_url":"https://avatars.githubusercontent.com/u/10882916?v=4"},{"login":"Aimsucks","avatar_url":"https://avatars.githubusercontent.com/u/1828486?v=4"},{"login":"JannesV","avatar_url":"https://avatars.githubusercontent.com/u/5984244?v=4"},{"login":"MauriceNino","avatar_url":"https://avatars.githubusercontent.com/u/18658092?v=4"},{"login":"hillaliy","avatar_url":"https://avatars.githubusercontent.com/u/950010?v=4"},{"login":"Skeeww","avatar_url":"https://avatars.githubusercontent.com/u/9639992?v=4"},{"login":"RichyHBM","avatar_url":"https://avatars.githubusercontent.com/u/5472275?v=4"},{"login":"Bonfire","avatar_url":"https://avatars.githubusercontent.com/u/5704760?v=4"},{"login":"wieli99","avatar_url":"https://avatars.githubusercontent.com/u/46794825?v=4"},{"login":"ishaanparlikar","avatar_url":"https://avatars.githubusercontent.com/u/43013132?v=4"},{"login":"Zareix","avatar_url":"https://avatars.githubusercontent.com/u/29818713?v=4"},{"login":"tuggan","avatar_url":"https://avatars.githubusercontent.com/u/4325608?v=4"},{"login":"Spillebulle","avatar_url":"https://avatars.githubusercontent.com/u/46653946?v=4"},{"login":"marektancak0106","avatar_url":"https://avatars.githubusercontent.com/u/25422667?v=4"},{"login":"spkesDE","avatar_url":"https://avatars.githubusercontent.com/u/1682314?v=4"},{"login":"j3lte","avatar_url":"https://avatars.githubusercontent.com/u/2557568?v=4"},{"login":"dslatt","avatar_url":"https://avatars.githubusercontent.com/u/5211001?v=4"},{"login":"Malong11-007","avatar_url":"https://avatars.githubusercontent.com/u/40298510?v=4"},{"login":"StefanB7","avatar_url":"https://avatars.githubusercontent.com/u/22056509?v=4"},{"login":"souravghosh01","avatar_url":"https://avatars.githubusercontent.com/u/37548139?v=4"},{"login":"SR3u","avatar_url":"https://avatars.githubusercontent.com/u/2380522?v=4"},{"login":"Rikpat","avatar_url":"https://avatars.githubusercontent.com/u/33869814?v=4"},{"login":"NormanJS","avatar_url":"https://avatars.githubusercontent.com/u/83409549?v=4"},{"login":"No-Maines-Land","avatar_url":"https://avatars.githubusercontent.com/u/20687725?v=4"},{"login":"stark1tty","avatar_url":"https://avatars.githubusercontent.com/u/69326376?v=4"},{"login":"Momcilo42","avatar_url":"https://avatars.githubusercontent.com/u/10118137?v=4"},{"login":"marius-arch","avatar_url":"https://avatars.githubusercontent.com/u/72494359?v=4"},{"login":"Lumilias","avatar_url":"https://avatars.githubusercontent.com/u/10852161?v=4"},{"login":"Havock94","avatar_url":"https://avatars.githubusercontent.com/u/7635248?v=4"},{"login":"Lollyde","avatar_url":"https://avatars.githubusercontent.com/u/11347524?v=4"},{"login":"krishnamuppaneni","avatar_url":"https://avatars.githubusercontent.com/u/4703366?v=4"},{"login":"devtobi","avatar_url":"https://avatars.githubusercontent.com/u/28538704?v=4"},{"login":"TyxTang","avatar_url":"https://avatars.githubusercontent.com/u/90897955?v=4"},{"login":"beanbag420","avatar_url":"https://avatars.githubusercontent.com/u/19630511?v=4"},{"login":"WillyJL","avatar_url":"https://avatars.githubusercontent.com/u/49810075?v=4"},{"login":"anonysoul","avatar_url":"https://avatars.githubusercontent.com/u/105715150?v=4"},{"login":"cospeedster","avatar_url":"https://avatars.githubusercontent.com/u/52749645?v=4"},{"login":"diederbert","avatar_url":"https://avatars.githubusercontent.com/u/162878798?v=4"},{"login":"digdilem","avatar_url":"https://avatars.githubusercontent.com/u/4052275?v=4"},{"login":"dinghino","avatar_url":"https://avatars.githubusercontent.com/u/14729459?v=4"},{"login":"gfomichev","avatar_url":"https://avatars.githubusercontent.com/u/1596146?v=4"},{"login":"gnattu","avatar_url":"https://avatars.githubusercontent.com/u/12995396?v=4"},{"login":"tuxpizza","avatar_url":"https://avatars.githubusercontent.com/u/84710786?v=4"},{"login":"xmarkurion","avatar_url":"https://avatars.githubusercontent.com/u/46654687?v=4"},{"login":"huanga","avatar_url":"https://avatars.githubusercontent.com/u/732970?v=4"},{"login":"taos15","avatar_url":"https://avatars.githubusercontent.com/u/122130728?v=4"},{"login":"arghyadipchak","avatar_url":"https://avatars.githubusercontent.com/u/32430374?v=4"},{"login":"AuthorShin","avatar_url":"https://avatars.githubusercontent.com/u/4959043?v=4"},{"login":"benniblot","avatar_url":"https://avatars.githubusercontentLine truncated
|
||||||
Reference in new issue
Block a user