feat(qbittorrent): add configurable server-side sort order as widget option
This commit is contained in:
7 files changed
+84
-8
No files matched your search
@@ -91,6 +91,8 @@ export default function DownloadClientsWidget({
|
||||
const { data: currentItems = [] } = clientApi.widget.downloads.getJobsAndStatuses.useQuery({
|
||||
integrationIds,
|
||||
limitPerIntegration: options.limitPerIntegration,
|
||||
qbittorrentSort: options.qbittorrentSort,
|
||||
qbittorrentSortReverse: options.qbittorrentSortReverse,
|
||||
});
|
||||
|
||||
const t = useScopedI18n("widget.downloads");
|
||||
|
||||
@@ -88,6 +88,30 @@ export const { definition, componentLoader } = createWidgetDefinition("downloads
|
||||
validate: z.number().min(1),
|
||||
withDescription: true,
|
||||
}),
|
||||
qbittorrentSort: factory.select({
|
||||
defaultValue: "added_on",
|
||||
options: [
|
||||
"added_on",
|
||||
"completion_on",
|
||||
"dlspeed",
|
||||
"eta",
|
||||
"name",
|
||||
"priority",
|
||||
"progress",
|
||||
"ratio",
|
||||
"size",
|
||||
"state",
|
||||
"time_active",
|
||||
"upspeed",
|
||||
"uploaded",
|
||||
].map((value) => ({
|
||||
value,
|
||||
label: (t) => t(`widget.downloads.option.qbittorrentSort.option.${value}`),
|
||||
})),
|
||||
}),
|
||||
qbittorrentSortReverse: factory.switch({
|
||||
defaultValue: false,
|
||||
}),
|
||||
}),
|
||||
{
|
||||
defaultSort: {
|
||||
@@ -116,6 +140,14 @@ export const { definition, componentLoader } = createWidgetDefinition("downloads
|
||||
shouldHide: (_, integrationKinds) =>
|
||||
!getIntegrationKindsByCategory("torrent").some((kinds) => integrationKinds.includes(kinds)),
|
||||
},
|
||||
qbittorrentSort: {
|
||||
shouldHide: (_, integrationKinds) =>
|
||||
!getIntegrationKindsByCategory("torrent").some((kinds) => integrationKinds.includes(kinds)),
|
||||
},
|
||||
qbittorrentSortReverse: {
|
||||
shouldHide: (_, integrationKinds) =>
|
||||
!getIntegrationKindsByCategory("torrent").some((kinds) => integrationKinds.includes(kinds)),
|
||||
},
|
||||
},
|
||||
);
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user