多处增加是否独立配置选项

This commit is contained in:
刘祥超
2020-09-23 18:43:38 +08:00
parent 6d6fb22d78
commit 94cdd7abb8
50 changed files with 615 additions and 267 deletions

View File

@@ -27,7 +27,7 @@ func (this *IndexAction) RunGet(params struct {
} }
this.Data["webId"] = webConfig.Id this.Data["webId"] = webConfig.Id
this.Data["charset"] = webConfig.Charset this.Data["charsetConfig"] = webConfig.Charset
this.Data["usualCharsets"] = configutils.UsualCharsets this.Data["usualCharsets"] = configutils.UsualCharsets
this.Data["allCharsets"] = configutils.AllCharsets this.Data["allCharsets"] = configutils.AllCharsets
@@ -36,14 +36,14 @@ func (this *IndexAction) RunGet(params struct {
} }
func (this *IndexAction) RunPost(params struct { func (this *IndexAction) RunPost(params struct {
WebId int64 WebId int64
Charset string CharsetJSON []byte
Must *actions.Must Must *actions.Must
}) { }) {
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebCharset(this.AdminContext(), &pb.UpdateHTTPWebCharsetRequest{ _, err := this.RPC().HTTPWebRPC().UpdateHTTPWebCharset(this.AdminContext(), &pb.UpdateHTTPWebCharsetRequest{
WebId: params.WebId, WebId: params.WebId,
Charset: params.Charset, CharsetJSON: params.CharsetJSON,
}) })
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)

View File

@@ -53,6 +53,15 @@ func (this *IndexAction) RunGet(params struct {
this.Data["gzipConfig"] = gzipConfig this.Data["gzipConfig"] = gzipConfig
if webConfig.GzipRef == nil {
webConfig.GzipRef = &serverconfigs.HTTPGzipRef{
IsPrior: false,
IsOn: false,
GzipId: 0,
}
}
this.Data["gzipRef"] = webConfig.GzipRef
this.Show() this.Show()
} }

View File

@@ -1,10 +1,11 @@
package headers package headers
import ( import (
"errors" "encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
) )
type IndexAction struct { type IndexAction struct {
@@ -24,42 +25,52 @@ func (this *IndexAction) RunGet(params struct {
this.ErrorPage(err) this.ErrorPage(err)
return return
} }
webId := webConfig.Id
// 初始化Header
webResp, err := this.RPC().HTTPWebRPC().FindEnabledHTTPWeb(this.AdminContext(), &pb.FindEnabledHTTPWebRequest{WebId: webConfig.Id})
if err != nil {
this.ErrorPage(err)
return
}
web := webResp.Web
if web == nil {
this.ErrorPage(errors.New("web should not be nil"))
return
}
isChanged := false isChanged := false
if web.RequestHeaderPolicyId <= 0 { if webConfig.RequestHeaderPolicy == nil {
createHeaderPolicyResp, err := this.RPC().HTTPHeaderPolicyRPC().CreateHTTPHeaderPolicy(this.AdminContext(), &pb.CreateHTTPHeaderPolicyRequest{}) createHeaderPolicyResp, err := this.RPC().HTTPHeaderPolicyRPC().CreateHTTPHeaderPolicy(this.AdminContext(), &pb.CreateHTTPHeaderPolicyRequest{})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)
return return
} }
headerPolicyId := createHeaderPolicyResp.HeaderPolicyId headerPolicyId := createHeaderPolicyResp.HeaderPolicyId
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebRequestHeaderPolicy(this.AdminContext(), &pb.UpdateHTTPWebRequestHeaderPolicyRequest{ ref := &shared.HTTPHeaderPolicyRef{
WebId: web.Id, IsPrior: false,
IsOn: true,
HeaderPolicyId: headerPolicyId, HeaderPolicyId: headerPolicyId,
}
refJSON, err := json.Marshal(ref)
if err != nil {
this.ErrorPage(err)
return
}
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebRequestHeader(this.AdminContext(), &pb.UpdateHTTPWebRequestHeaderRequest{
WebId: webId,
HeaderJSON: refJSON,
}) })
isChanged = true isChanged = true
} }
if web.ResponseHeaderPolicyId <= 0 { if webConfig.ResponseHeaderPolicy == nil {
createHeaderPolicyResp, err := this.RPC().HTTPHeaderPolicyRPC().CreateHTTPHeaderPolicy(this.AdminContext(), &pb.CreateHTTPHeaderPolicyRequest{}) createHeaderPolicyResp, err := this.RPC().HTTPHeaderPolicyRPC().CreateHTTPHeaderPolicy(this.AdminContext(), &pb.CreateHTTPHeaderPolicyRequest{})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)
return return
} }
headerPolicyId := createHeaderPolicyResp.HeaderPolicyId headerPolicyId := createHeaderPolicyResp.HeaderPolicyId
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebResponseHeaderPolicy(this.AdminContext(), &pb.UpdateHTTPWebResponseHeaderPolicyRequest{ ref := &shared.HTTPHeaderPolicyRef{
WebId: web.Id, IsPrior: false,
IsOn: true,
HeaderPolicyId: headerPolicyId, HeaderPolicyId: headerPolicyId,
}
refJSON, err := json.Marshal(ref)
if err != nil {
this.ErrorPage(err)
return
}
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebResponseHeader(this.AdminContext(), &pb.UpdateHTTPWebResponseHeaderRequest{
WebId: webId,
HeaderJSON: refJSON,
}) })
isChanged = true isChanged = true
} }
@@ -73,8 +84,10 @@ func (this *IndexAction) RunGet(params struct {
} }
} }
this.Data["requestHeaderPolicy"] = webConfig.RequestHeaders this.Data["requestHeaderRef"] = webConfig.RequestHeaderPolicyRef
this.Data["responseHeaderPolicy"] = webConfig.ResponseHeaders this.Data["requestHeaderPolicy"] = webConfig.RequestHeaderPolicy
this.Data["responseHeaderRef"] = webConfig.ResponseHeaderPolicyRef
this.Data["responseHeaderPolicy"] = webConfig.ResponseHeaderPolicy
this.Show() this.Show()
} }

View File

@@ -3,6 +3,7 @@ package http
import ( import (
"encoding/json" "encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs" "github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
@@ -43,6 +44,15 @@ func (this *IndexAction) RunGet(params struct {
"addresses": httpConfig.Listen, "addresses": httpConfig.Listen,
} }
// 跳转相关设置
webConfig, err := webutils.FindWebConfigWithServerId(this.Parent(), params.ServerId)
if err != nil {
this.ErrorPage(err)
return
}
this.Data["webId"] = webConfig.Id
this.Data["redirectToHTTPSConfig"] = webConfig.RedirectToHttps
this.Show() this.Show()
} }
@@ -50,6 +60,9 @@ func (this *IndexAction) RunPost(params struct {
ServerId int64 ServerId int64
Addresses string Addresses string
WebId int64
RedirectToHTTPSJSON []byte
Must *actions.Must Must *actions.Must
}) { }) {
addresses := []*serverconfigs.NetworkAddressConfig{} addresses := []*serverconfigs.NetworkAddressConfig{}
@@ -89,5 +102,16 @@ func (this *IndexAction) RunPost(params struct {
return return
} }
// 设置跳转到HTTPS
// TODO 校验设置
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebRedirectToHTTPS(this.AdminContext(), &pb.UpdateHTTPWebRedirectToHTTPSRequest{
WebId: params.WebId,
RedirectToHTTPSJSON: params.RedirectToHTTPSJSON,
})
if err != nil {
this.ErrorPage(err)
return
}
this.Success() this.Success()
} }

