mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-27 01:19:25 +08:00
fix(panel): remove parenthetical reservation and remaining text from quota rows
This commit is contained in:
+19
-68
@@ -1441,10 +1441,7 @@ const I18N_MESSAGES_ZH_CN = Object.freeze({
|
|||||||
'quota.weeklyPool': '周限 ({pool})',
|
'quota.weeklyPool': '周限 ({pool})',
|
||||||
'quota.loading': '读取中...',
|
'quota.loading': '读取中...',
|
||||||
'quota.failed': '获取失败 (--%)',
|
'quota.failed': '获取失败 (--%)',
|
||||||
'quota.usedAndLeft': '{reset} · 已用 {used}% (余 {rem}%)',
|
'quota.usedAndLeft': '{reset} · 已用 {used}%',
|
||||||
'quota.usedBeforeReserved': '{reset} · 已用 {used}% (',
|
|
||||||
'quota.reservedTag': '预占 {rsv}%',
|
|
||||||
'quota.usedAfterReserved': ' · 余 {rem}%)',
|
|
||||||
'quota.reservedTip': '预占估算(试验性):约 {rsv}%(实际已用约 {actual}%),静默约 10 分钟后未用差额自动退还',
|
'quota.reservedTip': '预占估算(试验性):约 {rsv}%(实际已用约 {actual}%),静默约 10 分钟后未用差额自动退还',
|
||||||
'quota.reservedTipMulti': '预占估算(试验性):约 {rsv}%(检测到 {leases} 笔叠加租约,实际已用约 {actual}%),静默约 10 分钟后未用差额自动退还',
|
'quota.reservedTipMulti': '预占估算(试验性):约 {rsv}%(检测到 {leases} 笔叠加租约,实际已用约 {actual}%),静默约 10 分钟后未用差额自动退还',
|
||||||
'quota.legendActual': '实占',
|
'quota.legendActual': '实占',
|
||||||
@@ -2332,10 +2329,7 @@ const I18N_MESSAGES_EN_US = Object.freeze({
|
|||||||
'quota.weeklyPool': 'Weekly ({pool})',
|
'quota.weeklyPool': 'Weekly ({pool})',
|
||||||
'quota.loading': 'Loading...',
|
'quota.loading': 'Loading...',
|
||||||
'quota.failed': 'Unavailable (--%)',
|
'quota.failed': 'Unavailable (--%)',
|
||||||
'quota.usedAndLeft': '{reset} · Used {used}% ({rem}% left)',
|
'quota.usedAndLeft': '{reset} · Used {used}%',
|
||||||
'quota.usedBeforeReserved': '{reset} · Used {used}% (',
|
|
||||||
'quota.reservedTag': '{rsv}% rsv',
|
|
||||||
'quota.usedAfterReserved': ' · {rem}% left)',
|
|
||||||
'quota.reservedTip': 'Estimated lease reservation (Experimental): ~{rsv}% (~{actual}% actual used); unused share refunds after ~10 min idle',
|
'quota.reservedTip': 'Estimated lease reservation (Experimental): ~{rsv}% (~{actual}% actual used); unused share refunds after ~10 min idle',
|
||||||
'quota.reservedTipMulti': 'Estimated lease reservation (Experimental): ~{rsv}% ({leases} stacked leases, ~{actual}% actual used); unused share refunds after ~10 min idle',
|
'quota.reservedTipMulti': 'Estimated lease reservation (Experimental): ~{rsv}% ({leases} stacked leases, ~{actual}% actual used); unused share refunds after ~10 min idle',
|
||||||
'quota.legendActual': 'Actual',
|
'quota.legendActual': 'Actual',
|
||||||
@@ -18724,14 +18718,7 @@ function createPoolQuotaRow() {
|
|||||||
const title5h = h('span', { className: 'quota-win-title', text: '5h' });
|
const title5h = h('span', { className: 'quota-win-title', text: '5h' });
|
||||||
const usage5h = h('span', { className: 'quota-win-usage', hidden: true, text: '' });
|
const usage5h = h('span', { className: 'quota-win-usage', hidden: true, text: '' });
|
||||||
const left5h = h('span', { className: 'quota-win-left' }, [title5h, usage5h]);
|
const left5h = h('span', { className: 'quota-win-left' }, [title5h, usage5h]);
|
||||||
const meta5hBefore = h('span', { text: '--' });
|
const meta5h = h('span', { className: 'panel-meta quota-win-meta text-mono', text: '--' });
|
||||||
const meta5hReserved = h('span', { className: 'quota-reserved-pct', hidden: true, text: '' });
|
|
||||||
const meta5hAfter = h('span', { hidden: true, text: '' });
|
|
||||||
const meta5h = h('span', { className: 'panel-meta quota-win-meta text-mono' }, [
|
|
||||||
meta5hBefore,
|
|
||||||
meta5hReserved,
|
|
||||||
meta5hAfter,
|
|
||||||
]);
|
|
||||||
const fill5h = h('div', { className: 'progress-fill' });
|
const fill5h = h('div', { className: 'progress-fill' });
|
||||||
const fillReserved5h = h('div', { className: 'progress-fill-reserved' });
|
const fillReserved5h = h('div', { className: 'progress-fill-reserved' });
|
||||||
const track5h = h('div', { className: 'progress-track' }, [fill5h, fillReserved5h]);
|
const track5h = h('div', { className: 'progress-track' }, [fill5h, fillReserved5h]);
|
||||||
@@ -18743,14 +18730,7 @@ function createPoolQuotaRow() {
|
|||||||
const titleWk = h('span', { className: 'quota-win-title', text: t('quota.weeklyShort') });
|
const titleWk = h('span', { className: 'quota-win-title', text: t('quota.weeklyShort') });
|
||||||
const usageWk = h('span', { className: 'quota-win-usage', hidden: true, text: '' });
|
const usageWk = h('span', { className: 'quota-win-usage', hidden: true, text: '' });
|
||||||
const leftWk = h('span', { className: 'quota-win-left' }, [titleWk, usageWk]);
|
const leftWk = h('span', { className: 'quota-win-left' }, [titleWk, usageWk]);
|
||||||
const metaWkBefore = h('span', { text: '--' });
|
const metaWk = h('span', { className: 'panel-meta quota-win-meta text-mono', text: '--' });
|
||||||
const metaWkReserved = h('span', { className: 'quota-reserved-pct', hidden: true, text: '' });
|
|
||||||
const metaWkAfter = h('span', { hidden: true, text: '' });
|
|
||||||
const metaWk = h('span', { className: 'panel-meta quota-win-meta text-mono' }, [
|
|
||||||
metaWkBefore,
|
|
||||||
metaWkReserved,
|
|
||||||
metaWkAfter,
|
|
||||||
]);
|
|
||||||
const fillWk = h('div', { className: 'progress-fill' });
|
const fillWk = h('div', { className: 'progress-fill' });
|
||||||
const fillReservedWk = h('div', { className: 'progress-fill-reserved' });
|
const fillReservedWk = h('div', { className: 'progress-fill-reserved' });
|
||||||
const trackWk = h('div', { className: 'progress-track' }, [fillWk, fillReservedWk]);
|
const trackWk = h('div', { className: 'progress-track' }, [fillWk, fillReservedWk]);
|
||||||
@@ -18772,9 +18752,6 @@ function createPoolQuotaRow() {
|
|||||||
title5h,
|
title5h,
|
||||||
usage5h,
|
usage5h,
|
||||||
meta5h,
|
meta5h,
|
||||||
meta5hBefore,
|
|
||||||
meta5hReserved,
|
|
||||||
meta5hAfter,
|
|
||||||
track5h,
|
track5h,
|
||||||
fill5h,
|
fill5h,
|
||||||
fillReserved5h,
|
fillReserved5h,
|
||||||
@@ -18783,9 +18760,6 @@ function createPoolQuotaRow() {
|
|||||||
titleWk,
|
titleWk,
|
||||||
usageWk,
|
usageWk,
|
||||||
metaWk,
|
metaWk,
|
||||||
metaWkBefore,
|
|
||||||
metaWkReserved,
|
|
||||||
metaWkAfter,
|
|
||||||
trackWk,
|
trackWk,
|
||||||
fillWk,
|
fillWk,
|
||||||
fillReservedWk,
|
fillReservedWk,
|
||||||
@@ -18817,15 +18791,12 @@ function formatQuotaSummaryFooter(quotas, account) {
|
|||||||
function syncQuotaWindowMeter({
|
function syncQuotaWindowMeter({
|
||||||
hasData,
|
hasData,
|
||||||
usedVal,
|
usedVal,
|
||||||
remVal,
|
|
||||||
resetTime,
|
resetTime,
|
||||||
fallbackMetaText,
|
fallbackMetaText,
|
||||||
showReserved,
|
showReserved,
|
||||||
rawReservedPct,
|
rawReservedPct,
|
||||||
leaseCount,
|
leaseCount,
|
||||||
metaBeforeEl,
|
metaEl,
|
||||||
metaReservedEl,
|
|
||||||
metaAfterEl,
|
|
||||||
trackEl,
|
trackEl,
|
||||||
fillEl,
|
fillEl,
|
||||||
fillReservedEl,
|
fillReservedEl,
|
||||||
@@ -18836,6 +18807,16 @@ function syncQuotaWindowMeter({
|
|||||||
const actualVal = Math.max(0, usedVal - rsvVal);
|
const actualVal = Math.max(0, usedVal - rsvVal);
|
||||||
const resetStr = hasData ? formatCountdown(resetTime) : '';
|
const resetStr = hasData ? formatCountdown(resetTime) : '';
|
||||||
|
|
||||||
|
patchText(
|
||||||
|
metaEl,
|
||||||
|
hasData
|
||||||
|
? t('quota.usedAndLeft', {
|
||||||
|
reset: resetStr,
|
||||||
|
used: formatPctNumber(usedVal),
|
||||||
|
})
|
||||||
|
: fallbackMetaText
|
||||||
|
);
|
||||||
|
|
||||||
if (hasData && rsvVal > 0) {
|
if (hasData && rsvVal > 0) {
|
||||||
const rsvStr = formatPctNumber(rsvVal);
|
const rsvStr = formatPctNumber(rsvVal);
|
||||||
const actualStr = formatPctNumber(actualVal);
|
const actualStr = formatPctNumber(actualVal);
|
||||||
@@ -18844,15 +18825,7 @@ function syncQuotaWindowMeter({
|
|||||||
leases >= 2
|
leases >= 2
|
||||||
? t('quota.reservedTipMulti', { rsv: rsvStr, leases, actual: actualStr })
|
? t('quota.reservedTipMulti', { rsv: rsvStr, leases, actual: actualStr })
|
||||||
: t('quota.reservedTip', { rsv: rsvStr, actual: actualStr });
|
: t('quota.reservedTip', { rsv: rsvStr, actual: actualStr });
|
||||||
patchText(
|
patchAttr(metaEl, 'title', tipText);
|
||||||
metaBeforeEl,
|
|
||||||
t('quota.usedBeforeReserved', { reset: resetStr, used: formatPctNumber(usedVal) })
|
|
||||||
);
|
|
||||||
metaReservedEl.hidden = false;
|
|
||||||
patchText(metaReservedEl, t('quota.reservedTag', { rsv: rsvStr }));
|
|
||||||
patchAttr(metaReservedEl, 'title', tipText);
|
|
||||||
metaAfterEl.hidden = false;
|
|
||||||
patchText(metaAfterEl, t('quota.usedAfterReserved', { rem: formatPctNumber(remVal) }));
|
|
||||||
patchAttr(trackEl, 'title', tipText);
|
patchAttr(trackEl, 'title', tipText);
|
||||||
const actualWidth = +Math.min(100, actualVal).toFixed(2);
|
const actualWidth = +Math.min(100, actualVal).toFixed(2);
|
||||||
const rsvWidth = +Math.min(Math.max(0, 100 - actualWidth), rsvVal).toFixed(2);
|
const rsvWidth = +Math.min(Math.max(0, 100 - actualWidth), rsvVal).toFixed(2);
|
||||||
@@ -18860,21 +18833,7 @@ function syncQuotaWindowMeter({
|
|||||||
patchStyleVar(fillReservedEl, '--reserved-w', `${rsvWidth}%`);
|
patchStyleVar(fillReservedEl, '--reserved-w', `${rsvWidth}%`);
|
||||||
patchClasses(fillReservedEl, { 'is-active': true, 'has-sep': actualWidth > 0 });
|
patchClasses(fillReservedEl, { 'is-active': true, 'has-sep': actualWidth > 0 });
|
||||||
} else {
|
} else {
|
||||||
patchText(
|
patchAttr(metaEl, 'title', null);
|
||||||
metaBeforeEl,
|
|
||||||
hasData
|
|
||||||
? t('quota.usedAndLeft', {
|
|
||||||
reset: resetStr,
|
|
||||||
used: formatPctNumber(usedVal),
|
|
||||||
rem: formatPctNumber(remVal),
|
|
||||||
})
|
|
||||||
: fallbackMetaText
|
|
||||||
);
|
|
||||||
metaReservedEl.hidden = true;
|
|
||||||
patchText(metaReservedEl, '');
|
|
||||||
patchAttr(metaReservedEl, 'title', null);
|
|
||||||
metaAfterEl.hidden = true;
|
|
||||||
patchText(metaAfterEl, '');
|
|
||||||
patchAttr(trackEl, 'title', null);
|
patchAttr(trackEl, 'title', null);
|
||||||
patchStyleVar(fillEl, '--fill-w', `${Math.min(100, usedVal)}%`);
|
patchStyleVar(fillEl, '--fill-w', `${Math.min(100, usedVal)}%`);
|
||||||
patchStyleVar(fillReservedEl, '--reserved-w', '0%');
|
patchStyleVar(fillReservedEl, '--reserved-w', '0%');
|
||||||
@@ -18896,7 +18855,6 @@ function syncPoolQuotaRow(refs, item, idx, rowEl) {
|
|||||||
|
|
||||||
const has5h = poolData?.usedPct != null && poolData?.remainingPct != null;
|
const has5h = poolData?.usedPct != null && poolData?.remainingPct != null;
|
||||||
const used5hVal = has5h ? Number(poolData.usedPct) : 0;
|
const used5hVal = has5h ? Number(poolData.usedPct) : 0;
|
||||||
const rem5hVal = has5h ? Number(poolData.remainingPct) : 0;
|
|
||||||
|
|
||||||
const useCustomWeekly = Boolean(isActivePool && fallbackWeekly?.isOfficial === false);
|
const useCustomWeekly = Boolean(isActivePool && fallbackWeekly?.isOfficial === false);
|
||||||
const wkUsedRaw = useCustomWeekly
|
const wkUsedRaw = useCustomWeekly
|
||||||
@@ -18910,7 +18868,6 @@ function syncPoolQuotaRow(refs, item, idx, rowEl) {
|
|||||||
: poolData?.weeklyResetTime || (isActivePool ? fallbackWeekly?.resetTime : null);
|
: poolData?.weeklyResetTime || (isActivePool ? fallbackWeekly?.resetTime : null);
|
||||||
const hasWk = wkUsedRaw != null && wkRemRaw != null;
|
const hasWk = wkUsedRaw != null && wkRemRaw != null;
|
||||||
const usedWkVal = hasWk ? Number(wkUsedRaw) : 0;
|
const usedWkVal = hasWk ? Number(wkUsedRaw) : 0;
|
||||||
const remWkVal = hasWk ? Number(wkRemRaw) : 0;
|
|
||||||
|
|
||||||
const hide5h = !has5h && hasWk;
|
const hide5h = !has5h && hasWk;
|
||||||
const hideWk = !hasWk && has5h;
|
const hideWk = !hasWk && has5h;
|
||||||
@@ -18948,15 +18905,12 @@ function syncPoolQuotaRow(refs, item, idx, rowEl) {
|
|||||||
syncQuotaWindowMeter({
|
syncQuotaWindowMeter({
|
||||||
hasData: has5h,
|
hasData: has5h,
|
||||||
usedVal: used5hVal,
|
usedVal: used5hVal,
|
||||||
remVal: rem5hVal,
|
|
||||||
resetTime: poolData?.resetTime,
|
resetTime: poolData?.resetTime,
|
||||||
fallbackMetaText,
|
fallbackMetaText,
|
||||||
showReserved: allowReserved,
|
showReserved: allowReserved,
|
||||||
rawReservedPct: poolData?.reservedPct,
|
rawReservedPct: poolData?.reservedPct,
|
||||||
leaseCount: poolData?.reservedLeaseCount,
|
leaseCount: poolData?.reservedLeaseCount,
|
||||||
metaBeforeEl: refs.meta5hBefore,
|
metaEl: refs.meta5h,
|
||||||
metaReservedEl: refs.meta5hReserved,
|
|
||||||
metaAfterEl: refs.meta5hAfter,
|
|
||||||
trackEl: refs.track5h,
|
trackEl: refs.track5h,
|
||||||
fillEl: refs.fill5h,
|
fillEl: refs.fill5h,
|
||||||
fillReservedEl: refs.fillReserved5h,
|
fillReservedEl: refs.fillReserved5h,
|
||||||
@@ -18996,15 +18950,12 @@ function syncPoolQuotaRow(refs, item, idx, rowEl) {
|
|||||||
syncQuotaWindowMeter({
|
syncQuotaWindowMeter({
|
||||||
hasData: hasWk,
|
hasData: hasWk,
|
||||||
usedVal: usedWkVal,
|
usedVal: usedWkVal,
|
||||||
remVal: remWkVal,
|
|
||||||
resetTime: wkResetRaw,
|
resetTime: wkResetRaw,
|
||||||
fallbackMetaText,
|
fallbackMetaText,
|
||||||
showReserved: allowReserved && !useCustomWeekly,
|
showReserved: allowReserved && !useCustomWeekly,
|
||||||
rawReservedPct: poolData?.weeklyReservedPct,
|
rawReservedPct: poolData?.weeklyReservedPct,
|
||||||
leaseCount: poolData?.weeklyReservedLeaseCount,
|
leaseCount: poolData?.weeklyReservedLeaseCount,
|
||||||
metaBeforeEl: refs.metaWkBefore,
|
metaEl: refs.metaWk,
|
||||||
metaReservedEl: refs.metaWkReserved,
|
|
||||||
metaAfterEl: refs.metaWkAfter,
|
|
||||||
trackEl: refs.trackWk,
|
trackEl: refs.trackWk,
|
||||||
fillEl: refs.fillWk,
|
fillEl: refs.fillWk,
|
||||||
fillReservedEl: refs.fillReservedWk,
|
fillReservedEl: refs.fillReservedWk,
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>用量监控</title>
|
<title>用量监控</title>
|
||||||
<link rel="stylesheet" href="/styles.css?v=1795425513494">
|
<link rel="stylesheet" href="/styles.css?v=1795426864084">
|
||||||
<script src="/preload.js"></script>
|
<script src="/preload.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app-root"></div>
|
<div id="app-root"></div>
|
||||||
<script src="/app.js?v=1795425513494"></script>
|
<script src="/app.js?v=1795426864084"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -81,14 +81,7 @@ export function createPoolQuotaRow() {
|
|||||||
const title5h = h('span', { className: 'quota-win-title', text: '5h' });
|
const title5h = h('span', { className: 'quota-win-title', text: '5h' });
|
||||||
const usage5h = h('span', { className: 'quota-win-usage', hidden: true, text: '' });
|
const usage5h = h('span', { className: 'quota-win-usage', hidden: true, text: '' });
|
||||||
const left5h = h('span', { className: 'quota-win-left' }, [title5h, usage5h]);
|
const left5h = h('span', { className: 'quota-win-left' }, [title5h, usage5h]);
|
||||||
const meta5hBefore = h('span', { text: '--' });
|
const meta5h = h('span', { className: 'panel-meta quota-win-meta text-mono', text: '--' });
|
||||||
const meta5hReserved = h('span', { className: 'quota-reserved-pct', hidden: true, text: '' });
|
|
||||||
const meta5hAfter = h('span', { hidden: true, text: '' });
|
|
||||||
const meta5h = h('span', { className: 'panel-meta quota-win-meta text-mono' }, [
|
|
||||||
meta5hBefore,
|
|
||||||
meta5hReserved,
|
|
||||||
meta5hAfter,
|
|
||||||
]);
|
|
||||||
const fill5h = h('div', { className: 'progress-fill' });
|
const fill5h = h('div', { className: 'progress-fill' });
|
||||||
const fillReserved5h = h('div', { className: 'progress-fill-reserved' });
|
const fillReserved5h = h('div', { className: 'progress-fill-reserved' });
|
||||||
const track5h = h('div', { className: 'progress-track' }, [fill5h, fillReserved5h]);
|
const track5h = h('div', { className: 'progress-track' }, [fill5h, fillReserved5h]);
|
||||||
@@ -100,14 +93,7 @@ export function createPoolQuotaRow() {
|
|||||||
const titleWk = h('span', { className: 'quota-win-title', text: t('quota.weeklyShort') });
|
const titleWk = h('span', { className: 'quota-win-title', text: t('quota.weeklyShort') });
|
||||||
const usageWk = h('span', { className: 'quota-win-usage', hidden: true, text: '' });
|
const usageWk = h('span', { className: 'quota-win-usage', hidden: true, text: '' });
|
||||||
const leftWk = h('span', { className: 'quota-win-left' }, [titleWk, usageWk]);
|
const leftWk = h('span', { className: 'quota-win-left' }, [titleWk, usageWk]);
|
||||||
const metaWkBefore = h('span', { text: '--' });
|
const metaWk = h('span', { className: 'panel-meta quota-win-meta text-mono', text: '--' });
|
||||||
const metaWkReserved = h('span', { className: 'quota-reserved-pct', hidden: true, text: '' });
|
|
||||||
const metaWkAfter = h('span', { hidden: true, text: '' });
|
|
||||||
const metaWk = h('span', { className: 'panel-meta quota-win-meta text-mono' }, [
|
|
||||||
metaWkBefore,
|
|
||||||
metaWkReserved,
|
|
||||||
metaWkAfter,
|
|
||||||
]);
|
|
||||||
const fillWk = h('div', { className: 'progress-fill' });
|
const fillWk = h('div', { className: 'progress-fill' });
|
||||||
const fillReservedWk = h('div', { className: 'progress-fill-reserved' });
|
const fillReservedWk = h('div', { className: 'progress-fill-reserved' });
|
||||||
const trackWk = h('div', { className: 'progress-track' }, [fillWk, fillReservedWk]);
|
const trackWk = h('div', { className: 'progress-track' }, [fillWk, fillReservedWk]);
|
||||||
@@ -129,9 +115,6 @@ export function createPoolQuotaRow() {
|
|||||||
title5h,
|
title5h,
|
||||||
usage5h,
|
usage5h,
|
||||||
meta5h,
|
meta5h,
|
||||||
meta5hBefore,
|
|
||||||
meta5hReserved,
|
|
||||||
meta5hAfter,
|
|
||||||
track5h,
|
track5h,
|
||||||
fill5h,
|
fill5h,
|
||||||
fillReserved5h,
|
fillReserved5h,
|
||||||
@@ -140,9 +123,6 @@ export function createPoolQuotaRow() {
|
|||||||
titleWk,
|
titleWk,
|
||||||
usageWk,
|
usageWk,
|
||||||
metaWk,
|
metaWk,
|
||||||
metaWkBefore,
|
|
||||||
metaWkReserved,
|
|
||||||
metaWkAfter,
|
|
||||||
trackWk,
|
trackWk,
|
||||||
fillWk,
|
fillWk,
|
||||||
fillReservedWk,
|
fillReservedWk,
|
||||||
@@ -174,15 +154,12 @@ export function formatQuotaSummaryFooter(quotas, account) {
|
|||||||
function syncQuotaWindowMeter({
|
function syncQuotaWindowMeter({
|
||||||
hasData,
|
hasData,
|
||||||
usedVal,
|
usedVal,
|
||||||
remVal,
|
|
||||||
resetTime,
|
resetTime,
|
||||||
fallbackMetaText,
|
fallbackMetaText,
|
||||||
showReserved,
|
showReserved,
|
||||||
rawReservedPct,
|
rawReservedPct,
|
||||||
leaseCount,
|
leaseCount,
|
||||||
metaBeforeEl,
|
metaEl,
|
||||||
metaReservedEl,
|
|
||||||
metaAfterEl,
|
|
||||||
trackEl,
|
trackEl,
|
||||||
fillEl,
|
fillEl,
|
||||||
fillReservedEl,
|
fillReservedEl,
|
||||||
@@ -193,6 +170,16 @@ function syncQuotaWindowMeter({
|
|||||||
const actualVal = Math.max(0, usedVal - rsvVal);
|
const actualVal = Math.max(0, usedVal - rsvVal);
|
||||||
const resetStr = hasData ? formatCountdown(resetTime) : '';
|
const resetStr = hasData ? formatCountdown(resetTime) : '';
|
||||||
|
|
||||||
|
patchText(
|
||||||
|
metaEl,
|
||||||
|
hasData
|
||||||
|
? t('quota.usedAndLeft', {
|
||||||
|
reset: resetStr,
|
||||||
|
used: formatPctNumber(usedVal),
|
||||||
|
})
|
||||||
|
: fallbackMetaText
|
||||||
|
);
|
||||||
|
|
||||||
if (hasData && rsvVal > 0) {
|
if (hasData && rsvVal > 0) {
|
||||||
const rsvStr = formatPctNumber(rsvVal);
|
const rsvStr = formatPctNumber(rsvVal);
|
||||||
const actualStr = formatPctNumber(actualVal);
|
const actualStr = formatPctNumber(actualVal);
|
||||||
@@ -201,15 +188,7 @@ function syncQuotaWindowMeter({
|
|||||||
leases >= 2
|
leases >= 2
|
||||||
? t('quota.reservedTipMulti', { rsv: rsvStr, leases, actual: actualStr })
|
? t('quota.reservedTipMulti', { rsv: rsvStr, leases, actual: actualStr })
|
||||||
: t('quota.reservedTip', { rsv: rsvStr, actual: actualStr });
|
: t('quota.reservedTip', { rsv: rsvStr, actual: actualStr });
|
||||||
patchText(
|
patchAttr(metaEl, 'title', tipText);
|
||||||
metaBeforeEl,
|
|
||||||
t('quota.usedBeforeReserved', { reset: resetStr, used: formatPctNumber(usedVal) })
|
|
||||||
);
|
|
||||||
metaReservedEl.hidden = false;
|
|
||||||
patchText(metaReservedEl, t('quota.reservedTag', { rsv: rsvStr }));
|
|
||||||
patchAttr(metaReservedEl, 'title', tipText);
|
|
||||||
metaAfterEl.hidden = false;
|
|
||||||
patchText(metaAfterEl, t('quota.usedAfterReserved', { rem: formatPctNumber(remVal) }));
|
|
||||||
patchAttr(trackEl, 'title', tipText);
|
patchAttr(trackEl, 'title', tipText);
|
||||||
const actualWidth = +Math.min(100, actualVal).toFixed(2);
|
const actualWidth = +Math.min(100, actualVal).toFixed(2);
|
||||||
const rsvWidth = +Math.min(Math.max(0, 100 - actualWidth), rsvVal).toFixed(2);
|
const rsvWidth = +Math.min(Math.max(0, 100 - actualWidth), rsvVal).toFixed(2);
|
||||||
@@ -217,21 +196,7 @@ function syncQuotaWindowMeter({
|
|||||||
patchStyleVar(fillReservedEl, '--reserved-w', `${rsvWidth}%`);
|
patchStyleVar(fillReservedEl, '--reserved-w', `${rsvWidth}%`);
|
||||||
patchClasses(fillReservedEl, { 'is-active': true, 'has-sep': actualWidth > 0 });
|
patchClasses(fillReservedEl, { 'is-active': true, 'has-sep': actualWidth > 0 });
|
||||||
} else {
|
} else {
|
||||||
patchText(
|
patchAttr(metaEl, 'title', null);
|
||||||
metaBeforeEl,
|
|
||||||
hasData
|
|
||||||
? t('quota.usedAndLeft', {
|
|
||||||
reset: resetStr,
|
|
||||||
used: formatPctNumber(usedVal),
|
|
||||||
rem: formatPctNumber(remVal),
|
|
||||||
})
|
|
||||||
: fallbackMetaText
|
|
||||||
);
|
|
||||||
metaReservedEl.hidden = true;
|
|
||||||
patchText(metaReservedEl, '');
|
|
||||||
patchAttr(metaReservedEl, 'title', null);
|
|
||||||
metaAfterEl.hidden = true;
|
|
||||||
patchText(metaAfterEl, '');
|
|
||||||
patchAttr(trackEl, 'title', null);
|
patchAttr(trackEl, 'title', null);
|
||||||
patchStyleVar(fillEl, '--fill-w', `${Math.min(100, usedVal)}%`);
|
patchStyleVar(fillEl, '--fill-w', `${Math.min(100, usedVal)}%`);
|
||||||
patchStyleVar(fillReservedEl, '--reserved-w', '0%');
|
patchStyleVar(fillReservedEl, '--reserved-w', '0%');
|
||||||
@@ -253,7 +218,6 @@ export function syncPoolQuotaRow(refs, item, idx, rowEl) {
|
|||||||
|
|
||||||
const has5h = poolData?.usedPct != null && poolData?.remainingPct != null;
|
const has5h = poolData?.usedPct != null && poolData?.remainingPct != null;
|
||||||
const used5hVal = has5h ? Number(poolData.usedPct) : 0;
|
const used5hVal = has5h ? Number(poolData.usedPct) : 0;
|
||||||
const rem5hVal = has5h ? Number(poolData.remainingPct) : 0;
|
|
||||||
|
|
||||||
const useCustomWeekly = Boolean(isActivePool && fallbackWeekly?.isOfficial === false);
|
const useCustomWeekly = Boolean(isActivePool && fallbackWeekly?.isOfficial === false);
|
||||||
const wkUsedRaw = useCustomWeekly
|
const wkUsedRaw = useCustomWeekly
|
||||||
@@ -267,7 +231,6 @@ export function syncPoolQuotaRow(refs, item, idx, rowEl) {
|
|||||||
: poolData?.weeklyResetTime || (isActivePool ? fallbackWeekly?.resetTime : null);
|
: poolData?.weeklyResetTime || (isActivePool ? fallbackWeekly?.resetTime : null);
|
||||||
const hasWk = wkUsedRaw != null && wkRemRaw != null;
|
const hasWk = wkUsedRaw != null && wkRemRaw != null;
|
||||||
const usedWkVal = hasWk ? Number(wkUsedRaw) : 0;
|
const usedWkVal = hasWk ? Number(wkUsedRaw) : 0;
|
||||||
const remWkVal = hasWk ? Number(wkRemRaw) : 0;
|
|
||||||
|
|
||||||
const hide5h = !has5h && hasWk;
|
const hide5h = !has5h && hasWk;
|
||||||
const hideWk = !hasWk && has5h;
|
const hideWk = !hasWk && has5h;
|
||||||
@@ -305,15 +268,12 @@ export function syncPoolQuotaRow(refs, item, idx, rowEl) {
|
|||||||
syncQuotaWindowMeter({
|
syncQuotaWindowMeter({
|
||||||
hasData: has5h,
|
hasData: has5h,
|
||||||
usedVal: used5hVal,
|
usedVal: used5hVal,
|
||||||
remVal: rem5hVal,
|
|
||||||
resetTime: poolData?.resetTime,
|
resetTime: poolData?.resetTime,
|
||||||
fallbackMetaText,
|
fallbackMetaText,
|
||||||
showReserved: allowReserved,
|
showReserved: allowReserved,
|
||||||
rawReservedPct: poolData?.reservedPct,
|
rawReservedPct: poolData?.reservedPct,
|
||||||
leaseCount: poolData?.reservedLeaseCount,
|
leaseCount: poolData?.reservedLeaseCount,
|
||||||
metaBeforeEl: refs.meta5hBefore,
|
metaEl: refs.meta5h,
|
||||||
metaReservedEl: refs.meta5hReserved,
|
|
||||||
metaAfterEl: refs.meta5hAfter,
|
|
||||||
trackEl: refs.track5h,
|
trackEl: refs.track5h,
|
||||||
fillEl: refs.fill5h,
|
fillEl: refs.fill5h,
|
||||||
fillReservedEl: refs.fillReserved5h,
|
fillReservedEl: refs.fillReserved5h,
|
||||||
@@ -353,15 +313,12 @@ export function syncPoolQuotaRow(refs, item, idx, rowEl) {
|
|||||||
syncQuotaWindowMeter({
|
syncQuotaWindowMeter({
|
||||||
hasData: hasWk,
|
hasData: hasWk,
|
||||||
usedVal: usedWkVal,
|
usedVal: usedWkVal,
|
||||||
remVal: remWkVal,
|
|
||||||
resetTime: wkResetRaw,
|
resetTime: wkResetRaw,
|
||||||
fallbackMetaText,
|
fallbackMetaText,
|
||||||
showReserved: allowReserved && !useCustomWeekly,
|
showReserved: allowReserved && !useCustomWeekly,
|
||||||
rawReservedPct: poolData?.weeklyReservedPct,
|
rawReservedPct: poolData?.weeklyReservedPct,
|
||||||
leaseCount: poolData?.weeklyReservedLeaseCount,
|
leaseCount: poolData?.weeklyReservedLeaseCount,
|
||||||
metaBeforeEl: refs.metaWkBefore,
|
metaEl: refs.metaWk,
|
||||||
metaReservedEl: refs.metaWkReserved,
|
|
||||||
metaAfterEl: refs.metaWkAfter,
|
|
||||||
trackEl: refs.trackWk,
|
trackEl: refs.trackWk,
|
||||||
fillEl: refs.fillWk,
|
fillEl: refs.fillWk,
|
||||||
fillReservedEl: refs.fillReservedWk,
|
fillReservedEl: refs.fillReservedWk,
|
||||||
|
|||||||
@@ -182,10 +182,7 @@ export const I18N_MESSAGES_EN_US = Object.freeze({
|
|||||||
'quota.weeklyPool': 'Weekly ({pool})',
|
'quota.weeklyPool': 'Weekly ({pool})',
|
||||||
'quota.loading': 'Loading...',
|
'quota.loading': 'Loading...',
|
||||||
'quota.failed': 'Unavailable (--%)',
|
'quota.failed': 'Unavailable (--%)',
|
||||||
'quota.usedAndLeft': '{reset} · Used {used}% ({rem}% left)',
|
'quota.usedAndLeft': '{reset} · Used {used}%',
|
||||||
'quota.usedBeforeReserved': '{reset} · Used {used}% (',
|
|
||||||
'quota.reservedTag': '{rsv}% rsv',
|
|
||||||
'quota.usedAfterReserved': ' · {rem}% left)',
|
|
||||||
'quota.reservedTip': 'Estimated lease reservation (Experimental): ~{rsv}% (~{actual}% actual used); unused share refunds after ~10 min idle',
|
'quota.reservedTip': 'Estimated lease reservation (Experimental): ~{rsv}% (~{actual}% actual used); unused share refunds after ~10 min idle',
|
||||||
'quota.reservedTipMulti': 'Estimated lease reservation (Experimental): ~{rsv}% ({leases} stacked leases, ~{actual}% actual used); unused share refunds after ~10 min idle',
|
'quota.reservedTipMulti': 'Estimated lease reservation (Experimental): ~{rsv}% ({leases} stacked leases, ~{actual}% actual used); unused share refunds after ~10 min idle',
|
||||||
'quota.legendActual': 'Actual',
|
'quota.legendActual': 'Actual',
|
||||||
|
|||||||
@@ -182,10 +182,7 @@ export const I18N_MESSAGES_ZH_CN = Object.freeze({
|
|||||||
'quota.weeklyPool': '周限 ({pool})',
|
'quota.weeklyPool': '周限 ({pool})',
|
||||||
'quota.loading': '读取中...',
|
'quota.loading': '读取中...',
|
||||||
'quota.failed': '获取失败 (--%)',
|
'quota.failed': '获取失败 (--%)',
|
||||||
'quota.usedAndLeft': '{reset} · 已用 {used}% (余 {rem}%)',
|
'quota.usedAndLeft': '{reset} · 已用 {used}%',
|
||||||
'quota.usedBeforeReserved': '{reset} · 已用 {used}% (',
|
|
||||||
'quota.reservedTag': '预占 {rsv}%',
|
|
||||||
'quota.usedAfterReserved': ' · 余 {rem}%)',
|
|
||||||
'quota.reservedTip': '预占估算(试验性):约 {rsv}%(实际已用约 {actual}%),静默约 10 分钟后未用差额自动退还',
|
'quota.reservedTip': '预占估算(试验性):约 {rsv}%(实际已用约 {actual}%),静默约 10 分钟后未用差额自动退还',
|
||||||
'quota.reservedTipMulti': '预占估算(试验性):约 {rsv}%(检测到 {leases} 笔叠加租约,实际已用约 {actual}%),静默约 10 分钟后未用差额自动退还',
|
'quota.reservedTipMulti': '预占估算(试验性):约 {rsv}%(检测到 {leases} 笔叠加租约,实际已用约 {actual}%),静默约 10 分钟后未用差额自动退还',
|
||||||
'quota.legendActual': '实占',
|
'quota.legendActual': '实占',
|
||||||
|
|||||||
@@ -599,11 +599,6 @@
|
|||||||
margin-left: 1px;
|
margin-left: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quota-reserved-pct {
|
|
||||||
color: var(--quota-reserved);
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.quota-reserve-legend {
|
.quota-reserve-legend {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -2317,11 +2317,6 @@ html[data-standalone="true"] .app-shell {
|
|||||||
margin-left: 1px;
|
margin-left: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.quota-reserved-pct {
|
|
||||||
color: var(--quota-reserved);
|
|
||||||
font-weight: 500;
|
|
||||||
}
|
|
||||||
|
|
||||||
.quota-reserve-legend {
|
.quota-reserve-legend {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
@@ -967,17 +967,19 @@ test('QuotaPoolsWidget & SettingsOtherTab render experimental reservation bar/te
|
|||||||
assert.ok(legendEl, 'quota reservation legend mounted');
|
assert.ok(legendEl, 'quota reservation legend mounted');
|
||||||
assert.equal(legendEl.hidden, false);
|
assert.equal(legendEl.hidden, false);
|
||||||
|
|
||||||
// Toggle OFF: no reserved highlight and legend hidden
|
// Toggle OFF: no reserved highlight, legend hidden, compact reset + used text only
|
||||||
widget.refs.update({ data: baseData, minuteTick: 1 });
|
widget.refs.update({ data: baseData, minuteTick: 1 });
|
||||||
assert.equal(legendEl.hidden, true);
|
assert.equal(legendEl.hidden, true);
|
||||||
const rsvTagsOff = widget.el.querySelectorAll('.quota-reserved-pct');
|
const metasOff = widget.el.querySelectorAll('.quota-win-meta');
|
||||||
assert.equal(rsvTagsOff.length, 2);
|
assert.equal(metasOff.length, 2);
|
||||||
assert.equal(rsvTagsOff[0].hidden, true);
|
assert.match(metasOff[0].textContent, /· 已用 4\.1%$/);
|
||||||
assert.equal(rsvTagsOff[1].hidden, true);
|
assert.doesNotMatch(metasOff[0].textContent, /[()()]|预占|余/);
|
||||||
|
assert.match(metasOff[1].textContent, /· 已用 16\.2%$/);
|
||||||
|
assert.doesNotMatch(metasOff[1].textContent, /[()()]|预占|余/);
|
||||||
const fillBarsOff = widget.el.querySelectorAll('.progress-fill');
|
const fillBarsOff = widget.el.querySelectorAll('.progress-fill');
|
||||||
assert.equal(fillBarsOff[0].style.getPropertyValue('--fill-w'), '4.1%');
|
assert.equal(fillBarsOff[0].style.getPropertyValue('--fill-w'), '4.1%');
|
||||||
|
|
||||||
// Toggle ON: violet reserved bar segment + colored percentage tag + bottom solid/dashed legend
|
// Toggle ON: violet reserved bar segment + hover tooltip + bottom solid/dashed legend, without parenthetical inline text
|
||||||
widget.refs.update({
|
widget.refs.update({
|
||||||
data: { ...baseData, settings: { experimentalQuotaReservation: true } },
|
data: { ...baseData, settings: { experimentalQuotaReservation: true } },
|
||||||
minuteTick: 1,
|
minuteTick: 1,
|
||||||
@@ -987,11 +989,13 @@ test('QuotaPoolsWidget & SettingsOtherTab render experimental reservation bar/te
|
|||||||
assert.ok(legendEl.querySelector('.quota-legend-line.is-reserved'));
|
assert.ok(legendEl.querySelector('.quota-legend-line.is-reserved'));
|
||||||
assert.match(legendEl.textContent, /实占/);
|
assert.match(legendEl.textContent, /实占/);
|
||||||
assert.match(legendEl.textContent, /预占/);
|
assert.match(legendEl.textContent, /预占/);
|
||||||
const rsvTagsOn = widget.el.querySelectorAll('.quota-reserved-pct');
|
const metasOn = widget.el.querySelectorAll('.quota-win-meta');
|
||||||
assert.equal(rsvTagsOn[0].hidden, false);
|
assert.match(metasOn[0].textContent, /· 已用 4\.1%$/);
|
||||||
assert.equal(rsvTagsOn[0].textContent, '预占 1.0%');
|
assert.doesNotMatch(metasOn[0].textContent, /[()()]|预占|余/);
|
||||||
assert.equal(rsvTagsOn[1].hidden, false);
|
assert.match(metasOn[0].getAttribute('title') || '', /1\.0%/);
|
||||||
assert.equal(rsvTagsOn[1].textContent, '预占 0.5%');
|
assert.match(metasOn[1].textContent, /· 已用 16\.2%$/);
|
||||||
|
assert.doesNotMatch(metasOn[1].textContent, /[()()]|预占|余/);
|
||||||
|
assert.match(metasOn[1].getAttribute('title') || '', /0\.5%/);
|
||||||
|
|
||||||
const fillBarsOn = widget.el.querySelectorAll('.progress-fill');
|
const fillBarsOn = widget.el.querySelectorAll('.progress-fill');
|
||||||
const rsvBarsOn = widget.el.querySelectorAll('.progress-fill-reserved');
|
const rsvBarsOn = widget.el.querySelectorAll('.progress-fill-reserved');
|
||||||
|
|||||||
Reference in New Issue
Block a user