mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-14 12:20:27 +08:00
选择DNS线路时增加搜索/节点如果没有设置DNS线路就使用默认线路
This commit is contained in:
@@ -12,9 +12,6 @@ Vue.component("node-clusters-labels", {
|
||||
if (labelSize == null) {
|
||||
labelSize = "small"
|
||||
}
|
||||
if (labelSize == "tiny") {
|
||||
labelSize += " olive"
|
||||
}
|
||||
return {
|
||||
cluster: cluster,
|
||||
secondaryClusters: secondaryClusters,
|
||||
@@ -22,7 +19,7 @@ Vue.component("node-clusters-labels", {
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<a v-if="cluster != null" :href="'/clusters/cluster?clusterId=' + cluster.id" class="ui label basic" :class="labelSize" title="主集群" style="margin-bottom: 0.3em;">{{cluster.name}}</a>
|
||||
<a v-for="c in secondaryClusters" :href="'/clusters/cluster?clusterId=' + c.id" class="ui label basic" :class="labelSize" title="从集群" style="margin-bottom: 0.3em;"><span class="grey" style="text-decoration: none">{{c.name}}</span></a>
|
||||
<a v-if="cluster != null" :href="'/clusters/cluster?clusterId=' + cluster.id" class="ui label basic grey" :class="labelSize" title="主集群" style="margin-bottom: 0.3em;">{{cluster.name}}</a>
|
||||
<a v-for="c in secondaryClusters" :href="'/clusters/cluster?clusterId=' + c.id" class="ui label basic grey" :class="labelSize" title="从集群" style="margin-bottom: 0.3em;"><span class="grey" style="text-decoration: none">{{c.name}}</span></a>
|
||||
</div>`
|
||||
})
|
||||
@@ -11,12 +11,21 @@ Vue.component("dns-route-selector", {
|
||||
return v.code + "@" + v.domainId
|
||||
}),
|
||||
isAdding: false,
|
||||
routeCode: ""
|
||||
routeCode: "",
|
||||
keyword: "",
|
||||
searchingRoutes: this.vAllRoutes.$copy()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add: function () {
|
||||
this.isAdding = true
|
||||
this.keyword = ""
|
||||
this.routeCode = ""
|
||||
|
||||
let that = this
|
||||
setTimeout(function () {
|
||||
that.$refs.keywordRef.focus()
|
||||
}, 200)
|
||||
},
|
||||
cancel: function () {
|
||||
this.isAdding = false
|
||||
@@ -50,6 +59,23 @@ Vue.component("dns-route-selector", {
|
||||
})
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
keyword: function (keyword) {
|
||||
if (keyword.length == 0) {
|
||||
this.searchingRoutes = this.vAllRoutes.$copy()
|
||||
this.routeCode = ""
|
||||
return
|
||||
}
|
||||
this.searchingRoutes = this.vAllRoutes.filter(function (route) {
|
||||
return teaweb.match(route.name, keyword)
|
||||
})
|
||||
if (this.searchingRoutes.length > 0) {
|
||||
this.routeCode = this.searchingRoutes[0].code + "@" + this.searchingRoutes[0].domainId
|
||||
} else {
|
||||
this.routeCode = ""
|
||||
}
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<input type="hidden" name="dnsRoutesJSON" :value="JSON.stringify(routeCodes)"/>
|
||||
<div v-if="routes.length > 0">
|
||||
@@ -62,16 +88,20 @@ Vue.component("dns-route-selector", {
|
||||
<div v-if="isAdding">
|
||||
<div class="ui fields inline">
|
||||
<div class="ui field">
|
||||
<select class="ui dropdown auto-width" v-model="routeCode">
|
||||
<option value="">[请选择]</option>
|
||||
<option v-for="route in vAllRoutes" :value="route.code + '@' + route.domainId">{{route.name}}({{route.domainName}})</option>
|
||||
<select class="ui dropdown" style="width: 18em" v-model="routeCode">
|
||||
<option value="" v-if="keyword.length == 0">[请选择]</option>
|
||||
<option v-for="route in searchingRoutes" :value="route.code + '@' + route.domainId">{{route.name}}({{route.domainName}})</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<input type="text" placeholder="搜索..." size="10" v-model="keyword" ref="keywordRef"/>
|
||||
</div>
|
||||
|
||||
<div class="ui field">
|
||||
<button class="ui button tiny" type="button" @click.prevent="confirm">确定</button>
|
||||
</div>
|
||||
<div class="ui field">
|
||||
<a href="" @click.prevent="cancel()"><i class="icon remove"></i></a>
|
||||
<a href="" @click.prevent="cancel()"><i class="icon remove small"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user