diff options
| author | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-04-25 16:53:38 +0300 |
|---|---|---|
| committer | MHSanaei <ho3ein.sanaei@gmail.com> | 2023-04-25 16:53:38 +0300 |
| commit | 6a71ea7f5e66fe147bad4b6df1f37d10cc632c0c (patch) | |
| tree | 78c5c78b214c98238152b364026e3a841f1b9aed /web/html/xui | |
| parent | 942b9862d8fe2b2c659d63a8f6c5bc24e476e6b0 (diff) | |
[feature] reset traffics of all client
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/html/xui')
| -rw-r--r-- | web/html/xui/inbounds.html | 45 |
1 files changed, 38 insertions, 7 deletions
diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index 14849873..483b0030 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -67,8 +67,23 @@ <a-card hoverable :class="siderDrawer.isDarkTheme ? darkClass : ''"> <div slot="title"> <a-button type="primary" icon="plus" @click="openAddInbound">{{ i18n "pages.inbounds.addInbound" }}</a-button> - <a-button type="primary" icon="export" @click="exportAllLinks">{{ i18n "pages.inbounds.export" }}</a-button> - <a-button type="primary" icon="reload" @click="resetAllTraffic">{{ i18n "pages.inbounds.resetAllTraffic" }}</a-button> + <a-dropdown :trigger="['click']"> + <a-button type="primary" icon="menu">General Actions</a-button> + <a-menu slot="overlay" @click="a => generalActions(a)" :theme="siderDrawer.theme"> + <a-menu-item key="export"> + <a-icon type="export"></a-icon> + {{ i18n "pages.inbounds.export" }} + </a-menu-item> + <a-menu-item key="resetInbounds"> + <a-icon type="reload"></a-icon> + {{ i18n "pages.inbounds.resetAllTraffic" }} + </a-menu-item> + <a-menu-item key="resetClients"> + <a-icon type="file-done"></a-icon> + {{ i18n "pages.inbounds.resetAllClientTraffics" }} + </a-menu-item> + </a-menu> + </a-dropdown> </div> <a-input v-model.lazy="searchKey" placeholder='{{ i18n "search" }}' autofocus style="max-width: 300px"></a-input> <a-table :columns="columns" :row-key="dbInbound => dbInbound.id" @@ -78,7 +93,7 @@ style="margin-top: 20px" @change="() => getDBInbounds()"> <template slot="action" slot-scope="text, dbInbound"> - <a-icon type="edit" style="font-size: 25px" @click="openEditInbound(dbInbound.id);"></a-icon> + <a-icon type="edit" style="font-size: 22px" @click="openEditInbound(dbInbound.id);"></a-icon> <a-dropdown :trigger="['click']"> <a @click="e => e.preventDefault()">{{ i18n "pages.inbounds.operate" }}</a> <a-menu slot="overlay" @click="a => clickAction(a, dbInbound)" :theme="siderDrawer.theme"> @@ -101,7 +116,7 @@ </a-menu-item> <a-menu-item key="resetClients"> <a-icon type="file-done"></a-icon> - {{ i18n "pages.inbounds.resetAllClientTraffics"}} + {{ i18n "pages.inbounds.resetInboundClientTraffics"}} </a-menu-item> <a-menu-item key="export"> <a-icon type="export"></a-icon> @@ -390,6 +405,21 @@ }); } }, + generalActions(action){ + switch (action.key) { + case "export": + this.exportAllLinks(); + break; + case "resetInbounds": + this.resetAllTraffic(); + break; + case "resetClients": + this.resetAllClientTraffics(-1); + break; + case "": + break; + } + }, clickAction(action, dbInbound) { switch (action.key) { case "qrcode": @@ -651,7 +681,8 @@ clients = this.getClients(dbInbound.protocol, inbound.settings); index = this.findIndexOfClient(clients, client); clients[index].enable = !clients[index].enable; - await this.updateClient(clients[index],dbInboundId, index); + clientId = dbInbound.protocol == "trojan" ? clients[index].password : clients[index].id; + await this.updateClient(clients[index],dbInboundId, clientId); this.loading(false); }, async submit(url, data) { @@ -691,8 +722,8 @@ }, resetAllClientTraffics(dbInboundId) { this.$confirm({ - title: '{{ i18n "pages.inbounds.resetAllClientTrafficTitle"}}', - content: '{{ i18n "pages.inbounds.resetAllClientTrafficContent"}}', + title: dbInboundId>0 ? '{{ i18n "pages.inbounds.resetInboundClientTrafficTitle"}}' : '{{ i18n "pages.inbounds.resetAllClientTrafficTitle"}}', + content: dbInboundId>0 ? '{{ i18n "pages.inbounds.resetInboundClientTrafficContent"}}' : '{{ i18n "pages.inbounds.resetAllClientTrafficContent"}}', class: siderDrawer.isDarkTheme ? darkClass : '', okText: '{{ i18n "reset"}}', cancelText: '{{ i18n "cancel"}}', |
