mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-03-14 03:59:53 +03:00
feat(dashboard): Add DL / UL Speed average to DashboardItems (#1203)
This commit is contained in:
parent
6a24e15b07
commit
7af47f9e3d
8 changed files with 38 additions and 1 deletions
|
@ -72,6 +72,8 @@ const speedPpts = [
|
|||
{ title: 'download_speed', text: 'dlspeed' },
|
||||
{ title: 'upload_limit', text: 'up_limit' },
|
||||
{ title: 'upload_speed', text: 'upspeed' },
|
||||
{ title: 'avg_download_speed', text: 'avgDownloadSpeed' },
|
||||
{ title: 'avg_upload_speed', text: 'avgUploadSpeed' },
|
||||
{ title: 'global_speed', text: 'globalSpeed' }
|
||||
]
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import { useI18n } from 'vue-i18n'
|
|||
export function useTorrentBuilder() {
|
||||
const { t } = useI18n()
|
||||
|
||||
const computedValues = ['globalSpeed', 'globalVolume', 'priority']
|
||||
const computedValues = ['avgDownloadSpeed', 'avgUploadSpeed', 'globalSpeed', 'globalVolume', 'priority']
|
||||
|
||||
function buildFromQbit(data: QbitTorrent): Torrent {
|
||||
const torrent = {
|
||||
|
@ -60,8 +60,15 @@ export function useTorrentBuilder() {
|
|||
upspeed: data.upspeed
|
||||
}
|
||||
|
||||
const dlDuration = torrent.time_active - torrent.seeding_time
|
||||
const ulDuration = torrent.time_active
|
||||
|
||||
return Object.freeze({
|
||||
...torrent,
|
||||
// const qlonglong dlDuration = torrent->activeTime() - torrent->finishedTime();
|
||||
// dataDict[KEY_PROP_DL_SPEED_AVG] = torrent->totalDownload() / ((dlDuration == 0) ? -1 : dlDuration);
|
||||
avgDownloadSpeed: torrent.downloaded / ((dlDuration == 0) ? -1 : dlDuration),
|
||||
avgUploadSpeed: torrent.uploaded / ((ulDuration == 0) ? -1 : ulDuration),
|
||||
globalSpeed: torrent.dlspeed + torrent.upspeed,
|
||||
globalVolume: torrent.downloaded + torrent.uploaded
|
||||
})
|
||||
|
|
|
@ -3,6 +3,8 @@ export enum SortOptions {
|
|||
AMOUNT_LEFT = 'amount_left',
|
||||
AUTO_TMM = 'auto_tmm',
|
||||
AVAILABILITY = 'availability',
|
||||
AVG_DOWNLOAD_SPEED = 'avgDownloadSpeed',
|
||||
AVG_UPLOAD_SPEED = 'avgUploadSpeed',
|
||||
CATEGORY = 'category',
|
||||
COMPLETED = 'completed',
|
||||
COMPLETION_ON = 'completion_on',
|
||||
|
|
|
@ -15,6 +15,14 @@ export const propsData: PropertyData = {
|
|||
active: true,
|
||||
order: 17
|
||||
},
|
||||
[DashboardProperty.AVG_DOWNLOAD_SPEED]: {
|
||||
active: false,
|
||||
order: 40
|
||||
},
|
||||
[DashboardProperty.AVG_UPLOAD_SPEED]: {
|
||||
active: false,
|
||||
order: 41
|
||||
},
|
||||
[DashboardProperty.CATEGORY]: {
|
||||
active: true,
|
||||
order: 14
|
||||
|
@ -173,6 +181,14 @@ export const propsMetadata: PropertyMetadata = {
|
|||
props: { title: 'availability', value: 'availability' },
|
||||
type: DashboardPropertyType.TEXT
|
||||
},
|
||||
[DashboardProperty.AVG_DOWNLOAD_SPEED]: {
|
||||
props: { title: 'avg_download_speed', value: 'avgDownloadSpeed' },
|
||||
type: DashboardPropertyType.SPEED
|
||||
},
|
||||
[DashboardProperty.AVG_UPLOAD_SPEED]: {
|
||||
props: { title: 'avg_upload_speed', value: 'avgUploadSpeed' },
|
||||
type: DashboardPropertyType.SPEED
|
||||
},
|
||||
[DashboardProperty.CATEGORY]: {
|
||||
props: { title: 'category', value: 'category', color: 'category' },
|
||||
type: DashboardPropertyType.CHIP
|
||||
|
|
|
@ -2,6 +2,8 @@ export enum DashboardProperty {
|
|||
ADDED_ON = 'added_on',
|
||||
AMOUNT_LEFT = 'amount_left',
|
||||
AVAILABILITY = 'availability',
|
||||
AVG_DOWNLOAD_SPEED = 'avg_download_speed',
|
||||
AVG_UPLOAD_SPEED = 'avg_upload_speed',
|
||||
CATEGORY = 'category',
|
||||
COMPLETED_ON = 'completed_on',
|
||||
CONTENT_PATH = 'content_path',
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
"amount_left": "Amount Left",
|
||||
"auto_tmm": "Auto TMM",
|
||||
"availability": "Availability",
|
||||
"avg_download_speed": "Avg DL Speed",
|
||||
"avg_upload_speed": "Avg UL Speed",
|
||||
"category": "Category",
|
||||
"completed": "Completed",
|
||||
"completion_on": "Completed On",
|
||||
|
@ -189,6 +191,8 @@
|
|||
"amount_left": "Amount Left",
|
||||
"auto_tmm": "Automatic Torrent Management",
|
||||
"availability": "Availability",
|
||||
"avg_download_speed": "Average Download Speed",
|
||||
"avg_upload_speed": "Average Upload Speed",
|
||||
"available_peers": "Peers (swarm)",
|
||||
"available_seeds": "Seeds (swarm)",
|
||||
"category": "Category",
|
||||
|
|
|
@ -30,6 +30,8 @@ const torrentSortOptions = [
|
|||
{ value: 'amount_left', title: t('dashboard.sortBy.amount_left') },
|
||||
{ value: 'auto_tmm', title: t('dashboard.sortBy.auto_tmm') },
|
||||
{ value: 'availability', title: t('dashboard.sortBy.availability') },
|
||||
{ value: 'avg_download_speed', title: t('dashboard.sortBy.avg_download_speed') },
|
||||
{ value: 'avg_upload_speed', title: t('dashboard.sortBy.avg_upload_speed') },
|
||||
{ value: 'category', title: t('dashboard.sortBy.category') },
|
||||
{ value: 'completed', title: t('dashboard.sortBy.completed') },
|
||||
{ value: 'completion_on', title: t('dashboard.sortBy.completion_on') },
|
||||
|
|
|
@ -50,6 +50,8 @@ export default interface Torrent {
|
|||
upspeed: number
|
||||
|
||||
// computed
|
||||
avgDownloadSpeed: number,
|
||||
avgUploadSpeed: number,
|
||||
globalSpeed: number
|
||||
globalVolume: number
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue