♻️ Refactor torrent network traffic widget #616

This commit is contained in:
Manuel
2023-01-22 21:35:13 +01:00
parent 2c2f3ea5f4
commit 653f8c6fd8
12 changed files with 543 additions and 450 deletions

View File

@@ -1,28 +0,0 @@
import { Label, NormalizedTorrent } from '@ctrl/shared-torrent';
export type NormalizedTorrentListResponse = {
/**
* Available labels on all torrent clients
*/
labels: Label[];
/**
* Feteched and normalized torrents of all download clients
*/
torrents: ConcatenatedTorrentList[];
/**
* Indicated wether all requests were a success
*/
allSuccess: boolean;
/**
* Missing download clients
*/
missingDownloadClients: boolean;
};
type ConcatenatedTorrentList = {
appId: string;
torrents: NormalizedTorrent[];
};

View File

@@ -0,0 +1,23 @@
import { NormalizedTorrent } from '@ctrl/shared-torrent';
import { UsenetQueueItem } from '../../../../widgets/useNet/types';
export type NormalizedDownloadQueueResponse = {
apps: NormalizedDownloadAppStat[];
};
export type NormalizedDownloadAppStat = {
success: boolean;
appId: string;
totalDownload: number;
} & (TorrentTotalDownload | UsenetTotalDownloas);
export type TorrentTotalDownload = {
type: 'torrent';
torrents: NormalizedTorrent[];
totalUpload: number;
};
export type UsenetTotalDownloas = {
type: 'usenet';
nzbs: UsenetQueueItem[];
};