View File

@@ -25,7 +25,7 @@ func (this *IndexAction) RunGet(params struct {
} }
this.Data["webId"] = webConfig.Id this.Data["webId"] = webConfig.Id
this.Data["charset"] = webConfig.Charset this.Data["charsetConfig"] = webConfig.Charset
this.Data["usualCharsets"] = configutils.UsualCharsets this.Data["usualCharsets"] = configutils.UsualCharsets
this.Data["allCharsets"] = configutils.AllCharsets this.Data["allCharsets"] = configutils.AllCharsets
@@ -34,14 +34,14 @@ func (this *IndexAction) RunGet(params struct {
} }
func (this *IndexAction) RunPost(params struct { func (this *IndexAction) RunPost(params struct {
WebId int64 WebId int64
Charset string CharsetJSON []byte
Must *actions.Must Must *actions.Must
}) { }) {
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebCharset(this.AdminContext(), &pb.UpdateHTTPWebCharsetRequest{ _, err := this.RPC().HTTPWebRPC().UpdateHTTPWebCharset(this.AdminContext(), &pb.UpdateHTTPWebCharsetRequest{
WebId: params.WebId, WebId: params.WebId,
Charset: params.Charset, CharsetJSON: params.CharsetJSON,
}) })
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)

View File

@@ -53,15 +53,25 @@ func (this *IndexAction) RunGet(params struct {
this.Data["gzipConfig"] = gzipConfig this.Data["gzipConfig"] = gzipConfig
if webConfig.GzipRef == nil {
webConfig.GzipRef = &serverconfigs.HTTPGzipRef{
IsPrior: false,
IsOn: false,
GzipId: 0,
}
}
this.Data["gzipRef"] = webConfig.GzipRef
this.Show() this.Show()
} }
func (this *IndexAction) RunPost(params struct { func (this *IndexAction) RunPost(params struct {
WebId int64 WebId int64
GzipId int64 GzipRefJSON []byte
Level int GzipId int64
MinLength string Level int
MaxLength string MinLength string
MaxLength string
Must *actions.Must Must *actions.Must
}) { }) {
@@ -87,6 +97,14 @@ func (this *IndexAction) RunPost(params struct {
} }
} }
gzipRef := &serverconfigs.HTTPGzipRef{}
err := json.Unmarshal(params.GzipRefJSON, gzipRef)
if err != nil {
this.ErrorPage(err)
return
}
gzipRef.GzipId = params.GzipId
if params.GzipId > 0 { if params.GzipId > 0 {
_, err := this.RPC().HTTPGzipRPC().UpdateHTTPGzip(this.AdminContext(), &pb.UpdateHTTPGzipRequest{ _, err := this.RPC().HTTPGzipRPC().UpdateHTTPGzip(this.AdminContext(), &pb.UpdateHTTPGzipRequest{
GzipId: params.GzipId, GzipId: params.GzipId,
@@ -109,24 +127,21 @@ func (this *IndexAction) RunPost(params struct {
return return
} }
gzipId := resp.GzipId gzipId := resp.GzipId
gzipRef.GzipId = gzipId
}
gzipRef := &serverconfigs.HTTPGzipRef{ gzipRefJSON, err := json.Marshal(gzipRef)
IsOn: true, if err != nil {
GzipId: gzipId, this.ErrorPage(err)
} return
gzipRefJSON, err := json.Marshal(gzipRef) }
if err != nil {
this.ErrorPage(err)
return
}
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebGzip(this.AdminContext(), &pb.UpdateHTTPWebGzipRequest{ _, err = this.RPC().HTTPWebRPC().UpdateHTTPWebGzip(this.AdminContext(), &pb.UpdateHTTPWebGzipRequest{
WebId: params.WebId, WebId: params.WebId,
GzipJSON: gzipRefJSON, GzipJSON: gzipRefJSON,
}) })
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)
}
} }
this.Success() this.Success()

View File

@@ -1,10 +1,12 @@
package headers package headers
import ( import (
"errors" "encoding/json"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs/shared"
"github.com/iwind/TeaGo/actions"
) )
type IndexAction struct { type IndexAction struct {
@@ -23,41 +25,54 @@ func (this *IndexAction) RunGet(params struct {
return return
} }
// 初始化Header webId := webConfig.Id
webResp, err := this.RPC().HTTPWebRPC().FindEnabledHTTPWeb(this.AdminContext(), &pb.FindEnabledHTTPWebRequest{WebId: webConfig.Id}) this.Data["webId"] = webId
if err != nil {
this.ErrorPage(err)
return
}
web := webResp.Web
if web == nil {
this.ErrorPage(errors.New("web should not be nil"))
return
}
isChanged := false isChanged := false
if web.RequestHeaderPolicyId <= 0 {
if webConfig.RequestHeaderPolicy == nil {
createHeaderPolicyResp, err := this.RPC().HTTPHeaderPolicyRPC().CreateHTTPHeaderPolicy(this.AdminContext(), &pb.CreateHTTPHeaderPolicyRequest{}) createHeaderPolicyResp, err := this.RPC().HTTPHeaderPolicyRPC().CreateHTTPHeaderPolicy(this.AdminContext(), &pb.CreateHTTPHeaderPolicyRequest{})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)
return return
} }
headerPolicyId := createHeaderPolicyResp.HeaderPolicyId headerPolicyId := createHeaderPolicyResp.HeaderPolicyId
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebRequestHeaderPolicy(this.AdminContext(), &pb.UpdateHTTPWebRequestHeaderPolicyRequest{ ref := &shared.HTTPHeaderPolicyRef{
WebId: web.Id, IsPrior: false,
IsOn: true,
HeaderPolicyId: headerPolicyId, HeaderPolicyId: headerPolicyId,
}
refJSON, err := json.Marshal(ref)
if err != nil {
this.ErrorPage(err)
return
}
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebRequestHeader(this.AdminContext(), &pb.UpdateHTTPWebRequestHeaderRequest{
WebId: webId,
HeaderJSON: refJSON,
}) })
isChanged = true isChanged = true
} }
if web.ResponseHeaderPolicyId <= 0 { if webConfig.ResponseHeaderPolicy == nil {
createHeaderPolicyResp, err := this.RPC().HTTPHeaderPolicyRPC().CreateHTTPHeaderPolicy(this.AdminContext(), &pb.CreateHTTPHeaderPolicyRequest{}) createHeaderPolicyResp, err := this.RPC().HTTPHeaderPolicyRPC().CreateHTTPHeaderPolicy(this.AdminContext(), &pb.CreateHTTPHeaderPolicyRequest{})
if err != nil { if err != nil {
this.ErrorPage(err) this.ErrorPage(err)
return return
} }
headerPolicyId := createHeaderPolicyResp.HeaderPolicyId headerPolicyId := createHeaderPolicyResp.HeaderPolicyId
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebResponseHeaderPolicy(this.AdminContext(), &pb.UpdateHTTPWebResponseHeaderPolicyRequest{ ref := &shared.HTTPHeaderPolicyRef{
WebId: web.Id, IsPrior: false,
IsOn: true,
HeaderPolicyId: headerPolicyId, HeaderPolicyId: headerPolicyId,
}
refJSON, err := json.Marshal(ref)
if err != nil {
this.ErrorPage(err)
return
}
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebResponseHeader(this.AdminContext(), &pb.UpdateHTTPWebResponseHeaderRequest{
WebId: webId,
HeaderJSON: refJSON,
}) })
isChanged = true isChanged = true
} }
@@ -71,8 +86,44 @@ func (this *IndexAction) RunGet(params struct {
} }
} }
this.Data["requestHeaderPolicy"] = webConfig.RequestHeaders this.Data["requestHeaderRef"] = webConfig.RequestHeaderPolicyRef
this.Data["responseHeaderPolicy"] = webConfig.ResponseHeaders this.Data["requestHeaderPolicy"] = webConfig.RequestHeaderPolicy
this.Data["responseHeaderRef"] = webConfig.ResponseHeaderPolicyRef
this.Data["responseHeaderPolicy"] = webConfig.ResponseHeaderPolicy
this.Show() this.Show()
} }
func (this *IndexAction) RunPost(params struct {
WebId int64
Type string
RequestHeaderJSON []byte
ResponseHeaderJSON []byte
Must *actions.Must
}) {
// TODO 检查配置
switch params.Type {
case "request":
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebRequestHeader(this.AdminContext(), &pb.UpdateHTTPWebRequestHeaderRequest{
WebId: params.WebId,
HeaderJSON: params.RequestHeaderJSON,
})
if err != nil {
this.ErrorPage(err)
return
}
case "response":
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebResponseHeader(this.AdminContext(), &pb.UpdateHTTPWebResponseHeaderRequest{
WebId: params.WebId,
HeaderJSON: params.ResponseHeaderJSON,
})
if err != nil {
this.ErrorPage(err)
return
}
}
this.Success()
}

