ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.
Python astracloudflarecontrol-panelcyberpaneldnsfablehosting-control-panelhosting-panelkimi-k3server-managementserverkitubuntu-web-panelwebserver
Format build and backup durations through intl
Juan Denisc7a50510c703
diff --git a/frontend/src/components/appdetail/BuildTab.jsx b/frontend/src/components/appdetail/BuildTab.jsxindex a9e73aca..a7969c20 100644--- a/frontend/src/components/appdetail/BuildTab.jsx+++ b/frontend/src/components/appdetail/BuildTab.jsx@@ -15,6 +15,7 @@ import { useTranslation } from 'react-i18next';import { Card as SharedCard } from '@/components/ui/card';import { CardHeader as SharedCardHeader, CardFooter as SharedCardFooter } from '@/components/ui/card';import { formatDateTime } from '@/utils/intl';+import { formatDuration } from '@/utils/serviceTypes';const BuildTab = ({ appId, app }) => {const { t } = useTranslation();@@ -177,12 +178,6 @@ const BuildTab = ({ appId, app }) => {}}- function formatDuration(seconds) {- if (!seconds) return '-';- if (seconds < 60) return `${Math.round(seconds)}s`;- return `${Math.floor(seconds / 60)}m ${Math.round(seconds % 60)}s`;- }-if (loading) {return <EmptyState loading loadingVariant="form" title={t('app.buildTab.loadingBuildConfiguration', 'Loading build settings…')} />;}diff --git a/frontend/src/components/backups/BackupsOverview.jsx b/frontend/src/components/backups/BackupsOverview.jsxindex 6debec05..90a282ff 100644--- a/frontend/src/components/backups/BackupsOverview.jsx+++ b/frontend/src/components/backups/BackupsOverview.jsx@@ -10,7 +10,7 @@ import { formatBytes } from '@/utils/formatBytes';import { KpiBand, MetricCard, Pill, DataTable, DataTableFooter } from '@/components/ds';import EmptyState from '../EmptyState';import { useTranslation } from 'react-i18next';-import { formatNumber } from '@/utils/intl';+import { formatDuration, formatNumber } from '@/utils/intl';// Daily activity cells: one column per week, one row per weekday. Half a year// rather than the mock's 18 weeks — the cells stretch to fill the card (see@@ -50,14 +50,6 @@ function relativeTime(iso) {return `${Math.round(diff / 86400)}d ago`;}-function formatDuration(seconds) {- if (!seconds && seconds !== 0) return '—';- if (seconds < 60) return `${Math.round(seconds)}s`;- const m = Math.floor(seconds / 60);- const s = Math.round(seconds % 60);- return s ? `${m}m ${s}s` : `${m}m`;-}-// DataTable columns for the "Latest snapshots" digest. The hand-rolled table// had no thead; the shared primitive always renders one, so the cells keep// their exact markup (.sk-cell-name, .bk-ico, .sk-cell-sub) and the columns@@ -339,7 +331,7 @@ export default function BackupsOverview({{[['Total backups', formatNumber(events.length)],['This week', String(thisWeek)],- ['Avg duration', formatDuration(avgDuration)],+ ['Avg duration', formatDuration(avgDuration, { fallback: '—' })],['Failed (30d)', String(failed30)],].map(([label, value]) => (<div key={label}>diff --git a/frontend/src/utils/serviceTypes.js b/frontend/src/utils/serviceTypes.jsindex 8b8e6e46..3750e917 100644--- a/frontend/src/utils/serviceTypes.js+++ b/frontend/src/utils/serviceTypes.js@@ -1,3 +1,5 @@+import { formatDuration as formatDurationIntl } from '@/utils/intl';+// Categorical palette: literal hex on purpose (consumed as inline styles in// JS). Values follow the redesign palette in styles/_theme-variables.scss —// green #3ddc97 / red #fb6f6f / amber #f5b945 / accent #6d7cff /@@ -113,12 +115,9 @@ export function isDockerApp(appType) {// from this module keep working.export { formatRelativeTime } from '@/utils/time';+// A deploy with no recorded duration (or 0) shows '-'.export function formatDuration(seconds) {- if (!seconds || seconds < 0) return '-';- if (seconds < 60) return `${Math.round(seconds)}s`;- const min = Math.floor(seconds / 60);- const sec = Math.round(seconds % 60);- return `${min}m ${sec}s`;+ return seconds ? formatDurationIntl(seconds) : '-';}export { SERVICE_TYPES, STATUS_CONFIG, DEPLOY_STATUS };