diff --git a/web/public/js/components.js b/web/public/js/components.js index 0ede655b..71a8fd0e 100644 --- a/web/public/js/components.js +++ b/web/public/js/components.js @@ -295,6 +295,16 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
+`}),Vue.component("ns-domain-group-selector",{props:["v-domain-group-id"],data:function(){let e=this.vDomainGroupId;return{userId:0,groupId:e=null==e?0:e}},methods:{change:function(e){null!=e?this.$emit("change",e.id):this.$emit("change",0)},reload:function(e){this.userId=e,this.$refs.comboBox.clear(),this.$refs.comboBox.setDataURL("/ns/domains/groups/options?userId="+e),this.$refs.comboBox.reloadData()}},template:`
+ +
`}),Vue.component("ns-routes-selector",{props:["v-routes"],mounted:function(){let t=this;Tea.action("/ns/routes/options").post().success(function(e){t.routes=e.data.routes})},data:function(){let e=this.vRoutes;return{routeCode:"default",routes:[],isAdding:!1,routeType:"default",selectedRoutes:e=null==e?[]:e}},watch:{routeType:function(t){this.routeCode="";let i=this;this.routes.forEach(function(e){e.type==t&&0==i.routeCode.length&&(i.routeCode=e.code)})}},methods:{add:function(){this.isAdding=!0,this.routeType="default",this.routeCode="default"},cancel:function(){this.isAdding=!1},confirm:function(){if(0!=this.routeCode.length){let t=this;this.routes.forEach(function(e){e.code==t.routeCode&&t.selectedRoutes.push(e)}),this.cancel()}},remove:function(e){this.selectedRoutes.$remove(e)}},template:`
@@ -610,11 +620,8 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
-
`}),Vue.component("ns-user-selector",{mounted:function(){let t=this;Tea.action("/ns/users/options").post().success(function(e){t.users=e.data.users})},props:["v-user-id"],data:function(){let e=this.vUserId;return{users:[],userId:e=null==e?0:e}},template:`
- +
`}),Vue.component("ns-user-selector",{props:["v-user-id"],data:function(){return{}},methods:{change:function(e){this.$emit("change",e)}},template:`
+
`}),Vue.component("ns-access-log-box",{props:["v-access-log","v-keyword"],data:function(){return{accessLog:this.vAccessLog}},methods:{showLog:function(){let e=this;var t=this.accessLog.requestId;this.$parent.$children.forEach(function(e){null!=e.deselect&&e.deselect()}),this.select(),teaweb.popup("/ns/clusters/accessLogs/viewPopup?requestId="+t,{width:"50em",height:"24em",onClose:function(){e.deselect()}})},select:function(){this.$refs.box.parentNode.style.cssText="background: rgba(0, 0, 0, 0.1)"},deselect:function(){this.$refs.box.parentNode.style.cssText=""}},template:`
[{{accessLog.region}}] {{accessLog.remoteAddr}} [{{accessLog.timeLocal}}] [{{accessLog.networking}}] {{accessLog.questionType}} {{accessLog.questionName}} -> @@ -636,11 +643,8 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
`}),Vue.component("ns-cluster-combo-box",{props:["v-cluster-id"],data:function(){let t=this;return Tea.action("/ns/clusters/options").post().success(function(e){t.clusters=e.data.clusters}),{clusters:[]}},methods:{change:function(e){null==e?this.$emit("change",0):this.$emit("change",e.value)}},template:`
-
`}),Vue.component("plan-user-selector",{mounted:function(){let t=this;Tea.action("/plans/users/options").post().success(function(e){t.users=e.data.users})},props:["v-user-id"],data:function(){let e=this.vUserId;return{users:[],userId:e=null==e?0:e}},watch:{userId:function(e){this.$emit("change",e)}},template:`
- +
`}),Vue.component("plan-user-selector",{props:["v-user-id"],data:function(){return{}},methods:{change:function(e){this.$emit("change",e)}},template:`
+
`}),Vue.component("plan-price-view",{props:["v-plan"],data:function(){return{plan:this.vPlan}},template:`
按时间周期计费 @@ -1140,6 +1144,8 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio Expires 状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}} 区间缓存 + If-None-Match + If-Modified-Since @@ -1225,7 +1231,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio

