可以在创建、修改节点的时候选择分组,可以根据分组筛选节点

This commit is contained in:
GoEdgeLab
2020-10-28 20:00:27 +08:00
parent 7aa62ea822
commit d68a49cb41
21 changed files with 310 additions and 33 deletions

View File

@@ -0,0 +1,50 @@
Vue.component("node-group-selector", {
props: ["v-cluster-id", "v-group"],
mounted: function () {
let that = this
Tea.action("/clusters/cluster/groups/options")
.post()
.params({
clusterId: this.vClusterId
})
.success(function (resp) {
})
},
data: function () {
return {
groups: [],
selectedGroup: this.vGroup,
}
},
methods: {
selectGroup: function () {
let that = this
teaweb.popup("/clusters/cluster/groups/selectPopup?clusterId=" + this.vClusterId, {
callback: function (resp) {
that.selectedGroup = resp.data.group
}
})
},
addGroup: function () {
let that = this
teaweb.popup("/clusters/cluster/groups/createPopup?clusterId=" + this.vClusterId, {
callback: function (resp) {
that.selectedGroup = resp.data.group
}
})
},
removeGroup: function () {
this.selectedGroup = null
}
},
template: `<div>
<div class="ui label tiny" v-if="selectedGroup != null">
<input type="hidden" name="groupId" :value="selectedGroup.id"/>
{{selectedGroup.name}} &nbsp;<a href="" title="删除" @click.prevent="removeGroup()"><i class="icon remove"></i></a>
</div>
<div v-if="selectedGroup == null">
<a href="" @click.prevent="selectGroup()">[选择分组]</a> &nbsp; <a href="" @click.prevent="addGroup()">[添加分组]</a>
</div>
</div>`
})