From 7a20d2c83c817d386b3cb5a670656fb23c4122cc Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Tue, 16 May 2023 23:07:17 +0200 Subject: [PATCH] [feature] filter inbound clients #301 --- web/html/xui/inbounds.html | 56 ++++++++++++++++++++++++-- web/translation/translate.en_US.toml | 1 + web/translation/translate.fa_IR.toml | 1 + web/translation/translate.ru_RU.toml | 1 + web/translation/translate.zh_Hans.toml | 1 + 5 files changed, 56 insertions(+), 4 deletions(-) diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index e946a26a..50c23a18 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -104,7 +104,17 @@ - + + + {{ i18n "none" }} + {{ i18n "disabled" }} + {{ i18n "depleted" }} + {{ i18n "depletingSoon" }} + + + { + const newInbound = new DBInbound(inbound); + const inboundSettings = JSON.parse(inbound.settings); + if (this.clientCount[inbound.id] && this.clientCount[inbound.id].hasOwnProperty(this.filterBy)){ + const list = this.clientCount[inbound.id][this.filterBy]; + if (list.length > 0) { + const filteredSettings = { "clients": [] }; + inboundSettings.clients.forEach(client => { + if (list.includes(client.email)) { + filteredSettings.clients.push(client); + } + }); + newInbound.settings = Inbound.Settings.fromJson(inbound.protocol, filteredSettings); + this.searchedInbounds.push(newInbound); + } + } + }); + } + }, + toggleFilter(){ + if(this.enableFilter) { + this.searchKey = ''; + } else { + this.filterBy = ''; + this.searchedInbounds = this.dbInbounds.slice(); + } + }, generalActions(action) { switch (action.key) { case "export": diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index 03387a8f..e93f07e9 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -11,6 +11,7 @@ "enable" = "Enable" "protocol" = "Protocol" "search" = "Search" +"filter" = "Filter" "loading" = "Loading" "second" = "Second" diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml index bba8b7f8..90f22d89 100644 --- a/web/translation/translate.fa_IR.toml +++ b/web/translation/translate.fa_IR.toml @@ -11,6 +11,7 @@ "enable" = "فعال" "protocol" = "پروتکل" "search" = "جستجو" +"filter" = "فیلتر" "loading" = "در حال بروزرسانی.." "second" = "ثانیه" diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml index 958ccc28..16019ca6 100644 --- a/web/translation/translate.ru_RU.toml +++ b/web/translation/translate.ru_RU.toml @@ -11,6 +11,7 @@ "enable" = "включить" "protocol" = "протокол" "search" = "поиск" +"filter" = "Фильтр" "loading" = "загрузка" "second" = "секунда" diff --git a/web/translation/translate.zh_Hans.toml b/web/translation/translate.zh_Hans.toml index f6a8dba9..cd66d65a 100644 --- a/web/translation/translate.zh_Hans.toml +++ b/web/translation/translate.zh_Hans.toml @@ -11,6 +11,7 @@ "enable" = "启用" "protocol" = "协议" "search" = "搜尋" +"filter" = "过滤器" "loading" = "加载中" "second" = "秒"