mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	节点列表增加连接数列
This commit is contained in:
		@@ -32,11 +32,12 @@ func (this *NodesAction) RunGet(params struct {
 | 
				
			|||||||
	Keyword        string
 | 
						Keyword        string
 | 
				
			||||||
	Level          int32
 | 
						Level          int32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	CpuOrder        string
 | 
						CpuOrder         string
 | 
				
			||||||
	MemoryOrder     string
 | 
						MemoryOrder      string
 | 
				
			||||||
	TrafficInOrder  string
 | 
						TrafficInOrder   string
 | 
				
			||||||
	TrafficOutOrder string
 | 
						TrafficOutOrder  string
 | 
				
			||||||
	LoadOrder       string
 | 
						LoadOrder        string
 | 
				
			||||||
 | 
						ConnectionsOrder string
 | 
				
			||||||
}) {
 | 
					}) {
 | 
				
			||||||
	this.Data["groupId"] = params.GroupId
 | 
						this.Data["groupId"] = params.GroupId
 | 
				
			||||||
	this.Data["regionId"] = params.RegionId
 | 
						this.Data["regionId"] = params.RegionId
 | 
				
			||||||
@@ -44,7 +45,7 @@ func (this *NodesAction) RunGet(params struct {
 | 
				
			|||||||
	this.Data["activeState"] = params.ActiveState
 | 
						this.Data["activeState"] = params.ActiveState
 | 
				
			||||||
	this.Data["keyword"] = params.Keyword
 | 
						this.Data["keyword"] = params.Keyword
 | 
				
			||||||
	this.Data["level"] = params.Level
 | 
						this.Data["level"] = params.Level
 | 
				
			||||||
	this.Data["hasOrder"] = len(params.CpuOrder) > 0 || len(params.MemoryOrder) > 0 || len(params.TrafficInOrder) > 0 || len(params.TrafficOutOrder) > 0 || len(params.LoadOrder) > 0
 | 
						this.Data["hasOrder"] = len(params.CpuOrder) > 0 || len(params.MemoryOrder) > 0 || len(params.TrafficInOrder) > 0 || len(params.TrafficOutOrder) > 0 || len(params.LoadOrder) > 0 || len(params.ConnectionsOrder) > 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 集群是否已经设置了线路
 | 
						// 集群是否已经设置了线路
 | 
				
			||||||
	clusterDNSResp, err := this.RPC().NodeClusterRPC().FindEnabledNodeClusterDNS(this.AdminContext(), &pb.FindEnabledNodeClusterDNSRequest{NodeClusterId: params.ClusterId})
 | 
						clusterDNSResp, err := this.RPC().NodeClusterRPC().FindEnabledNodeClusterDNS(this.AdminContext(), &pb.FindEnabledNodeClusterDNSRequest{NodeClusterId: params.ClusterId})
 | 
				
			||||||
@@ -112,6 +113,10 @@ func (this *NodesAction) RunGet(params struct {
 | 
				
			|||||||
		req.LoadAsc = true
 | 
							req.LoadAsc = true
 | 
				
			||||||
	} else if params.LoadOrder == "desc" {
 | 
						} else if params.LoadOrder == "desc" {
 | 
				
			||||||
		req.LoadDesc = true
 | 
							req.LoadDesc = true
 | 
				
			||||||
 | 
						} else if params.ConnectionsOrder == "asc" {
 | 
				
			||||||
 | 
							req.ConnectionsAsc = true
 | 
				
			||||||
 | 
						} else if params.ConnectionsOrder == "desc" {
 | 
				
			||||||
 | 
							req.ConnectionsDesc = true
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	nodesResp, err := this.RPC().NodeRPC().ListEnabledNodesMatch(this.AdminContext(), req)
 | 
						nodesResp, err := this.RPC().NodeRPC().ListEnabledNodesMatch(this.AdminContext(), req)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
@@ -121,8 +126,8 @@ func (this *NodesAction) RunGet(params struct {
 | 
				
			|||||||
	var nodeMaps = []maps.Map{}
 | 
						var nodeMaps = []maps.Map{}
 | 
				
			||||||
	for _, node := range nodesResp.Nodes {
 | 
						for _, node := range nodesResp.Nodes {
 | 
				
			||||||
		// 状态
 | 
							// 状态
 | 
				
			||||||
		isSynced := false
 | 
							var isSynced = false
 | 
				
			||||||
		status := &nodeconfigs.NodeStatus{}
 | 
							var status = &nodeconfigs.NodeStatus{}
 | 
				
			||||||
		if len(node.StatusJSON) > 0 {
 | 
							if len(node.StatusJSON) > 0 {
 | 
				
			||||||
			err = json.Unmarshal(node.StatusJSON, &status)
 | 
								err = json.Unmarshal(node.StatusJSON, &status)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
@@ -211,16 +216,17 @@ func (this *NodesAction) RunGet(params struct {
 | 
				
			|||||||
				"error":      node.InstallStatus.Error,
 | 
									"error":      node.InstallStatus.Error,
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			"status": maps.Map{
 | 
								"status": maps.Map{
 | 
				
			||||||
				"isActive":        status.IsActive,
 | 
									"isActive":         status.IsActive,
 | 
				
			||||||
				"updatedAt":       status.UpdatedAt,
 | 
									"updatedAt":        status.UpdatedAt,
 | 
				
			||||||
				"hostname":        status.Hostname,
 | 
									"hostname":         status.Hostname,
 | 
				
			||||||
				"cpuUsage":        status.CPUUsage,
 | 
									"cpuUsage":         status.CPUUsage,
 | 
				
			||||||
				"cpuUsageText":    fmt.Sprintf("%.2f%%", status.CPUUsage*100),
 | 
									"cpuUsageText":     fmt.Sprintf("%.2f%%", status.CPUUsage*100),
 | 
				
			||||||
				"memUsage":        status.MemoryUsage,
 | 
									"memUsage":         status.MemoryUsage,
 | 
				
			||||||
				"memUsageText":    fmt.Sprintf("%.2f%%", status.MemoryUsage*100),
 | 
									"memUsageText":     fmt.Sprintf("%.2f%%", status.MemoryUsage*100),
 | 
				
			||||||
				"trafficInBytes":  status.TrafficInBytes,
 | 
									"trafficInBytes":   status.TrafficInBytes,
 | 
				
			||||||
				"trafficOutBytes": status.TrafficOutBytes,
 | 
									"trafficOutBytes":  status.TrafficOutBytes,
 | 
				
			||||||
				"load1m":          numberutils.FormatFloat2(status.Load1m),
 | 
									"load1m":           numberutils.FormatFloat2(status.Load1m),
 | 
				
			||||||
 | 
									"countConnections": status.ConnectionCount,
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			"cluster": maps.Map{
 | 
								"cluster": maps.Map{
 | 
				
			||||||
				"id":   node.NodeCluster.Id,
 | 
									"id":   node.NodeCluster.Id,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -33,11 +33,12 @@ func (this *NodesAction) RunGet(params struct {
 | 
				
			|||||||
	Keyword        string
 | 
						Keyword        string
 | 
				
			||||||
	Level          int32
 | 
						Level          int32
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	CpuOrder        string
 | 
						CpuOrder         string
 | 
				
			||||||
	MemoryOrder     string
 | 
						MemoryOrder      string
 | 
				
			||||||
	TrafficInOrder  string
 | 
						TrafficInOrder   string
 | 
				
			||||||
	TrafficOutOrder string
 | 
						TrafficOutOrder  string
 | 
				
			||||||
	LoadOrder       string
 | 
						LoadOrder        string
 | 
				
			||||||
 | 
						ConnectionsOrder string
 | 
				
			||||||
}) {
 | 
					}) {
 | 
				
			||||||
	this.Data["groupId"] = params.GroupId
 | 
						this.Data["groupId"] = params.GroupId
 | 
				
			||||||
	this.Data["regionId"] = params.RegionId
 | 
						this.Data["regionId"] = params.RegionId
 | 
				
			||||||
@@ -46,7 +47,7 @@ func (this *NodesAction) RunGet(params struct {
 | 
				
			|||||||
	this.Data["keyword"] = params.Keyword
 | 
						this.Data["keyword"] = params.Keyword
 | 
				
			||||||
	this.Data["level"] = params.Level
 | 
						this.Data["level"] = params.Level
 | 
				
			||||||
	this.Data["clusterId"] = params.ClusterId
 | 
						this.Data["clusterId"] = params.ClusterId
 | 
				
			||||||
	this.Data["hasOrder"] = len(params.CpuOrder) > 0 || len(params.MemoryOrder) > 0 || len(params.TrafficInOrder) > 0 || len(params.TrafficOutOrder) > 0 || len(params.LoadOrder) > 0
 | 
						this.Data["hasOrder"] = len(params.CpuOrder) > 0 || len(params.MemoryOrder) > 0 || len(params.TrafficInOrder) > 0 || len(params.TrafficOutOrder) > 0 || len(params.LoadOrder) > 0 || len(params.ConnectionsOrder) > 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// 集群是否已经设置了线路
 | 
						// 集群是否已经设置了线路
 | 
				
			||||||
	clusterDNSResp, err := this.RPC().NodeClusterRPC().FindEnabledNodeClusterDNS(this.AdminContext(), &pb.FindEnabledNodeClusterDNSRequest{NodeClusterId: params.ClusterId})
 | 
						clusterDNSResp, err := this.RPC().NodeClusterRPC().FindEnabledNodeClusterDNS(this.AdminContext(), &pb.FindEnabledNodeClusterDNSRequest{NodeClusterId: params.ClusterId})
 | 
				
			||||||
@@ -114,6 +115,10 @@ func (this *NodesAction) RunGet(params struct {
 | 
				
			|||||||
		req.LoadAsc = true
 | 
							req.LoadAsc = true
 | 
				
			||||||
	} else if params.LoadOrder == "desc" {
 | 
						} else if params.LoadOrder == "desc" {
 | 
				
			||||||
		req.LoadDesc = true
 | 
							req.LoadDesc = true
 | 
				
			||||||
 | 
						} else if params.ConnectionsOrder == "asc" {
 | 
				
			||||||
 | 
							req.ConnectionsAsc = true
 | 
				
			||||||
 | 
						} else if params.ConnectionsOrder == "desc" {
 | 
				
			||||||
 | 
							req.ConnectionsDesc = true
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	nodesResp, err := this.RPC().NodeRPC().ListEnabledNodesMatch(this.AdminContext(), req)
 | 
						nodesResp, err := this.RPC().NodeRPC().ListEnabledNodesMatch(this.AdminContext(), req)
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
@@ -123,8 +128,8 @@ func (this *NodesAction) RunGet(params struct {
 | 
				
			|||||||
	var nodeMaps = []maps.Map{}
 | 
						var nodeMaps = []maps.Map{}
 | 
				
			||||||
	for _, node := range nodesResp.Nodes {
 | 
						for _, node := range nodesResp.Nodes {
 | 
				
			||||||
		// 状态
 | 
							// 状态
 | 
				
			||||||
		isSynced := false
 | 
							var isSynced = false
 | 
				
			||||||
		status := &nodeconfigs.NodeStatus{}
 | 
							var status = &nodeconfigs.NodeStatus{}
 | 
				
			||||||
		if len(node.StatusJSON) > 0 {
 | 
							if len(node.StatusJSON) > 0 {
 | 
				
			||||||
			err = json.Unmarshal(node.StatusJSON, &status)
 | 
								err = json.Unmarshal(node.StatusJSON, &status)
 | 
				
			||||||
			if err != nil {
 | 
								if err != nil {
 | 
				
			||||||
@@ -213,16 +218,17 @@ func (this *NodesAction) RunGet(params struct {
 | 
				
			|||||||
				"error":      node.InstallStatus.Error,
 | 
									"error":      node.InstallStatus.Error,
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			"status": maps.Map{
 | 
								"status": maps.Map{
 | 
				
			||||||
				"isActive":        status.IsActive,
 | 
									"isActive":         status.IsActive,
 | 
				
			||||||
				"updatedAt":       status.UpdatedAt,
 | 
									"updatedAt":        status.UpdatedAt,
 | 
				
			||||||
				"hostname":        status.Hostname,
 | 
									"hostname":         status.Hostname,
 | 
				
			||||||
				"cpuUsage":        status.CPUUsage,
 | 
									"cpuUsage":         status.CPUUsage,
 | 
				
			||||||
				"cpuUsageText":    numberutils.FormatFloat2(status.CPUUsage * 100),
 | 
									"cpuUsageText":     numberutils.FormatFloat2(status.CPUUsage * 100),
 | 
				
			||||||
				"memUsage":        status.MemoryUsage,
 | 
									"memUsage":         status.MemoryUsage,
 | 
				
			||||||
				"memUsageText":    numberutils.FormatFloat2(status.MemoryUsage * 100),
 | 
									"memUsageText":     numberutils.FormatFloat2(status.MemoryUsage * 100),
 | 
				
			||||||
				"trafficInBytes":  status.TrafficInBytes,
 | 
									"trafficInBytes":   status.TrafficInBytes,
 | 
				
			||||||
				"trafficOutBytes": status.TrafficOutBytes,
 | 
									"trafficOutBytes":  status.TrafficOutBytes,
 | 
				
			||||||
				"load1m":          numberutils.FormatFloat2(status.Load1m),
 | 
									"load1m":           numberutils.FormatFloat2(status.Load1m),
 | 
				
			||||||
 | 
									"countConnections": status.ConnectionCount,
 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
			"cluster": maps.Map{
 | 
								"cluster": maps.Map{
 | 
				
			||||||
				"id":   node.NodeCluster.Id,
 | 
									"id":   node.NodeCluster.Id,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -64,10 +64,11 @@
 | 
				
			|||||||
		<th>节点名称</th>
 | 
							<th>节点名称</th>
 | 
				
			||||||
		<th>IP</th>
 | 
							<th>IP</th>
 | 
				
			||||||
		<th class="width10">DNS线路</th>
 | 
							<th class="width10">DNS线路</th>
 | 
				
			||||||
		<th class="width5 center">CPU<sort-arrow name="cpuOrder"></sort-arrow></th>
 | 
							<th class="width5 center" v-if="windowWidth < miniWidth || windowWidth > columnWidth1">CPU<sort-arrow name="cpuOrder"></sort-arrow></th>
 | 
				
			||||||
		<th class="width5 center">内存<sort-arrow name="memoryOrder"></sort-arrow></th>
 | 
							<th class="width5 center" v-if="windowWidth < miniWidth || windowWidth > columnWidth2">内存<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" v-if="windowWidth < miniWidth || windowWidth > columnWidth3">下行带宽<sort-arrow name="trafficOutOrder"></sort-arrow></th>
 | 
				
			||||||
        <th class="center" style="width: 7em">负载<sort-arrow name="loadOrder"></sort-arrow></th>
 | 
					        <th class="center" style="width: 7em" v-if="windowWidth < miniWidth || windowWidth > columnWidth4">连接数<sort-arrow name="connectionsOrder"></sort-arrow></th>
 | 
				
			||||||
 | 
					        <th class="center" style="width: 7em" v-if="windowWidth < miniWidth || windowWidth > columnWidth5">负载<sort-arrow name="loadOrder"></sort-arrow></th>
 | 
				
			||||||
		<th class="two wide center">状态</th>
 | 
							<th class="two wide center">状态</th>
 | 
				
			||||||
		<th class="two op">操作</th>
 | 
							<th class="two op">操作</th>
 | 
				
			||||||
	</tr>
 | 
						</tr>
 | 
				
			||||||
@@ -117,20 +118,24 @@
 | 
				
			|||||||
            </span>
 | 
					            </span>
 | 
				
			||||||
			<span v-else class="disabled">-</span>
 | 
								<span v-else class="disabled">-</span>
 | 
				
			||||||
		</td>
 | 
							</td>
 | 
				
			||||||
		<td class="center">
 | 
							<td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth1">
 | 
				
			||||||
			<span v-if="node.status.isActive" :class="{red:node.status.cpuUsage > 0.50}">{{node.status.cpuUsageText}}</span>
 | 
								<span v-if="node.status.isActive" :class="{red:node.status.cpuUsage > 0.50}">{{node.status.cpuUsageText}}</span>
 | 
				
			||||||
			<span v-else class="disabled">-</span>
 | 
								<span v-else class="disabled">-</span>
 | 
				
			||||||
		</td>
 | 
							</td>
 | 
				
			||||||
		<td class="center">
 | 
							<td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth2">
 | 
				
			||||||
			<span v-if="node.status.isActive" :class="{red:node.status.memUsage > 0.80}">{{node.status.memUsageText}}</span>
 | 
								<span v-if="node.status.isActive" :class="{red:node.status.memUsage > 0.80}">{{node.status.memUsageText}}</span>
 | 
				
			||||||
			<span v-else class="disabled">-</span>
 | 
								<span v-else class="disabled">-</span>
 | 
				
			||||||
		</td>
 | 
							</td>
 | 
				
			||||||
        <td class="center">
 | 
					        <td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth3">
 | 
				
			||||||
            <span v-if="node.status.isActive && node.status.trafficOutBytes > 0">{{teaweb.formatBits(node.status.trafficOutBytes * 8/60)}}</span>
 | 
					            <span v-if="node.status.isActive && node.status.trafficOutBytes > 0">{{teaweb.formatBits(node.status.trafficOutBytes * 8/60)}}</span>
 | 
				
			||||||
            <span v-else class="disabled">-</span>
 | 
					            <span v-else class="disabled">-</span>
 | 
				
			||||||
        </td>
 | 
					        </td>
 | 
				
			||||||
        <td class="center">
 | 
					        <td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth4">
 | 
				
			||||||
            <span v-if="node.status.isActive">{{node.status.load1m}}</span>
 | 
					            <span v-if="node.status.isActive && node.status.countConnections > 0">{{node.status.countConnections}}</span>
 | 
				
			||||||
 | 
					            <span v-else class="disabled">-</span>
 | 
				
			||||||
 | 
					        </td>
 | 
				
			||||||
 | 
					        <td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth5">
 | 
				
			||||||
 | 
					            <span v-if="node.status.isActive && node.status.load1m > 0">{{node.status.load1m}}</span>
 | 
				
			||||||
            <span v-else class="disabled">-</span>
 | 
					            <span v-else class="disabled">-</span>
 | 
				
			||||||
        </td>
 | 
					        </td>
 | 
				
			||||||
		<td class="center">
 | 
							<td class="center">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,20 @@
 | 
				
			|||||||
Tea.context(function () {
 | 
					Tea.context(function () {
 | 
				
			||||||
	this.teaweb = teaweb
 | 
						this.teaweb = teaweb
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// 显示的统计项
 | 
				
			||||||
 | 
						this.windowWidth = window.innerWidth
 | 
				
			||||||
 | 
						this.miniWidth = 760
 | 
				
			||||||
 | 
						this.columnWidth1 = 800
 | 
				
			||||||
 | 
						this.columnWidth2 = 900
 | 
				
			||||||
 | 
						this.columnWidth3 = 1000
 | 
				
			||||||
 | 
						this.columnWidth4 = 1100
 | 
				
			||||||
 | 
						this.columnWidth5 = 1200
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let that = this
 | 
				
			||||||
 | 
						window.addEventListener("resize", function () {
 | 
				
			||||||
 | 
							that.windowWidth = window.innerWidth
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this.deleteNode = function (nodeId) {
 | 
						this.deleteNode = function (nodeId) {
 | 
				
			||||||
		teaweb.confirm("确定要从当前集群中删除这个节点吗?", function () {
 | 
							teaweb.confirm("确定要从当前集群中删除这个节点吗?", function () {
 | 
				
			||||||
			this.$post("/nodes/delete")
 | 
								this.$post("/nodes/delete")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -58,10 +58,11 @@
 | 
				
			|||||||
        <th>节点名称</th>
 | 
					        <th>节点名称</th>
 | 
				
			||||||
        <th>IP</th>
 | 
					        <th>IP</th>
 | 
				
			||||||
        <th class="width10">DNS线路</th>
 | 
					        <th class="width10">DNS线路</th>
 | 
				
			||||||
        <th class="width5 center">CPU<sort-arrow name="cpuOrder"></sort-arrow></th>
 | 
					        <th class="width5 center" v-if="windowWidth < miniWidth || windowWidth > columnWidth1">CPU<sort-arrow name="cpuOrder"></sort-arrow></th>
 | 
				
			||||||
        <th class="width5 center">内存<sort-arrow name="memoryOrder"></sort-arrow></th>
 | 
					        <th class="width5 center" v-if="windowWidth < miniWidth || windowWidth > columnWidth2">内存<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" v-if="windowWidth < miniWidth || windowWidth > columnWidth3">下行带宽<sort-arrow name="trafficOutOrder"></sort-arrow></th>
 | 
				
			||||||
        <th class="center" style="width: 7em">负载<sort-arrow name="loadOrder"></sort-arrow></th>
 | 
					        <th class="center" style="width: 7em" v-if="windowWidth < miniWidth || windowWidth > columnWidth4">连接数<sort-arrow name="connectionsOrder"></sort-arrow></th>
 | 
				
			||||||
 | 
					        <th class="center" style="width: 7em" v-if="windowWidth < miniWidth || windowWidth > columnWidth5">负载<sort-arrow name="loadOrder"></sort-arrow></th>
 | 
				
			||||||
        <th class="two wide center">状态</th>
 | 
					        <th class="two wide center">状态</th>
 | 
				
			||||||
        <th class="one op">操作</th>
 | 
					        <th class="one op">操作</th>
 | 
				
			||||||
    </tr>
 | 
					    </tr>
 | 
				
			||||||
@@ -111,20 +112,24 @@
 | 
				
			|||||||
            </span>
 | 
					            </span>
 | 
				
			||||||
            <span v-else class="disabled">-</span>
 | 
					            <span v-else class="disabled">-</span>
 | 
				
			||||||
        </td>
 | 
					        </td>
 | 
				
			||||||
        <td class="center">
 | 
					        <td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth1">
 | 
				
			||||||
            <span v-if="node.status.isActive" :class="{red:node.status.cpuUsage > 0.50}">{{node.status.cpuUsageText}}%</span>
 | 
					            <span v-if="node.status.isActive" :class="{red:node.status.cpuUsage > 0.50}">{{node.status.cpuUsageText}}</span>
 | 
				
			||||||
            <span v-else class="disabled">-</span>
 | 
					            <span v-else class="disabled">-</span>
 | 
				
			||||||
        </td>
 | 
					        </td>
 | 
				
			||||||
        <td class="center">
 | 
					        <td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth2">
 | 
				
			||||||
            <span v-if="node.status.isActive" :class="{red:node.status.memUsage > 0.80}">{{node.status.memUsageText}}%</span>
 | 
					            <span v-if="node.status.isActive" :class="{red:node.status.memUsage > 0.80}">{{node.status.memUsageText}}</span>
 | 
				
			||||||
            <span v-else class="disabled">-</span>
 | 
					            <span v-else class="disabled">-</span>
 | 
				
			||||||
        </td>
 | 
					        </td>
 | 
				
			||||||
        <td class="center">
 | 
					        <td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth3">
 | 
				
			||||||
            <span v-if="node.status.isActive && node.status.trafficOutBytes > 0">{{teaweb.formatBits(node.status.trafficOutBytes * 8/60)}}</span>
 | 
					            <span v-if="node.status.isActive && node.status.trafficOutBytes > 0">{{teaweb.formatBits(node.status.trafficOutBytes * 8/60)}}</span>
 | 
				
			||||||
            <span v-else class="disabled">-</span>
 | 
					            <span v-else class="disabled">-</span>
 | 
				
			||||||
        </td>
 | 
					        </td>
 | 
				
			||||||
        <td class="center">
 | 
					        <td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth4">
 | 
				
			||||||
            <span v-if="node.status.isActive">{{node.status.load1m}}<span class="grey small"></span></span>
 | 
					            <span v-if="node.status.isActive && node.status.countConnections > 0">{{node.status.countConnections}}</span>
 | 
				
			||||||
 | 
					            <span v-else class="disabled">-</span>
 | 
				
			||||||
 | 
					        </td>
 | 
				
			||||||
 | 
					        <td class="center" v-if="windowWidth < miniWidth || windowWidth > columnWidth5">
 | 
				
			||||||
 | 
					            <span v-if="node.status.isActive && node.status.load1m > 0">{{node.status.load1m}}</span>
 | 
				
			||||||
            <span v-else class="disabled">-</span>
 | 
					            <span v-else class="disabled">-</span>
 | 
				
			||||||
        </td>
 | 
					        </td>
 | 
				
			||||||
        <td class="center">
 | 
					        <td class="center">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,20 @@
 | 
				
			|||||||
Tea.context(function () {
 | 
					Tea.context(function () {
 | 
				
			||||||
	this.teaweb = teaweb
 | 
						this.teaweb = teaweb
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// 显示的统计项
 | 
				
			||||||
 | 
						this.windowWidth = window.innerWidth
 | 
				
			||||||
 | 
						this.miniWidth = 760
 | 
				
			||||||
 | 
						this.columnWidth1 = 800
 | 
				
			||||||
 | 
						this.columnWidth2 = 900
 | 
				
			||||||
 | 
						this.columnWidth3 = 1000
 | 
				
			||||||
 | 
						this.columnWidth4 = 1100
 | 
				
			||||||
 | 
						this.columnWidth5 = 1200
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						let that = this
 | 
				
			||||||
 | 
						window.addEventListener("resize", function () {
 | 
				
			||||||
 | 
							that.windowWidth = window.innerWidth
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this.deleteNode = function (nodeId) {
 | 
						this.deleteNode = function (nodeId) {
 | 
				
			||||||
		teaweb.confirm("确定要删除这个节点吗?", function () {
 | 
							teaweb.confirm("确定要删除这个节点吗?", function () {
 | 
				
			||||||
			this.$post("/cluster/nodes/delete")
 | 
								this.$post("/cluster/nodes/delete")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user