fix(ui): согласовать настройки и контекст Community
This commit is contained in:
1 parent
6e6558bde9
commit
5a23dfcfe6
15 files changed
+33
-12
No files matched your search
@@ -518,7 +518,7 @@ export function buildLiveOptimizerData(
|
||||
sorted.sort((a, b) => b.probabilityOptimal - a.probabilityOptimal)
|
||||
const best = sorted[0] ?? null
|
||||
|
||||
const commRecs: CommRec[] = flatRules.slice(0, 24).map((rule) => {
|
||||
const commRecs: CommRec[] = flatRules.filter(rule=>rule.sourceServerId===home.id).slice(0, 24).map((rule) => {
|
||||
const curProb = 38 + (rule.community.length % 12)
|
||||
const recProb = best ? Math.min(92, curProb + 18 + (best.score % 10)) : curProb
|
||||
const rec = best
|
||||
|
||||
@@ -32,3 +32,11 @@ test("live topology never imports mock WAN or creates a synthetic uplink",()=>{
|
||||
assert.equal(result.homes[0].bestRoute,null)
|
||||
}
|
||||
})
|
||||
|
||||
test("Community recommendations belong to their source home only",()=>{
|
||||
const inventory=[...rows,{...rows[0],id:4,name:"Second home"}]
|
||||
const rule=(id:string,community:string)=>({id,community,communityName:community,gateway:"192.0.2.2",gatewayTunnelId:"",description:""})
|
||||
const result=buildLiveOptimizerData(inventory,[{serverId:"1",rules:[rule("a","65001:1")]},{serverId:"4",rules:[rule("b","65001:4")]},{serverId:"3",rules:[rule("c","65001:3")]}],DEFAULT_ROUTE_AI_OPTIMIZER_SETTINGS)
|
||||
assert.deepEqual(result.homes[0].commRecs.map(r=>r.community),["65001:1"])
|
||||
assert.deepEqual(result.homes[1].commRecs.map(r=>r.community),["65001:4"])
|
||||
})
|
||||
Reference in new issue
Block a user