mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	[节点]可以设置节点区域
This commit is contained in:
		@@ -44,6 +44,7 @@ func (this *CreateBatchAction) RunGet(params struct {
 | 
			
		||||
func (this *CreateBatchAction) RunPost(params struct {
 | 
			
		||||
	ClusterId int64
 | 
			
		||||
	GroupId   int64
 | 
			
		||||
	RegionId  int64
 | 
			
		||||
	IpList    string
 | 
			
		||||
 | 
			
		||||
	Must *actions.Must
 | 
			
		||||
@@ -79,6 +80,7 @@ func (this *CreateBatchAction) RunPost(params struct {
 | 
			
		||||
			Name:      ip,
 | 
			
		||||
			ClusterId: params.ClusterId,
 | 
			
		||||
			GroupId:   params.GroupId,
 | 
			
		||||
			RegionId:  params.RegionId,
 | 
			
		||||
			Login:     nil,
 | 
			
		||||
		})
 | 
			
		||||
		if err != nil {
 | 
			
		||||
 
 | 
			
		||||
@@ -72,6 +72,7 @@ func (this *CreateNodeAction) RunPost(params struct {
 | 
			
		||||
	IpAddressesJSON []byte
 | 
			
		||||
	ClusterId       int64
 | 
			
		||||
	GroupId         int64
 | 
			
		||||
	RegionId        int64
 | 
			
		||||
	GrantId         int64
 | 
			
		||||
	SshHost         string
 | 
			
		||||
	SshPort         int
 | 
			
		||||
@@ -120,6 +121,7 @@ func (this *CreateNodeAction) RunPost(params struct {
 | 
			
		||||
		Name:        params.Name,
 | 
			
		||||
		ClusterId:   params.ClusterId,
 | 
			
		||||
		GroupId:     params.GroupId,
 | 
			
		||||
		RegionId:    params.RegionId,
 | 
			
		||||
		Login:       loginInfo,
 | 
			
		||||
		DnsDomainId: params.DnsDomainId,
 | 
			
		||||
		DnsRoutes:   dnsRouteCodes,
 | 
			
		||||
 
 | 
			
		||||
@@ -25,11 +25,13 @@ func (this *IndexAction) Init() {
 | 
			
		||||
func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
	ClusterId      int64
 | 
			
		||||
	GroupId        int64
 | 
			
		||||
	RegionId       int64
 | 
			
		||||
	InstalledState int
 | 
			
		||||
	ActiveState    int
 | 
			
		||||
	Keyword        string
 | 
			
		||||
}) {
 | 
			
		||||
	this.Data["groupId"] = params.GroupId
 | 
			
		||||
	this.Data["regionId"] = params.RegionId
 | 
			
		||||
	this.Data["installState"] = params.InstalledState
 | 
			
		||||
	this.Data["activeState"] = params.ActiveState
 | 
			
		||||
	this.Data["keyword"] = params.Keyword
 | 
			
		||||
@@ -37,6 +39,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
	countResp, err := this.RPC().NodeRPC().CountAllEnabledNodesMatch(this.AdminContext(), &pb.CountAllEnabledNodesMatchRequest{
 | 
			
		||||
		ClusterId:    params.ClusterId,
 | 
			
		||||
		GroupId:      params.GroupId,
 | 
			
		||||
		RegionId:     params.RegionId,
 | 
			
		||||
		InstallState: types.Int32(params.InstalledState),
 | 
			
		||||
		ActiveState:  types.Int32(params.ActiveState),
 | 
			
		||||
		Keyword:      params.Keyword,
 | 
			
		||||
@@ -54,6 +57,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
		Size:         page.Size,
 | 
			
		||||
		ClusterId:    params.ClusterId,
 | 
			
		||||
		GroupId:      params.GroupId,
 | 
			
		||||
		RegionId:     params.RegionId,
 | 
			
		||||
		InstallState: types.Int32(params.InstalledState),
 | 
			
		||||
		ActiveState:  types.Int32(params.ActiveState),
 | 
			
		||||
		Keyword:      params.Keyword,
 | 
			
		||||
@@ -89,6 +93,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// 分组
 | 
			
		||||
		var groupMap maps.Map = nil
 | 
			
		||||
		if node.Group != nil {
 | 
			
		||||
			groupMap = maps.Map{
 | 
			
		||||
@@ -97,6 +102,15 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// 区域
 | 
			
		||||
		var regionMap maps.Map = nil
 | 
			
		||||
		if node.Region != nil {
 | 
			
		||||
			regionMap = maps.Map{
 | 
			
		||||
				"id":   node.Region.Id,
 | 
			
		||||
				"name": node.Region.Name,
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// DNS
 | 
			
		||||
		dnsRouteNames := []string{}
 | 
			
		||||
		for _, route := range node.DnsRoutes {
 | 
			
		||||
@@ -131,6 +145,7 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
			"isSynced":      isSynced,
 | 
			
		||||
			"ipAddresses":   ipAddresses,
 | 
			
		||||
			"group":         groupMap,
 | 
			
		||||
			"region":        regionMap,
 | 
			
		||||
			"dnsRouteNames": dnsRouteNames,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
@@ -164,5 +179,20 @@ func (this *IndexAction) RunGet(params struct {
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["groups"] = groupMaps
 | 
			
		||||
 | 
			
		||||
	// 所有区域
 | 
			
		||||
	regionsResp, err := this.RPC().NodeRegionRPC().FindAllEnabledAndOnNodeRegions(this.AdminContext(), &pb.FindAllEnabledAndOnNodeRegionsRequest{})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	regionMaps := []maps.Map{}
 | 
			
		||||
	for _, region := range regionsResp.NodeRegions {
 | 
			
		||||
		regionMaps = append(regionMaps, maps.Map{
 | 
			
		||||
			"id":   region.Id,
 | 
			
		||||
			"name": region.Name,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["regions"] = regionMaps
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -137,6 +137,7 @@ func (this *NodeAction) RunGet(params struct {
 | 
			
		||||
		status.IsActive = status.IsActive && time.Now().Unix()-status.UpdatedAt <= 60 // N秒之内认为活跃
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 分组
 | 
			
		||||
	var groupMap maps.Map = nil
 | 
			
		||||
	if node.Group != nil {
 | 
			
		||||
		groupMap = maps.Map{
 | 
			
		||||
@@ -145,6 +146,15 @@ func (this *NodeAction) RunGet(params struct {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 区域
 | 
			
		||||
	var regionMap maps.Map = nil
 | 
			
		||||
	if node.Region != nil {
 | 
			
		||||
		regionMap = maps.Map{
 | 
			
		||||
			"id":   node.Region.Id,
 | 
			
		||||
			"name": node.Region.Name,
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Data["node"] = maps.Map{
 | 
			
		||||
		"id":          node.Id,
 | 
			
		||||
		"name":        node.Name,
 | 
			
		||||
@@ -170,6 +180,7 @@ func (this *NodeAction) RunGet(params struct {
 | 
			
		||||
		},
 | 
			
		||||
 | 
			
		||||
		"group":  groupMap,
 | 
			
		||||
		"region": regionMap,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
 
 | 
			
		||||
@@ -138,6 +138,7 @@ func (this *UpdateAction) RunGet(params struct {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 分组
 | 
			
		||||
	var groupMap maps.Map = nil
 | 
			
		||||
	if node.Group != nil {
 | 
			
		||||
		groupMap = maps.Map{
 | 
			
		||||
@@ -146,6 +147,15 @@ func (this *UpdateAction) RunGet(params struct {
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 区域
 | 
			
		||||
	var regionMap maps.Map = nil
 | 
			
		||||
	if node.Region != nil {
 | 
			
		||||
		regionMap = maps.Map{
 | 
			
		||||
			"id":   node.Region.Id,
 | 
			
		||||
			"name": node.Region.Name,
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Data["node"] = maps.Map{
 | 
			
		||||
		"id":          node.Id,
 | 
			
		||||
		"name":        node.Name,
 | 
			
		||||
@@ -155,6 +165,7 @@ func (this *UpdateAction) RunGet(params struct {
 | 
			
		||||
		"maxCPU":      node.MaxCPU,
 | 
			
		||||
		"isOn":        node.IsOn,
 | 
			
		||||
		"group":       groupMap,
 | 
			
		||||
		"region":      regionMap,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 所有集群
 | 
			
		||||
@@ -182,6 +193,7 @@ func (this *UpdateAction) RunPost(params struct {
 | 
			
		||||
	LoginId         int64
 | 
			
		||||
	NodeId          int64
 | 
			
		||||
	GroupId         int64
 | 
			
		||||
	RegionId        int64
 | 
			
		||||
	Name            string
 | 
			
		||||
	IPAddressesJSON []byte `alias:"ipAddressesJSON"`
 | 
			
		||||
	ClusterId       int64
 | 
			
		||||
@@ -237,6 +249,7 @@ func (this *UpdateAction) RunPost(params struct {
 | 
			
		||||
	_, err := this.RPC().NodeRPC().UpdateNode(this.AdminContext(), &pb.UpdateNodeRequest{
 | 
			
		||||
		NodeId:      params.NodeId,
 | 
			
		||||
		GroupId:     params.GroupId,
 | 
			
		||||
		RegionId:    params.RegionId,
 | 
			
		||||
		Name:        params.Name,
 | 
			
		||||
		ClusterId:   params.ClusterId,
 | 
			
		||||
		Login:       loginInfo,
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
			
		||||
	"github.com/iwind/TeaGo/actions"
 | 
			
		||||
	"github.com/iwind/TeaGo/maps"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type CreatePopupAction struct {
 | 
			
		||||
@@ -34,6 +35,11 @@ func (this *CreatePopupAction) RunPost(params struct {
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Data["region"] = maps.Map{
 | 
			
		||||
		"id":   createResp.NodeRegionId,
 | 
			
		||||
		"name": params.Name,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// 日志
 | 
			
		||||
	defer this.CreateLogInfo("创建节点区域 %d", createResp.NodeRegionId)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -18,6 +18,7 @@ func init() {
 | 
			
		||||
			GetPost("/updatePopup", new(UpdatePopupAction)).
 | 
			
		||||
			Post("/delete", new(DeleteAction)).
 | 
			
		||||
			Post("/sort", new(SortAction)).
 | 
			
		||||
			GetPost("/selectPopup", new(SelectPopupAction)).
 | 
			
		||||
			EndAll()
 | 
			
		||||
	})
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										60
									
								
								internal/web/actions/default/clusters/regions/selectPopup.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								internal/web/actions/default/clusters/regions/selectPopup.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,60 @@
 | 
			
		||||
package regions
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
 | 
			
		||||
	"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
 | 
			
		||||
	"github.com/iwind/TeaGo/actions"
 | 
			
		||||
	"github.com/iwind/TeaGo/maps"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type SelectPopupAction struct {
 | 
			
		||||
	actionutils.ParentAction
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *SelectPopupAction) Init() {
 | 
			
		||||
	this.Nav("", "", "")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *SelectPopupAction) RunGet(params struct{}) {
 | 
			
		||||
	regionsResp, err := this.RPC().NodeRegionRPC().FindAllEnabledAndOnNodeRegions(this.AdminContext(), &pb.FindAllEnabledAndOnNodeRegionsRequest{})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	regionMaps := []maps.Map{}
 | 
			
		||||
	for _, region := range regionsResp.NodeRegions {
 | 
			
		||||
		regionMaps = append(regionMaps, maps.Map{
 | 
			
		||||
			"id":   region.Id,
 | 
			
		||||
			"name": region.Name,
 | 
			
		||||
		})
 | 
			
		||||
	}
 | 
			
		||||
	this.Data["regions"] = regionMaps
 | 
			
		||||
 | 
			
		||||
	this.Show()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (this *SelectPopupAction) RunPost(params struct {
 | 
			
		||||
	RegionId int64
 | 
			
		||||
 | 
			
		||||
	Must *actions.Must
 | 
			
		||||
	CSRF *actionutils.CSRF
 | 
			
		||||
}) {
 | 
			
		||||
	regionResp, err := this.RPC().NodeRegionRPC().FindEnabledNodeRegion(this.AdminContext(), &pb.FindEnabledNodeRegionRequest{NodeRegionId: params.RegionId})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		this.ErrorPage(err)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	region := regionResp.NodeRegion
 | 
			
		||||
	if region == nil {
 | 
			
		||||
		this.NotFound("nodeRegion", params.RegionId)
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Data["region"] = maps.Map{
 | 
			
		||||
		"id":   region.Id,
 | 
			
		||||
		"name": region.Name,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.Success()
 | 
			
		||||
}
 | 
			
		||||
@@ -27,7 +27,7 @@ Vue.component("node-group-selector", {
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	template: `<div>
 | 
			
		||||
	<div class="ui label tiny" v-if="selectedGroup != null">
 | 
			
		||||
	<div class="ui label small basic" v-if="selectedGroup != null">
 | 
			
		||||
		<input type="hidden" name="groupId" :value="selectedGroup.id"/>
 | 
			
		||||
		{{selectedGroup.name}}  <a href="" title="删除" @click.prevent="removeGroup()"><i class="icon remove"></i></a>
 | 
			
		||||
	</div>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										38
									
								
								web/public/js/components/node/node-region-selector.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								web/public/js/components/node/node-region-selector.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
Vue.component("node-region-selector", {
 | 
			
		||||
	props: ["v-region"],
 | 
			
		||||
	data: function () {
 | 
			
		||||
		return {
 | 
			
		||||
			selectedRegion: this.vRegion
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	methods: {
 | 
			
		||||
		selectRegion: function () {
 | 
			
		||||
			let that = this
 | 
			
		||||
			teaweb.popup("/clusters/regions/selectPopup?clusterId=" + this.vClusterId, {
 | 
			
		||||
				callback: function (resp) {
 | 
			
		||||
					that.selectedRegion = resp.data.region
 | 
			
		||||
				}
 | 
			
		||||
			})
 | 
			
		||||
		},
 | 
			
		||||
		addRegion: function () {
 | 
			
		||||
			let that = this
 | 
			
		||||
			teaweb.popup("/clusters/regions/createPopup?clusterId=" + this.vClusterId, {
 | 
			
		||||
				callback: function (resp) {
 | 
			
		||||
					that.selectedRegion = resp.data.region
 | 
			
		||||
				}
 | 
			
		||||
			})
 | 
			
		||||
		},
 | 
			
		||||
		removeRegion: function () {
 | 
			
		||||
			this.selectedRegion = null
 | 
			
		||||
		}
 | 
			
		||||
	},
 | 
			
		||||
	template: `<div>
 | 
			
		||||
	<div class="ui label small basic" v-if="selectedRegion != null">
 | 
			
		||||
		<input type="hidden" name="regionId" :value="selectedRegion.id"/>
 | 
			
		||||
		{{selectedRegion.name}}  <a href="" title="删除" @click.prevent="removeRegion()"><i class="icon remove"></i></a>
 | 
			
		||||
	</div>
 | 
			
		||||
	<div v-if="selectedRegion == null">
 | 
			
		||||
		<a href="" @click.prevent="selectRegion()">[选择区域]</a>   <a href="" @click.prevent="addRegion()">[添加区域]</a>
 | 
			
		||||
	</div>
 | 
			
		||||
</div>`
 | 
			
		||||
})
 | 
			
		||||
@@ -14,6 +14,12 @@
 | 
			
		||||
					<p class="comment">每行一个节点IP。</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>所属区域</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <node-region-selector></node-region-selector>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td>所属分组</td>
 | 
			
		||||
				<td>
 | 
			
		||||
 
 | 
			
		||||
@@ -27,6 +27,12 @@
 | 
			
		||||
					<p class="comment">可用线路是根据集群设置的域名获取的,注意DNS服务商可能对这些线路有所限制。</p>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>所属区域</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <node-region-selector></node-region-selector>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td>所属分组</td>
 | 
			
		||||
				<td>
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@
 | 
			
		||||
			<td class="title">选择分组</td>
 | 
			
		||||
			<td>
 | 
			
		||||
				<div v-if="groups.length > 0">
 | 
			
		||||
					<a href="" class="ui label tiny" v-for="group in groups" :class="{blue:group.id == groupId}" style="margin-bottom:0.5em" @click.prevent="selectGroup(group)">{{group.name}}</a>
 | 
			
		||||
					<a href="" class="ui label small basic" v-for="group in groups" :class="{blue:group.id == groupId}" style="margin-bottom:0.5em" @click.prevent="selectGroup(group)">{{group.name}}</a>
 | 
			
		||||
					<p class="comment">点击可已选中要使用的分组。</p>
 | 
			
		||||
				</div>
 | 
			
		||||
				<div v-else>
 | 
			
		||||
 
 | 
			
		||||
@@ -5,31 +5,28 @@
 | 
			
		||||
<form class="ui form" action="/clusters/cluster">
 | 
			
		||||
	<input type="hidden" name="clusterId" :value="clusterId"/>
 | 
			
		||||
	<div class="ui fields inline">
 | 
			
		||||
		<div class="ui field" v-if="groups.length > 0" style="padding-right: 0">
 | 
			
		||||
			所属分组:
 | 
			
		||||
        <div class="ui field" v-if="regions.length > 0">
 | 
			
		||||
            <select class="ui dropdown" name="regionId" v-model="regionId">
 | 
			
		||||
                <option value="0">[全部区域]</option>
 | 
			
		||||
                <option v-for="region in regions" :value="region.id">{{region.name}}</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
		<div class="ui field" v-if="groups.length > 0">
 | 
			
		||||
			<select class="ui dropdown" name="groupId" v-model="groupId">
 | 
			
		||||
				<option value="0">[全部]</option>
 | 
			
		||||
				<option value="0">[全部分组]</option>
 | 
			
		||||
				<option v-for="group in groups" :value="group.id">{{group.name}}</option>
 | 
			
		||||
			</select>
 | 
			
		||||
		</div>
 | 
			
		||||
		<div class="ui field" style="padding-right: 0">
 | 
			
		||||
			安装状态:
 | 
			
		||||
		</div>
 | 
			
		||||
		<div class="ui field">
 | 
			
		||||
			<select class="ui dropdown" name="installedState" v-model="installState">
 | 
			
		||||
				<option value="0">[全部]</option>
 | 
			
		||||
				<option value="0">[安装状态]</option>
 | 
			
		||||
				<option value="1">已安装</option>
 | 
			
		||||
				<option value="2">未安装</option>
 | 
			
		||||
			</select>
 | 
			
		||||
		</div>
 | 
			
		||||
		<div class="ui field" style="padding-right: 0">
 | 
			
		||||
			在线状态:
 | 
			
		||||
		</div>
 | 
			
		||||
		<div class="ui field">
 | 
			
		||||
			<select class="ui dropdown" name="activeState" v-model="activeState">
 | 
			
		||||
				<option value="0">[全部]</option>
 | 
			
		||||
				<option value="0">[在线状态]</option>
 | 
			
		||||
				<option value="1">在线</option>
 | 
			
		||||
				<option value="2">不在线</option>
 | 
			
		||||
			</select>
 | 
			
		||||
@@ -48,10 +45,10 @@
 | 
			
		||||
<table class="ui table selectable celled" v-if="nodes.length > 0">
 | 
			
		||||
	<thead>
 | 
			
		||||
	<tr>
 | 
			
		||||
		<th class="one wide center">ID</th>
 | 
			
		||||
		<th>节点名称</th>
 | 
			
		||||
		<th class="width10">所属分组</th>
 | 
			
		||||
		<th class="width10">IP</th>
 | 
			
		||||
        <th>所属区域</th>
 | 
			
		||||
		<th>所属分组</th>
 | 
			
		||||
		<th>IP</th>
 | 
			
		||||
		<th class="width10">DNS线路</th>
 | 
			
		||||
		<th class="width5 center">CPU</th>
 | 
			
		||||
		<th class="width5 center">内存</th>
 | 
			
		||||
@@ -62,10 +59,13 @@
 | 
			
		||||
	</tr>
 | 
			
		||||
	</thead>
 | 
			
		||||
	<tr v-for="node in nodes">
 | 
			
		||||
		<td nowrap="" class="center">{{node.id}}</td>
 | 
			
		||||
		<td>{{node.name}}</td>
 | 
			
		||||
        <td>
 | 
			
		||||
			<tiny-basic-label v-if="node.group != null">{{node.group.name}}</tiny-basic-label>
 | 
			
		||||
            <span v-if="node.region != null">{{node.region.name}}</span>
 | 
			
		||||
            <span v-else class="disabled">-</span>
 | 
			
		||||
        </td>
 | 
			
		||||
		<td>
 | 
			
		||||
			<span v-if="node.group != null">{{node.group.name}}</span>
 | 
			
		||||
			<span v-else class="disabled">-</span>
 | 
			
		||||
		</td>
 | 
			
		||||
		<td>
 | 
			
		||||
 
 | 
			
		||||
@@ -35,10 +35,17 @@
 | 
			
		||||
				<span class="ui label tiny basic" v-for="route in dnsRoutes">{{route.name}}</span>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <td>所属区域</td>
 | 
			
		||||
            <td>
 | 
			
		||||
                <span v-if="node.region != null" class="ui label small basic">{{node.region.name}}</span>
 | 
			
		||||
                <span v-else class="disabled">没有设置区域。</span>
 | 
			
		||||
            </td>
 | 
			
		||||
        </tr>
 | 
			
		||||
		<tr>
 | 
			
		||||
			<td>所属分组</td>
 | 
			
		||||
			<td>
 | 
			
		||||
				<span v-if="node.group != null" class="ui label tiny">{{node.group.name}}</span>
 | 
			
		||||
				<span v-if="node.group != null" class="ui label small basic">{{node.group.name}}</span>
 | 
			
		||||
				<span v-else class="disabled">没有设置分组。</span>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,12 @@
 | 
			
		||||
					</select>
 | 
			
		||||
				</td>
 | 
			
		||||
			</tr>
 | 
			
		||||
            <tr>
 | 
			
		||||
                <td>所属区域</td>
 | 
			
		||||
                <td>
 | 
			
		||||
                    <node-region-selector :v-region="node.region"></node-region-selector>
 | 
			
		||||
                </td>
 | 
			
		||||
            </tr>
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td>所属分组</td>
 | 
			
		||||
				<td>
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										23
									
								
								web/views/@default/clusters/regions/selectPopup.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								web/views/@default/clusters/regions/selectPopup.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
{$layout "layout_popup"}
 | 
			
		||||
 | 
			
		||||
<h3>选择分组</h3>
 | 
			
		||||
 | 
			
		||||
<form method="post" class="ui form" data-tea-action="$" data-tea-success="success">
 | 
			
		||||
    <csrf-token></csrf-token>
 | 
			
		||||
	<input type="hidden" name="regionId" :value="regionId"/>
 | 
			
		||||
	<table class="ui table definition selectable">
 | 
			
		||||
		<tr>
 | 
			
		||||
			<td class="title">选择区域</td>
 | 
			
		||||
			<td>
 | 
			
		||||
				<div v-if="regions.length > 0">
 | 
			
		||||
					<a href="" class="ui label small basic" v-for="region in regions" :class="{blue:region.id == regionId}" style="margin-bottom:0.5em" @click.prevent="selectRegion(region)">{{region.name}}</a>
 | 
			
		||||
					<p class="comment">点击可已选中要使用的区域。</p>
 | 
			
		||||
				</div>
 | 
			
		||||
				<div v-else>
 | 
			
		||||
					<p class="comment">暂时还没有可以使用的区域。</p>
 | 
			
		||||
				</div>
 | 
			
		||||
			</td>
 | 
			
		||||
		</tr>
 | 
			
		||||
	</table>
 | 
			
		||||
	<submit-btn>确定</submit-btn>
 | 
			
		||||
</form>
 | 
			
		||||
							
								
								
									
										8
									
								
								web/views/@default/clusters/regions/selectPopup.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								web/views/@default/clusters/regions/selectPopup.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
Tea.context(function () {
 | 
			
		||||
	this.success = NotifyPopup
 | 
			
		||||
	this.regionId = 0
 | 
			
		||||
 | 
			
		||||
	this.selectRegion = function (region) {
 | 
			
		||||
		this.regionId = region.id
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
		Reference in New Issue
	
	Block a user