Skip to content

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.

Pass error details through and translate last labels

Juan Denisd2465d9817bf
diff --git a/docs/MIGRATION_INVENTORY.md b/docs/MIGRATION_INVENTORY.md
index e24dd309..d698c084 100644
--- a/docs/MIGRATION_INVENTORY.md
+++ b/docs/MIGRATION_INVENTORY.md
@@ -19,12 +19,12 @@ debt. Regenerate with `python scripts/generate-migration-inventory.py`.
| Hand-shaped {'error': ...} bodies in app/api | typed errors + the global handler | 850 | 850 | migrate when touched; new endpoints raise |
| Raw subprocess calls outside the runners | app/utils/system.py runners | 24 | 24 | migrate when touched |
| Controller-boundary violations (routes doing service work) | service layer extraction | 491 | 491 | migrate when touched (first-wave ratchet) |
-| raw api.* calls in pages/ | E1: useServerQuery/useServerMutation | 398 | 398 | migrate when touched |
-| per-page toast.error extractions in pages/ | E1: query-layer error presentation | 206 | 206 | migrate when touched |
-| hand-rolled form-group blocks | F2: FormField/useForm | 317 | 321 | migrate when touched |
+| raw api.* calls in pages/ | E1: useServerQuery/useServerMutation | 396 | 398 | migrate when touched |
+| per-page toast.error extractions in pages/ | E1: query-layer error presentation | 200 | 206 | migrate when touched |
+| hand-rolled form-group blocks | F2: FormField/useForm | 320 | 321 | migrate when touched |
| unencoded ?k=${v} query interpolations in services/api | C4: buildQuery/encoding template | 0 | 0 | INVARIANT at 0 |
| raw setInterval pollers | E2: usePolling/refetchInterval | 7 | 7 | DELIBERATE RESIDUE: clock ticks, socket-fallback hooks, and sibling-repo extension timers - each listed per file |
| direct navigator.clipboard call sites | F3: copyToClipboard | 0 | 0 | INVARIANT at 0 |
-| hex colour literals outside token files | G: var(--token) | 150 | 150 | migrate when touched |
+| hex colour literals outside token files | G: var(--token) | 140 | 140 | migrate when touched |
| SCSS class names defined in multiple files | single-owner partials | 0 | 0 | needs eyes on pages (no byte-identical proof available) |
diff --git a/frontend/src/components/git/RepoConnectForm.jsx b/frontend/src/components/git/RepoConnectForm.jsx
index 69e609a7..975b0d2e 100644
--- a/frontend/src/components/git/RepoConnectForm.jsx
+++ b/frontend/src/components/git/RepoConnectForm.jsx
@@ -44,10 +44,10 @@ const RepoConnectForm = ({
},
showPaths = false,
defaultPaths = [],
- pathsLabel = 'Tracked paths',
+ pathsLabel,
pathsHint = '',
urlPlaceholder = 'https://github.com/user/repo.git',
- submitLabel = 'Connect Repository',
+ submitLabel,
idPrefix = 'repo',
enableGithub = true,
}) => {
@@ -271,7 +271,7 @@ const RepoConnectForm = ({
id={`${idPrefix}-paths`}
paths={formData.paths}
onChange={handlePathsChange}
- label={pathsLabel}
+ label={pathsLabel ?? t('app.repoConnectForm.trackedPaths', 'Tracked paths')}
hint={pathsHint}
/>
)}
@@ -292,7 +292,7 @@ const RepoConnectForm = ({
<div className="git-connect__actions">
<Button type="submit" disabled={loading}>
<GitBranch size={14} />
- {loading ? t('app.repoConnectForm.connecting', 'Connecting…') : submitLabel}
+ {loading ? t('app.repoConnectForm.connecting', 'Connecting…') : (submitLabel ?? t('app.repoConnectForm.connectRepository', 'Connect repository'))}
</Button>
</div>
</form>
diff --git a/frontend/src/components/settings/connections/ConnectionsHub.jsx b/frontend/src/components/settings/connections/ConnectionsHub.jsx
index 96cb43e8..ecf52937 100644
--- a/frontend/src/components/settings/connections/ConnectionsHub.jsx
+++ b/frontend/src/components/settings/connections/ConnectionsHub.jsx
@@ -183,7 +183,7 @@ export default function ConnectionsHub() {
const onAddDns = useCallback(async (payload) => {
try {
const res = await api.addEmailDNSProvider(payload);
- if (res && res.success === false) throw new Error(res.error || 'Failed to add connection');
+ if (res && res.success === false) throw new Error(res.error || t('app.connectionsHub.couldntAddConnection', "Couldn't add the connection."));
toast.success(t('app.connectionsHub.providerConnected', '{{name}} connected', { name: payload.name }));
await loadData();
return true;
diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json
index ec85fa00..a1b94ba1 100644
--- a/frontend/src/i18n/locales/en.json
+++ b/frontend/src/i18n/locales/en.json
@@ -1261,6 +1261,7 @@
"connectionTestFailed": "Couldn't connect.",
"connectionWorks": "Connection works",
"connectionsAreManagedByAdministrators": "Connections are managed by administrators.",
+ "couldntAddConnection": "Couldn't add the connection.",
"couldntLoad": "Couldn't load.",
"countConnected": "{{count}} connected",
"disconnect": "Disconnect",
@@ -5008,6 +5009,7 @@
"autoDeployOnPush": "Auto-deploy on push",
"automaticallyDeployWhenNewCommitsLand": "Automatically deploy when new commits land on this branch.",
"connectAGitRepository": "Connect a Git repository",
+ "connectRepository": "Connect repository",
"connecting": "Connecting…",
"deployedAt": "Deployed At",
"disabled": "Disabled",
@@ -5020,7 +5022,8 @@
"orPasteAUrl": "or paste a URL",
"repositoryConnected": "Repository connected",
"repositoryUrl": "Repository URL",
- "trackThisServiceInVersionControl": "Track this service in version control. Push to deploy."
+ "trackThisServiceInVersionControl": "Track this service in version control. Push to deploy.",
+ "trackedPaths": "Tracked paths"
},
"requestMetrics": {
"cacheHit": "Cache hit ratio",
diff --git a/frontend/src/pages/Services.jsx b/frontend/src/pages/Services.jsx
index eefa64cf..fc943559 100644
--- a/frontend/src/pages/Services.jsx
+++ b/frontend/src/pages/Services.jsx
@@ -22,6 +22,7 @@ import Modal from '@/components/Modal';
import RequiresDocker from '../components/RequiresDocker';
import { useTranslation } from 'react-i18next';
import { toastError } from '@/utils/errorMessage';
+import { translateLabel } from '@/i18n/labels';
// Severity order for status sorting — also the page's default row order.
const STATUS_SORT_ORDER = { running: 0, deploying: 1, building: 2, stopped: 3, failed: 4 };
@@ -244,7 +245,7 @@ const Services = () => {
<ServiceTile name={app.name} size={30} className="wp-list__tile" aria-hidden="true" />
<span>
<div>{app.name}</div>
- <div className="sk-cell-sub">{typeInfo.label}</div>
+ <div className="sk-cell-sub">{translateLabel(t, typeInfo)}</div>
</span>
</div>
);
diff --git a/frontend/src/services/api/client.js b/frontend/src/services/api/client.js
index 155351bc..e0cad601 100644
--- a/frontend/src/services/api/client.js
+++ b/frontend/src/services/api/client.js
@@ -213,7 +213,7 @@ class ApiClient {
// exactly today's behaviour. The 257 `toast.error(err.message)`
// sites keep working unchanged and gain translations as codes land.
const serverMessage = data.error || data.msg || fallback;
- const err = new Error(translateServerError(data.code, serverMessage));
+ const err = new Error(translateServerError(data.code, serverMessage, data.details));
err.status = response.status;
err.code = data.code || null;
err.serverMessage = serverMessage;