View File

@@ -15,7 +15,7 @@ func init() {
Helper(serverutils.NewServerHelper()). Helper(serverutils.NewServerHelper()).
Data("tinyMenuItem", "header"). Data("tinyMenuItem", "header").
Prefix("/servers/server/settings/locations/headers"). Prefix("/servers/server/settings/locations/headers").
Get("", new(IndexAction)). GetPost("", new(IndexAction)).
EndAll() EndAll()
}) })
} }

View File

@@ -0,0 +1,50 @@
package http
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
"github.com/iwind/TeaGo/actions"
)
type IndexAction struct {
actionutils.ParentAction
}
func (this *IndexAction) Init() {
}
func (this *IndexAction) RunGet(params struct {
LocationId int64
}) {
// 跳转相关设置
webConfig, err := webutils.FindWebConfigWithLocationId(this.Parent(), params.LocationId)
if err != nil {
this.ErrorPage(err)
return
}
this.Data["webId"] = webConfig.Id
this.Data["redirectToHTTPSConfig"] = webConfig.RedirectToHttps
this.Show()
}
func (this *IndexAction) RunPost(params struct {
WebId int64
RedirectToHTTPSJSON []byte
Must *actions.Must
}) {
// 设置跳转到HTTPS
// TODO 校验设置
_, err := this.RPC().HTTPWebRPC().UpdateHTTPWebRedirectToHTTPS(this.AdminContext(), &pb.UpdateHTTPWebRedirectToHTTPSRequest{
WebId: params.WebId,
RedirectToHTTPSJSON: params.RedirectToHTTPSJSON,
})
if err != nil {
this.ErrorPage(err)
return
}
this.Success()
}

View File

@@ -0,0 +1,21 @@
package http
import (
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/locationutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/serverutils"
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
"github.com/iwind/TeaGo"
)
func init() {
TeaGo.BeforeStart(func(server *TeaGo.Server) {
server.
Helper(helpers.NewUserMustAuth()).
Helper(locationutils.NewLocationHelper()).
Helper(serverutils.NewServerHelper()).
Data("tinyMenuItem", "http").
Prefix("/servers/server/settings/locations/http").
GetPost("", new(IndexAction)).
EndAll()
})
}

View File

