PortIO/resources/js/views/Tunnels/Index.vue

93 lines
2.4 KiB
Vue
Raw Normal View History

2023-03-15 13:45:41 +00:00
<template>
<h3>隧道列表</h3>
<table class="table table-hover">
<thead>
2023-07-30 15:52:39 +00:00
<tr>
<th scope="col">ID</th>
<th scope="col">名称</th>
<th scope="col">协议</th>
<th scope="col">本地地址</th>
<th scope="col">远程端口/域名</th>
<!-- <th scope="col">连接数</th>
<th scope="col">下载流量</th>
<th scope="col">上载流量</th> -->
<th scope="col">服务器</th>
<th scope="col">状态</th>
</tr>
2023-03-15 13:45:41 +00:00
</thead>
<tbody>
2023-07-30 15:52:39 +00:00
<tr v-for="tunnel in tunnels">
<th>{{ tunnel.id }}</th>
<td>
<router-link
:to="{
2023-05-14 07:42:18 +00:00
name: 'tunnels.show',
params: { id: tunnel.id },
}"
2023-07-30 15:52:39 +00:00
>
{{ tunnel.name }}
</router-link>
</td>
<td>
{{ tunnel.protocol.toString().toUpperCase() }}
</td>
<td>
{{ tunnel.local_address }}
</td>
2023-03-16 13:36:59 +00:00
2023-07-30 15:52:39 +00:00
<td>
2023-05-14 07:42:18 +00:00
<span
v-if="
tunnel.protocol === 'http' ||
tunnel.protocol === 'https'
"
>
{{ tunnel.custom_domain }}
</span>
2023-07-30 15:52:39 +00:00
<span v-else>
2023-05-14 07:42:18 +00:00
{{ tunnel.server.server_address }}:{{
2023-07-30 15:52:39 +00:00
tunnel.remote_port
}}
2023-05-14 07:42:18 +00:00
</span>
2023-07-30 15:52:39 +00:00
</td>
2023-03-16 13:36:59 +00:00
2023-07-30 15:52:39 +00:00
<!-- <td>0</td>
<td>0.000 Bytes</td>
<td>0.000 Bytes</td> -->
2023-03-16 13:36:59 +00:00
2023-07-30 15:52:39 +00:00
<td>{{ tunnel.server.name }}</td>
2023-03-16 13:36:59 +00:00
2023-07-30 15:52:39 +00:00
<td>
<span v-if="tunnel.run_id" class="text-success">在线</span>
<span v-else="tunnel.run_id" class="text-danger">离线</span>
</td>
</tr>
2023-03-15 13:45:41 +00:00
</tbody>
</table>
</template>
<script setup>
2023-07-30 15:52:39 +00:00
import {ref} from "vue";
2023-03-15 13:45:41 +00:00
import http from "../../plugins/http";
2023-03-18 14:06:02 +00:00
const tunnels = ref([
{
2023-05-14 07:42:18 +00:00
id: "0",
protocol: "",
2023-03-18 14:06:02 +00:00
server: {
2023-05-14 07:42:18 +00:00
server_address: "",
server_port: "",
name: "",
},
run_id: ""
},
]);
2023-03-15 13:45:41 +00:00
2023-05-14 07:42:18 +00:00
http.get("tunnels").then((res) => {
tunnels.value = res.data;
2023-03-15 13:45:41 +00:00
2023-09-16 11:23:44 +00:00
// console.log(tunnels.value);
2023-05-14 07:42:18 +00:00
});
2023-03-15 13:45:41 +00:00
</script>