handle duplicate tagkey
This commit is contained in:
parent
fe86cb4b74
commit
61f76afa0d
|
@ -41,6 +41,7 @@ var (
|
|||
"No permission. You are not admin of BG(%s)": "没有权限操作,您并非业务组(%s)的管理员",
|
||||
"The business group must retain at least one team": "业务组下要保留至少一个团队",
|
||||
"At least one team have rw permission": "业务组下至少要有一个具备读写权限的团队",
|
||||
"duplicate tagkey(%s)": "标签KEY(%s)重复了",
|
||||
}
|
||||
langDict = map[string]map[string]string{
|
||||
"zh": dict,
|
||||
|
|
|
@ -90,6 +90,15 @@ func targetBindTags(c *gin.Context) {
|
|||
continue
|
||||
}
|
||||
|
||||
// 不能有同key的标签,否则附到时序数据上会产生覆盖,让人困惑
|
||||
for j := 0; j < len(f.Tags); j++ {
|
||||
tagkey := strings.Split(f.Tags[j], "=")[0]
|
||||
tagkeyPrefix := tagkey + "="
|
||||
if strings.HasPrefix(target.Tags, tagkeyPrefix) {
|
||||
ginx.Bomb(200, "duplicate tagkey(%s)", tagkey)
|
||||
}
|
||||
}
|
||||
|
||||
ginx.Dangerous(target.AddTags(f.Tags))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue