2017-03-27 02:15:31 +08:00
|
|
|
<template>
|
|
|
|
<div>
|
2020-12-03 20:20:48 +08:00
|
|
|
<el-table :data="proxies" :default-sort="{ prop: 'name', order: 'ascending' }" style="width: 100%">
|
2017-03-27 02:15:31 +08:00
|
|
|
<el-table-column type="expand">
|
2018-05-16 02:51:02 +08:00
|
|
|
<template slot-scope="props">
|
2020-12-03 20:20:48 +08:00
|
|
|
<el-popover placement="right" width="600" style="margin-left: 0px" trigger="click">
|
|
|
|
<my-traffic-chart :proxy-name="props.row.name" />
|
|
|
|
|
|
|
|
<el-button slot="reference" type="primary" size="small" icon="view" :name="props.row.name" style="margin-bottom: 10px">
|
|
|
|
Traffic Statistics
|
|
|
|
</el-button>
|
2017-03-27 02:15:31 +08:00
|
|
|
</el-popover>
|
2020-12-03 20:20:48 +08:00
|
|
|
|
2017-03-27 02:15:31 +08:00
|
|
|
<el-form label-position="left" inline class="demo-table-expand">
|
|
|
|
<el-form-item label="Name">
|
|
|
|
<span>{{ props.row.name }}</span>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="Type">
|
|
|
|
<span>{{ props.row.type }}</span>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="Addr">
|
|
|
|
<span>{{ props.row.addr }}</span>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="Encryption">
|
|
|
|
<span>{{ props.row.encryption }}</span>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="Compression">
|
|
|
|
<span>{{ props.row.compression }}</span>
|
|
|
|
</el-form-item>
|
2017-05-31 02:21:15 +08:00
|
|
|
<el-form-item label="Last Start">
|
|
|
|
<span>{{ props.row.last_start_time }}</span>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item label="Last Close">
|
|
|
|
<span>{{ props.row.last_close_time }}</span>
|
|
|
|
</el-form-item>
|
2020-12-03 20:20:48 +08:00
|
|
|
</el-form>
|
2017-03-27 02:15:31 +08:00
|
|
|
</template>
|
2020-12-03 20:20:48 +08:00
|
|
|
</el-table-column>
|
|
|
|
<el-table-column label="Name" prop="name" sortable />
|
|
|
|
<el-table-column label="Port" prop="port" sortable />
|
|
|
|
<el-table-column label="Connections" prop="conns" sortable />
|
|
|
|
<el-table-column label="Traffic In" prop="traffic_in" :formatter="formatTrafficIn" sortable />
|
|
|
|
<el-table-column label="Traffic Out" prop="traffic_out" :formatter="formatTrafficOut" sortable />
|
|
|
|
<el-table-column label="status" prop="status" sortable>
|
|
|
|
<template slot-scope="scope">
|
|
|
|
<el-tag v-if="scope.row.status === 'online'" type="success">{{ scope.row.status }}</el-tag>
|
|
|
|
<el-tag v-else type="danger">{{ scope.row.status }}</el-tag>
|
|
|
|
</template>
|
|
|
|
</el-table-column>
|
|
|
|
</el-table>
|
|
|
|
</div>
|
2017-03-27 02:15:31 +08:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2020-12-03 20:20:48 +08:00
|
|
|
import Humanize from 'humanize-plus'
|
|
|
|
import Traffic from './Traffic.vue'
|
|
|
|
import { TcpProxy } from '../utils/proxy.js'
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
'my-traffic-chart': Traffic
|
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
proxies: []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.initData()
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
formatTrafficIn(row, column) {
|
|
|
|
return Humanize.fileSize(row.traffic_in)
|
2017-03-27 02:15:31 +08:00
|
|
|
},
|
2020-12-03 20:20:48 +08:00
|
|
|
formatTrafficOut(row, column) {
|
|
|
|
return Humanize.fileSize(row.traffic_out)
|
2017-03-27 02:15:31 +08:00
|
|
|
},
|
2020-12-03 20:20:48 +08:00
|
|
|
async initData() {
|
|
|
|
const json = await this.$fetch('proxy/tcp')
|
|
|
|
if (!json) return
|
|
|
|
|
|
|
|
this.proxies = []
|
|
|
|
for (const proxyStats of json.proxies) {
|
|
|
|
this.proxies.push(new TcpProxy(proxyStats))
|
2017-03-27 02:15:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-12-03 20:20:48 +08:00
|
|
|
}
|
2017-03-27 02:15:31 +08:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|