fix remaining modal state leaks

This commit is contained in:
Sora39831 2026-04-06 21:03:50 +08:00
parent 6564cf8202
commit 266f368b07
3 changed files with 16 additions and 9 deletions

View file

@ -650,7 +650,9 @@
this.dbInbound = new DBInbound(dbInbound);
this.clientSettings = this.inbound.clients ? this.inbound.clients[index] : null;
this.isExpired = this.inbound.clients ? this.inbound.isExpiry(index) : this.dbInbound.isExpiry;
this.clientStats = this.inbound.clients ? (this.dbInbound.clientStats.find(row => row.email === this.clientSettings.email) || null) : null;
this.clientStats = (this.inbound.clients && this.clientSettings)
? (this.dbInbound.clientStats.find(row => row.email === this.clientSettings.email) || null)
: null;
if (
[
@ -774,10 +776,13 @@
return ColorUtils.usageColor(stats.up + stats.down, app.trafficDiff, stats.total);
},
getRemStats() {
remained = this.infoModal.clientStats.total - this.infoModal.clientStats.up - this.infoModal.clientStats.down;
const remained = this.infoModal.clientStats.total - this.infoModal.clientStats.up - this.infoModal.clientStats.down;
return remained > 0 ? SizeFormatter.sizeFormat(remained) : '-';
},
refreshIPs() {
if (!this.infoModal.clientStats) {
return;
}
this.refreshing = true;
refreshIPs(this.infoModal.clientStats.email)
.then((result) => {
@ -789,6 +794,9 @@
});
},
clearClientIps() {
if (!this.infoModal.clientStats) {
return;
}
HttpUtil.post(`/panel/api/inbounds/clearClientIps/${this.infoModal.clientStats.email}`)
.then((msg) => {
if (!msg.success) {

View file

@ -84,10 +84,9 @@
type: reverse.type,
domain: reverse.domain,
};
reverse;
rules0 = rules.filter(r => r.domain != null);
let rules0 = rules.filter(r => r.domain != null);
if(rules0.length == 0) rules0 = [{ outboundTag: '', domain: ["full:" + this.reverse.domain], inboundTag: []}];
rules1 = rules.filter(r => r.domain == null);
let rules1 = rules.filter(r => r.domain == null);
if(rules1.length == 0) rules1 = [{ outboundTag: '', inboundTag: []}];
this.rules = [];
this.rules.push({

View file

@ -147,7 +147,7 @@
users: [],
balancerTags: [],
ok() {
newRule = ruleModal.getResult();
const newRule = ruleModal.getResult();
ObjectUtil.execute(ruleModal.confirm, newRule);
},
show({
@ -215,9 +215,9 @@
ruleModal.confirmLoading = loading;
},
getResult() {
value = ruleModal.rule;
rule = {};
newRule = {};
const value = ruleModal.rule;
const rule = {};
const newRule = {};
rule.type = "field";
rule.domain = value.domain.length > 0 ? value.domain.split(',').map(s => s.trim()) : [];
rule.ip = value.ip.length > 0 ? value.ip.split(',').map(s => s.trim()) : [];