Skip to content

A full-featured download manager.

feat: task peers

Dr_rOotd14ddef8e85b
diff --git a/src/renderer/components/TaskDetail/TaskPeers.vue b/src/renderer/components/TaskDetail/TaskPeers.vue
new file mode 100644
index 00000000..4163383e
--- /dev/null
+++ b/src/renderer/components/TaskDetail/TaskPeers.vue
@@ -0,0 +1,77 @@
+<template>
+ <div class="mo-task-peers">
+ <div class="mo-table-wrapper">
+ <el-table
+ stripe
+ ref="peerTable"
+ style="width: 100%"
+ height="61.8vh"
+ :data="peers"
+ >
+ <el-table-column
+ :label="`${$t('task.task-peer-host')}: `"
+ min-width="150">
+ <template slot-scope="scope">
+ {{ `${scope.row.ip}:${scope.row.port}` }}
+ </template>
+ </el-table-column>
+ <el-table-column
+ :label="`${$t('task.task-peer-client')}: `"
+ min-width="130">
+ <template slot-scope="scope">
+ {{ scope.row.peerId | peerIdParser }}
+ </template>
+ </el-table-column>
+ <el-table-column
+ :label="`%`"
+ align="right"
+ width="50">
+ <template slot-scope="scope">
+ {{ scope.row.bitfield | bitfieldToPercent }}%
+ </template>
+ </el-table-column>
+ <el-table-column
+ :label="`↑`"
+ align="right"
+ width="100">
+ <template slot-scope="scope">
+ {{ scope.row.uploadSpeed | bytesToSize }}/s
+ </template>
+ </el-table-column>
+ <el-table-column
+ :label="`↓`"
+ align="right"
+ width="100">
+ <template slot-scope="scope">
+ {{ scope.row.downloadSpeed | bytesToSize }}/s
+ </template>
+ </el-table-column>
+ </el-table>
+ </div>
+ </div>
+</template>
+
+<script>
+ import {
+ bitfieldToPercent,
+ bytesToSize,
+ peerIdParser
+ } from '@shared/utils'
+
+ export default {
+ name: 'mo-task-peers',
+ filters: {
+ bitfieldToPercent,
+ bytesToSize,
+ peerIdParser
+ },
+ props: {
+ peers: {
+ type: Array,
+ default: function () {
+ return []
+ }
+ }
+ }
+ }
+</script>