mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-27 05:00:25 +08:00
服务列表增加下行带宽
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/utils/nodelogutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/clusters/cluster/node/nodeutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
timeutil "github.com/iwind/TeaGo/utils/time"
|
||||
@@ -43,7 +44,7 @@ func (this *LogsAction) RunGet(params struct {
|
||||
this.Data["tag"] = params.Tag
|
||||
|
||||
countResp, err := this.RPC().NodeLogRPC().CountNodeLogs(this.AdminContext(), &pb.CountNodeLogsRequest{
|
||||
Role: "node",
|
||||
Role: nodeconfigs.NodeRoleNode,
|
||||
NodeId: params.NodeId,
|
||||
DayFrom: params.DayFrom,
|
||||
DayTo: params.DayTo,
|
||||
|
||||
@@ -3,6 +3,7 @@ package servers
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/configutils"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs"
|
||||
@@ -92,6 +93,8 @@ func (this *IndexAction) RunGet(params struct {
|
||||
ServerGroupId: params.GroupId,
|
||||
Keyword: params.Keyword,
|
||||
AuditingFlag: params.AuditingFlag,
|
||||
TrafficOutDesc: params.TrafficOutOrder == "desc",
|
||||
TrafficOutAsc: params.TrafficOutOrder == "asc",
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
@@ -208,6 +211,15 @@ func (this *IndexAction) RunGet(params struct {
|
||||
auditingTime = timeutil.FormatTime("Y-m-d", server.AuditingAt)
|
||||
}
|
||||
|
||||
// 统计数据
|
||||
var bandwidth = ""
|
||||
if server.LatestServerDailyStat != nil {
|
||||
var bytesPerSecond = server.LatestServerDailyStat.Bytes / 300
|
||||
if bytesPerSecond > 0 {
|
||||
bandwidth = numberutils.FormatBytes(bytesPerSecond)
|
||||
}
|
||||
}
|
||||
|
||||
serverMaps = append(serverMaps, maps.Map{
|
||||
"id": server.Id,
|
||||
"isOn": server.IsOn,
|
||||
@@ -225,6 +237,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
"auditingIsOk": auditingIsOk,
|
||||
"user": userMap,
|
||||
"auditingTime": auditingTime,
|
||||
"bandwidth": bandwidth,
|
||||
})
|
||||
}
|
||||
this.Data["servers"] = serverMaps
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<th class="width10">DNS线路</th>
|
||||
<th class="width5 center">CPU<sort-arrow name="cpuOrder"></sort-arrow></th>
|
||||
<th class="width5 center">内存<sort-arrow name="memoryOrder"></sort-arrow></th>
|
||||
<th class="center" style="width: 7em">下行流量<sort-arrow name="trafficOutOrder"></sort-arrow></th>
|
||||
<th class="center" style="width: 7em">下行带宽<sort-arrow name="trafficOutOrder"></sort-arrow></th>
|
||||
<th class="center" style="width: 7em">负载<sort-arrow name="loadOrder"></sort-arrow></th>
|
||||
<th class="two wide center">状态</th>
|
||||
<th class="two op">操作</th>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<th class="width10">DNS线路</th>
|
||||
<th class="width5 center">CPU<sort-arrow name="cpuOrder"></sort-arrow></th>
|
||||
<th class="width5 center">内存<sort-arrow name="memoryOrder"></sort-arrow></th>
|
||||
<th class="center" style="width: 7em">下行流量<sort-arrow name="trafficOutOrder"></sort-arrow></th>
|
||||
<th class="center" style="width: 7em">下行带宽<sort-arrow name="trafficOutOrder"></sort-arrow></th>
|
||||
<th class="center" style="width: 7em">负载<sort-arrow name="loadOrder"></sort-arrow></th>
|
||||
<th class="two wide center">状态</th>
|
||||
<th class="one op">操作</th>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<first-menu>
|
||||
<menu-item href="/servers" code="index">服务列表</menu-item>
|
||||
<menu-item href="/servers?auditingFlag=1" code="auditing">审核中<span :class="{red: countAuditing > 0}">({{countAuditing}})</span></menu-item>
|
||||
<menu-item href="/servers/create" code="create">创建网站服务</menu-item>
|
||||
<span class="item disabled">|</span>
|
||||
<menu-item href="/servers/create" code="create">[创建网站服务]</menu-item>
|
||||
</first-menu>
|
||||
@@ -26,7 +26,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">源站地址</td>
|
||||
<td class="title">源站地址 *</td>
|
||||
<td>
|
||||
<input type="text" name="addr" ref="focus" v-model="addr" @input="changeAddr"/>
|
||||
<p class="comment"><span class="red" v-if="addrError.length > 0">{{addrError}}</span>源站服务器地址,通常是一个IP(或域名)加端口<span v-if="serverType == 'httpProxy'">,不需要加 http:// 或 https://</span>。</p>
|
||||
|
||||
@@ -9,12 +9,14 @@
|
||||
<td class="title">服务名称 *</td>
|
||||
<td>
|
||||
<input type="text" name="name" maxlength="60" ref="focus"/>
|
||||
<p class="comment">可以是网站用途或者域名等。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-show="hasUsers">
|
||||
<td>选择用户</td>
|
||||
<td>所属用户<optional-label></optional-label></td>
|
||||
<td>
|
||||
<user-selector @change="changeUserId"></user-selector>
|
||||
<p class="comment">当前服务所属平台用户。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="plans.length > 0">
|
||||
@@ -41,7 +43,7 @@
|
||||
|
||||
<!-- 域名 -->
|
||||
<tr v-if="serverType == 'httpProxy' || serverType == 'httpWeb'">
|
||||
<td>绑定域名</td>
|
||||
<td>绑定域名 *</td>
|
||||
<td>
|
||||
<server-name-box></server-name-box>
|
||||
<p class="comment">绑定后,才能通过域名可以访问不同的服务。</p>
|
||||
@@ -99,7 +101,7 @@
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>选择分组</td>
|
||||
<td>选择分组<optional-label></optional-label></td>
|
||||
<td>
|
||||
<server-group-selector></server-group-selector>
|
||||
</td>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<div class="ui field">
|
||||
<button type="submit" class="ui button">搜索</button>
|
||||
|
||||
<a href="/servers" v-if="clusterId > 0 || groupId > 0 || keyword.length > 0">[清除条件]</a>
|
||||
<a href="/servers" v-if="clusterId > 0 || groupId > 0 || keyword.length > 0 || hasOrder">[清除条件]</a>
|
||||
</div>
|
||||
<div class="ui field" v-if="clusterId == 0 && groupId == 0 && keyword.length == 0 && latestServers.length > 0">
|
||||
<a href="" @click.prevent="showLatest()">常用<i class="icon angle" :class="{down: !latestVisible, up: latestVisible}"></i> </a>
|
||||
@@ -58,6 +58,7 @@
|
||||
<th>部署集群</th>
|
||||
<th>域名</th>
|
||||
<th>端口</th>
|
||||
<th class="center" style="width: 8em">下行带宽<tip-icon content="最近5分钟平均带宽,每5分钟更新一次"></tip-icon><sort-arrow name="trafficOutOrder"></sort-arrow></th>
|
||||
<th class="two wide center">状态</th>
|
||||
<th class="two op">操作</th>
|
||||
</tr>
|
||||
@@ -98,6 +99,10 @@
|
||||
</div>
|
||||
</td>
|
||||
<td class="center">
|
||||
<span v-if="server.bandwidth.length > 0">{{server.bandwidth}}</span>
|
||||
<span class="disabled" v-else>-</span>
|
||||
</td>
|
||||
<td class="center">
|
||||
<div v-if="!checkDNS">
|
||||
<label-on :v-is-on="server.isOn"></label-on>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="title">源站地址</td>
|
||||
<td class="title">源站地址 *</td>
|
||||
<td>
|
||||
<input type="text" name="addr" ref="focus" v-model="origin.addr" @input="changeAddr"/>
|
||||
<p class="comment"><span class="red" v-if="addrError.length > 0">{{addrError}}</span>源站服务器地址,通常是一个IP(或域名)加端口<span v-if="serverType == 'httpProxy'">,不需要加 http:// 或 https://</span>。</p>
|
||||
|
||||
Reference in New Issue
Block a user