mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-03 20:40:26 +08:00
可以自行设定指标数据保留时间
This commit is contained in:
@@ -29,12 +29,13 @@ func (this *CreatePopupAction) RunGet(params struct {
|
||||
}
|
||||
|
||||
func (this *CreatePopupAction) RunPost(params struct {
|
||||
Name string
|
||||
Category string
|
||||
KeysJSON []byte
|
||||
PeriodJSON []byte
|
||||
Value string
|
||||
IsPublic bool
|
||||
Name string
|
||||
Category string
|
||||
KeysJSON []byte
|
||||
PeriodJSON []byte
|
||||
Value string
|
||||
IsPublic bool
|
||||
ExpiresPeriod int32
|
||||
|
||||
Must *actions.Must
|
||||
CSRF *actionutils.CSRF
|
||||
@@ -68,15 +69,20 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
var period = periodMap.GetInt32("period")
|
||||
var periodUnit = periodMap.GetString("unit")
|
||||
|
||||
if params.ExpiresPeriod < 0 {
|
||||
params.ExpiresPeriod = 0
|
||||
}
|
||||
|
||||
createResp, err := this.RPC().MetricItemRPC().CreateMetricItem(this.AdminContext(), &pb.CreateMetricItemRequest{
|
||||
Code: "", // TODO 未来实现
|
||||
Category: params.Category,
|
||||
Name: params.Name,
|
||||
Keys: keys,
|
||||
Period: period,
|
||||
PeriodUnit: periodUnit,
|
||||
Value: params.Value,
|
||||
IsPublic: params.IsPublic,
|
||||
Code: "", // TODO 未来实现
|
||||
Category: params.Category,
|
||||
Name: params.Name,
|
||||
Keys: keys,
|
||||
Period: period,
|
||||
PeriodUnit: periodUnit,
|
||||
ExpiresPeriod: params.ExpiresPeriod,
|
||||
Value: params.Value,
|
||||
IsPublic: params.IsPublic,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
|
||||
@@ -53,6 +53,7 @@ func (this *IndexAction) RunGet(params struct {
|
||||
"period": item.Period,
|
||||
"periodUnit": item.PeriodUnit,
|
||||
"periodUnitName": serverconfigs.FindMetricPeriodUnitName(item.PeriodUnit),
|
||||
"expiresPeriod": item.ExpiresPeriod,
|
||||
"keys": item.Keys,
|
||||
"value": item.Value,
|
||||
"valueName": serverconfigs.FindMetricValueName(item.Category, item.Value),
|
||||
|
||||
@@ -46,6 +46,7 @@ func InitItem(parent *actionutils.ParentAction, itemId int64) (*pb.MetricItem, e
|
||||
"category": item.Category,
|
||||
"isPublic": item.IsPublic,
|
||||
"countCharts": countCharts,
|
||||
"expiresPeriod": item.ExpiresPeriod,
|
||||
}
|
||||
return item, nil
|
||||
}
|
||||
|
||||
@@ -35,13 +35,14 @@ func (this *UpdateAction) RunGet(params struct {
|
||||
}
|
||||
|
||||
func (this *UpdateAction) RunPost(params struct {
|
||||
ItemId int64
|
||||
Name string
|
||||
KeysJSON []byte
|
||||
PeriodJSON []byte
|
||||
Value string
|
||||
IsOn bool
|
||||
IsPublic bool
|
||||
ItemId int64
|
||||
Name string
|
||||
KeysJSON []byte
|
||||
PeriodJSON []byte
|
||||
ExpiresPeriod int32
|
||||
Value string
|
||||
IsOn bool
|
||||
IsPublic bool
|
||||
|
||||
Must *actions.Must
|
||||
CSRF *actionutils.CSRF
|
||||
@@ -71,15 +72,20 @@ func (this *UpdateAction) RunPost(params struct {
|
||||
var period = periodMap.GetInt32("period")
|
||||
var periodUnit = periodMap.GetString("unit")
|
||||
|
||||
if params.ExpiresPeriod < 0 {
|
||||
params.ExpiresPeriod = 0
|
||||
}
|
||||
|
||||
_, err = this.RPC().MetricItemRPC().UpdateMetricItem(this.AdminContext(), &pb.UpdateMetricItemRequest{
|
||||
MetricItemId: params.ItemId,
|
||||
Name: params.Name,
|
||||
Keys: keys,
|
||||
Period: period,
|
||||
PeriodUnit: periodUnit,
|
||||
Value: params.Value,
|
||||
IsOn: params.IsOn,
|
||||
IsPublic: params.IsPublic,
|
||||
MetricItemId: params.ItemId,
|
||||
Name: params.Name,
|
||||
Keys: keys,
|
||||
Period: period,
|
||||
PeriodUnit: periodUnit,
|
||||
Value: params.Value,
|
||||
IsOn: params.IsOn,
|
||||
IsPublic: params.IsPublic,
|
||||
ExpiresPeriod: params.ExpiresPeriod,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
|
||||
@@ -42,6 +42,15 @@
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>数据保留周期</td>
|
||||
<td>
|
||||
<div class="ui input">
|
||||
<input type="text" size="4" maxlength="4" name="expiresPeriod"/>
|
||||
</div>
|
||||
<p class="comment">自动删除此周期以外的数据。单位和统计周期一致。不填或者为0,表示自动计算。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否公用</td>
|
||||
<td>
|
||||
|
||||
@@ -30,6 +30,14 @@
|
||||
<span class="ui label small basic">{{item.valueName}}</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>数据保留周期</td>
|
||||
<td>
|
||||
<span v-if="item.expiresPeriod > 0">{{item.expiresPeriod}}</span>
|
||||
<span v-else>自动</span>
|
||||
<p class="comment" v-if="item.expiresPeriod > 0">单位和统计周期一致。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否公用</td>
|
||||
<td>
|
||||
|
||||
@@ -44,6 +44,15 @@
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>数据保留周期</td>
|
||||
<td>
|
||||
<div class="ui input">
|
||||
<input type="text" size="4" maxlength="4" name="expiresPeriod" v-model="item.expiresPeriod"/>
|
||||
</div>
|
||||
<p class="comment">自动删除此周期以外的数据。单位和统计周期一致。不填或者为0,表示自动计算。</p>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否公用</td>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user