mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-06 14:50:25 +08:00
[节点]可以设置节点区域
This commit is contained in:
38
web/public/js/components/node/node-region-selector.js
Normal file
38
web/public/js/components/node/node-region-selector.js
Normal file
@@ -0,0 +1,38 @@
|
||||
Vue.component("node-region-selector", {
|
||||
props: ["v-region"],
|
||||
data: function () {
|
||||
return {
|
||||
selectedRegion: this.vRegion
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
selectRegion: function () {
|
||||
let that = this
|
||||
teaweb.popup("/clusters/regions/selectPopup?clusterId=" + this.vClusterId, {
|
||||
callback: function (resp) {
|
||||
that.selectedRegion = resp.data.region
|
||||
}
|
||||
})
|
||||
},
|
||||
addRegion: function () {
|
||||
let that = this
|
||||
teaweb.popup("/clusters/regions/createPopup?clusterId=" + this.vClusterId, {
|
||||
callback: function (resp) {
|
||||
that.selectedRegion = resp.data.region
|
||||
}
|
||||
})
|
||||
},
|
||||
removeRegion: function () {
|
||||
this.selectedRegion = null
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<div class="ui label small basic" v-if="selectedRegion != null">
|
||||
<input type="hidden" name="regionId" :value="selectedRegion.id"/>
|
||||
{{selectedRegion.name}} <a href="" title="删除" @click.prevent="removeRegion()"><i class="icon remove"></i></a>
|
||||
</div>
|
||||
<div v-if="selectedRegion == null">
|
||||
<a href="" @click.prevent="selectRegion()">[选择区域]</a> <a href="" @click.prevent="addRegion()">[添加区域]</a>
|
||||
</div>
|
||||
</div>`
|
||||
})
|
||||
Reference in New Issue
Block a user