Skip to content

Commit 1bdf62e

Browse files
committed
feat(web): show sandbox TTL countdown in system status dialog
Display remaining time before each sandbox is cleaned up, calculated from (session_ttl_sec - elapsed since last_used_at). Shows amber text when under 60 seconds remaining. TTL is sourced from the Box runtime status API. Includes i18n for all 8 supported languages.
1 parent 11920b5 commit 1bdf62e

9 files changed

Lines changed: 50 additions & 0 deletions

File tree

web/src/app/home/monitoring/components/overview-cards/SystemStatusCards.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
Info,
1010
Container,
1111
Clock,
12+
Timer,
1213
Cpu,
1314
HardDrive,
1415
Network,
@@ -348,6 +349,39 @@ export default function SystemStatusCard({
348349
</span>
349350
</span>
350351
</div>
352+
{boxStatus?.session_ttl_sec != null &&
353+
boxStatus.session_ttl_sec > 0 &&
354+
(() => {
355+
const elapsed =
356+
(Date.now() -
357+
new Date(session.last_used_at).getTime()) /
358+
1000;
359+
const remaining = Math.max(
360+
0,
361+
boxStatus.session_ttl_sec! - elapsed,
362+
);
363+
const mins = Math.floor(remaining / 60);
364+
const secs = Math.floor(remaining % 60);
365+
return (
366+
<div className="flex items-center gap-1.5 text-muted-foreground col-span-2">
367+
<Timer className="w-3 h-3 flex-shrink-0" />
368+
<span>
369+
{t('monitoring.boxSessionTTL')}:{' '}
370+
<span
371+
className={
372+
remaining <= 60
373+
? 'text-amber-600 font-medium'
374+
: 'text-foreground'
375+
}
376+
>
377+
{remaining <= 0
378+
? t('monitoring.boxSessionExpiring')
379+
: `${mins}m ${secs.toString().padStart(2, '0')}s`}
380+
</span>
381+
</span>
382+
</div>
383+
);
384+
})()}
351385
</div>
352386
</div>
353387
))}

web/src/i18n/locales/en-US.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,8 @@ const enUS = {
12481248
boxSandboxes: 'Sandboxes',
12491249
boxSessionCreated: 'Created',
12501250
boxSessionLastUsed: 'Last used',
1251+
boxSessionTTL: 'Expires in',
1252+
boxSessionExpiring: 'Expiring soon',
12511253
},
12521254
limitation: {
12531255
maxBotsReached:

web/src/i18n/locales/es-ES.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,6 +1273,8 @@ const esES = {
12731273
boxSandboxes: 'Sandboxes',
12741274
boxSessionCreated: 'Creado',
12751275
boxSessionLastUsed: 'Último uso',
1276+
boxSessionTTL: 'Expira en',
1277+
boxSessionExpiring: 'Expirando pronto',
12761278
},
12771279
limitation: {
12781280
maxBotsReached:

web/src/i18n/locales/ja-JP.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,8 @@
12451245
boxSandboxes: 'サンドボックス',
12461246
boxSessionCreated: '作成日時',
12471247
boxSessionLastUsed: '最終使用',
1248+
boxSessionTTL: '残り時間',
1249+
boxSessionExpiring: 'まもなく期限切れ',
12481250
},
12491251
limitation: {
12501252
maxBotsReached:

web/src/i18n/locales/ru-RU.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1247,6 +1247,8 @@ const ruRU = {
12471247
boxSandboxes: 'Песочницы',
12481248
boxSessionCreated: 'Создано',
12491249
boxSessionLastUsed: 'Последнее использование',
1250+
boxSessionTTL: 'Истекает через',
1251+
boxSessionExpiring: 'Скоро истекает',
12501252
},
12511253
limitation: {
12521254
maxBotsReached:

web/src/i18n/locales/th-TH.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,6 +1220,8 @@ const thTH = {
12201220
boxSandboxes: 'แซนด์บ็อกซ์',
12211221
boxSessionCreated: 'สร้างเมื่อ',
12221222
boxSessionLastUsed: 'ใช้ล่าสุด',
1223+
boxSessionTTL: 'หมดอายุใน',
1224+
boxSessionExpiring: 'ใกล้หมดอายุ',
12231225
},
12241226
limitation: {
12251227
maxBotsReached:

web/src/i18n/locales/vi-VN.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,8 @@ const viVN = {
12411241
boxSandboxes: 'Sandbox',
12421242
boxSessionCreated: 'Đã tạo',
12431243
boxSessionLastUsed: 'Lần cuối sử dụng',
1244+
boxSessionTTL: 'Hết hạn sau',
1245+
boxSessionExpiring: 'Sắp hết hạn',
12441246
},
12451247
limitation: {
12461248
maxBotsReached:

web/src/i18n/locales/zh-Hans.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,8 @@ const zhHans = {
11941194
boxSandboxes: '沙箱数',
11951195
boxSessionCreated: '创建时间',
11961196
boxSessionLastUsed: '最后使用',
1197+
boxSessionTTL: '剩余时间',
1198+
boxSessionExpiring: '即将过期',
11971199
},
11981200
limitation: {
11991201
maxBotsReached:

web/src/i18n/locales/zh-Hant.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1186,6 +1186,8 @@ const zhHant = {
11861186
boxSandboxes: '沙箱數',
11871187
boxSessionCreated: '建立時間',
11881188
boxSessionLastUsed: '最後使用',
1189+
boxSessionTTL: '剩餘時間',
1190+
boxSessionExpiring: '即將過期',
11891191
},
11901192
limitation: {
11911193
maxBotsReached:

0 commit comments

Comments
 (0)