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.

redesign(domains): inline DNS records table in the drawer

Juan Denisfb0fd1cf44be
diff --git a/frontend/src/pages/Domains.jsx b/frontend/src/pages/Domains.jsx
index 3a471343..a5820959 100644
--- a/frontend/src/pages/Domains.jsx
+++ b/frontend/src/pages/Domains.jsx
@@ -27,6 +27,12 @@ const Domains = () => {
const [filter, setFilter] = useState('all');
const [drawerDomain, setDrawerDomain] = useState(null);
+ // Inline DNS records for the open drawer domain
+ const [dnsRecords, setDnsRecords] = useState([]);
+ const [dnsLoading, setDnsLoading] = useState(false);
+ const [dnsError, setDnsError] = useState('');
+ const [dnsHasZone, setDnsHasZone] = useState(true);
+
// Modal states
const [showAddModal, setShowAddModal] = useState(false);
const [showSslModal, setShowSslModal] = useState(false);
@@ -43,6 +49,41 @@ const Domains = () => {
loadData();
}, []);
+ // Load DNS records for the domain shown in the drawer. A domain has no zone
+ // reference, so we match it to a DNS zone by name; unmanaged domains have no
+ // zone and fall back to the empty/hint state rather than erroring.
+ useEffect(() => {
+ if (!drawerDomain) return;
+ let cancelled = false;
+ const domainName = drawerDomain.name;
+
+ async function loadDnsRecords() {
+ setDnsLoading(true);
+ setDnsError('');
+ setDnsRecords([]);
+ setDnsHasZone(true);
+ try {
+ const zonesData = await api.getDNSZones();
+ const zone = (zonesData.zones || []).find(z => z.domain === domainName);
+ if (cancelled) return;
+ if (!zone) {
+ setDnsHasZone(false);
+ return;
+ }
+ const recordsData = await api.getDNSRecords(zone.id);
+ if (cancelled) return;
+ setDnsRecords(recordsData.records || []);
+ } catch {
+ if (!cancelled) setDnsError('Failed to load DNS records');
+ } finally {
+ if (!cancelled) setDnsLoading(false);
+ }
+ }
+
+ loadDnsRecords();
+ return () => { cancelled = true; };
+ }, [drawerDomain]);
+
async function loadData() {
try {
setLoading(true);
@@ -351,9 +392,53 @@ const Domains = () => {
</div>
</div>
- <div className="dom-drawer__section">
- <h3 className="dom-drawer__sectiontitle">DNS records</h3>
- <p className="dom-drawer__hint">DNS records for this domain are managed in DNS Zones.</p>
+ <div className="dom-drawer__section dom-dns">
+ <h3 className="dom-drawer__sectiontitle">
+ DNS records
+ {dnsHasZone && !dnsLoading && !dnsError && (
+ <span className="dom-dns__count">· {dnsRecords.length}</span>
+ )}
+ </h3>
+
+ {dnsLoading ? (
+ <p className="dom-drawer__hint">Loading DNS records…</p>
+ ) : dnsError ? (
+ <p className="dom-drawer__hint dom-dns__error">{dnsError}</p>
+ ) : !dnsHasZone ? (
+ <p className="dom-drawer__hint">No DNS records — this domain isn&apos;t managed in DNS Zones.</p>
+ ) : dnsRecords.length === 0 ? (
+ <p className="dom-drawer__hint">No DNS records.</p>
+ ) : (
+ <div className="dom-dns__table">
+ <table className="sk-dtable">
+ <thead>
+ <tr>
+ <th className="dom-dns__col-type">Type</th>
+ <th>Name</th>
+ <th>Value</th>
+ <th className="dom-dns__col-ttl">TTL</th>
+ </tr>
+ </thead>
+ <tbody>
+ {dnsRecords.map(rec => (
+ <tr key={rec.id}>
+ <td>
+ <span className={`dns-rtype dns-rtype--${(rec.record_type || '').toLowerCase()}`}>
+ {rec.record_type}
+ </span>
+ </td>
+ <td className="sk-cell-mono">{rec.name}</td>
+ <td className="sk-cell-mono dom-dns__value">
+ {rec.priority ? `${rec.priority} ` : ''}{rec.content}
+ </td>
+ <td className="sk-cell-mono">{rec.ttl}</td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </div>
+ )}
+
<Button variant="outline" size="sm" onClick={() => navigate('/dns')}>
<NetworkIcon size={14} /> Manage DNS records
</Button>
diff --git a/frontend/src/styles/pages/_domains.scss b/frontend/src/styles/pages/_domains.scss
index d5792418..69ae2f68 100644
--- a/frontend/src/styles/pages/_domains.scss
+++ b/frontend/src/styles/pages/_domains.scss
@@ -120,6 +120,41 @@
}
}
+// ── Inline DNS records table inside the domain drawer ────────
+.dom-dns {
+ width: 100%;
+
+ &__count {
+ margin-left: $space-2;
+ font-family: var(--mono);
+ font-size: 11px;
+ font-weight: $font-weight-normal;
+ color: var(--text-faint);
+ }
+
+ &__error { color: var(--red); }
+
+ &__table {
+ width: 100%;
+ background: var(--surface);
+ border: 1px solid var(--border-soft);
+ border-radius: var(--radius);
+ overflow: hidden;
+ }
+
+ &__col-type { width: 70px; }
+ &__col-ttl { width: 70px; }
+
+ // Truncate long record values (e.g. TXT/SPF) to keep the table dense
+ &__value {
+ max-width: 280px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ color: var(--text);
+ }
+}
+
.dom-specs {
display: grid;
grid-template-columns: repeat(3, 1fr);