apache / dubbo-admin

The ops and reference implementation for Apache Dubbo
https://dubbo.apache.org
Apache License 2.0
3.99k stars 2.17k forks source link

"权重比例" 菜单前端交互解析 #1158

Closed chickenlj closed 1 year ago

chickenlj commented 1 year ago

展示 UI 效果如下:

image

其中,匹配条件和权重值分别来自 matchweight

type Percentage struct {
    Service string   `json:"service" binding:"required"`
    Group   string   `json:"group"`
    Version string   `json:"version"`
    Weights []Weight `json:"weights" binding:"required"`
}

type Weight struct {
    Weight int            `json:"weight" binding:"required"`
    Match  ConditionMatch `json:"match"  binding:"required"`
}

type ConditionMatch struct {
    Param       []ParamMatch    `json:"param" yaml:"param,omitempty"`
}
chickenlj commented 1 year ago

新建规则时的传入数据格式:

{
     "service": "demo",
    "group": "xxx",
    "version": "xxx",
    "weights": [{
        "weight": 25,
        "match": {
            "key": "xxx",
            "value": {
                "exact": "xxx"
            }
        }
    }]
}