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.

fix(ui): honour the service URL in the ⋯ menu and surface email install errors

Juan Denise1a7e551284d
diff --git a/frontend/src/pages/Email.jsx b/frontend/src/pages/Email.jsx
index 02ec61fd..ee5ce184 100644
--- a/frontend/src/pages/Email.jsx
+++ b/frontend/src/pages/Email.jsx
@@ -158,16 +158,35 @@ export default function Email() {
// ---------- Overview ----------
function OverviewTab({ status, installed, onChange }) {
const toast = useToast();
+ const [installError, setInstallError] = useState(null);
const components = status?.components || {};
const names = Object.keys(components);
+ // install_all answers {error, results: {postfix: {success, error}, ...}},
+ // and the API client hangs that body off the thrown error as err.data. Dig
+ // the failing components' stderr out of `results` so the user sees WHICH
+ // component failed and why instead of a bare "Install failed". More than
+ // one can fail in a single call: the installer only returns early on
+ // postfix and dovecot, and lets dkim/spamassassin fall through.
+ const installFailures = (err) => Object.entries(err?.data?.results || {})
+ .filter(([, r]) => r && r.success === false)
+ .map(([component, r]) => `${component}: ${r.error || 'unknown error'}`);
+
const install = async () => {
+ setInstallError(null);
try {
await api.installEmailServer();
toast.success('Email server install started');
onChange();
- } catch {
- toast.error('Install failed');
+ } catch (err) {
+ // err.message is the server's top-line reason ("Postfix
+ // installation failed"); the failures carry the actual stderr.
+ const summary = err?.message || 'Install failed';
+ const failures = installFailures(err);
+ // The toast stays one line — the inline block below keeps the full
+ // detail on screen after the toast has gone.
+ setInstallError([summary, ...failures].join('\n'));
+ toast.error(failures.length ? `${summary} — ${failures[0]}` : summary);
}
};
@@ -198,6 +217,9 @@ function OverviewTab({ status, installed, onChange }) {
A deliverability preflight (PTR, port 25, RBL) gates outbound sending before mail
can leave this host.
</p>
+ {installError && (
+ <p className="sk-email__hero-error" role="alert">{installError}</p>
+ )}
</div>
);
}
diff --git a/frontend/src/pages/ServiceDetail.jsx b/frontend/src/pages/ServiceDetail.jsx
index 98e82bf1..713eb3a9 100644
--- a/frontend/src/pages/ServiceDetail.jsx
+++ b/frontend/src/pages/ServiceDetail.jsx
@@ -367,9 +367,9 @@ const ServiceDetail = () => {
Suspend Service
</button>
)}
- {service.port && (
+ {openUrl && (
<a
- href={`http://localhost:${service.port}`}
+ href={openUrl}
target="_blank"
rel="noopener noreferrer"
onClick={() => setShowMoreMenu(false)}
diff --git a/frontend/src/styles/pages/_email.scss b/frontend/src/styles/pages/_email.scss
index 55730019..9ce278c4 100644
--- a/frontend/src/styles/pages/_email.scss
+++ b/frontend/src/styles/pages/_email.scss
@@ -82,6 +82,25 @@
text-align: center;
}
+ // Inline install failure (component + stderr from the API) — same card
+ // chrome as the hero note, in the danger tone. pre-line keeps one failing
+ // component per line; anywhere stops a long unbroken stderr token from
+ // widening the hero.
+ &__hero-error {
+ margin: $space-3 0 0;
+ padding: $space-3 $space-4;
+ background: var(--red-bg);
+ border: 1px solid var(--red);
+ border-radius: var(--radius);
+ font-family: var(--mono);
+ font-size: 11.5px;
+ line-height: 1.55;
+ color: var(--red);
+ white-space: pre-line;
+ overflow-wrap: anywhere;
+ text-align: left;
+ }
+
// ── Action clusters (row actions, form buttons, toolbars) ─
&__actions {
display: flex;