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

View file

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

View file

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