mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	优化集群没有节点时的提示
This commit is contained in:
		@@ -36,6 +36,15 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
	this.Data["activeState"] = params.ActiveState
 | 
			
		||||
	this.Data["keyword"] = params.Keyword
 | 
			
		||||
 | 
			
		||||
	countAllResp, err := this.RPC().NodeRPC().CountAllEnabledNodesMatch(this.AdminContext(), &pb.CountAllEnabledNodesMatchRequest{
 | 
			
		||||
		NodeClusterId: params.ClusterId,
 | 
			
		||||
	})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["countAll"] = countAllResp.Count
 | 
			
		||||
 | 
			
		||||
	countResp, err := this.RPC().NodeRPC().CountAllEnabledNodesMatch(this.AdminContext(), &pb.CountAllEnabledNodesMatchRequest{
 | 
			
		||||
		NodeClusterId: params.ClusterId,
 | 
			
		||||
		GroupId:       params.GroupId,
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ package clusterutils
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"encoding/json"
 | 
			
		||||
	teaconst "github.com/TeaOSLab/EdgeAdmin/internal/const"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/rpc"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/utils/numberutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
@@ -115,11 +116,13 @@ func (this *ClusterHelper) createSettingMenu(cluster *pb.NodeCluster, selectedIt
 | 
			
		||||
		"isActive": selectedItem == "dns",
 | 
			
		||||
		"isOn":     cluster.DnsDomainId > 0 || len(cluster.DnsName) > 0,
 | 
			
		||||
	})
 | 
			
		||||
	items = append(items, maps.Map{
 | 
			
		||||
		"name":     "消息通知",
 | 
			
		||||
		"url":      "/clusters/cluster/settings/message?clusterId=" + clusterId,
 | 
			
		||||
		"isActive": selectedItem == "message",
 | 
			
		||||
	})
 | 
			
		||||
	if teaconst.IsPlus {
 | 
			
		||||
		items = append(items, maps.Map{
 | 
			
		||||
			"name":     "消息通知",
 | 
			
		||||
			"url":      "/clusters/cluster/settings/message?clusterId=" + clusterId,
 | 
			
		||||
			"isActive": selectedItem == "message",
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	items = append(items, maps.Map{
 | 
			
		||||
		"name":     "-",
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								web/public/js/components/common/not-found-box.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								web/public/js/components/common/not-found-box.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
Vue.component("not-found-box", {
 | 
			
		||||
	props: ["message"],
 | 
			
		||||
	template: `<div style="text-align: center; margin-top: 5em;">
 | 
			
		||||
	<div style="font-size: 2em; margin-bottom: 1em"><i class="icon exclamation triangle large grey"></i></div>
 | 
			
		||||
	<p class="comment">{{message}}</p>
 | 
			
		||||
</div>`
 | 
			
		||||
})
 | 
			
		||||
@@ -2,7 +2,7 @@
 | 
			
		||||
 | 
			
		||||
{$template "menu"}
 | 
			
		||||
 | 
			
		||||
<form class="ui form" action="/clusters/cluster">
 | 
			
		||||
<form class="ui form" action="/clusters/cluster" v-show="countAll > 0">
 | 
			
		||||
	<input type="hidden" name="clusterId" :value="clusterId"/>
 | 
			
		||||
	<div class="ui fields inline">
 | 
			
		||||
        <div class="ui field" v-if="regions.length > 0">
 | 
			
		||||
@@ -40,7 +40,12 @@
 | 
			
		||||
	</div>
 | 
			
		||||
</form>
 | 
			
		||||
 | 
			
		||||
<p class="comment" v-if="nodes.length == 0">暂时还没有节点。</p>
 | 
			
		||||
<div v-if="countAll == 0">
 | 
			
		||||
   <not-found-box message="当前集群下还没有节点,至少添加一个节点后才能提供服务。"></not-found-box>
 | 
			
		||||
</div>
 | 
			
		||||
<div v-if="countAll > 0">
 | 
			
		||||
    <p class="comment" v-if="nodes.length == 0">暂时还没有节点。</p>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<table class="ui table selectable celled" v-if="nodes.length > 0">
 | 
			
		||||
	<thead>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user