diff --git a/internal/web/actions/default/servers/groups/group/settings/pages/index.go b/internal/web/actions/default/servers/groups/group/settings/pages/index.go index edad89a5..b2307f92 100644 --- a/internal/web/actions/default/servers/groups/group/settings/pages/index.go +++ b/internal/web/actions/default/servers/groups/group/settings/pages/index.go @@ -1,6 +1,7 @@ package pages -import ( "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" +import ( + "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils" "github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/groups/group/servergrouputils" "github.com/TeaOSLab/EdgeCommon/pkg/langs/codes" "github.com/TeaOSLab/EdgeCommon/pkg/rpc/dao" @@ -33,6 +34,7 @@ func (this *IndexAction) RunGet(params struct { } this.Data["webId"] = webConfig.Id + this.Data["enableGlobalPages"] = webConfig.EnableGlobalPages this.Data["pages"] = webConfig.Pages this.Data["shutdownConfig"] = webConfig.Shutdown @@ -40,17 +42,27 @@ func (this *IndexAction) RunGet(params struct { } func (this *IndexAction) RunPost(params struct { - WebId int64 - PagesJSON string - ShutdownJSON string - Must *actions.Must + WebId int64 + EnableGlobalPages bool + PagesJSON string + ShutdownJSON string + Must *actions.Must }) { // 日志 defer this.CreateLogInfo(codes.ServerPage_LogUpdatePages, params.WebId) // TODO 检查配置 - _, err := this.RPC().HTTPWebRPC().UpdateHTTPWebPages(this.AdminContext(), &pb.UpdateHTTPWebPagesRequest{ + _, err := this.RPC().HTTPWebRPC().UpdateHTTPWebGlobalPagesEnabled(this.AdminContext(), &pb.UpdateHTTPWebGlobalPagesEnabledRequest{ + HttpWebId: params.WebId, + IsEnabled: params.EnableGlobalPages, + }) + if err != nil { + this.ErrorPage(err) + return + } + + _, err = this.RPC().HTTPWebRPC().UpdateHTTPWebPages(this.AdminContext(), &pb.UpdateHTTPWebPagesRequest{ HttpWebId: params.WebId, PagesJSON: []byte(params.PagesJSON), }) diff --git a/internal/web/actions/default/servers/server/settings/locations/pages/index.go b/internal/web/actions/default/servers/server/settings/locations/pages/index.go index 33700a37..635bf33f 100644 --- a/internal/web/actions/default/servers/server/settings/locations/pages/index.go +++ b/internal/web/actions/default/servers/server/settings/locations/pages/index.go @@ -25,6 +25,7 @@ func (this *IndexAction) RunGet(params struct { } this.Data["webId"] = webConfig.Id + this.Data["enableGlobalPages"] = webConfig.EnableGlobalPages this.Data["pages"] = webConfig.Pages this.Data["shutdownConfig"] = webConfig.Shutdown @@ -32,16 +33,26 @@ func (this *IndexAction) RunGet(params struct { } func (this *IndexAction) RunPost(params struct { - WebId int64 - PagesJSON string - ShutdownJSON string - Must *actions.Must + WebId int64 + EnableGlobalPages bool + PagesJSON string + ShutdownJSON string + Must *actions.Must }) { defer this.CreateLogInfo(codes.ServerPage_LogUpdatePages, params.WebId) // TODO 检查配置 - _, err := this.RPC().HTTPWebRPC().UpdateHTTPWebPages(this.AdminContext(), &pb.UpdateHTTPWebPagesRequest{ + _, err := this.RPC().HTTPWebRPC().UpdateHTTPWebGlobalPagesEnabled(this.AdminContext(), &pb.UpdateHTTPWebGlobalPagesEnabledRequest{ + HttpWebId: params.WebId, + IsEnabled: params.EnableGlobalPages, + }) + if err != nil { + this.ErrorPage(err) + return + } + + _, err = this.RPC().HTTPWebRPC().UpdateHTTPWebPages(this.AdminContext(), &pb.UpdateHTTPWebPagesRequest{ HttpWebId: params.WebId, PagesJSON: []byte(params.PagesJSON), }) diff --git a/internal/web/actions/default/servers/server/settings/pages/index.go b/internal/web/actions/default/servers/server/settings/pages/index.go index f756c079..c7e25f40 100644 --- a/internal/web/actions/default/servers/server/settings/pages/index.go +++ b/internal/web/actions/default/servers/server/settings/pages/index.go @@ -47,6 +47,7 @@ func (this *IndexAction) RunGet(params struct { } this.Data["webId"] = webConfig.Id + this.Data["enableGlobalPages"] = webConfig.EnableGlobalPages this.Data["pages"] = webConfig.Pages this.Data["shutdownConfig"] = webConfig.Shutdown @@ -54,10 +55,11 @@ func (this *IndexAction) RunGet(params struct { } func (this *IndexAction) RunPost(params struct { - WebId int64 - PagesJSON []byte - ShutdownJSON []byte - Must *actions.Must + WebId int64 + PagesJSON []byte + ShutdownJSON []byte + EnableGlobalPages bool + Must *actions.Must }) { // 日志 defer this.CreateLogInfo(codes.ServerPage_LogUpdatePages, params.WebId) @@ -135,7 +137,16 @@ func (this *IndexAction) RunPost(params struct { } } - _, err := this.RPC().HTTPWebRPC().UpdateHTTPWebPages(this.AdminContext(), &pb.UpdateHTTPWebPagesRequest{ + _, err := this.RPC().HTTPWebRPC().UpdateHTTPWebGlobalPagesEnabled(this.AdminContext(), &pb.UpdateHTTPWebGlobalPagesEnabledRequest{ + HttpWebId: params.WebId, + IsEnabled: params.EnableGlobalPages, + }) + if err != nil { + this.ErrorPage(err) + return + } + + _, err = this.RPC().HTTPWebRPC().UpdateHTTPWebPages(this.AdminContext(), &pb.UpdateHTTPWebPagesRequest{ HttpWebId: params.WebId, PagesJSON: params.PagesJSON, }) diff --git a/web/public/js/components.js b/web/public/js/components.js index 65197035..578f1347 100644 --- a/web/public/js/components.js +++ b/web/public/js/components.js @@ -3808,7 +3808,7 @@ example2.com
-`}),Vue.component("http-pages-and-shutdown-box",{props:["v-pages","v-shutdown-config","v-is-location"],data:function(){let e=[],t=(null!=this.vPages&&(e=this.vPages),{isPrior:!1,isOn:!1,bodyType:"html",url:"",body:"",status:0}),i=(null!=this.vShutdownConfig&&(null==this.vShutdownConfig.body&&(this.vShutdownConfig.body=""),null==this.vShutdownConfig.bodyType&&(this.vShutdownConfig.bodyType="html"),t=this.vShutdownConfig),"");return 0根据响应状态码返回一些自定义页面,比如404,500等错误页面。
@@ -3958,7 +3959,19 @@ example2.com| 启用系统自定义页面 | +
+ 选中后,表示如果当前网站没有自定义页面,则尝试使用系统对应的自定义页面。 + |
+
根据响应状态码返回一些自定义页面,比如404,500等错误页面。
@@ -10847,7 +10849,19 @@ Vue.component("http-pages-and-shutdown-box", {| 启用系统自定义页面 | +
+ 选中后,表示如果当前网站没有自定义页面,则尝试使用系统对应的自定义页面。 + |
+
根据响应状态码返回一些自定义页面,比如404,500等错误页面。
@@ -243,6 +245,18 @@ Vue.component("http-pages-and-shutdown-box", {| 启用系统自定义页面 | +
+ 选中后,表示如果当前网站没有自定义页面,则尝试使用系统对应的自定义页面。 + |
+