@@ -55,6 +55,12 @@ func (this *LocationHelper) createMenus(serverIdString string, locationIdString
}, },
} }
menuItems = append(menuItems, maps.Map{
"name": "HTTP",
"url": "/servers/server/settings/locations/http?serverId=" + serverIdString + "&locationId=" + locationIdString,
"isActive": secondMenuItem == "http",
})
menuItems = append(menuItems, maps.Map{ menuItems = append(menuItems, maps.Map{
"name": "Web设置", "name": "Web设置",
"url": "/servers/server/settings/locations/web?serverId=" + serverIdString + "&locationId=" + locationIdString, "url": "/servers/server/settings/locations/web?serverId=" + serverIdString + "&locationId=" + locationIdString,

View File

@@ -41,6 +41,7 @@ import (
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/charset" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/charset"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/gzip" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/gzip"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/headers" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/headers"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/http"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/location" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/location"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/pages" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/pages"
_ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/reverseProxy" _ "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/locations/reverseProxy"

View File

@@ -1,5 +1,5 @@
Vue.component("http-access-log-config-box", { Vue.component("http-access-log-config-box", {
props: ["v-access-log-config", "v-fields", "v-default-field-codes", "v-access-log-policies"], props: ["v-access-log-config", "v-fields", "v-default-field-codes", "v-access-log-policies", "v-is-location"],
data: function () { data: function () {
let that = this let that = this
@@ -10,6 +10,7 @@ Vue.component("http-access-log-config-box", {
}, 100) }, 100)
let accessLog = { let accessLog = {
isPrior: false,
isOn: true, isOn: true,
fields: [], fields: [],
status1: true, status1: true,
@@ -59,7 +60,8 @@ Vue.component("http-access-log-config-box", {
template: `<div> template: `<div>
<input type="hidden" name="accessLogJSON" :value="JSON.stringify(accessLog)"/> <input type="hidden" name="accessLogJSON" :value="JSON.stringify(accessLog)"/>
<table class="ui table definition selectable"> <table class="ui table definition selectable">
<tbody> <prior-checkbox :v-config="accessLog" v-if="vIsLocation"></prior-checkbox>
<tbody v-show="!vIsLocation || accessLog.isPrior">
<tr> <tr>
<td class="title">是否开启访问日志存储</td> <td class="title">是否开启访问日志存储</td>
<td> <td>
@@ -71,7 +73,7 @@ Vue.component("http-access-log-config-box", {
</td> </td>
</tr> </tr>
</tbody> </tbody>
<tbody v-show="accessLog.isOn"> <tbody v-show="(!vIsLocation || accessLog.isPrior) && accessLog.isOn">
<tr> <tr>
<td>要存储的访问日志字段</td> <td>要存储的访问日志字段</td>
<td> <td>

View File

@@ -1,9 +1,10 @@
Vue.component("http-cache-config-box", { Vue.component("http-cache-config-box", {
props: ["v-cache-config", "v-cache-policies"], props: ["v-cache-config", "v-cache-policies", "v-is-location"],
data: function () { data: function () {
let cacheConfig = this.vCacheConfig let cacheConfig = this.vCacheConfig
if (cacheConfig == null) { if (cacheConfig == null) {
cacheConfig = { cacheConfig = {
isPrior: false,
isOn: false, isOn: false,
cachePolicyId: 0 cachePolicyId: 0
} }
@@ -20,30 +21,31 @@ Vue.component("http-cache-config-box", {
template: `<div> template: `<div>
<input type="hidden" name="cacheJSON" :value="JSON.stringify(cacheConfig)"/> <input type="hidden" name="cacheJSON" :value="JSON.stringify(cacheConfig)"/>
<table class="ui table definition selectable"> <table class="ui table definition selectable">
<tbody> <prior-checkbox :v-config="cacheConfig" v-if="vIsLocation"></prior-checkbox>
<tr> <tbody v-show="!vIsLocation || cacheConfig.isPrior">
<td class="title">是否开启缓存</td> <tr>
<td> <td class="title">是否开启缓存</td>
<div class="ui checkbox"> <td>
<input type="checkbox" v-model="cacheConfig.isOn"/> <div class="ui checkbox">
<label></label> <input type="checkbox" v-model="cacheConfig.isOn"/>
</div> <label></label>
</td> </div>
</tr> </td>
</tr>
</tbody> </tbody>
<tbody v-show="cacheConfig.isOn"> <tbody v-show="(!vIsLocation || cacheConfig.isPrior) && cacheConfig.isOn">
<tr> <tr>
<td class="title">选择缓存策略</td> <td class="title">选择缓存策略</td>
<td> <td>
<span class="disabled" v-if="vCachePolicies.length == 0">暂时没有可选的缓存策略</span> <span class="disabled" v-if="vCachePolicies.length == 0">暂时没有可选的缓存策略</span>
<div v-if="vCachePolicies.length > 0"> <div v-if="vCachePolicies.length > 0">
<select class="ui dropdown auto-width" v-model="cacheConfig.cachePolicyId" @change="changePolicyId"> <select class="ui dropdown auto-width" v-model="cacheConfig.cachePolicyId" @change="changePolicyId">
<option value="0">[不使用缓存策略]</option> <option value="0">[不使用缓存策略]</option>
<option v-for="policy in vCachePolicies" :value="policy.id">{{policy.name}}</option> <option v-for="policy in vCachePolicies" :value="policy.id">{{policy.name}}</option>
</select> </select>
</div> </div>
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div class="margin"></div> <div class="margin"></div>

View File

@@ -1,27 +1,46 @@
Vue.component("http-charsets-box", { Vue.component("http-charsets-box", {
props: ["v-usual-charsets", "v-all-charsets", "v-charset"], props: ["v-usual-charsets", "v-all-charsets", "v-charset-config", "v-is-location"],
data: function () { data: function () {
let charset = this.vCharset let charsetConfig = this.vCharsetConfig
if (charset == null) { if (charsetConfig == null) {
charset = "" charsetConfig = {
isPrior: false,
isOn: false,
charset: ""
}
} }
return { return {
charset: charset charsetConfig: charsetConfig
} }
}, },
template: `<div> template: `<div>
<input type="hidden" name="charsetJSON" :value="JSON.stringify(charsetConfig)"/>
<table class="ui table definition selectable"> <table class="ui table definition selectable">
<tr> <prior-checkbox :v-config="charsetConfig" v-if="vIsLocation"></prior-checkbox>
<td class="title">选择字符编码</td> <tbody v-show="!vIsLocation || charsetConfig.isPrior">
<td><select class="ui dropdown" style="width:20em" name="charset" v-model="charset"> <tr>
<option value="">[未选择]</option> <td class="title">是否启用</td>
<optgroup label="常用字符编码"></optgroup> <td>
<option v-for="charset in vUsualCharsets" :value="charset.charset">{{charset.charset}}{{charset.name}}</option> <div class="ui checkbox">
<optgroup label="全部字符编码"></optgroup> <input type="checkbox" v-model="charsetConfig.isOn"/>
<option v-for="charset in vAllCharsets" :value="charset.charset">{{charset.charset}}{{charset.name}}</option> <label></label>
</select> </div>
</td> </td>
</tr> </tr>
</tbody>
<tbody v-show="(!vIsLocation || charsetConfig.isPrior) && charsetConfig.isOn">
<tr>
<td class="title">选择字符编码</td>
<td><select class="ui dropdown" style="width:20em" name="charset" v-model="charsetConfig.charset">
<option value="">[未选择]</option>
<optgroup label="常用字符编码"></optgroup>
<option v-for="charset in vUsualCharsets" :value="charset.charset">{{charset.charset}}{{charset.name}}</option>
<optgroup label="全部字符编码"></optgroup>
<option v-for="charset in vAllCharsets" :value="charset.charset">{{charset.charset}}{{charset.name}}</option>
</select>
</td>
</tr>
</tbody>
</table> </table>
<div class="margin"></div> <div class="margin"></div>
</div>` </div>`

View File

@@ -1,9 +1,10 @@
Vue.component("http-firewall-config-box", { Vue.component("http-firewall-config-box", {
props: ["v-firewall-config", "v-firewall-policies"], props: ["v-firewall-config", "v-firewall-policies", "v-is-location"],
data: function () { data: function () {
let firewall = this.vFirewallConfig let firewall = this.vFirewallConfig
if (firewall == null) { if (firewall == null) {
firewall = { firewall = {
isPrior: false,
isOn: false, isOn: false,
firewallPolicyId: 0 firewallPolicyId: 0
} }
@@ -21,7 +22,8 @@ Vue.component("http-firewall-config-box", {
template: `<div> template: `<div>
<input type="hidden" name="firewallJSON" :value="JSON.stringify(firewall)"/> <input type="hidden" name="firewallJSON" :value="JSON.stringify(firewall)"/>
<table class="ui table selectable definition"> <table class="ui table selectable definition">
<tbody> <prior-checkbox :v-config="firewall" v-if="vIsLocation"></prior-checkbox>
<tbody v-show="!vIsLocation || firewall.isPrior">
<tr> <tr>
<td class="title">是否启用Web防火墙</td> <td class="title">是否启用Web防火墙</td>
<td> <td>
@@ -32,7 +34,7 @@ Vue.component("http-firewall-config-box", {
</td> </td>
</tr> </tr>
</tbody> </tbody>
<tbody v-show="firewall.isOn"> <tbody v-show="(!vIsLocation || firewall.isPrior) && firewall.isOn">
<tr> <tr>
<td>选择Web防火墙策略</td> <td>选择Web防火墙策略</td>
<td> <td>

View File

@@ -1,5 +1,5 @@
Vue.component("http-gzip-box", { Vue.component("http-gzip-box", {
props: ["v-gzip-config"], props: ["v-gzip-config", "v-gzip-ref", "v-is-location"],
data: function () { data: function () {
let gzip = this.vGzipConfig let gzip = this.vGzipConfig
if (gzip == null) { if (gzip == null) {
@@ -16,31 +16,35 @@ Vue.component("http-gzip-box", {
} }
}, },
template: `<div> template: `<div>
<input type="hidden" name="gzipRefJSON" :value="JSON.stringify(vGzipRef)"/>
<table class="ui table selectable definition"> <table class="ui table selectable definition">
<tr> <prior-checkbox :v-config="vGzipRef" v-if="vIsLocation"></prior-checkbox>
<td class="title">压缩级别</td> <tbody v-show="!vIsLocation || vGzipRef.isPrior">
<td> <tr>
<select class="dropdown auto-width" name="level" v-model="gzip.level"> <td class="title">压缩级别</td>
<option value="0">不压缩</option> <td>
<option v-for="i in 9" :value="i">{{i}}</option> <select class="dropdown auto-width" name="level" v-model="gzip.level">
</select> <option value="0">不压缩</option>
<p class="comment">级别越高,压缩比例越大。</p> <option v-for="i in 9" :value="i">{{i}}</option>
</td> </select>
</tr> <p class="comment">级别越高,压缩比例越大。</p>
<tr> </td>
<td>Gzip内容最小长度</td> </tr>
<td> <tr>
<size-capacity-box :v-name="'minLength'" :v-value="gzip.minLength" :v-unit="'kb'"></size-capacity-box> <td>Gzip内容最小长度</td>
<p class="comment">0表示不限制内容长度从文件尺寸或Content-Length中获取。</p> <td>
</td> <size-capacity-box :v-name="'minLength'" :v-value="gzip.minLength" :v-unit="'kb'"></size-capacity-box>
</tr> <p class="comment">0表示不限制内容长度从文件尺寸或Content-Length中获取。</p>
<tr> </td>
<td>Gzip内容最大长度</td> </tr>
<td> <tr>
<size-capacity-box :v-name="'maxLength'" :v-value="gzip.maxLength" :v-unit="'mb'"></size-capacity-box> <td>Gzip内容最大长度</td>
<p class="comment">0表示不限制内容长度从文件尺寸或Content-Length中获取。</p> <td>
</td> <size-capacity-box :v-name="'maxLength'" :v-value="gzip.maxLength" :v-unit="'mb'"></size-capacity-box>
</tr> <p class="comment">0表示不限制内容长度从文件尺寸或Content-Length中获取。</p>
</td>
</tr>
</tbody>
</table> </table>
</div>` </div>`
}) })

View File

@@ -1,5 +1,5 @@
Vue.component("http-header-policy-box", { Vue.component("http-header-policy-box", {
props: ["v-request-header-policy", "v-response-header-policy", "v-params"], props: ["v-request-header-policy", "v-request-header-ref", "v-response-header-policy", "v-response-header-ref", "v-params", "v-is-location"],
data: function () { data: function () {
let type = "request" let type = "request"
let hash = window.location.hash let hash = window.location.hash
@@ -7,6 +7,25 @@ Vue.component("http-header-policy-box", {
type = "response" type = "response"
} }
// ref
let requestHeaderRef = this.vRequestHeaderRef
if (requestHeaderRef == null) {
requestHeaderRef = {
isPrior: false,
isOn: true,
headerPolicyId: 0
}
}
let responseHeaderRef = this.vResponseHeaderRef
if (responseHeaderRef == null) {
responseHeaderRef = {
isPrior: false,
isOn: true,
headerPolicyId: 0
}
}
// 请求相关 // 请求相关
let requestSettingHeaders = [] let requestSettingHeaders = []
let requestDeletingHeaders = [] let requestDeletingHeaders = []
@@ -37,6 +56,9 @@ Vue.component("http-header-policy-box", {
return { return {
type: type, type: type,
typeName: (type == "request") ? "请求" : "响应",
requestHeaderRef: requestHeaderRef,
responseHeaderRef: responseHeaderRef,
requestSettingHeaders: requestSettingHeaders, requestSettingHeaders: requestSettingHeaders,
requestDeletingHeaders: requestDeletingHeaders, requestDeletingHeaders: requestDeletingHeaders,
responseSettingHeaders: responseSettingHeaders, responseSettingHeaders: responseSettingHeaders,
@@ -47,6 +69,7 @@ Vue.component("http-header-policy-box", {
selectType: function (type) { selectType: function (type) {
this.type = type this.type = type
window.location.hash = "#" + type window.location.hash = "#" + type
window.location.reload()
}, },
addSettingHeader: function (policyId) { addSettingHeader: function (policyId) {
teaweb.popup("/servers/server/settings/headers/createSetPopup?" + this.vParams + "&headerPolicyId=" + policyId, { teaweb.popup("/servers/server/settings/headers/createSetPopup?" + this.vParams + "&headerPolicyId=" + policyId, {
@@ -101,9 +124,19 @@ Vue.component("http-header-policy-box", {
<div class="margin"></div> <div class="margin"></div>
<input type="hidden" name="type" :value="type"/>
<!-- 请求 --> <!-- 请求 -->
<div v-if="type == 'request'"> <div v-if="vIsLocation && type == 'request'">
<h3>设置Header <a href="" @click.prevent="addSettingHeader(vRequestHeaderPolicy.id)">[添加新Header]</a></h3> <input type="hidden" name="requestHeaderJSON" :value="JSON.stringify(requestHeaderRef)"/>
<table class="ui table definition selectable">
<prior-checkbox :v-config="requestHeaderRef"></prior-checkbox>
</table>
<submit-btn></submit-btn>
</div>
<div v-if="(!vIsLocation || requestHeaderRef.isPrior) && type == 'request'">
<h3>设置请求Header <a href="" @click.prevent="addSettingHeader(vRequestHeaderPolicy.id)">[添加新Header]</a></h3>
<p class="comment" v-if="requestSettingHeaders.length == 0">暂时还没有Header。</p> <p class="comment" v-if="requestSettingHeaders.length == 0">暂时还没有Header。</p>
<table class="ui table selectable" v-if="requestSettingHeaders.length > 0"> <table class="ui table selectable" v-if="requestSettingHeaders.length > 0">
<thead> <thead>
@@ -120,7 +153,7 @@ Vue.component("http-header-policy-box", {
</tr> </tr>
</table> </table>
<h3>删除Header</h3> <h3>删除请求Header</h3>
<p class="comment">这里可以设置需要从请求中删除的Header。</p> <p class="comment">这里可以设置需要从请求中删除的Header。</p>
<table class="ui table definition selectable"> <table class="ui table definition selectable">
@@ -136,8 +169,16 @@ Vue.component("http-header-policy-box", {
</div> </div>
<!-- 响应 --> <!-- 响应 -->
<div v-if="vIsLocation && type == 'response'">
<input type="hidden" name="responseHeaderJSON" :value="JSON.stringify(responseHeaderRef)"/>
<table class="ui table definition selectable">
<prior-checkbox :v-config="responseHeaderRef"></prior-checkbox>
</table>
<submit-btn></submit-btn>
</div>
<div v-if="type == 'response'"> <div v-if="type == 'response'">
<h3>设置Header <a href="" @click.prevent="addSettingHeader(vResponseHeaderPolicy.id)">[添加新Header]</a></h3> <h3>设置响应Header <a href="" @click.prevent="addSettingHeader(vResponseHeaderPolicy.id)">[添加新Header]</a></h3>
<p class="comment" v-if="responseSettingHeaders.length == 0">暂时还没有Header。</p> <p class="comment" v-if="responseSettingHeaders.length == 0">暂时还没有Header。</p>
<table class="ui table selectable" v-if="responseSettingHeaders.length > 0"> <table class="ui table selectable" v-if="responseSettingHeaders.length > 0">
<thead> <thead>
@@ -154,7 +195,7 @@ Vue.component("http-header-policy-box", {
</tr> </tr>
</table> </table>
<h3>删除Header</h3> <h3>删除响应Header</h3>
<p class="comment">这里可以设置需要从响应中删除的Header。</p> <p class="comment">这里可以设置需要从响应中删除的Header。</p>
<table class="ui table definition selectable"> <table class="ui table definition selectable">
@@ -168,6 +209,6 @@ Vue.component("http-header-policy-box", {
</td> </td>
</table> </table>
</div> </div>
<div class="margin"></div>
</div>` </div>`
}) })

View File

@@ -0,0 +1,45 @@
Vue.component("http-redirect-to-https-box", {
props: ["v-redirect-to-https-config", "v-is-location"],
data: function () {
let redirectToHttpsConfig = this.vRedirectToHttpsConfig
if (redirectToHttpsConfig == null) {
redirectToHttpsConfig = {
isPrior: false,
isOn: false
}
}
return {
redirectToHttpsConfig: redirectToHttpsConfig
}
},
template: `<div>
<input type="hidden" name="redirectToHTTPSJSON" :value="JSON.stringify(redirectToHttpsConfig)"/>
<!-- Location -->
<table class="ui table selectable definition" v-if="vIsLocation">
<prior-checkbox :v-config="redirectToHttpsConfig"></prior-checkbox>
<tbody v-show="redirectToHttpsConfig.isPrior">
<tr>
<td class="title">自动跳转到HTTPS</td>
<td>
<div class="ui checkbox">
<input type="checkbox" v-model="redirectToHttpsConfig.isOn"/>
<label></label>
</div>
<p class="comment">开启后所有HTTP的请求都会自动跳转到对应的HTTPS URL上。</p>
</td>
</tr>
</tbody>
</table>
<!-- 非Location -->
<div v-if="!vIsLocation">
<div class="ui checkbox">
<input type="checkbox" v-model="redirectToHttpsConfig.isOn"/>
<label></label>
</div>
<p class="comment">开启后所有HTTP的请求都会自动跳转到对应的HTTPS URL上。</p>
</div>
<div class="margin"></div>
</div>`
})

View File

@@ -1,9 +1,10 @@
Vue.component("http-stat-config-box", { Vue.component("http-stat-config-box", {
props: ["v-stat-config"], props: ["v-stat-config", "v-is-location"],
data: function () { data: function () {
let stat = this.vStatConfig let stat = this.vStatConfig
if (stat == null) { if (stat == null) {
stat = { stat = {
isPrior: false,
isOn: true isOn: true
} }
} }
@@ -14,15 +15,18 @@ Vue.component("http-stat-config-box", {
template: `<div> template: `<div>
<input type="hidden" name="statJSON" :value="JSON.stringify(stat)"/> <input type="hidden" name="statJSON" :value="JSON.stringify(stat)"/>
<table class="ui table definition selectable"> <table class="ui table definition selectable">
<tr> <prior-checkbox :v-config="stat" v-if="vIsLocation" ></prior-checkbox>
<td class="title">是否开启统计</td> <tbody v-show="!vIsLocation || stat.isPrior">
<td> <tr>
<div class="ui checkbox"> <td class="title">是否开启统计</td>
<input type="checkbox" v-model="stat.isOn"/> <td>
<label></label> <div class="ui checkbox">
</div> <input type="checkbox" v-model="stat.isOn"/>
</td> <label></label>
</tr> </div>
</td>
</tr>
</tbody>
</table> </table>
<div class="margin"></div> <div class="margin"></div>
</div>` </div>`

View File

@@ -0,0 +1,25 @@
Vue.component("prior-checkbox", {
props: ["v-config"],
data: function () {
return {
isPrior: this.vConfig.isPrior
}
},
watch: {
isPrior: function (v) {
this.vConfig.isPrior = v
}
},
template: `<tbody>
<tr :class="{active:isPrior}">
<td class="title">打开独立配置</td>
<td>
<div class="ui toggle checkbox">
<input type="checkbox" v-model="isPrior"/>
<label class="red"></label>
</div>
<p class="comment"><strong v-if="isPrior">[已打开]</strong> 打开后可以覆盖父级配置。</p>
</td>
</tr>
</tbody>`
})

View File

@@ -0,0 +1,34 @@
Vue.component("reverse-proxy-box", {
props: ["v-reverse-proxy-ref", "v-is-location"],
data: function () {
let reverseProxyRef = this.vReverseProxyRef
if (reverseProxyRef == null) {
reverseProxyRef = {
isPrior: false,
isOn: false,
reverseProxyId: 0
}
}
return {
reverseProxyRef: reverseProxyRef
}
},
template: `<div>
<input type="hidden" name="reverseProxyRefJSON" :value="JSON.stringify(reverseProxyRef)"/>
<table class="ui table selectable definition">
<prior-checkbox :v-config="reverseProxyRef" v-if="vIsLocation"></prior-checkbox>
<tbody v-show="!vIsLocation || reverseProxyRef.isPrior">
<tr>
<td class="title">是否启用反向代理</td>
<td>
<div class="ui checkbox">
<input type="checkbox" v-model="reverseProxyRef.isOn"/>
<label></label>
</div>
</td>
</tr>
</tbody>
</table>
<div class="margin"></div>
</div>`
})

View File

@@ -111,6 +111,9 @@ tbody {
.table td { .table td {
font-size: 0.9em !important; font-size: 0.9em !important;
} }
.table tr.active td {
background: rgba(0, 0, 0, 0.01) !important;
}
p.comment, p.comment,
div.comment { div.comment {
color: rgba(0, 0, 0, 0.3); color: rgba(0, 0, 0, 0.3);

File diff suppressed because one or more lines are too long

View File

@@ -6,8 +6,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=0">
<link rel="shortcut icon" href="/images/favicon.png"/> <link rel="shortcut icon" href="/images/favicon.png"/>
<link rel="stylesheet" type="text/css" href="/_/@default/@layout.css" media="all"/> <link rel="stylesheet" type="text/css" href="/_/@default/@layout.css" media="all"/>
{$TEA.SEMANTIC} {$TEA.SEMANTIC}
<link rel="stylesheet" type="text/css" href="/_/@default/@layout_override.css" media="all"/>
{$TEA.VUE} {$TEA.VUE}
{$echo "header"} {$echo "header"}
<script type="text/javascript" src="/_/@default/@layout.js"></script> <script type="text/javascript" src="/_/@default/@layout.js"></script>

View File

@@ -2,6 +2,10 @@ Tea.context(function () {
this.moreOptionsVisible = false; this.moreOptionsVisible = false;
this.globalChangedClusters = []; this.globalChangedClusters = [];
if (typeof this.leftMenuItemIsDisabled == "undefined") {
this.leftMenuItemIsDisabled = false
}
this.$delay(function () { this.$delay(function () {
if (this.$refs.focus != null) { if (this.$refs.focus != null) {
this.$refs.focus.focus(); this.$refs.focus.focus();

View File

@@ -57,6 +57,10 @@ tbody {
font-size: 0.9em !important; font-size: 0.9em !important;
} }
.table tr.active td {
background: rgba(0, 0, 0, 0.01) !important;
}
p.comment, div.comment { p.comment, div.comment {
color: rgba(0, 0, 0, 0.3); color: rgba(0, 0, 0, 0.3);
padding-top: 0.4em; padding-top: 0.4em;

View File

@@ -0,0 +1,9 @@
.ui.toggle.checkbox input:focus:checked ~ .box:before,
.ui.toggle.checkbox input:focus:checked ~ label:before {
background-color: #21ba45 !important;
}
.ui.toggle.checkbox input:checked ~ .box:before,
.ui.toggle.checkbox input:checked ~ label:before {
background-color: #21ba45 !important;
}
/*# sourceMappingURL=@layout_override.css.map */

View File

@@ -0,0 +1 @@
{"version":3,"sources":["@layout_override.less"],"names":[],"mappings":"AACA,GAAG,OAAO,SAAU,MAAK,MAAM,QAAS,OAAM;AAAS,GAAG,OAAO,SAAU,MAAK,MAAM,QAAS,QAAO;EACrG,oCAAA;;AAGD,GAAG,OAAO,SAAU,MAAK,QAAS,OAAM;AAAS,GAAG,OAAO,SAAU,MAAK,QAAS,QAAO;EACzF,oCAAA","file":"@layout_override.css"}

View File

@@ -0,0 +1,8 @@
// labels
.ui.toggle.checkbox input:focus:checked ~ .box:before, .ui.toggle.checkbox input:focus:checked ~ label:before {
background-color: #21ba45 !important;
}
.ui.toggle.checkbox input:checked ~ .box:before, .ui.toggle.checkbox input:checked ~ label:before {
background-color: #21ba45 !important;
}

View File

@@ -5,7 +5,7 @@
<div class="right-box"> <div class="right-box">
<form class="ui form" data-tea-action="$" data-tea-success="success"> <form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/> <input type="hidden" name="webId" :value="webId"/>
<http-charsets-box :v-usual-charsets="usualCharsets" :v-all-charsets="allCharsets" :v-charset="charset"></http-charsets-box> <http-charsets-box :v-usual-charsets="usualCharsets" :v-all-charsets="allCharsets" :v-charset-config="charsetConfig"></http-charsets-box>
<submit-btn></submit-btn> <submit-btn></submit-btn>
</form> </form>
</div> </div>

View File

@@ -5,6 +5,7 @@
<div class="right-box"> <div class="right-box">
<form class="ui form" data-tea-action="$" data-tea-success="success"> <form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="serverId" :value="serverId"/> <input type="hidden" name="serverId" :value="serverId"/>
<input type="hidden" name="webId" :value="webId"/>
<input type="hidden" name="serverType" :value="serverType"/> <input type="hidden" name="serverType" :value="serverType"/>
<table class="ui table selectable definition"> <table class="ui table selectable definition">
<tr> <tr>
@@ -13,6 +14,12 @@
<network-addresses-box :v-server-type="serverType" :v-addresses="httpConfig.addresses" :v-protocol="'http'"></network-addresses-box> <network-addresses-box :v-server-type="serverType" :v-addresses="httpConfig.addresses" :v-protocol="'http'"></network-addresses-box>
</td> </td>
</tr> </tr>
<tr>
<td>自动跳转到HTTPS</td>
<td>
<http-redirect-to-https-box :v-redirect-to-https-config="redirectToHTTPSConfig"></http-redirect-to-https-box>
</td>
</tr>
</table> </table>
<submit-btn></submit-btn> <submit-btn></submit-btn>
</form> </form>

View File

@@ -13,7 +13,8 @@
:v-access-log-config="accessLogConfig" :v-access-log-config="accessLogConfig"
:v-fields="fields" :v-fields="fields"
:v-default-field-codes="defaultFieldCodes" :v-default-field-codes="defaultFieldCodes"
:v-access-log-policies="accessLogPolicies"></http-access-log-config-box> :v-access-log-policies="accessLogPolicies"
:v-is-location="true"></http-access-log-config-box>
<submit-btn></submit-btn> <submit-btn></submit-btn>
</form> </form>
</div> </div>

View File

@@ -9,7 +9,7 @@
<div class="right-box tiny"> <div class="right-box tiny">
<form class="ui form" data-tea-action="$" data-tea-success="success"> <form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/> <input type="hidden" name="webId" :value="webId"/>
<http-cache-config-box :v-cache-config="cacheConfig" :v-cache-policies="policies"></http-cache-config-box> <http-cache-config-box :v-cache-config="cacheConfig" :v-cache-policies="policies" :v-is-location="true"></http-cache-config-box>
<submit-btn></submit-btn> <submit-btn></submit-btn>
</form> </form>
</div> </div>

View File

@@ -10,7 +10,7 @@
<div class="margin"></div> <div class="margin"></div>
<form class="ui form" data-tea-action="$" data-tea-success="success"> <form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/> <input type="hidden" name="webId" :value="webId"/>
<http-charsets-box :v-usual-charsets="usualCharsets" :v-all-charsets="allCharsets" :v-charset="charset"></http-charsets-box> <http-charsets-box :v-usual-charsets="usualCharsets" :v-all-charsets="allCharsets" :v-charset-config="charsetConfig" :v-is-location="true"></http-charsets-box>
<submit-btn></submit-btn> <submit-btn></submit-btn>
</form> </form>
</div> </div>

View File

@@ -12,7 +12,7 @@
<input type="hidden" name="webId" :value="webId"/> <input type="hidden" name="webId" :value="webId"/>
<input type="hidden" name="gzipId" :value="gzipConfig.id"/> <input type="hidden" name="gzipId" :value="gzipConfig.id"/>
<http-gzip-box :v-gzip-config="gzipConfig"></http-gzip-box> <http-gzip-box :v-gzip-ref="gzipRef" :v-gzip-config="gzipConfig" :v-is-location="true"></http-gzip-box>
<div class="margin"></div> <div class="margin"></div>
<submit-btn></submit-btn> <submit-btn></submit-btn>

View File

@@ -1,15 +0,0 @@
{$layout "layout_popup"}
<h3>添加需要删除的Header</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="headerPolicyId" :value="headerPolicyId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">名称<em>Name</em></td>
<td>
<input type="text" name="name" maxlength="100" ref="focus"/>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -1,22 +0,0 @@
{$layout "layout_popup"}
<h3>设置Header</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="serverId" :value="serverId"/>
<input type="hidden" name="headerPolicyId" :value="headerPolicyId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">名称<em>Name</em></td>
<td>
<input type="text" name="name" value="" maxlength="200" placeholder="类似于Server、Content-Type之类" ref="focus"/>
</td>
</tr>
<tr>
<td><em>Value</em></td>
<td>
<input type="text" name="value" maxlength="500"/>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -7,6 +7,15 @@
{$template "../left_menu"} {$template "../left_menu"}
<div class="right-box tiny"> <div class="right-box tiny">
<http-header-policy-box :v-request-header-policy="requestHeaderPolicy" :v-response-header-policy="responseHeaderPolicy" :v-params="'serverId=' + serverId"></http-header-policy-box> <form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-header-policy-box
:v-request-header-policy="requestHeaderPolicy"
:v-request-header-ref="requestHeaderRef"
:v-response-header-policy="responseHeaderPolicy"
:v-response-header-ref="responseHeaderRef"
:v-params="'serverId=' + serverId"
:v-is-location="true"></http-header-policy-box>
</form>
</div> </div>
</div> </div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -1,23 +0,0 @@
{$layout "layout_popup"}
<h3>修改Header</h3>
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="serverId" :value="serverId"/>
<input type="hidden" name="headerPolicyId" :value="headerPolicyId"/>
<input type="hidden" name="headerId" :value="headerId"/>
<table class="ui table definition selectable">
<tr>
<td class="title">名称<em>Name</em></td>
<td>
<input type="text" name="name" value="" v-model="headerConfig.name" maxlength="200" placeholder="类似于Server、Content-Type之类" ref="focus"/>
</td>
</tr>
<tr>
<td><em>Value</em></td>
<td>
<input type="text" name="value" v-model="headerConfig.value" maxlength="500"/>
</td>
</tr>
</table>
<submit-btn></submit-btn>
</form>

View File

@@ -1,3 +0,0 @@
Tea.context(function () {
this.success = NotifyPopup
})

View File

@@ -0,0 +1,16 @@
{$layout}
{$template "/left_menu"}
<div class="right-box">
{$template "../location_menu"}
{$template "../left_menu"}
<div class="right-box tiny">
<form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/>
<http-redirect-to-https-box :v-redirect-to-https-config="redirectToHTTPSConfig" :v-is-location="true"></http-redirect-to-https-box>
<submit-btn></submit-btn>
</form>
</div>
</div>

View File

@@ -0,0 +1,3 @@
Tea.context(function () {
this.success = NotifyReloadSuccess("保存成功")
})

View File

@@ -10,25 +10,15 @@
<div class="margin"></div> <div class="margin"></div>
<form class="ui form" data-tea-action="$" data-tea-success="success"> <form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="locationId" :value="locationId"/> <input type="hidden" name="locationId" :value="locationId"/>
<input type="hidden" name="reverseProxyRefJSON" :value="JSON.stringify(reverseProxyRef)"/> <reverse-proxy-box :v-reverse-proxy-ref="reverseProxyRef" :v-is-location="true"></reverse-proxy-box>
<table class="ui table selectable definition">
<tr>
<td class="title">是否启用反向代理</td>
<td>
<div class="ui checkbox">
<input type="checkbox" v-model="reverseProxyRef.isOn"/>
<label></label>
</div>
</td>
</tr>
</table>
<submit-btn></submit-btn> <submit-btn></submit-btn>
</form> </form>
<div v-if="reverseProxyRef.isOn"> <div v-if="reverseProxyRef.isPrior && reverseProxyRef.isOn">
<div class="ui divider"></div> <div class="ui divider"></div>
<origin-list-box :v-primary-origins="primaryOrigins" :v-backup-origins="backupOrigins" :v-server-type="serverType" <origin-list-box :v-primary-origins="primaryOrigins" :v-backup-origins="backupOrigins"
:v-params="'type=server&serverId=' + serverId + '&reverseProxyId=' + reverseProxyConfig.id"></origin-list-box> :v-server-type="serverType"
:v-params="'type=server&serverId=' + serverId + '&reverseProxyId=' + reverseProxyConfig.id"></origin-list-box>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -9,7 +9,7 @@
<div class="right-box tiny"> <div class="right-box tiny">
<form class="ui form" data-tea-action="$" data-tea-success="success"> <form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/> <input type="hidden" name="webId" :value="webId"/>
<http-stat-config-box :v-stat-config="statConfig"></http-stat-config-box> <http-stat-config-box :v-stat-config="statConfig" :v-is-location="true"></http-stat-config-box>
<submit-btn></submit-btn> <submit-btn></submit-btn>
</form> </form>
</div> </div>

View File

@@ -9,7 +9,7 @@
<div class="right-box tiny"> <div class="right-box tiny">
<form class="ui form" data-tea-action="$" data-tea-success="success"> <form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="webId" :value="webId"/> <input type="hidden" name="webId" :value="webId"/>
<http-firewall-config-box :v-firewall-config="firewallConfig" :v-firewall-policies="firewallPolicies"></http-firewall-config-box> <http-firewall-config-box :v-firewall-config="firewallConfig" :v-firewall-policies="firewallPolicies" :v-is-location="true"></http-firewall-config-box>
<submit-btn></submit-btn> <submit-btn></submit-btn>
</form> </form>
</div> </div>

View File

@@ -8,17 +8,7 @@
<form class="ui form" data-tea-action="$" data-tea-success="success"> <form class="ui form" data-tea-action="$" data-tea-success="success">
<input type="hidden" name="serverId" :value="serverId"/> <input type="hidden" name="serverId" :value="serverId"/>
<input type="hidden" name="reverseProxyRefJSON" :value="JSON.stringify(reverseProxyRef)"/> <input type="hidden" name="reverseProxyRefJSON" :value="JSON.stringify(reverseProxyRef)"/>
<table class="ui table selectable definition"> <reverse-proxy-box :v-reverse-proxy-ref="reverseProxyRef"></reverse-proxy-box>
<tr>
<td class="title">是否启用反向代理</td>
<td>
<div class="ui checkbox">
<input type="checkbox" v-model="reverseProxyRef.isOn"/>
<label></label>
</div>
</td>
</tr>
</table>
<submit-btn></submit-btn> <submit-btn></submit-btn>
</form> </form>