mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-12-14 20:06:34 +08:00
实现基础的统计指标
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
{$layout "layout_popup"}
|
||||
|
||||
<h3>添加指标</h3>
|
||||
<h3>可以添加的指标</h3>
|
||||
|
||||
<p class="comment" v-if="items.length == 0">暂时还没有指标。</p>
|
||||
<p class="comment" v-if="items.length == 0">暂时还没有可用的指标。</p>
|
||||
<table class="ui table celled selectable" v-if="items.length > 0">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -29,8 +29,8 @@
|
||||
<label-on :v-is-on="item.isOn"></label-on>
|
||||
</td>
|
||||
<td>
|
||||
<a href="" v-if="!item.isChecked">添加</a>
|
||||
<a href="" v-if="item.isChecked"><span class="grey">已添加</span></a>
|
||||
<a href="" @click.prevent="addItem(item)" v-if="!item.isChecked">添加</a>
|
||||
<a href="" @click.prevent="removeItem(item)" v-if="item.isChecked"><span class="grey">已添加</span></a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
Tea.context(function () {
|
||||
this.addItem = function (item) {
|
||||
this.$post("$")
|
||||
.params({
|
||||
clusterId: this.clusterId,
|
||||
itemId: item.id
|
||||
})
|
||||
.success(function () {
|
||||
item.isChecked = true
|
||||
})
|
||||
}
|
||||
|
||||
this.removeItem = function (item) {
|
||||
this.$post(".delete")
|
||||
.params({
|
||||
clusterId: this.clusterId,
|
||||
itemId: item.id
|
||||
})
|
||||
.success(function () {
|
||||
item.isChecked = false
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -4,15 +4,15 @@
|
||||
<div class="right-box">
|
||||
<first-menu>
|
||||
<menu-item :href="'/clusters/cluster/settings/metrics?category=http&clusterId=' + clusterId" :active="category == 'http'">HTTP</menu-item>
|
||||
<menu-item :href="'/clusters/cluster/settings/metrics?category=tcp&clusterId=' + clusterId" :active="category == 'tcp'">TCP</menu-item>
|
||||
<menu-item :href="'/clusters/cluster/settings/metrics?category=udp&clusterId=' + clusterId" :active="category == 'udp'">UDP</menu-item>
|
||||
<!--<menu-item :href="'/clusters/cluster/settings/metrics?category=tcp&clusterId=' + clusterId" :active="category == 'tcp'">TCP</menu-item>
|
||||
<menu-item :href="'/clusters/cluster/settings/metrics?category=udp&clusterId=' + clusterId" :active="category == 'udp'">UDP</menu-item>-->
|
||||
<span class="item disabled">|</span>
|
||||
<menu-item @click.prevent="createItem">[添加指标]</menu-item>
|
||||
<span class="item disabled">|</span>
|
||||
<span class="item"><tip-icon content="在这里设置的指标,会自动应用到部署在当前集群上的所有服务上。"></tip-icon></span>
|
||||
</first-menu>
|
||||
|
||||
<p class="comment" v-if="items.length == 0">暂时还没有设置指标。</p>
|
||||
<p class="comment" v-if="items.length == 0">暂时还没有添加指标。</p>
|
||||
|
||||
<table class="ui table celled selectable" v-if="items.length > 0">
|
||||
<thead>
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
Tea.context(function () {
|
||||
this.createItem = function () {
|
||||
teaweb.popup(Tea.url(".createPopup", {
|
||||
clusterId: this.clusterId
|
||||
clusterId: this.clusterId,
|
||||
category: this.category
|
||||
}), {
|
||||
callback: function () {
|
||||
teaweb.success("保存成功", function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
},
|
||||
onClose: function () {
|
||||
teaweb.reload()
|
||||
},
|
||||
width: "50em",
|
||||
height: "25em"
|
||||
})
|
||||
@@ -18,6 +22,7 @@ Tea.context(function () {
|
||||
teaweb.confirm("确定要删除这个指标吗?", function () {
|
||||
that.$post(".delete")
|
||||
.params({
|
||||
clusterId: that.clusterId,
|
||||
itemId: itemId
|
||||
})
|
||||
.success(function () {
|
||||
|
||||
Reference in New Issue
Block a user