2017-03-26 18:15:31 +00:00
|
|
|
<template>
|
|
|
|
<div :id="proxy_name" style="width: 600px;height:400px;"></div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import {DrawProxyTrafficChart} from '../utils/chart.js'
|
|
|
|
export default {
|
|
|
|
props: ['proxy_name'],
|
|
|
|
created() {
|
|
|
|
this.fetchData()
|
|
|
|
},
|
|
|
|
//watch: {
|
|
|
|
//'$route': 'fetchData'
|
|
|
|
//},
|
|
|
|
methods: {
|
|
|
|
fetchData() {
|
|
|
|
let url = '/api/proxy/traffic/' + this.proxy_name
|
2017-05-15 13:18:06 +00:00
|
|
|
fetch(url, {credentials: 'include'})
|
2017-03-26 18:15:31 +00:00
|
|
|
.then(res => {
|
|
|
|
return res.json()
|
|
|
|
}).then(json => {
|
|
|
|
DrawProxyTrafficChart(this.proxy_name, json.traffic_in, json.traffic_out)
|
|
|
|
}).catch( err => {
|
|
|
|
this.$message({
|
|
|
|
showClose: true,
|
|
|
|
message: 'Get server info from frps failed!' + err,
|
|
|
|
type: 'warning'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
</style>
|