This commit is contained in:
robin
2026-03-13 14:25:13 +08:00
parent a25a474d6a
commit afbaaa869c
95 changed files with 4591 additions and 2578 deletions

View File

@@ -2272,6 +2272,57 @@ Vue.component("health-check-config-box", {
</div>`
})
Vue.component("httpdns-clusters-selector", {
props: ["vClusters", "vName"],
data: function () {
let inputClusters = this.vClusters
let clusters = []
if (inputClusters != null && inputClusters.length > 0) {
if (inputClusters[0].isChecked !== undefined) {
// 带 isChecked 标志的完整集群列表
clusters = inputClusters.map(function (c) {
return {id: c.id, name: c.name, isChecked: c.isChecked}
})
} else {
// 仅包含已选集群,全部标记为选中
clusters = inputClusters.map(function (c) {
return {id: c.id, name: c.name, isChecked: true}
})
}
}
// 无 prop 时从根实例读取所有集群(如创建应用页面)
if (clusters.length === 0) {
let rootClusters = this.$root.clusters
if (rootClusters != null && rootClusters.length > 0) {
clusters = rootClusters.map(function (c) {
return {id: c.id, name: c.name, isChecked: false}
})
}
}
return {
clusters: clusters,
fieldName: this.vName || "clusterIds"
}
},
methods: {
changeCluster: function (cluster) {
cluster.isChecked = !cluster.isChecked
}
},
template: `<div>
<div v-if="clusters.length > 0">
<checkbox v-for="cluster in clusters" :key="cluster.id" :v-value="cluster.id" :value="cluster.isChecked ? cluster.id : 0" style="margin-right: 1em" @input="changeCluster(cluster)" :name="fieldName">
{{cluster.name}}
</checkbox>
</div>
<span class="grey" v-else>暂无可用集群</span>
</div>`
})
/**
* 菜单项
*/
@@ -11294,10 +11345,18 @@ Vue.component("http-auth-config-box", {
if (authConfig.policyRefs == null) {
authConfig.policyRefs = []
}
return {
return {
authConfig: authConfig
}
},
watch: {
"authConfig.isOn": function () {
this.change()
},
"authConfig.isPrior": function () {
this.change()
}
},
methods: {
isOn: function () {
return (!this.vIsLocation || this.authConfig.isPrior) && this.authConfig.isOn
@@ -11309,18 +11368,17 @@ Vue.component("http-auth-config-box", {
that.authConfig.policyRefs.push(resp.data.policyRef)
that.change()
},
height: "28em"
height: "32em"
})
},
update: function (index, policyId) {
let that = this
teaweb.popup("/servers/server/settings/access/updatePopup?policyId=" + policyId, {
callback: function (resp) {
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
},
height: "28em"
height: "32em"
})
},
remove: function (index) {
@@ -11341,14 +11399,15 @@ Vue.component("http-auth-config-box", {
return "URL鉴权C"
case "typeD":
return "URL鉴权D"
case "typeE":
return "URL鉴权E"
}
return ""
},
change: function () {
let that = this
setTimeout(function () {
// 延时通知,是为了让表单有机会变更数据
that.$emit("change", this.authConfig)
that.$emit("change", that.authConfig)
}, 100)
}
},
@@ -11369,7 +11428,6 @@ Vue.component("http-auth-config-box", {
</tbody>
</table>
<div class="margin"></div>
<!-- 鉴权方式 -->
<div v-show="isOn()">
<h4>鉴权方式</h4>
<table class="ui table selectable celled" v-show="authConfig.policyRefs.length > 0">
@@ -11385,9 +11443,7 @@ Vue.component("http-auth-config-box", {
<tbody v-for="(ref, index) in authConfig.policyRefs" :key="ref.authPolicyId">
<tr>
<td>{{ref.authPolicy.name}}</td>
<td>
{{methodName(ref.authPolicy.type)}}
</td>
<td>{{methodName(ref.authPolicy.type)}}</td>
<td>
<span v-if="ref.authPolicy.type == 'basicAuth'">{{ref.authPolicy.params.users.length}}个用户</span>
<span v-if="ref.authPolicy.type == 'subRequest'">
@@ -11398,7 +11454,7 @@ Vue.component("http-auth-config-box", {
<span v-if="ref.authPolicy.type == 'typeB'">有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeC'">有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeD'">{{ref.authPolicy.params.signParamName}}/{{ref.authPolicy.params.timestampParamName}}/有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeE'">路径模式/有效期{{ref.authPolicy.params.life}}秒</span>
<div v-if="(ref.authPolicy.params.exts != null && ref.authPolicy.params.exts.length > 0) || (ref.authPolicy.params.domains != null && ref.authPolicy.params.domains.length > 0)">
<grey-label v-if="ref.authPolicy.params.exts != null" v-for="ext in ref.authPolicy.params.exts">扩展名:{{ext}}</grey-label>
<grey-label v-if="ref.authPolicy.params.domains != null" v-for="domain in ref.authPolicy.params.domains">域名:{{domain}}</grey-label>
@@ -11420,6 +11476,7 @@ Vue.component("http-auth-config-box", {
</div>`
})
Vue.component("http-cache-config-box", {
props: ["v-cache-config", "v-is-location", "v-is-group", "v-cache-policy", "v-web-id"],
data: function () {

View File

@@ -2272,6 +2272,57 @@ Vue.component("health-check-config-box", {
</div>`
})
Vue.component("httpdns-clusters-selector", {
props: ["vClusters", "vName"],
data: function () {
let inputClusters = this.vClusters
let clusters = []
if (inputClusters != null && inputClusters.length > 0) {
if (inputClusters[0].isChecked !== undefined) {
// 带 isChecked 标志的完整集群列表
clusters = inputClusters.map(function (c) {
return {id: c.id, name: c.name, isChecked: c.isChecked}
})
} else {
// 仅包含已选集群,全部标记为选中
clusters = inputClusters.map(function (c) {
return {id: c.id, name: c.name, isChecked: true}
})
}
}
// 无 prop 时从根实例读取所有集群(如创建应用页面)
if (clusters.length === 0) {
let rootClusters = this.$root.clusters
if (rootClusters != null && rootClusters.length > 0) {
clusters = rootClusters.map(function (c) {
return {id: c.id, name: c.name, isChecked: false}
})
}
}
return {
clusters: clusters,
fieldName: this.vName || "clusterIds"
}
},
methods: {
changeCluster: function (cluster) {
cluster.isChecked = !cluster.isChecked
}
},
template: `<div>
<div v-if="clusters.length > 0">
<checkbox v-for="cluster in clusters" :key="cluster.id" :v-value="cluster.id" :value="cluster.isChecked ? cluster.id : 0" style="margin-right: 1em" @input="changeCluster(cluster)" :name="fieldName">
{{cluster.name}}
</checkbox>
</div>
<span class="grey" v-else>暂无可用集群</span>
</div>`
})
/**
* 菜单项
*/
@@ -11294,10 +11345,18 @@ Vue.component("http-auth-config-box", {
if (authConfig.policyRefs == null) {
authConfig.policyRefs = []
}
return {
return {
authConfig: authConfig
}
},
watch: {
"authConfig.isOn": function () {
this.change()
},
"authConfig.isPrior": function () {
this.change()
}
},
methods: {
isOn: function () {
return (!this.vIsLocation || this.authConfig.isPrior) && this.authConfig.isOn
@@ -11309,18 +11368,17 @@ Vue.component("http-auth-config-box", {
that.authConfig.policyRefs.push(resp.data.policyRef)
that.change()
},
height: "28em"
height: "32em"
})
},
update: function (index, policyId) {
let that = this
teaweb.popup("/servers/server/settings/access/updatePopup?policyId=" + policyId, {
callback: function (resp) {
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
},
height: "28em"
height: "32em"
})
},
remove: function (index) {
@@ -11341,14 +11399,15 @@ Vue.component("http-auth-config-box", {
return "URL鉴权C"
case "typeD":
return "URL鉴权D"
case "typeE":
return "URL鉴权E"
}
return ""
},
change: function () {
let that = this
setTimeout(function () {
// 延时通知,是为了让表单有机会变更数据
that.$emit("change", this.authConfig)
that.$emit("change", that.authConfig)
}, 100)
}
},
@@ -11369,7 +11428,6 @@ Vue.component("http-auth-config-box", {
</tbody>
</table>
<div class="margin"></div>
<!-- 鉴权方式 -->
<div v-show="isOn()">
<h4>鉴权方式</h4>
<table class="ui table selectable celled" v-show="authConfig.policyRefs.length > 0">
@@ -11385,9 +11443,7 @@ Vue.component("http-auth-config-box", {
<tbody v-for="(ref, index) in authConfig.policyRefs" :key="ref.authPolicyId">
<tr>
<td>{{ref.authPolicy.name}}</td>
<td>
{{methodName(ref.authPolicy.type)}}
</td>
<td>{{methodName(ref.authPolicy.type)}}</td>
<td>
<span v-if="ref.authPolicy.type == 'basicAuth'">{{ref.authPolicy.params.users.length}}个用户</span>
<span v-if="ref.authPolicy.type == 'subRequest'">
@@ -11398,7 +11454,7 @@ Vue.component("http-auth-config-box", {
<span v-if="ref.authPolicy.type == 'typeB'">有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeC'">有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeD'">{{ref.authPolicy.params.signParamName}}/{{ref.authPolicy.params.timestampParamName}}/有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeE'">路径模式/有效期{{ref.authPolicy.params.life}}秒</span>
<div v-if="(ref.authPolicy.params.exts != null && ref.authPolicy.params.exts.length > 0) || (ref.authPolicy.params.domains != null && ref.authPolicy.params.domains.length > 0)">
<grey-label v-if="ref.authPolicy.params.exts != null" v-for="ext in ref.authPolicy.params.exts">扩展名:{{ext}}</grey-label>
<grey-label v-if="ref.authPolicy.params.domains != null" v-for="domain in ref.authPolicy.params.domains">域名:{{domain}}</grey-label>
@@ -11420,6 +11476,7 @@ Vue.component("http-auth-config-box", {
</div>`
})
Vue.component("http-cache-config-box", {
props: ["v-cache-config", "v-is-location", "v-is-group", "v-cache-policy", "v-web-id"],
data: function () {

View File

@@ -0,0 +1,49 @@
Vue.component("httpdns-clusters-selector", {
props: ["vClusters", "vName"],
data: function () {
let inputClusters = this.vClusters
let clusters = []
if (inputClusters != null && inputClusters.length > 0) {
if (inputClusters[0].isChecked !== undefined) {
// 带 isChecked 标志的完整集群列表
clusters = inputClusters.map(function (c) {
return {id: c.id, name: c.name, isChecked: c.isChecked}
})
} else {
// 仅包含已选集群,全部标记为选中
clusters = inputClusters.map(function (c) {
return {id: c.id, name: c.name, isChecked: true}
})
}
}
// 无 prop 时从根实例读取所有集群(如创建应用页面)
if (clusters.length === 0) {
let rootClusters = this.$root.clusters
if (rootClusters != null && rootClusters.length > 0) {
clusters = rootClusters.map(function (c) {
return {id: c.id, name: c.name, isChecked: false}
})
}
}
return {
clusters: clusters,
fieldName: this.vName || "clusterIds"
}
},
methods: {
changeCluster: function (cluster) {
cluster.isChecked = !cluster.isChecked
}
},
template: `<div>
<div v-if="clusters.length > 0">
<checkbox v-for="cluster in clusters" :key="cluster.id" :v-value="cluster.id" :value="cluster.isChecked ? cluster.id : 0" style="margin-right: 1em" @input="changeCluster(cluster)" :name="fieldName">
{{cluster.name}}
</checkbox>
</div>
<span class="grey" v-else>暂无可用集群</span>
</div>`
})

View File

@@ -12,10 +12,18 @@ Vue.component("http-auth-config-box", {
if (authConfig.policyRefs == null) {
authConfig.policyRefs = []
}
return {
return {
authConfig: authConfig
}
},
watch: {
"authConfig.isOn": function () {
this.change()
},
"authConfig.isPrior": function () {
this.change()
}
},
methods: {
isOn: function () {
return (!this.vIsLocation || this.authConfig.isPrior) && this.authConfig.isOn
@@ -27,18 +35,17 @@ Vue.component("http-auth-config-box", {
that.authConfig.policyRefs.push(resp.data.policyRef)
that.change()
},
height: "28em"
height: "32em"
})
},
update: function (index, policyId) {
let that = this
teaweb.popup("/servers/server/settings/access/updatePopup?policyId=" + policyId, {
callback: function (resp) {
callback: function () {
teaweb.success("保存成功", function () {
teaweb.reload()
})
},
height: "28em"
height: "32em"
})
},
remove: function (index) {
@@ -59,14 +66,15 @@ Vue.component("http-auth-config-box", {
return "URL鉴权C"
case "typeD":
return "URL鉴权D"
case "typeE":
return "URL鉴权E"
}
return ""
},
change: function () {
let that = this
setTimeout(function () {
// 延时通知,是为了让表单有机会变更数据
that.$emit("change", this.authConfig)
that.$emit("change", that.authConfig)
}, 100)
}
},
@@ -87,7 +95,6 @@ Vue.component("http-auth-config-box", {
</tbody>
</table>
<div class="margin"></div>
<!-- 鉴权方式 -->
<div v-show="isOn()">
<h4>鉴权方式</h4>
<table class="ui table selectable celled" v-show="authConfig.policyRefs.length > 0">
@@ -103,9 +110,7 @@ Vue.component("http-auth-config-box", {
<tbody v-for="(ref, index) in authConfig.policyRefs" :key="ref.authPolicyId">
<tr>
<td>{{ref.authPolicy.name}}</td>
<td>
{{methodName(ref.authPolicy.type)}}
</td>
<td>{{methodName(ref.authPolicy.type)}}</td>
<td>
<span v-if="ref.authPolicy.type == 'basicAuth'">{{ref.authPolicy.params.users.length}}个用户</span>
<span v-if="ref.authPolicy.type == 'subRequest'">
@@ -116,7 +121,7 @@ Vue.component("http-auth-config-box", {
<span v-if="ref.authPolicy.type == 'typeB'">有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeC'">有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeD'">{{ref.authPolicy.params.signParamName}}/{{ref.authPolicy.params.timestampParamName}}/有效期{{ref.authPolicy.params.life}}秒</span>
<span v-if="ref.authPolicy.type == 'typeE'">路径模式/有效期{{ref.authPolicy.params.life}}秒</span>
<div v-if="(ref.authPolicy.params.exts != null && ref.authPolicy.params.exts.length > 0) || (ref.authPolicy.params.domains != null && ref.authPolicy.params.domains.length > 0)">
<grey-label v-if="ref.authPolicy.params.exts != null" v-for="ext in ref.authPolicy.params.exts">扩展名:{{ext}}</grey-label>
<grey-label v-if="ref.authPolicy.params.domains != null" v-for="domain in ref.authPolicy.params.domains">域名:{{domain}}</grey-label>
@@ -136,4 +141,4 @@ Vue.component("http-auth-config-box", {
</div>
<div class="margin"></div>
</div>`
})
})