mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
实现公用的统计指标
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
// 获取CNAME
|
||||
// LookupCNAME 获取CNAME
|
||||
func LookupCNAME(host string) (string, error) {
|
||||
config, err := dns.ClientConfigFromFile("/etc/resolv.conf")
|
||||
if err != nil {
|
||||
|
||||
@@ -70,6 +70,7 @@ func (this *CreatePopupAction) RunGet(params struct {
|
||||
"value": item.Value,
|
||||
"valueName": serverconfigs.FindMetricValueName(item.Category, item.Value),
|
||||
"category": item.Category,
|
||||
"isPublic": item.IsPublic,
|
||||
"isChecked": exists,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
"value": item.Value,
|
||||
"valueName": serverconfigs.FindMetricValueName(item.Category, item.Value),
|
||||
"category": item.Category,
|
||||
"isPublic": item.IsPublic,
|
||||
})
|
||||
}
|
||||
this.Data["items"] = itemMaps
|
||||
|
||||
@@ -34,6 +34,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
KeysJSON []byte
|
||||
PeriodJSON []byte
|
||||
Value string
|
||||
IsPublic bool
|
||||
|
||||
Must *actions.Must
|
||||
CSRF *actionutils.CSRF
|
||||
@@ -75,6 +76,7 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
Period: period,
|
||||
PeriodUnit: periodUnit,
|
||||
Value: params.Value,
|
||||
IsPublic: params.IsPublic,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
|
||||
@@ -56,6 +56,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
"value": item.Value,
|
||||
"valueName": serverconfigs.FindMetricValueName(item.Category, item.Value),
|
||||
"category": item.Category,
|
||||
"isPublic": item.IsPublic,
|
||||
})
|
||||
}
|
||||
this.Data["items"] = itemMaps
|
||||
|
||||
@@ -43,6 +43,7 @@ func InitItem(parent *actionutils.ParentAction, itemId int64) (*pb.MetricItem, e
|
||||
"periodUnit": item.PeriodUnit,
|
||||
"periodUnitName": serverconfigs.FindMetricPeriodUnitName(item.PeriodUnit),
|
||||
"category": item.Category,
|
||||
"isPublic": item.IsPublic,
|
||||
"countCharts": countCharts,
|
||||
}
|
||||
return item, nil
|
||||
|
||||
@@ -41,6 +41,7 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
PeriodJSON []byte
|
||||
Value string
|
||||
IsOn bool
|
||||
IsPublic bool
|
||||
|
||||
Must *actions.Must
|
||||
CSRF *actionutils.CSRF
|
||||
@@ -78,6 +79,7 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
PeriodUnit: periodUnit,
|
||||
Value: params.Value,
|
||||
IsOn: params.IsOn,
|
||||
IsPublic: params.IsPublic,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
|
||||
@@ -169,7 +169,7 @@ Vue.component("http-firewall-checkpoint-cc", {
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<input type="hidden" name="operator" value="gte"/>
|
||||
<input type="hidden" name="operator" value="gt"/>
|
||||
<input type="hidden" name="value" :value="value"/>
|
||||
<table class="ui table">
|
||||
<tr>
|
||||
|
||||
@@ -15,7 +15,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="item in items">
|
||||
<td>{{item.name}}</td>
|
||||
<td>{{item.name}}
|
||||
<div style="margin-top: 0.3em" v-if="item.isPublic">
|
||||
<span class="ui label olive tiny basic">公用</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div v-if="item.keys != null" v-for="key in item.keys" style="margin-top: 0.2em; margin-bottom: 0.2em"><metric-key-label :v-key="key"></metric-key-label></div>
|
||||
</td>
|
||||
|
||||
@@ -26,7 +26,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="item in items">
|
||||
<td>{{item.name}}</td>
|
||||
<td>{{item.name}}
|
||||
<div style="margin-top: 0.3em" v-if="item.isPublic">
|
||||
<span class="ui label olive tiny basic">公用</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div v-if="item.keys != null" v-for="key in item.keys" style="margin-top: 0.2em; margin-bottom: 0.2em"><metric-key-label :v-key="key"></metric-key-label></div>
|
||||
</td>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<span v-if="task.type == 'serverChange'">服务</span>
|
||||
<span v-if="task.type == 'domainChange'">域名</span>
|
||||
</td>
|
||||
<td>
|
||||
<td style="word-break: break-word; width: 26em">
|
||||
<span v-if="task.isDone" class="red">{{task.error}}</span>
|
||||
<span v-else>正在同步...</span>
|
||||
</td>
|
||||
|
||||
@@ -42,6 +42,13 @@
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否公用</td>
|
||||
<td>
|
||||
<checkbox name="isPublic" checked="checked"></checkbox>
|
||||
<p class="comment">选中表示所有集群自动使用此指标。</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<submit-btn></submit-btn>
|
||||
</form>
|
||||
@@ -23,7 +23,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tr v-for="item in items">
|
||||
<td>{{item.name}}</td>
|
||||
<td>{{item.name}}
|
||||
<div style="margin-top: 0.3em" v-if="item.isPublic">
|
||||
<span class="ui label olive tiny basic">公用</span>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div v-if="item.keys != null" v-for="key in item.keys" style="margin-bottom: 0.3em; margin-top: 0.3em"><metric-key-label :v-key="key"></metric-key-label></div>
|
||||
</td>
|
||||
|
||||
@@ -30,4 +30,11 @@
|
||||
<span class="ui label small basic">{{item.valueName}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否公用</td>
|
||||
<td>
|
||||
<span class="green" v-if="item.isPublic">公用</span>
|
||||
<span class="disabled" v-else>非公用</span>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -44,6 +44,13 @@
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否公用</td>
|
||||
<td>
|
||||
<checkbox name="isPublic" v-model="item.isPublic"></checkbox>
|
||||
<p class="comment">选中表示所有集群自动使用此指标。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否启用</td>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user