mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 13:10:26 +08:00 
			
		
		
		
	创建集群时自动创建缓存策略和WAF策略/优化界面
This commit is contained in:
		@@ -19,6 +19,7 @@ func (this *CreateAction) Init() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (this *CreateAction) RunGet(params struct{}) {
 | 
					func (this *CreateAction) RunGet(params struct{}) {
 | 
				
			||||||
 | 
						// 是否有域名
 | 
				
			||||||
	hasDomainsResp, err := this.RPC().DNSDomainRPC().ExistAvailableDomains(this.AdminContext(), &pb.ExistAvailableDomainsRequest{})
 | 
						hasDomainsResp, err := this.RPC().DNSDomainRPC().ExistAvailableDomains(this.AdminContext(), &pb.ExistAvailableDomainsRequest{})
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		this.ErrorPage(err)
 | 
							this.ErrorPage(err)
 | 
				
			||||||
@@ -53,13 +54,6 @@ func (this *CreateAction) RunPost(params struct {
 | 
				
			|||||||
		Field("name", params.Name).
 | 
							Field("name", params.Name).
 | 
				
			||||||
		Require("请输入集群名称")
 | 
							Require("请输入集群名称")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if params.CachePolicyId <= 0 {
 | 
					 | 
				
			||||||
		this.Fail("请选择或者创建缓存策略")
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	if params.HttpFirewallPolicyId <= 0 {
 | 
					 | 
				
			||||||
		this.Fail("请选择或者创建WAF策略")
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	// 检查DNS名称
 | 
						// 检查DNS名称
 | 
				
			||||||
	if len(params.DnsName) > 0 {
 | 
						if len(params.DnsName) > 0 {
 | 
				
			||||||
		if !domainutils.ValidateDomainFormat(params.DnsName) {
 | 
							if !domainutils.ValidateDomainFormat(params.DnsName) {
 | 
				
			||||||
@@ -113,5 +107,7 @@ func (this *CreateAction) RunPost(params struct {
 | 
				
			|||||||
	// 创建日志
 | 
						// 创建日志
 | 
				
			||||||
	defer this.CreateLog(oplogs.LevelInfo, "创建节点集群:%d", createResp.NodeClusterId)
 | 
						defer this.CreateLog(oplogs.LevelInfo, "创建节点集群:%d", createResp.NodeClusterId)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						this.Data["clusterId"] = createResp.NodeClusterId
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this.Success()
 | 
						this.Success()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -385,6 +385,9 @@ body.expanded .main {
 | 
				
			|||||||
  font-style: normal;
 | 
					  font-style: normal;
 | 
				
			||||||
  font-size: 0.9em;
 | 
					  font-size: 0.9em;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					.main table td em.grey {
 | 
				
			||||||
 | 
					  color: grey;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
.main h3 {
 | 
					.main h3 {
 | 
				
			||||||
  font-weight: normal;
 | 
					  font-weight: normal;
 | 
				
			||||||
  margin-top: 1em !important;
 | 
					  margin-top: 1em !important;
 | 
				
			||||||
 
 | 
				
			|||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@@ -390,6 +390,11 @@ body.expanded .main {
 | 
				
			|||||||
	font-size: 0.9em;
 | 
						font-size: 0.9em;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.main table td em.grey {
 | 
				
			||||||
 | 
						color: grey;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.main h3 {
 | 
					.main h3 {
 | 
				
			||||||
	font-weight: normal;
 | 
						font-weight: normal;
 | 
				
			||||||
	margin-top: 1em !important;
 | 
						margin-top: 1em !important;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,17 +10,17 @@
 | 
				
			|||||||
			<td><input type="text" name="name" maxlength="50" ref="focus"/></td>
 | 
								<td><input type="text" name="name" maxlength="50" ref="focus"/></td>
 | 
				
			||||||
		</tr>
 | 
							</tr>
 | 
				
			||||||
        <tr>
 | 
					        <tr>
 | 
				
			||||||
            <td>默认缓存设置 *</td>
 | 
					            <td>默认缓存设置</td>
 | 
				
			||||||
            <td>
 | 
					            <td>
 | 
				
			||||||
                <http-cache-policy-selector></http-cache-policy-selector>
 | 
					                <http-cache-policy-selector></http-cache-policy-selector>
 | 
				
			||||||
                <p class="comment">此全局设置不会强制应用到每个网站服务。</p>
 | 
					                <p class="comment">为可选项。集群中的网站服务可以自行设置是否启用此设置。</p>
 | 
				
			||||||
            </td>
 | 
					            </td>
 | 
				
			||||||
        </tr>
 | 
					        </tr>
 | 
				
			||||||
        <tr>
 | 
					        <tr>
 | 
				
			||||||
            <td>默认WAF设置 *</td>
 | 
					            <td>默认WAF设置</td>
 | 
				
			||||||
            <td>
 | 
					            <td>
 | 
				
			||||||
                <http-firewall-policy-selector></http-firewall-policy-selector>
 | 
					                <http-firewall-policy-selector></http-firewall-policy-selector>
 | 
				
			||||||
                <p class="comment">此全局设置不会强制应用到每个网站服务。</p>
 | 
					                <p class="comment">为可选项。集群中的网站服务可以自行设置是否启用此设置。</p>
 | 
				
			||||||
            </td>
 | 
					            </td>
 | 
				
			||||||
        </tr>
 | 
					        </tr>
 | 
				
			||||||
	</table>
 | 
						</table>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,3 +1,7 @@
 | 
				
			|||||||
Tea.context(function () {
 | 
					Tea.context(function () {
 | 
				
			||||||
	this.success = NotifySuccess("保存成功", "/clusters")
 | 
						this.success = function (resp) {
 | 
				
			||||||
 | 
							teaweb.success("集群创建成功", function () {
 | 
				
			||||||
 | 
								window.location = "/clusters/cluster/nodes?clusterId=" + resp.data.clusterId
 | 
				
			||||||
 | 
							} )
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
@@ -30,7 +30,7 @@
 | 
				
			|||||||
		</tr>
 | 
							</tr>
 | 
				
			||||||
	</thead>
 | 
						</thead>
 | 
				
			||||||
	<tr v-for="grant in grants">
 | 
						<tr v-for="grant in grants">
 | 
				
			||||||
        <td><a :href="'/clusters/grants/grant?grantId=' + grant.id">{{grant.name}}</a></td>
 | 
					        <td><a :href="'/clusters/grants/grant?grantId=' + grant.id"><keyword :v-word="keyword">{{grant.name}}</keyword></a></td>
 | 
				
			||||||
		<td>
 | 
							<td>
 | 
				
			||||||
			<span class="ui label tiny basic">{{grant.method.name}}</span>
 | 
								<span class="ui label tiny basic">{{grant.method.name}}</span>
 | 
				
			||||||
		</td>
 | 
							</td>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@
 | 
				
			|||||||
<table class="ui table selectable small definition celled">
 | 
					<table class="ui table selectable small definition celled">
 | 
				
			||||||
    <thead>
 | 
					    <thead>
 | 
				
			||||||
    <tr>
 | 
					    <tr>
 | 
				
			||||||
        <th style="width:7em">区域\范围</th>
 | 
					        <th style="width: 7em; border-left: 1px solid rgba(34,36,38,.15);  border-top: 1px solid rgba(34,36,38,.15)">区域\范围</th>
 | 
				
			||||||
        <th v-for="item in items" class="center">
 | 
					        <th v-for="item in items" class="center">
 | 
				
			||||||
            {{item.name}}
 | 
					            {{item.name}}
 | 
				
			||||||
            <br/>
 | 
					            <br/>
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user