mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	修复服务无法创建的Bug
This commit is contained in:
		@@ -57,6 +57,14 @@ func (this *CreateAction) RunGet(params struct{}) {
 | 
			
		||||
	// 服务类型
 | 
			
		||||
	this.Data["serverTypes"] = serverconfigs.AllServerTypes()
 | 
			
		||||
 | 
			
		||||
	// 检查是否有用户
 | 
			
		||||
	countUsersResp, err := this.RPC().UserRPC().CountAllEnabledUsers(this.AdminContext(), &pb.CountAllEnabledUsersRequest{})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["hasUsers"] = countUsersResp.Count > 0
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -94,14 +102,16 @@ func (this *CreateAction) RunPost(params struct {
 | 
			
		||||
 | 
			
		||||
	// 用户
 | 
			
		||||
	var userId = params.UserId
 | 
			
		||||
	clusterIdResp, err := this.RPC().UserRPC().FindUserNodeClusterId(this.AdminContext(), &pb.FindUserNodeClusterIdRequest{UserId: userId})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	clusterId = clusterIdResp.NodeClusterId
 | 
			
		||||
	if clusterId <= 0 {
 | 
			
		||||
		this.Fail("请选择部署的集群")
 | 
			
		||||
	if userId > 0 {
 | 
			
		||||
		clusterIdResp, err := this.RPC().UserRPC().FindUserNodeClusterId(this.AdminContext(), &pb.FindUserNodeClusterIdRequest{UserId: userId})
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			this.ErrorPage(err)
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
		clusterId = clusterIdResp.NodeClusterId
 | 
			
		||||
		if clusterId <= 0 {
 | 
			
		||||
			this.Fail("请选择部署的集群")
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 套餐
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@
 | 
			
		||||
				<input type="text" name="name" maxlength="60" ref="focus"/>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
        <tr v-show="hasUsers">
 | 
			
		||||
            <td>选择用户</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <user-selector @change="changeUserId"></user-selector>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user