Skip to content

Commit 017ae33

Browse files
committed
improve console
1 parent a8cb048 commit 017ae33

19 files changed

+227
-35
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<script lang="ts">
2+
export interface ServerNode {
3+
host: string,
4+
port: number,
5+
proto: string,
6+
life_time:number,
7+
self_ip:string,
8+
idle_size:number,
9+
total_connect:number,
10+
total_hit:number,
11+
total_err:number,
12+
}
13+
14+
</script>

console/src/router/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ const router = createRouter({
8686
name: 'cmd',
8787
component: () => import("../views/extend/CmdView.vue"),
8888
},
89+
{
90+
path: 'api',
91+
name: 'api',
92+
component: () => import("../views/extend/ApiView.vue"),
93+
},
94+
{
95+
path: 'dso',
96+
name: 'dso',
97+
component: () => import("../views/extend/DsoView.vue"),
98+
},
8999
],
90100
}
91101
],

console/src/test.html

Lines changed: 0 additions & 21 deletions
This file was deleted.

console/src/views/VirtualHostView.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ onMounted(flushVirtualHost);
6161
[<a href=# @click='addVirtualHost'>新增</a>]
6262
[<a href=# @click='setCurVirtualHost("")'>全局设置</a>]
6363
<hr>
64-
<table width="100%">
64+
<table border=1 cellspacing="0">
6565
<tr>
6666
<td>操作</td>
6767
<td>名称</td>
@@ -85,7 +85,7 @@ onMounted(flushVirtualHost);
8585
</span>
8686
<span v-else>全局设置</span>
8787
<hr>
88-
<table width='100%'>
88+
<table border=1 cellspacing="0">
8989
<tr>
9090
<td>
9191
<template v-if="curVirtualHost.length>0">

console/src/views/config/ListenView.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function onNewListenSubmit() {
3030
<tr>
3131
<td>
3232
配置侦听
33-
<table class="table table-bordered">
33+
<table border=1 cellspacing="0">
3434
<tr>
3535
<td>操作</td>
3636
<td>ip</td>
@@ -47,7 +47,7 @@ function onNewListenSubmit() {
4747
</td>
4848
<td>
4949
成功侦听
50-
<table class="table table-bordered">
50+
<table border=1 cellspacing="0">
5151
<tr>
5252
<td>ip</td>
5353
<td>port</td>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<script lang="ts" setup>
2+
import { whm_get } from '@/components/Whm.vue';
3+
import { onMounted, ref } from 'vue';
4+
interface Api {
5+
name: string,
6+
file: string,
7+
type: number,
8+
state:string,
9+
info: string,
10+
refs:number
11+
}
12+
const new_server = ref(false);
13+
const apis = ref(<Api[]>[])
14+
function flushApi() {
15+
whm_get("list_api").then((json) => {
16+
apis.value = json.result.api;
17+
});
18+
}
19+
function del_api(api: Api) {
20+
if (!confirm("确定删除 " + api.name + "吗?")) {
21+
return;
22+
}
23+
whm_get("del_api", { name: api.name }).then((json) => {
24+
flushApi();
25+
})
26+
}
27+
onMounted(flushApi)
28+
</script>
29+
<template>
30+
<table border=1 cellspacing="0">
31+
<tr>
32+
<th>操作</th>
33+
<th>名字</th>
34+
<th>文件</th>
35+
<th>独立进程</th>
36+
<th>状态</th>
37+
<th>版本</th>
38+
<th>引用</th>
39+
</tr>
40+
<tr v-for="api in apis">
41+
<td>[<a href=# @click="del_api(api)">删除</a>]</td>
42+
<td>{{ api.name }}</td>
43+
<td>{{ api.file }}</td>
44+
<td>{{ api.type==3?"否":"是" }}</td>
45+
<td>{{ api.state }}</td>
46+
<td>{{ api.info }}</td>
47+
<td>{{ api.refs }}</td>
48+
</tr>
49+
</table>
50+
</template>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<script lang="ts" setup>
2+
import { whm_get } from '@/components/Whm.vue';
3+
import { onMounted, ref } from 'vue';
4+
interface Cmd {
5+
name: string,
6+
refs:number
7+
}
8+
const new_server = ref(false);
9+
const cmds = ref(<Cmd[]>[])
10+
function flushCmd() {
11+
whm_get("list_cmd").then((json) => {
12+
cmds.value = json.result.cmd;
13+
});
14+
}
15+
function del_cmd(cmd: Cmd) {
16+
if (!confirm("确定删除 " + cmd.name + "吗?")) {
17+
return;
18+
}
19+
whm_get("del_cmd", { name: cmd.name }).then((json) => {
20+
flushCmd();
21+
})
22+
}
23+
onMounted(flushCmd)
24+
</script>
25+
<template>
26+
<table border=1 cellspacing="0">
27+
<tr>
28+
<th>操作</th>
29+
<th>名字</th>
30+
<th>文件</th>
31+
<th>类型</th>
32+
<th>协议</th>
33+
<th>端口</th>
34+
<th>引用</th>
35+
<th>环境变量</th>
36+
</tr>
37+
<tr v-for="cmd in cmds">
38+
<td>[<a href=# @click="del_cmd(cmd)">删除</a>]</td>
39+
<td>{{ cmd.name }}</td>
40+
<td>文件</td>
41+
<td>类型</td>
42+
<td>协议</td>
43+
<td>端口</td>
44+
<td>{{ cmd.refs }}</td>
45+
<td>环境变量</td>
46+
</tr>
47+
</table>
48+
</template>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<script lang="ts" setup>
2+
import { whm_get } from '@/components/Whm.vue';
3+
import { onMounted, ref } from 'vue';
4+
interface Dso {
5+
name: string,
6+
}
7+
const new_server = ref(false);
8+
const dsos = ref(<Dso[]>[])
9+
function flushDso() {
10+
whm_get("list_dso").then((json) => {
11+
dsos.value = json.result.dso;
12+
});
13+
}
14+
function del_server(dso: Dso) {
15+
if (!confirm("确定删除 " + dso.name + "吗?")) {
16+
return;
17+
}
18+
whm_get("del_dso", { name: dso.name }).then((json) => {
19+
flushDso();
20+
})
21+
}
22+
onMounted(flushDso)
23+
</script>
24+
<template>
25+
<table border=1 cellspacing="0">
26+
<tr>
27+
<th>操作</th>
28+
<th>名字</th>
29+
<th>文件</th>
30+
<th>独立进程</th>
31+
<th>引用</th>
32+
<th>状态</th>
33+
<th>version</th>
34+
35+
</tr>
36+
<tr v-for="dso in dsos">
37+
<td>[删除]</td>
38+
<td>{{ dso.name }}</td>
39+
<td>文件</td>
40+
<td>类型</td>
41+
<td>协议</td>
42+
<td>端口</td>
43+
<td>引用</td>
44+
</tr>
45+
</table>
46+
</template>

console/src/views/extend/MServerView.vue

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ onMounted(flushMserver)
6363
<th>引用</th>
6464
<th>icp</th>
6565
<th>节点</th>
66+
<th>节点信息</th>
6667
</tr>
6768
<tr v-for="server in mservers">
6869

@@ -80,12 +81,15 @@ onMounted(flushMserver)
8081
<td>{{ server.refs }}</td>
8182
<td>{{ server.icp }}</td>
8283
<td >
83-
<div >
84-
[<a href='#' @click="toggle_node(server)">显示</a>]
84+
<span>{{ server.nodes.length }}</span>
85+
<span >
8586
[<a href='#'>增加</a>]
86-
</div>
87+
[<a href='#' @click="toggle_node(server)">详细</a>]
88+
</span>
89+
</td>
90+
<td>
8791
<div v-if="server.show_node">
88-
<table width="99%" border=1 cellspacing="0">
92+
<table width="100%" border=1 cellspacing="0">
8993
<tr>
9094
<th>地址</th>
9195
<th>端口</th>
@@ -97,10 +101,7 @@ onMounted(flushMserver)
97101
<th>err/avg</th>
98102
<th>状态</th>
99103
</tr>
100-
<tr v-for="(node, index) in server.nodes">
101-
<template v-if="index == 0">
102-
<MServerCommon :server="server"></MServerCommon>
103-
</template>
104+
<tr v-for="(node, index) in server.nodes">
104105
<td>[删][改]{{ node.host }}</td>
105106
<td>{{ node.port }}</td>
106107
<td>{{ node.life_time }}</td>

include/KApiRedirect.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class KApiRedirect final: public KRedirect,public KExtendProgram {
4141
}
4242
bool load();
4343
void setFile(const KString& file);
44+
void dump(kgl::serializable* sl);
4445
public:
4546
KString apiFile;
4647
KApiDso dso;

0 commit comments

Comments
 (0)