2020-09-27 18:40:55 +08:00
Vue . component ( "http-location-labels" , {
2020-10-05 16:54:34 +08:00
props : [ "v-location-config" , "v-server-id" ] ,
2020-09-27 18:40:55 +08:00
data : function ( ) {
return {
location : this . vLocationConfig
}
} ,
methods : {
// 判断是否已启用某配置
configIsOn : function ( config ) {
return config != null && config . isPrior && config . isOn
} ,
refIsOn : function ( ref , config ) {
return this . configIsOn ( ref ) && config != null && config . isOn
} ,
len : function ( arr ) {
return ( arr == null ) ? 0 : arr . length
2020-10-05 16:54:34 +08:00
} ,
url : function ( path ) {
return "/servers/server/settings/locations" + path + "?serverId=" + this . vServerId + "&locationId=" + this . location . id
2020-09-27 18:40:55 +08:00
}
} ,
template : ` <div class="labels-box">
2020-09-28 16:25:26 +08:00
<!-- 基本信息 -- >
2020-10-05 16:54:34 +08:00
< http - location - labels - label v - if = "location.name != null && location.name.length > 0" : class = "'olive'" : href = "url('/location')" > { { location . name } } < / h t t p - l o c a t i o n - l a b e l s - l a b e l >
2021-12-12 16:38:52 +08:00
<!-- domains -- >
< div v - if = "location.domains != null && location.domains.length > 0" >
< grey - label v - for = "domain in location.domains" > { { domain } } < / g r e y - l a b e l >
< / d i v >
<!-- break -- >
2020-10-05 16:54:34 +08:00
< http - location - labels - label v - if = "location.isBreak" : href = "url('/location')" > BREAK < / h t t p - l o c a t i o n - l a b e l s - l a b e l >
2020-09-28 16:25:26 +08:00
2020-09-27 18:40:55 +08:00
<!-- redirectToHTTPS -- >
2020-10-05 16:54:34 +08:00
< http - location - labels - label v - if = "location.web != null && configIsOn(location.web.redirectToHTTPS)" : href = "url('/http')" > 自动跳转HTTPS < / h t t p - l o c a t i o n - l a b e l s - l a b e l >
2020-09-27 18:40:55 +08:00
<!-- Web -- >
2020-10-05 16:54:34 +08:00
< http - location - labels - label v - if = "location.web != null && configIsOn(location.web.root)" : href = "url('/web')" > 文档根目录 < / h t t p - l o c a t i o n - l a b e l s - l a b e l >
2020-09-27 18:40:55 +08:00
<!-- 反向代理 -- >
2020-10-05 16:54:34 +08:00
< http - location - labels - label v - if = "refIsOn(location.reverseProxyRef, location.reverseProxy)" : v - href = "url('/reverseProxy')" > 反向代理 < / h t t p - l o c a t i o n - l a b e l s - l a b e l >
2020-09-27 18:40:55 +08:00
<!-- WAF -- >
<!-- TODO -- >
<!-- Cache -- >
2020-10-05 16:54:34 +08:00
< http - location - labels - label v - if = "location.web != null && configIsOn(location.web.cache)" : v - href = "url('/cache')" > CACHE < / h t t p - l o c a t i o n - l a b e l s - l a b e l >
2020-09-27 18:40:55 +08:00
<!-- Charset -- >
2020-10-05 16:54:34 +08:00
< http - location - labels - label v - if = "location.web != null && configIsOn(location.web.charset) && location.web.charset.charset.length > 0" : href = "url('/charset')" > { { location . web . charset . charset } } < / h t t p - l o c a t i o n - l a b e l s - l a b e l >
2020-09-27 18:40:55 +08:00
<!-- 访问日志 -- >
<!-- TODO -- >
<!-- 统计 -- >
<!-- TODO -- >
<!-- Gzip -- >
2020-10-05 16:54:34 +08:00
< http - location - labels - label v - if = "location.web != null && refIsOn(location.web.gzipRef, location.web.gzip) && location.web.gzip.level > 0" : href = "url('/gzip')" > Gzip : { { location . web . gzip . level } } < / h t t p - l o c a t i o n - l a b e l s - l a b e l >
2020-09-27 18:40:55 +08:00
<!-- HTTP Header -- >
2020-10-05 16:54:34 +08:00
< http - location - labels - label v - if = "location.web != null && refIsOn(location.web.requestHeaderPolicyRef, location.web.requestHeaderPolicy) && (len(location.web.requestHeaderPolicy.addHeaders) > 0 || len(location.web.requestHeaderPolicy.setHeaders) > 0 || len(location.web.requestHeaderPolicy.replaceHeaders) > 0 || len(location.web.requestHeaderPolicy.deleteHeaders) > 0)" : href = "url('/headers')" > 请求Header < / h t t p - l o c a t i o n - l a b e l s - l a b e l >
< http - location - labels - label v - if = "location.web != null && refIsOn(location.web.responseHeaderPolicyRef, location.web.responseHeaderPolicy) && (len(location.web.responseHeaderPolicy.addHeaders) > 0 || len(location.web.responseHeaderPolicy.setHeaders) > 0 || len(location.web.responseHeaderPolicy.replaceHeaders) > 0 || len(location.web.responseHeaderPolicy.deleteHeaders) > 0)" : href = "url('/headers')" > 响应Header < / h t t p - l o c a t i o n - l a b e l s - l a b e l >
2020-09-27 18:40:55 +08:00
<!-- Websocket -- >
2020-10-05 16:54:34 +08:00
< http - location - labels - label v - if = "location.web != null && refIsOn(location.web.websocketRef, location.web.websocket)" : href = "url('/websocket')" > Websocket < / h t t p - l o c a t i o n - l a b e l s - l a b e l >
2020-09-27 18:40:55 +08:00
<!-- 特殊页面 -- >
< div v - if = "location.web != null && location.web.pages != null && location.web.pages.length > 0" >
2020-10-05 16:54:34 +08:00
< div v - for = "page in location.web.pages" : key = "page.id" > < http - location - labels - label : href = "url('/pages')" > PAGE [ 状态码 { { page . status [ 0 ] } } ] - & gt ; { { page . url } } < / h t t p - l o c a t i o n - l a b e l s - l a b e l > < / d i v >
2020-09-27 18:40:55 +08:00
< / d i v >
< div v - if = "location.web != null && configIsOn(location.web.shutdown)" >
2020-10-05 16:54:34 +08:00
< http - location - labels - label : v - class = "'red'" : href = "url('/pages')" > 临时关闭 < / h t t p - l o c a t i o n - l a b e l s - l a b e l >
2020-09-27 18:40:55 +08:00
< / d i v >
2020-09-28 16:25:26 +08:00
<!-- 重写规则 -- >
2020-10-05 16:54:34 +08:00
< div v - if = "location.web != null && location.web.rewriteRules != null && location.web.rewriteRules.length > 0" >
< div v - for = "rewriteRule in location.web.rewriteRules" >
< http - location - labels - label : href = "url('/rewrite')" > REWRITE { { rewriteRule . pattern } } - & gt ; { { rewriteRule . replace } } < / h t t p - l o c a t i o n - l a b e l s - l a b e l >
< / d i v >
< / d i v >
2020-09-27 18:40:55 +08:00
< / d i v > `
} )
Vue . component ( "http-location-labels-label" , {
2020-10-05 16:54:34 +08:00
props : [ "v-class" , "v-href" ] ,
template : ` <a :href="vHref" class="ui label tiny" :class="vClass" style="font-size:0.7em;padding:4px;margin-top:0.3em;margin-bottom:0.3em"><slot></slot></a> `
2020-09-27 18:40:55 +08:00
} )