web/frpc: support more info (#3334)

This commit is contained in:
fatedier
2023-02-26 02:54:53 +08:00
committed by GitHub
parent 871511ba52
commit 8c6303c1e5
20 changed files with 277 additions and 340 deletions

View File

@@ -9,30 +9,39 @@
style="width: 100%"
:default-sort="{ prop: 'type', order: 'ascending' }"
>
<el-table-column prop="name" label="name"></el-table-column>
<el-table-column
prop="name"
label="name"
sortable
></el-table-column>
<el-table-column
prop="type"
label="type"
width="150"
sortable
></el-table-column>
<el-table-column
prop="local_addr"
label="local address"
width="200"
sortable
></el-table-column>
<el-table-column
prop="plugin"
label="plugin"
width="200"
sortable
></el-table-column>
<el-table-column
prop="remote_addr"
label="remote address"
sortable
></el-table-column>
<el-table-column
prop="status"
label="status"
width="150"
sortable
></el-table-column>
<el-table-column prop="err" label="info"></el-table-column>
</el-table>
@@ -43,49 +52,34 @@
</template>
<script setup lang="ts">
import { ref } from "vue";
import { ElMessage } from "element-plus";
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
let status = ref<any[]>([]);
let status = ref<any[]>([])
const fetchData = () => {
fetch("/api/status", { credentials: "include" })
fetch('/api/status', { credentials: 'include' })
.then((res) => {
return res.json();
return res.json()
})
.then((json) => {
status.value = new Array();
for (let s of json.tcp) {
status.value.push(s);
}
for (let s of json.udp) {
status.value.push(s);
}
for (let s of json.http) {
status.value.push(s);
}
for (let s of json.https) {
status.value.push(s);
}
for (let s of json.stcp) {
status.value.push(s);
}
for (let s of json.sudp) {
status.value.push(s);
}
for (let s of json.xtcp) {
status.value.push(s);
status.value = new Array()
for (let key in json) {
for (let ps of json[key]) {
console.log(ps)
status.value.push(ps)
}
}
})
.catch(() => {
.catch((err) => {
ElMessage({
showClose: true,
message: "Get status info from frpc failed!",
type: "warning",
});
});
};
fetchData();
message: 'Get status info from frpc failed!' + err,
type: 'warning',
})
})
}
fetchData()
</script>
<style></style>