Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanaei <ho3ein.sanaei@gmail.com>2025-03-07 14:40:35 +0300
committerGitHub <noreply@github.com>2025-03-07 14:40:35 +0300
commit42fa64770bab9f9fb52e0cdb6d5dd82d66f19c35 (patch)
tree17d8a98faecccbda02b98ede48adf020d5e8d2f9 /web/html/xui/inbounds.html
parent2d8cca3a2ec1ae9034b7bc28a2fb5f2260f43e1a (diff)
parent0a207b8a2c0629b7f1996025a40a10fbe58d05d0 (diff)
Merge pull request #2732 from shishkevichd/refactor/refactor-1
Code refactoring
Diffstat (limited to 'web/html/xui/inbounds.html')
-rw-r--r--web/html/xui/inbounds.html53
1 files changed, 26 insertions, 27 deletions
diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html
index 86890926..677a3074 100644
--- a/web/html/xui/inbounds.html
+++ b/web/html/xui/inbounds.html
@@ -141,11 +141,11 @@
<a-row>
<a-col :xs="24" :sm="24" :lg="12">
{{ i18n "pages.inbounds.totalDownUp" }}:
- <a-tag color="green">[[ sizeFormat(total.up) ]] / [[ sizeFormat(total.down) ]]</a-tag>
+ <a-tag color="green">[[ SizeFormatter.sizeFormat(total.up) ]] / [[ SizeFormatter.sizeFormat(total.down) ]]</a-tag>
</a-col>
<a-col :xs="24" :sm="24" :lg="12">
{{ i18n "pages.inbounds.totalUsage" }}:
- <a-tag color="green">[[ sizeFormat(total.up + total.down) ]]</a-tag>
+ <a-tag color="green">[[ SizeFormatter.sizeFormat(total.up + total.down) ]]</a-tag>
</a-col>
<a-col :xs="24" :sm="24" :lg="12">
{{ i18n "pages.inbounds.inboundCount" }}:
@@ -375,19 +375,19 @@
<template slot="content">
<table cellpadding="2" width="100%">
<tr>
- <td>↑[[ sizeFormat(dbInbound.up) ]]</td>
- <td>↓[[ sizeFormat(dbInbound.down) ]]</td>
+ <td>↑[[ SizeFormatter.sizeFormat(dbInbound.up) ]]</td>
+ <td>↓[[ SizeFormatter.sizeFormat(dbInbound.down) ]]</td>
</tr>
<tr v-if="dbInbound.total > 0 && dbInbound.up + dbInbound.down < dbInbound.total">
<td>{{ i18n "remained" }}</td>
- <td>[[ sizeFormat(dbInbound.total - dbInbound.up - dbInbound.down) ]]</td>
+ <td>[[ SizeFormatter.sizeFormat(dbInbound.total - dbInbound.up - dbInbound.down) ]]</td>
</tr>
</table>
</template>
- <a-tag :color="usageColor(dbInbound.up + dbInbound.down, app.trafficDiff, dbInbound.total)">
- [[ sizeFormat(dbInbound.up + dbInbound.down) ]] /
+ <a-tag :color="ColorUtils.usageColor(dbInbound.up + dbInbound.down, app.trafficDiff, dbInbound.total)">
+ [[ SizeFormatter.sizeFormat(dbInbound.up + dbInbound.down) ]] /
<template v-if="dbInbound.total > 0">
- [[ sizeFormat(dbInbound.total) ]]
+ [[ SizeFormatter.sizeFormat(dbInbound.total) ]]
</template>
<template v-else>
<svg height="10px" width="14px" viewBox="0 0 640 512" fill="currentColor">
@@ -408,7 +408,7 @@
<template v-else slot="content">
[[ DateUtil.convertToJalalian(moment(dbInbound.expiryTime)) ]]
</template>
- <a-tag style="min-width: 50px;" :color="usageColor(new Date().getTime(), app.expireDiff, dbInbound._expiryTime)">
+ <a-tag style="min-width: 50px;" :color="ColorUtils.usageColor(new Date().getTime(), app.expireDiff, dbInbound._expiryTime)">
[[ remainedDays(dbInbound._expiryTime) ]]
</a-tag>
</a-popover>
@@ -474,19 +474,19 @@
<template slot="content">
<table cellpadding="2" width="100%">
<tr>
- <td>↑[[ sizeFormat(dbInbound.up) ]]</td>
- <td>↓[[ sizeFormat(dbInbound.down) ]]</td>
+ <td>↑[[ SizeFormatter.sizeFormat(dbInbound.up) ]]</td>
+ <td>↓[[ SizeFormatter.sizeFormat(dbInbound.down) ]]</td>
</tr>
<tr v-if="dbInbound.total > 0 && dbInbound.up + dbInbound.down < dbInbound.total">
<td>{{ i18n "remained" }}</td>
- <td>[[ sizeFormat(dbInbound.total - dbInbound.up - dbInbound.down) ]]</td>
+ <td>[[ SizeFormatter.sizeFormat(dbInbound.total - dbInbound.up - dbInbound.down) ]]</td>
</tr>
</table>
</template>
- <a-tag :color="usageColor(dbInbound.up + dbInbound.down, app.trafficDiff, dbInbound.total)">
- [[ sizeFormat(dbInbound.up + dbInbound.down) ]] /
+ <a-tag :color="ColorUtils.usageColor(dbInbound.up + dbInbound.down, app.trafficDiff, dbInbound.total)">
+ [[ SizeFormatter.sizeFormat(dbInbound.up + dbInbound.down) ]] /
<template v-if="dbInbound.total > 0">
- [[ sizeFormat(dbInbound.total) ]]
+ [[ SizeFormatter.sizeFormat(dbInbound.total) ]]
</template>
<template v-else>
<svg height="10px" width="14px" viewBox="0 0 640 512" fill="currentColor">
@@ -544,7 +544,6 @@
</a-layout>
</a-layout>
{{template "js" .}}
-<script src="{{ .base_path }}assets/base64/base64.min.js"></script>
<script src="{{ .base_path }}assets/qrcode/qrious2.min.js?{{ .cur_ver }}"></script>
<script src="{{ .base_path }}assets/uri/URI.min.js?{{ .cur_ver }}"></script>
<script src="{{ .base_path }}assets/js/model/inbound.js?{{ .cur_ver }}"></script>
@@ -884,7 +883,7 @@
this.exportSubs(dbInbound.id);
break;
case "clipboard":
- this.copyToClipboard(dbInbound.id);
+ this.copy(dbInbound.id);
break;
case "resetTraffic":
this.resetTraffic(dbInbound.id);
@@ -1275,9 +1274,9 @@
return remained>0 ? remained : 0;
},
clientStatsColor(dbInbound, email) {
- if (email.length == 0) return clientUsageColor();
+ if (email.length == 0) return ColorUtils.clientUsageColor();
clientStats = dbInbound.clientStats.find(stats => stats.email === email);
- return clientUsageColor(clientStats, app.trafficDiff)
+ return ColorUtils.clientUsageColor(clientStats, app.trafficDiff)
},
statsProgress(dbInbound, email) {
if (email.length == 0) return 100;
@@ -1295,17 +1294,17 @@
},
remainedDays(expTime){
if (expTime == 0) return null;
- if (expTime < 0) return formatSecond(expTime/-1000);
+ if (expTime < 0) return TimeFormatter.formatSecond(expTime/-1000);
now = new Date().getTime();
if (expTime < now) return '{{ i18n "depleted" }}';
- return formatSecond((expTime-now)/1000);
+ return TimeFormatter.formatSecond((expTime-now)/1000);
},
statsExpColor(dbInbound, email){
if (email.length == 0) return '#7a316f';
clientStats = dbInbound.clientStats.find(stats => stats.email === email);
if (!clientStats) return '#7a316f';
- statsColor = usageColor(clientStats.down + clientStats.up, this.trafficDiff, clientStats.total);
- expColor = usageColor(new Date().getTime(), this.expireDiff, clientStats.expiryTime);
+ statsColor = ColorUtils.usageColor(clientStats.down + clientStats.up, this.trafficDiff, clientStats.total);
+ expColor = ColorUtils.usageColor(new Date().getTime(), this.expireDiff, clientStats.expiryTime);
switch (true) {
case statsColor == "red" || expColor == "red":
return "#cf3c3c"; // Red
@@ -1383,9 +1382,9 @@
}
txtModal.show('{{ i18n "pages.inbounds.export"}}', copyText.join('\r\n'), 'All-Inbounds');
},
- copyToClipboard(dbInboundId) {
- dbInbound = this.dbInbounds.find(row => row.id === dbInboundId);
- txtModal.show('{{ i18n "pages.inbounds.inboundData" }}', JSON.stringify(dbInbound, null, 2));
+ copy(dbInboundId) {
+ dbInbound = this.dbInbounds.find(row => row.id === dbInboundId);
+ txtModal.show('{{ i18n "pages.inbounds.inboundData" }}', JSON.stringify(dbInbound, null, 2));
},
async startDataRefreshLoop() {
while (this.isRefreshEnabled) {
@@ -1439,7 +1438,7 @@
}
},
watch: {
- searchKey: debounce(function (newVal) {
+ searchKey: Utils.debounce(function (newVal) {
this.searchInbounds(newVal);
}, 500)
},