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