所有规则匹配顺序为从上到下,可以拖动左侧的排序。

-
`}),Vue.component("http-cache-ref-box",{props:["v-cache-ref","v-is-reverse"],mounted:function(){this.$refs.variablesDescriber.update(this.ref.key)},data:function(){let e=this.vCacheRef;return null==(e=null==e?{isOn:!0,cachePolicyId:0,key:"${scheme}://${host}${requestPath}${isArgs}${args}",life:{count:2,unit:"hour"},status:[200],maxSize:{count:32,unit:"mb"},minSize:{count:0,unit:"kb"},skipCacheControlValues:["private","no-cache","no-store"],skipSetCookie:!0,enableRequestCachePragma:!1,conds:null,allowChunkedEncoding:!0,allowPartialContent:!1,isReverse:this.vIsReverse,methods:[],expiresTime:{isPrior:!1,isOn:!1,overwrite:!0,autoCalculate:!0,duration:{count:-1,unit:"hour"}}}:e).key&&(e.key=""),null==e.methods&&(e.methods=[]),null==e.life&&(e.life={count:2,unit:"hour"}),null==e.maxSize&&(e.maxSize={count:32,unit:"mb"}),null==e.minSize&&(e.minSize={count:0,unit:"kb"}),{ref:e,moreOptionsVisible:!1}},methods:{changeOptionsVisible:function(e){this.moreOptionsVisible=e},changeLife:function(e){this.ref.life=e},changeMaxSize:function(e){this.ref.maxSize=e},changeMinSize:function(e){this.ref.minSize=e},changeConds:function(e){this.ref.conds=e},changeStatusList:function(e){let t=[];e.forEach(function(e){e=parseInt(e);isNaN(e)||e<100||999 +`}),Vue.component("http-cache-ref-box",{props:["v-cache-ref","v-is-reverse"],mounted:function(){this.$refs.variablesDescriber.update(this.ref.key)},data:function(){let e=this.vCacheRef;return null==(e=null==e?{isOn:!0,cachePolicyId:0,key:"${scheme}://${host}${requestPath}${isArgs}${args}",life:{count:2,unit:"hour"},status:[200],maxSize:{count:32,unit:"mb"},minSize:{count:0,unit:"kb"},skipCacheControlValues:["private","no-cache","no-store"],skipSetCookie:!0,enableRequestCachePragma:!1,conds:null,allowChunkedEncoding:!0,allowPartialContent:!1,enableIfNoneMatch:!1,enableIfModifiedSince:!1,isReverse:this.vIsReverse,methods:[],expiresTime:{isPrior:!1,isOn:!1,overwrite:!0,autoCalculate:!0,duration:{count:-1,unit:"hour"}}}:e).key&&(e.key=""),null==e.methods&&(e.methods=[]),null==e.life&&(e.life={count:2,unit:"hour"}),null==e.maxSize&&(e.maxSize={count:32,unit:"mb"}),null==e.minSize&&(e.minSize={count:0,unit:"kb"}),{ref:e,moreOptionsVisible:!1}},methods:{changeOptionsVisible:function(e){this.moreOptionsVisible=e},changeLife:function(e){this.ref.life=e},changeMaxSize:function(e){this.ref.maxSize=e},changeMinSize:function(e){this.ref.minSize=e},changeConds:function(e){this.ref.conds=e},changeStatusList:function(e){let t=[];e.forEach(function(e){e=parseInt(e);isNaN(e)||e<100||999 匹配条件分组 * @@ -1325,13 +1331,27 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio

选中后,当请求的Header中含有Pragma: no-cache或Cache-Control: no-cache时,会跳过缓存直接读取源内容。

+ + 允许If-None-Match回源 + + +

特殊情况下才需要开启,可能会降低缓存命中率。

+ + + + 允许If-Modified-Since回源 + + +

特殊情况下才需要开启,可能会降低缓存命中率。

+ + `}),Vue.component("http-request-limit-config-box",{props:["v-request-limit-config","v-is-group","v-is-location"],data:function(){let e=this.vRequestLimitConfig;return{config:e=null==e?{isPrior:!1,isOn:!1,maxConns:0,maxConnsPerIP:0,maxBodySize:{count:-1,unit:"kb"},outBandwidthPerConn:{count:-1,unit:"kb"}}:e,maxConns:e.maxConns,maxConnsPerIP:e.maxConnsPerIP}},watch:{maxConns:function(e){e=parseInt(e,10);isNaN(e)?this.config.maxConns=0:this.config.maxConns=e<0?0:e},maxConnsPerIP:function(e){e=parseInt(e,10);isNaN(e)?this.config.maxConnsPerIP=0:this.config.maxConnsPerIP=e<0?0:e}},methods:{isOn:function(){return(!this.vIsLocation&&!this.vIsGroup||this.config.isPrior)&&this.config.isOn}},template:`
- + @@ -1342,14 +1362,14 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio @@ -1662,6 +1682,8 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio Expires状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}}区间缓存 + If-None-Match + If-Modified-Since -
是否启用启用 最大并发连接数 -

当前服务最大并发连接数。为0表示不限制。

+

当前服务最大并发连接数,超出此限制则响应用户429代码。为0表示不限制。

单IP最大并发连接数 -

单IP最大连接数,统计单个IP总连接数时不区分服务。为0表示不限制。

+

单IP最大连接数,统计单个IP总连接数时不区分服务,超出此限制则响应用户429代码。为0表示不限制。

@@ -1703,7 +1725,8 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
{{origin.addr}}   + + {{origin.addr}}  
{{origin.name}} 证书 @@ -2330,8 +2353,8 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
-`}),Vue.component("user-selector",{props:["v-user-id"],data:function(){let e=this.vUserId;return{users:[],userId:e=null==e?0:e}},watch:{userId:function(e){this.$emit("change",e)}},template:`
- +
`}),Vue.component("user-selector",{props:["v-user-id","data-url"],data:function(){let e=this.vUserId,t=(null==e&&(e=0),this.dataUrl);return null!=t&&0!=t.length||(t="/servers/users/options"),{users:[],userId:e,dataURL:t}},methods:{change:function(e){null!=e?this.$emit("change",e.id):this.$emit("change",0)}},template:`
+
`}),Vue.component("uam-config-box",{props:["v-uam-config","v-is-location","v-is-group"],data:function(){let e=this.vUamConfig;return{config:e=null==e?{isPrior:!1,isOn:!1}:e}},template:`
@@ -2961,6 +2984,12 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio 请求脚本 + + 访客IP地址 + + + 请求限制 +
PAGE [状态码{{page.status[0]}}] -> {{page.url}}
@@ -4454,7 +4483,7 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
`}),Vue.component("request-variables-describer",{data:function(){return{vars:[]}},methods:{update:function(e){this.vars=[];let i=this;e.replace(/\${.+?}/g,function(e){var t=i.findVar(e);if(null==t)return e;i.vars.push(t)})},findVar:function(t){let i=null;return window.REQUEST_VARIABLES.forEach(function(e){e.code==t&&(i=e)}),i}},template:` {{v.code}} - {{v.name}} -`}),Vue.component("combo-box",{props:["name","title","placeholder","size","v-items","v-value","data-url","data-key","width"],mounted:function(){var e=this.dataUrl;let i=this.dataKey,s=this;null!=e&&0this.hoverIndex&&this.selectItem(this.items[this.hoverIndex])},show:function(){this.visible=!0},hide:function(){let e=this;this.hideTimer=setTimeout(function(){e.visible=!1},500)},downItem:function(){this.hoverIndex++,this.hoverIndex>this.items.length-1&&(this.hoverIndex=0),this.focusItem()},upItem:function(){this.hoverIndex--,this.hoverIndex<0&&(this.hoverIndex=0),this.focusItem()},focusItem:function(){if(this.hoverIndex +`}),Vue.component("combo-box",{props:["name","title","placeholder","size","v-items","v-value","data-url","data-key","data-search","width"],mounted:function(){0this.hoverIndex&&this.selectItem(this.items[this.hoverIndex])},show:function(){this.visible=!0},hide:function(){let e=this;this.hideTimer=setTimeout(function(){e.visible=!1},500)},downItem:function(){this.hoverIndex++,this.hoverIndex>this.items.length-1&&(this.hoverIndex=0),this.focusItem()},upItem:function(){this.hoverIndex--,this.hoverIndex<0&&(this.hoverIndex=0),this.focusItem()},focusItem:function(){if(this.hoverIndex
@@ -4574,11 +4603,8 @@ Vue.component("traffic-map-box",{props:["v-stats","v-is-attack"],mounted:functio
-`}),Vue.component("finance-user-selector",{mounted:function(){let t=this;Tea.action("/finance/users/options").post().success(function(e){t.users=e.data.users})},props:["v-user-id"],data:function(){let e=this.vUserId;return{users:[],userId:e=null==e?0:e}},watch:{userId:function(e){this.$emit("change",e)}},template:`
- +
`}),Vue.component("finance-user-selector",{props:["v-user-id"],data:function(){return{}},methods:{change:function(e){this.$emit("change",e)}},template:`
+
`}),Vue.component("node-login-suggest-ports",{data:function(){return{ports:[],availablePorts:[],autoSelected:!1,isLoading:!1}},methods:{reload:function(e){let t=this;this.autoSelected=!1,this.isLoading=!0,Tea.action("/clusters/cluster/suggestLoginPorts").params({host:e}).success(function(e){null!=e.data.availablePorts&&(t.availablePorts=e.data.availablePorts,0 正在检查端口... diff --git a/web/public/js/components.src.js b/web/public/js/components.src.js index 30a0dd88..3b94a174 100755 --- a/web/public/js/components.src.js +++ b/web/public/js/components.src.js @@ -1119,6 +1119,46 @@ Vue.component("message-row", { ` }) +Vue.component("ns-domain-group-selector", { + props: ["v-domain-group-id"], + data: function () { + let groupId = this.vDomainGroupId + if (groupId == null) { + groupId = 0 + } + return { + userId: 0, + groupId: groupId + } + }, + methods: { + change: function (group) { + if (group != null) { + this.$emit("change", group.id) + } else { + this.$emit("change", 0) + } + }, + reload: function (userId) { + this.userId = userId + this.$refs.comboBox.clear() + this.$refs.comboBox.setDataURL("/ns/domains/groups/options?userId=" + userId) + this.$refs.comboBox.reloadData() + } + }, + template: `
+ + +
` +}) + // 选择多个线路 Vue.component("ns-routes-selector", { props: ["v-routes"], @@ -2004,31 +2044,17 @@ Vue.component("ns-route-selector", { }) Vue.component("ns-user-selector", { - mounted: function () { - let that = this - - Tea.action("/ns/users/options") - .post() - .success(function (resp) { - that.users = resp.data.users - }) - }, props: ["v-user-id"], data: function () { - let userId = this.vUserId - if (userId == null) { - userId = 0 - } - return { - users: [], - userId: userId + return {} + }, + methods: { + change: function (userId) { + this.$emit("change", userId) } }, template: `
- +
` }) @@ -2140,36 +2166,17 @@ Vue.component("ns-cluster-combo-box", { }) Vue.component("plan-user-selector", { - mounted: function () { - let that = this - - Tea.action("/plans/users/options") - .post() - .success(function (resp) { - that.users = resp.data.users - }) - }, props: ["v-user-id"], data: function () { - let userId = this.vUserId - if (userId == null) { - userId = 0 - } - return { - users: [], - userId: userId - } + return {} }, - watch: { - userId: function (v) { - this.$emit("change", v) + methods: { + change: function (userId) { + this.$emit("change", userId) } }, template: `
- +
` }) @@ -3420,6 +3427,8 @@ Vue.component("http-cache-refs-box", { Expires 状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}} 区间缓存 + If-None-Match + If-Modified-Since
+ + + + + + + + ` }) @@ -3950,7 +3975,7 @@ Vue.component("http-request-limit-config-box", { - + @@ -3961,14 +3986,14 @@ Vue.component("http-request-limit-config-box", { @@ -5344,6 +5369,8 @@ Vue.component("http-cache-refs-config-box", { Expires状态码:{{cacheRef.status.map(function(v) {return v.toString()}).join(", ")}}区间缓存 + If-None-Match + If-Modified-Since -
@@ -3712,6 +3721,8 @@ Vue.component("http-cache-ref-box", { conds: null, allowChunkedEncoding: true, allowPartialContent: false, + enableIfNoneMatch: false, + enableIfModifiedSince: false, isReverse: this.vIsReverse, methods: [], expiresTime: { @@ -3883,6 +3894,20 @@ Vue.component("http-cache-ref-box", {

选中后,当请求的Header中含有Pragma: no-cache或Cache-Control: no-cache时,会跳过缓存直接读取源内容。

允许If-None-Match回源 + +

特殊情况下才需要开启,可能会降低缓存命中率。

+
允许If-Modified-Since回源 + +

特殊情况下才需要开启,可能会降低缓存命中率。

+
是否启用启用 最大并发连接数 -

当前服务最大并发连接数。为0表示不限制。

+

当前服务最大并发连接数,超出此限制则响应用户429代码。为0表示不限制。

单IP最大并发连接数 -

单IP最大连接数,统计单个IP总连接数时不区分服务。为0表示不限制。

+

单IP最大连接数,统计单个IP总连接数时不区分服务,超出此限制则响应用户429代码。为0表示不限制。

@@ -5456,7 +5483,8 @@ Vue.component("origin-list-table", {
{{origin.addr}}   + + {{origin.addr}}  
{{origin.name}} 证书 @@ -7105,24 +7133,35 @@ Vue.component("http-auth-config-box", { }) Vue.component("user-selector", { - props: ["v-user-id"], + props: ["v-user-id", "data-url"], data: function () { let userId = this.vUserId if (userId == null) { userId = 0 } + + let dataURL = this.dataUrl + if (dataURL == null || dataURL.length == 0) { + dataURL = "/servers/users/options" + } + return { users: [], - userId: userId + userId: userId, + dataURL: dataURL } }, - watch: { - userId: function (v) { - this.$emit("change", v) + methods: { + change: function(item) { + if (item != null) { + this.$emit("change", item.id) + } else { + this.$emit("change", 0) + } } }, template: `
- +
` }) @@ -8551,6 +8590,12 @@ Vue.component("http-location-labels", { 请求脚本 + + 访客IP地址 + + + 请求限制 +
PAGE [状态码{{page.status[0]}}] -> {{page.url}}
@@ -13356,32 +13401,16 @@ Vue.component("request-variables-describer", { Vue.component("combo-box", { // data-url 和 data-key 成对出现 - props: ["name", "title", "placeholder", "size", "v-items", "v-value", "data-url", "data-key", "width"], + props: [ + "name", "title", "placeholder", "size", "v-items", "v-value", + "data-url", // 数据源URL + "data-key", // 数据源中数据的键名 + "data-search", // 是否启用动态搜索,如果值为on或true,则表示启用 + "width" + ], mounted: function () { - // 从URL中获取选项数据 - let dataUrl = this.dataUrl - let dataKey = this.dataKey - let that = this - if (dataUrl != null && dataUrl.length > 0 && dataKey != null) { - Tea.action(dataUrl) - .post() - .success(function (resp) { - if (resp.data != null) { - if (typeof (resp.data[dataKey]) == "object") { - let items = that.formatItems(resp.data[dataKey]) - that.allItems = items - that.items = items.$copy() - - if (that.vValue != null) { - items.forEach(function (v) { - if (v.value == that.vValue) { - that.selectedItem = v - } - }) - } - } - } - }) + if (this.dataURL.length > 0) { + this.search("") } // 设定菜单宽度 @@ -13422,6 +13451,12 @@ Vue.component("combo-box", { } } + // data url + let dataURL = "" + if (typeof this.dataUrl == "string" && this.dataUrl.length > 0) { + dataURL = this.dataUrl + } + return { allItems: items, // 原始的所有的items items: items.$copy(), // 候选的items @@ -13430,10 +13465,53 @@ Vue.component("combo-box", { visible: false, hideTimer: null, hoverIndex: 0, - styleWidth: width + styleWidth: width, + + isInitial: true, + dataURL: dataURL, + urlRequestId: 0 // 记录URL请求ID,防止并行冲突 } }, methods: { + search: function (keyword) { + // 从URL中获取选项数据 + let dataUrl = this.dataURL + let dataKey = this.dataKey + let that = this + + let requestId = Math.random() + this.urlRequestId = requestId + + Tea.action(dataUrl) + .params({ + keyword: (keyword == null) ? "" : keyword + }) + .post() + .success(function (resp) { + if (requestId != that.urlRequestId) { + return + } + + if (resp.data != null) { + if (typeof (resp.data[dataKey]) == "object") { + let items = that.formatItems(resp.data[dataKey]) + that.allItems = items + that.items = items.$copy() + + if (that.isInitial) { + that.isInitial = false + if (that.vValue != null) { + items.forEach(function (v) { + if (v.value == that.vValue) { + that.selectedItem = v + } + }) + } + } + } + } + }) + }, formatItems: function (items) { items.forEach(function (v) { if (v.value == null) { @@ -13460,18 +13538,30 @@ Vue.component("combo-box", { this.hoverIndex = 0 }, changeKeyword: function () { + let shouldSearch = this.dataURL.length > 0 && (this.dataSearch == "on" || this.dataSearch == "true") + this.hoverIndex = 0 let keyword = this.keyword if (keyword.length == 0) { - this.items = this.allItems.$copy() + if (shouldSearch) { + this.search(keyword) + } else { + this.items = this.allItems.$copy() + } return } - this.items = this.allItems.$copy().filter(function (v) { - if (v.fullname != null && v.fullname.length > 0 && teaweb.match(v.fullname, keyword)) { - return true - } - return teaweb.match(v.name, keyword) - }) + + + if (shouldSearch) { + this.search(keyword) + } else { + this.items = this.allItems.$copy().filter(function (v) { + if (v.fullname != null && v.fullname.length > 0 && teaweb.match(v.fullname, keyword)) { + return true + } + return teaweb.match(v.name, keyword) + }) + } }, selectItem: function (item) { this.selectedItem = item @@ -13548,6 +13638,13 @@ Vue.component("combo-box", { break } } + }, + + setDataURL: function (dataURL) { + this.dataURL = dataURL + }, + reloadData: function () { + this.search("") } }, template: `
@@ -14442,36 +14539,17 @@ Vue.component("report-node-groups-selector", { }) Vue.component("finance-user-selector", { - mounted: function () { - let that = this - - Tea.action("/finance/users/options") - .post() - .success(function (resp) { - that.users = resp.data.users - }) - }, props: ["v-user-id"], data: function () { - let userId = this.vUserId - if (userId == null) { - userId = 0 - } - return { - users: [], - userId: userId - } + return {} }, - watch: { - userId: function (v) { - this.$emit("change", v) + methods: { + change: function (userId) { + this.$emit("change", userId) } }, template: `
- +
` })