From c53cee31f5a64ed3292f977bf5a0749324eb78a2 Mon Sep 17 00:00:00 2001 From: Saeid <43953720+surbiks@users.noreply.github.com> Date: Tue, 6 Feb 2024 11:40:49 +0330 Subject: Manage balancers in settings UI (#1759) * add balancer config to ui * manage balancer in rules table * fix balancer translations * fix edit button text --- web/html/xui/xray.html | 166 +++++++++++++++++++++++++++++++++- web/html/xui/xray_balancer_modal.html | 111 +++++++++++++++++++++++ web/html/xui/xray_rule_modal.html | 23 ++++- 3 files changed, 297 insertions(+), 3 deletions(-) create mode 100644 web/html/xui/xray_balancer_modal.html (limited to 'web/html') diff --git a/web/html/xui/xray.html b/web/html/xui/xray.html index 267103cb..a144c766 100644 --- a/web/html/xui/xray.html +++ b/web/html/xui/xray.html @@ -327,6 +327,14 @@ [[ rule.outboundTag ]] + + + + Balancer Tag: [[ rule.balancerTag ]] + + [[ rule.balancerTag ]] + + + + {{ i18n "pages.xray.balancer.addBalancer"}} + + + [[ index+1 ]] + + e.preventDefault()" type="more" style="font-size: 16px; text-decoration: bold;"> + + + + {{ i18n "edit" }} + + + + {{ i18n "delete"}} + + + + + + + Random + Round Robin + + + [[ sel ]] + + + @@ -474,6 +517,7 @@ {{template "ruleModal"}} {{template "outModal"}} {{template "reverseModal"}} +{{template "balancerModal"}} {{template "warpModal"}} +{{end}} \ No newline at end of file diff --git a/web/html/xui/xray_rule_modal.html b/web/html/xui/xray_rule_modal.html index 9ed9e06a..07cc3217 100644 --- a/web/html/xui/xray_rule_modal.html +++ b/web/html/xui/xray_rule_modal.html @@ -107,6 +107,19 @@ [[ tag ]] + + + + + {{ i18n "pages.xray.balancer.balancerDesc" }} + + Balancer Tag + + + + [[ tag ]] + + @@ -133,11 +146,12 @@ protocol: [], attrs: [], outboundTag: "", + balancerTag: "", }, inboundTags: [], outboundTags: [], users: [], - balancerTag: [], + balancerTags: [], ok() { newRule = ruleModal.getResult(); ObjectUtil.execute(ruleModal.confirm, newRule); @@ -160,6 +174,7 @@ this.rule.protocol = rule.protocol; this.rule.attrs = rule.attrs ? Object.entries(rule.attrs) : []; this.rule.outboundTag = rule.outboundTag; + this.rule.balancerTag = rule.balancerTag ? rule.balancerTag : "" } else { this.rule = { domainMatcher: "", @@ -174,6 +189,7 @@ protocol: [], attrs: [], outboundTag: "", + balancerTag: "", } } this.isEdit = isEdit; @@ -186,6 +202,10 @@ } if(app.templateSettings.reverse.portals) this.outboundTags.push(...app.templateSettings.reverse.portals.map(b => b.tag)); } + + if (app.templateSettings.routing && app.templateSettings.routing.balancers) { + this.balancerTags = app.templateSettings.routing.balancers.filter((o) => !ObjectUtil.isEmpty(o.tag)).map(obj => obj.tag) + } }, close() { ruleModal.visible = false; @@ -211,6 +231,7 @@ rule.protocol = value.protocol; rule.attrs = Object.fromEntries(value.attrs); rule.outboundTag = value.outboundTag; + rule.balancerTag = value.balancerTag; for (const [key, value] of Object.entries(rule)) { if ( -- cgit v1.2.3
Balancer Tag: [[ rule.balancerTag ]]