feat: refine project container detail panels
This commit is contained in:
1 parent
2815de9e14
commit
cb77dab219
12 files changed
+118
-441
No files matched your search
+18
@@ -2,6 +2,7 @@ import SearchField from "@/components/SearchField";
|
|||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
ChevronDown,
|
ChevronDown,
|
||||||
|
CloudSyncIcon,
|
||||||
Database,
|
Database,
|
||||||
Loader2,
|
Loader2,
|
||||||
Plus,
|
Plus,
|
||||||
@@ -163,6 +164,23 @@ export default function EnvironmentContainersToolbar({
|
|||||||
<Database size={14} style={{ color: "var(--accent-green)" }} />
|
<Database size={14} style={{ color: "var(--accent-green)" }} />
|
||||||
Deploy Database
|
Deploy Database
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
role="menuitem"
|
||||||
|
className="btn btn-ghost"
|
||||||
|
onClick={handleDeployDatabase}
|
||||||
|
style={{
|
||||||
|
justifyContent: "flex-start",
|
||||||
|
fontSize: 12,
|
||||||
|
color: "var(--text-secondary)",
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CloudSyncIcon
|
||||||
|
size={14}
|
||||||
|
style={{ color: "var(--accent-red)" }}
|
||||||
|
/>
|
||||||
|
Import form Sync
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+3
-1
@@ -12,7 +12,9 @@ interface AdvancedSummaryCardProps {
|
|||||||
item: AdvancedSummary;
|
item: AdvancedSummary;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function AdvancedSummaryCard({ item }: AdvancedSummaryCardProps) {
|
export default function AdvancedSummaryCard({
|
||||||
|
item,
|
||||||
|
}: AdvancedSummaryCardProps) {
|
||||||
return (
|
return (
|
||||||
<section
|
<section
|
||||||
className="card"
|
className="card"
|
||||||
|
|||||||
+6
-93
@@ -1,15 +1,11 @@
|
|||||||
import {
|
import {
|
||||||
AlertTriangle,
|
|
||||||
Clock3,
|
Clock3,
|
||||||
Cpu,
|
Cpu,
|
||||||
Database,
|
Database,
|
||||||
Loader2,
|
|
||||||
RefreshCcw,
|
RefreshCcw,
|
||||||
Settings2,
|
|
||||||
ShieldCheck,
|
ShieldCheck,
|
||||||
ToggleLeft,
|
ToggleLeft,
|
||||||
ToggleRight,
|
ToggleRight,
|
||||||
Trash2,
|
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
import type {
|
import type {
|
||||||
AdvancedAuditEvent,
|
AdvancedAuditEvent,
|
||||||
@@ -231,7 +227,7 @@ export default function AdvancedTabPanel({
|
|||||||
</PanelShell>
|
</PanelShell>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
{/* <div
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns:
|
gridTemplateColumns:
|
||||||
@@ -255,13 +251,13 @@ export default function AdvancedTabPanel({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</PanelShell>
|
</PanelShell>
|
||||||
</div>
|
</div> */}
|
||||||
|
|
||||||
<div
|
{/* <div
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns:
|
gridTemplateColumns:
|
||||||
"minmax(min(620px, 100%), 1.2fr) minmax(min(360px, 100%), 0.8fr)",
|
"minmax(min(620px, 100%), 1.2fr) minmax(min(360px, 100%), 1.2fr)",
|
||||||
gap: 12,
|
gap: 12,
|
||||||
alignItems: "start",
|
alignItems: "start",
|
||||||
}}
|
}}
|
||||||
@@ -271,7 +267,7 @@ export default function AdvancedTabPanel({
|
|||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns:
|
gridTemplateColumns:
|
||||||
"repeat(auto-fit, minmax(min(180px, 100%), 1fr))",
|
"repeat(auto-fit, minmax(min(280px, 100%), 1fr))",
|
||||||
gap: 10,
|
gap: 10,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -355,90 +351,7 @@ export default function AdvancedTabPanel({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</PanelShell>
|
</PanelShell>
|
||||||
</div>
|
</div> */}
|
||||||
|
|
||||||
<PanelShell title="Danger Zone">
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "grid",
|
|
||||||
gridTemplateColumns: "auto minmax(0, 1fr) auto",
|
|
||||||
gap: 12,
|
|
||||||
alignItems: "center",
|
|
||||||
border: "1px solid rgba(239,68,68,0.35)",
|
|
||||||
borderRadius: 7,
|
|
||||||
background: "rgba(239,68,68,0.06)",
|
|
||||||
padding: 13,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
style={{
|
|
||||||
width: 40,
|
|
||||||
height: 40,
|
|
||||||
borderRadius: 10,
|
|
||||||
display: "inline-flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
color: "var(--text-danger)",
|
|
||||||
background: "rgba(239,68,68,0.1)",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<AlertTriangle size={20} />
|
|
||||||
</span>
|
|
||||||
<div style={{ minWidth: 0 }}>
|
|
||||||
<p
|
|
||||||
style={{
|
|
||||||
margin: 0,
|
|
||||||
color: "var(--text-primary)",
|
|
||||||
fontSize: 13,
|
|
||||||
fontWeight: 800,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Destructive actions require confirmation
|
|
||||||
</p>
|
|
||||||
<p
|
|
||||||
style={{
|
|
||||||
marginTop: 4,
|
|
||||||
color: "var(--text-muted)",
|
|
||||||
fontSize: 12,
|
|
||||||
lineHeight: 1.45,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
Remove, reset, and cleanup operations stay behind explicit
|
|
||||||
confirmation dialogs before they execute.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div style={{ display: "flex", gap: 8, flexWrap: "wrap" }}>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="btn btn-ghost"
|
|
||||||
disabled={actionBusy}
|
|
||||||
aria-busy={activeAction === "rebuild"}
|
|
||||||
onClick={onReset}
|
|
||||||
>
|
|
||||||
{activeAction === "rebuild" ? (
|
|
||||||
<Loader2 size={14} className="animate-spin" />
|
|
||||||
) : (
|
|
||||||
<Settings2 size={14} />
|
|
||||||
)}
|
|
||||||
Reset
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="btn btn-danger"
|
|
||||||
disabled={actionBusy}
|
|
||||||
aria-busy={activeAction === "remove"}
|
|
||||||
onClick={onRemove}
|
|
||||||
>
|
|
||||||
{activeAction === "remove" ? (
|
|
||||||
<Loader2 size={14} className="animate-spin" />
|
|
||||||
) : (
|
|
||||||
<Trash2 size={14} />
|
|
||||||
)}
|
|
||||||
Remove
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</PanelShell>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
-33
@@ -9,7 +9,6 @@ import {
|
|||||||
ExternalLink,
|
ExternalLink,
|
||||||
GitBranch,
|
GitBranch,
|
||||||
GitCommit,
|
GitCommit,
|
||||||
Package,
|
|
||||||
Rocket,
|
Rocket,
|
||||||
XCircle,
|
XCircle,
|
||||||
} from "lucide-react";
|
} from "lucide-react";
|
||||||
@@ -242,7 +241,6 @@ export default function DeploymentsTabPanel({
|
|||||||
<th>Branch</th>
|
<th>Branch</th>
|
||||||
<th>Duration</th>
|
<th>Duration</th>
|
||||||
<th>Deployed At</th>
|
<th>Deployed At</th>
|
||||||
<th style={{ textAlign: "right" }}>Actions</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -269,16 +267,6 @@ export default function DeploymentsTabPanel({
|
|||||||
</td>
|
</td>
|
||||||
<td>{deployment.duration}</td>
|
<td>{deployment.duration}</td>
|
||||||
<td>{deployment.deployedAt}</td>
|
<td>{deployment.deployedAt}</td>
|
||||||
<td style={{ textAlign: "right" }}>
|
|
||||||
<button
|
|
||||||
type="button"
|
|
||||||
className="btn btn-ghost"
|
|
||||||
style={{ padding: "4px 7px" }}
|
|
||||||
aria-label={`Open deployment ${deployment.version}`}
|
|
||||||
>
|
|
||||||
<ExternalLink size={13} />
|
|
||||||
</button>
|
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -356,27 +344,6 @@ export default function DeploymentsTabPanel({
|
|||||||
</div>
|
</div>
|
||||||
</PanelShell>
|
</PanelShell>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<PanelShell title="Release Notes">
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "grid",
|
|
||||||
gridTemplateColumns: "auto minmax(0, 1fr)",
|
|
||||||
gap: 10,
|
|
||||||
alignItems: "start",
|
|
||||||
color: "var(--text-secondary)",
|
|
||||||
fontSize: 12,
|
|
||||||
lineHeight: 1.6,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Package size={16} style={{ color: "var(--accent-blue)" }} />
|
|
||||||
<p style={{ margin: 0 }}>
|
|
||||||
Deployment history is currently derived from the real container
|
|
||||||
record. A permanent deployment history API is not available yet, so
|
|
||||||
only the current deployment snapshot is shown here.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</PanelShell>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+5
-246
@@ -1,14 +1,11 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useMemo, useState } from "react";
|
import { useMemo, useState } from "react";
|
||||||
import TablePagination from "@/components/TablePagination";
|
|
||||||
import { useTablePagination } from "@/lib/use-table-pagination";
|
import { useTablePagination } from "@/lib/use-table-pagination";
|
||||||
import {
|
import {
|
||||||
CheckCircle2,
|
CheckCircle2,
|
||||||
ClipboardCheck,
|
ClipboardCheck,
|
||||||
KeyRound,
|
|
||||||
Loader2,
|
Loader2,
|
||||||
LockKeyhole,
|
|
||||||
RotateCcw,
|
RotateCcw,
|
||||||
Save,
|
Save,
|
||||||
ShieldAlert,
|
ShieldAlert,
|
||||||
@@ -178,7 +175,7 @@ export default function EnvironmentTabPanel({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<section style={{ display: "flex", flexDirection: "column", gap: 12 }}>
|
<section style={{ display: "flex", flexDirection: "column", gap: 12 }}>
|
||||||
<div
|
{/* <div
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns:
|
gridTemplateColumns:
|
||||||
@@ -189,7 +186,7 @@ export default function EnvironmentTabPanel({
|
|||||||
{environment.summaries.map((summary) => (
|
{environment.summaries.map((summary) => (
|
||||||
<EnvironmentSummaryCard key={summary.label} item={summary} />
|
<EnvironmentSummaryCard key={summary.label} item={summary} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div> */}
|
||||||
|
|
||||||
<PanelShell title="Project .env Editor">
|
<PanelShell title="Project .env Editor">
|
||||||
<div
|
<div
|
||||||
@@ -215,7 +212,7 @@ export default function EnvironmentTabPanel({
|
|||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
style={{
|
style={{
|
||||||
width: "100%",
|
width: "100%",
|
||||||
minHeight: 260,
|
minHeight: 480,
|
||||||
resize: "vertical",
|
resize: "vertical",
|
||||||
border: "1px solid var(--border)",
|
border: "1px solid var(--border)",
|
||||||
borderRadius: 7,
|
borderRadius: 7,
|
||||||
@@ -255,7 +252,8 @@ export default function EnvironmentTabPanel({
|
|||||||
});
|
});
|
||||||
setEditorNotice({
|
setEditorNotice({
|
||||||
tone: "info",
|
tone: "info",
|
||||||
message: "Editor content has been reset to the last loaded .env.",
|
message:
|
||||||
|
"Editor content has been reset to the last loaded .env.",
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -444,245 +442,6 @@ export default function EnvironmentTabPanel({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</PanelShell>
|
</PanelShell>
|
||||||
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "grid",
|
|
||||||
gridTemplateColumns:
|
|
||||||
"minmax(min(660px, 100%), 1.35fr) minmax(min(340px, 100%), 0.65fr)",
|
|
||||||
gap: 12,
|
|
||||||
alignItems: "start",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<PanelShell title={`Variables (${environment.variables.length})`}>
|
|
||||||
{environment.variables.length > 0 ? (
|
|
||||||
<>
|
|
||||||
<div style={{ overflowX: "auto" }}>
|
|
||||||
<table className="data-table" style={{ minWidth: 760 }}>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Key</th>
|
|
||||||
<th>Value</th>
|
|
||||||
<th>Scope</th>
|
|
||||||
<th>Source</th>
|
|
||||||
<th>Required</th>
|
|
||||||
<th>Sensitive</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{pagination.paginatedItems.map((variable) => (
|
|
||||||
<tr key={variable.id}>
|
|
||||||
<td style={{ fontFamily: "var(--font--code)" }}>
|
|
||||||
<KeyRound size={13} />
|
|
||||||
{variable.key}
|
|
||||||
</td>
|
|
||||||
<td style={{ fontFamily: "var(--font--code)" }}>
|
|
||||||
{variable.value}
|
|
||||||
</td>
|
|
||||||
<td>{variable.scope}</td>
|
|
||||||
<td>{variable.source}</td>
|
|
||||||
<td>
|
|
||||||
<span
|
|
||||||
className={`ui-badge ${
|
|
||||||
variable.required ? "badge-warning" : ""
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{variable.required ? "Required" : "Optional"}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<span
|
|
||||||
className={`ui-badge ${
|
|
||||||
variable.sensitive ? "badge-online" : ""
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{variable.sensitive ? "Masked" : "Plain"}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<TablePagination
|
|
||||||
currentPage={pagination.currentPage}
|
|
||||||
totalPages={pagination.totalPages}
|
|
||||||
totalItems={pagination.totalItems}
|
|
||||||
startItem={pagination.startItem}
|
|
||||||
endItem={pagination.endItem}
|
|
||||||
itemLabel="variables"
|
|
||||||
onPageChange={pagination.setCurrentPage}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
minHeight: 180,
|
|
||||||
display: "flex",
|
|
||||||
flexDirection: "column",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "center",
|
|
||||||
gap: 10,
|
|
||||||
textAlign: "center",
|
|
||||||
color: "var(--text-muted)",
|
|
||||||
border: "1px dashed var(--border)",
|
|
||||||
borderRadius: 7,
|
|
||||||
background: "var(--bg-input)",
|
|
||||||
padding: 18,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<KeyRound size={22} style={{ color: "var(--accent-blue)" }} />
|
|
||||||
<div>
|
|
||||||
<p
|
|
||||||
style={{
|
|
||||||
margin: 0,
|
|
||||||
color: "var(--text-primary)",
|
|
||||||
fontSize: 13,
|
|
||||||
fontWeight: 700,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
No environment variables detected
|
|
||||||
</p>
|
|
||||||
<p style={{ marginTop: 4, fontSize: 12 }}>
|
|
||||||
This container has no stored deploy variables or runtime
|
|
||||||
inspect variables available.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</PanelShell>
|
|
||||||
|
|
||||||
<PanelShell title="Validation">
|
|
||||||
<div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
|
|
||||||
{environment.checks.map((check) => (
|
|
||||||
<div
|
|
||||||
key={check.label}
|
|
||||||
style={{
|
|
||||||
display: "grid",
|
|
||||||
gridTemplateColumns: "auto minmax(0, 1fr)",
|
|
||||||
gap: 10,
|
|
||||||
alignItems: "start",
|
|
||||||
padding: "10px 11px",
|
|
||||||
border: "1px solid var(--border)",
|
|
||||||
borderRadius: 7,
|
|
||||||
background: "var(--bg-input)",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span
|
|
||||||
style={{
|
|
||||||
color:
|
|
||||||
check.status === "Ready"
|
|
||||||
? "var(--accent-green)"
|
|
||||||
: check.status === "Missing"
|
|
||||||
? "var(--text-danger)"
|
|
||||||
: "var(--accent-yellow)",
|
|
||||||
display: "inline-flex",
|
|
||||||
marginTop: 1,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{check.status === "Ready" ? (
|
|
||||||
<CheckCircle2 size={15} />
|
|
||||||
) : check.status === "Missing" ? (
|
|
||||||
<ShieldAlert size={15} />
|
|
||||||
) : (
|
|
||||||
<LockKeyhole size={15} />
|
|
||||||
)}
|
|
||||||
</span>
|
|
||||||
<div style={{ minWidth: 0 }}>
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "flex",
|
|
||||||
alignItems: "center",
|
|
||||||
justifyContent: "space-between",
|
|
||||||
gap: 8,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<p
|
|
||||||
style={{
|
|
||||||
margin: 0,
|
|
||||||
color: "var(--text-primary)",
|
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: 700,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{check.label}
|
|
||||||
</p>
|
|
||||||
<span className={`ui-badge ${checkClass[check.status]}`}>
|
|
||||||
{check.status}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<p
|
|
||||||
style={{
|
|
||||||
marginTop: 4,
|
|
||||||
color: "var(--text-muted)",
|
|
||||||
fontSize: 11,
|
|
||||||
lineHeight: 1.45,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{check.description}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</PanelShell>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
style={{
|
|
||||||
display: "grid",
|
|
||||||
gridTemplateColumns:
|
|
||||||
"repeat(auto-fit, minmax(min(360px, 100%), 1fr))",
|
|
||||||
gap: 12,
|
|
||||||
alignItems: "start",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{environment.groups.map((group) => (
|
|
||||||
<PanelShell key={group.title} title={group.title}>
|
|
||||||
<p
|
|
||||||
style={{
|
|
||||||
marginBottom: 12,
|
|
||||||
color: "var(--text-muted)",
|
|
||||||
fontSize: 12,
|
|
||||||
lineHeight: 1.5,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{group.description}
|
|
||||||
</p>
|
|
||||||
<div style={{ display: "flex", flexDirection: "column", gap: 8 }}>
|
|
||||||
{group.items.map((item) => (
|
|
||||||
<div
|
|
||||||
key={item.label}
|
|
||||||
style={{
|
|
||||||
display: "grid",
|
|
||||||
gridTemplateColumns:
|
|
||||||
"minmax(120px, 0.45fr) minmax(0, 1fr)",
|
|
||||||
gap: 12,
|
|
||||||
alignItems: "center",
|
|
||||||
fontSize: 12,
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<span style={{ color: "var(--text-muted)" }}>
|
|
||||||
{item.label}
|
|
||||||
</span>
|
|
||||||
<span
|
|
||||||
style={{
|
|
||||||
color: "var(--text-primary)",
|
|
||||||
fontFamily: "var(--font--code)",
|
|
||||||
overflow: "hidden",
|
|
||||||
textOverflow: "ellipsis",
|
|
||||||
whiteSpace: "nowrap",
|
|
||||||
textAlign: "right",
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{item.value}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</PanelShell>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+26
-23
@@ -28,21 +28,25 @@ const levelColor: Record<LogsStreamItem["level"], string> = {
|
|||||||
DEBUG: "#38bdf8",
|
DEBUG: "#38bdf8",
|
||||||
};
|
};
|
||||||
|
|
||||||
const sourceStatusClass: Record<LogsTabData["sources"][number]["status"], string> =
|
const sourceStatusClass: Record<
|
||||||
{
|
LogsTabData["sources"][number]["status"],
|
||||||
Streaming: "badge-online",
|
string
|
||||||
Paused: "badge-warning",
|
> = {
|
||||||
Unavailable: "badge-danger",
|
Streaming: "badge-online",
|
||||||
};
|
Paused: "badge-warning",
|
||||||
|
Unavailable: "badge-danger",
|
||||||
|
};
|
||||||
|
|
||||||
const summaryToneColor: Record<LogsTabData["summaries"][number]["tone"], string> =
|
const summaryToneColor: Record<
|
||||||
{
|
LogsTabData["summaries"][number]["tone"],
|
||||||
blue: "var(--accent-blue)",
|
string
|
||||||
green: "var(--accent-green)",
|
> = {
|
||||||
purple: "var(--accent-purple)",
|
blue: "var(--accent-blue)",
|
||||||
amber: "var(--accent-yellow)",
|
green: "var(--accent-green)",
|
||||||
cyan: "var(--accent-cyan)",
|
purple: "var(--accent-purple)",
|
||||||
};
|
amber: "var(--accent-yellow)",
|
||||||
|
cyan: "var(--accent-cyan)",
|
||||||
|
};
|
||||||
|
|
||||||
export default function LogsTabPanel({
|
export default function LogsTabPanel({
|
||||||
logs,
|
logs,
|
||||||
@@ -198,8 +202,7 @@ export default function LogsTabPanel({
|
|||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns:
|
gridTemplateColumns: "minmax(min(360px, 100%), 1fr) auto auto auto",
|
||||||
"minmax(min(360px, 100%), 1fr) auto auto auto",
|
|
||||||
gap: 8,
|
gap: 8,
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
marginBottom: 10,
|
marginBottom: 10,
|
||||||
@@ -295,7 +298,7 @@ export default function LogsTabPanel({
|
|||||||
key={line.id}
|
key={line.id}
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns: "72px 54px 110px minmax(360px, 1fr) auto",
|
gridTemplateColumns: "72px 54px 180px minmax(360px, 1fr) auto",
|
||||||
gap: 10,
|
gap: 10,
|
||||||
whiteSpace: "nowrap",
|
whiteSpace: "nowrap",
|
||||||
}}
|
}}
|
||||||
@@ -306,9 +309,7 @@ export default function LogsTabPanel({
|
|||||||
<span style={{ color: levelColor[line.level], fontWeight: 800 }}>
|
<span style={{ color: levelColor[line.level], fontWeight: 800 }}>
|
||||||
{line.level}
|
{line.level}
|
||||||
</span>
|
</span>
|
||||||
<span style={{ color: "var(--accent-cyan)" }}>
|
<span style={{ color: "var(--accent-cyan)" }}>{line.source}</span>
|
||||||
{line.source}
|
|
||||||
</span>
|
|
||||||
<span>{line.message}</span>
|
<span>{line.message}</span>
|
||||||
<span style={{ color: "var(--text-muted)" }}>
|
<span style={{ color: "var(--text-muted)" }}>
|
||||||
{line.traceId ?? ""}
|
{line.traceId ?? ""}
|
||||||
@@ -356,7 +357,7 @@ export default function LogsTabPanel({
|
|||||||
</div>
|
</div>
|
||||||
</PanelShell>
|
</PanelShell>
|
||||||
|
|
||||||
<div
|
{/* <div
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns:
|
gridTemplateColumns:
|
||||||
@@ -402,7 +403,9 @@ export default function LogsTabPanel({
|
|||||||
{source.type} - {source.lines} lines - {source.retention}
|
{source.type} - {source.lines} lines - {source.retention}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<span className={`ui-badge ${sourceStatusClass[source.status]}`}>
|
<span
|
||||||
|
className={`ui-badge ${sourceStatusClass[source.status]}`}
|
||||||
|
>
|
||||||
{source.status}
|
{source.status}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -455,7 +458,7 @@ export default function LogsTabPanel({
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</PanelShell>
|
</PanelShell>
|
||||||
</div>
|
</div> */}
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+17
-11
@@ -22,13 +22,19 @@ export default function AppOverview({
|
|||||||
<section
|
<section
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns:
|
gridTemplateColumns: "repeat(auto-fit, minmax(min(360px, 100%), 1fr))",
|
||||||
"repeat(auto-fit, minmax(min(360px, 100%), 1fr))",
|
|
||||||
gap: 12,
|
gap: 12,
|
||||||
minWidth: 0,
|
minWidth: 0,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div style={{ display: "flex", flexDirection: "column", gap: 12, minWidth: 0 }}>
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
gap: 12,
|
||||||
|
minWidth: 0,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
@@ -40,16 +46,16 @@ export default function AppOverview({
|
|||||||
<DeploymentPanel deployment={app.deployment} />
|
<DeploymentPanel deployment={app.deployment} />
|
||||||
<HealthPanel health={app.health} />
|
<HealthPanel health={app.health} />
|
||||||
</div>
|
</div>
|
||||||
<RuntimeContainersPanel containers={app.runtimeContainers} />
|
|
||||||
</div>
|
</div>
|
||||||
<div style={{ display: "flex", flexDirection: "column", gap: 12, minWidth: 0 }}>
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "column",
|
||||||
|
gap: 12,
|
||||||
|
minWidth: 0,
|
||||||
|
}}
|
||||||
|
>
|
||||||
<DomainsPanel domains={app.domains} />
|
<DomainsPanel domains={app.domains} />
|
||||||
<RecentLogsPanel
|
|
||||||
logs={app.logs}
|
|
||||||
autoRefresh={logsAutoRefresh}
|
|
||||||
refreshing={logsRefreshing}
|
|
||||||
onAutoRefreshChange={onLogsAutoRefreshChange}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
|
|||||||
+2
-2
@@ -79,13 +79,13 @@ export default function RecentLogsPanel({
|
|||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<button
|
{/* <button
|
||||||
type="button"
|
type="button"
|
||||||
className="btn btn-ghost"
|
className="btn btn-ghost"
|
||||||
style={{ width: "100%", marginTop: 10, fontSize: 12 }}
|
style={{ width: "100%", marginTop: 10, fontSize: 12 }}
|
||||||
>
|
>
|
||||||
View all logs
|
View all logs
|
||||||
</button>
|
</button> */}
|
||||||
</PanelShell>
|
</PanelShell>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+1
-1
@@ -181,7 +181,7 @@ export default function RuntimeTabPanel({ runtime }: RuntimeTabPanelProps) {
|
|||||||
) : (
|
) : (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
minHeight: 156,
|
minHeight: 210,
|
||||||
display: "flex",
|
display: "flex",
|
||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
alignItems: "center",
|
alignItems: "center",
|
||||||
|
|||||||
+7
-15
@@ -1,15 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||||
import {
|
import { Loader2, RotateCw, TerminalSquare } from "lucide-react";
|
||||||
AlertTriangle,
|
|
||||||
History,
|
|
||||||
Loader2,
|
|
||||||
Play,
|
|
||||||
RotateCw,
|
|
||||||
ShieldAlert,
|
|
||||||
TerminalSquare,
|
|
||||||
} from "lucide-react";
|
|
||||||
import { terminal as terminalApi } from "@/lib/api";
|
import { terminal as terminalApi } from "@/lib/api";
|
||||||
import { createClientId } from "@/lib/random-id";
|
import { createClientId } from "@/lib/random-id";
|
||||||
import { sanitizeTerminalStreamChunk } from "@/lib/terminal-output";
|
import { sanitizeTerminalStreamChunk } from "@/lib/terminal-output";
|
||||||
@@ -541,7 +533,7 @@ export default function TerminalTabPanel({ terminal }: TerminalTabPanelProps) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<section style={{ display: "flex", flexDirection: "column", gap: 12 }}>
|
<section style={{ display: "flex", flexDirection: "column", gap: 12 }}>
|
||||||
<div
|
{/* <div
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns:
|
gridTemplateColumns:
|
||||||
@@ -608,7 +600,7 @@ export default function TerminalTabPanel({ terminal }: TerminalTabPanelProps) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div> */}
|
||||||
|
|
||||||
<PanelShell
|
<PanelShell
|
||||||
title="Container Terminal"
|
title="Container Terminal"
|
||||||
@@ -688,7 +680,7 @@ export default function TerminalTabPanel({ terminal }: TerminalTabPanelProps) {
|
|||||||
</div>
|
</div>
|
||||||
</PanelShell>
|
</PanelShell>
|
||||||
|
|
||||||
<div
|
{/* <div
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns:
|
gridTemplateColumns:
|
||||||
@@ -803,9 +795,9 @@ export default function TerminalTabPanel({ terminal }: TerminalTabPanelProps) {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</PanelShell>
|
</PanelShell>
|
||||||
</div>
|
</div> */}
|
||||||
|
|
||||||
<div
|
{/* <div
|
||||||
style={{
|
style={{
|
||||||
display: "grid",
|
display: "grid",
|
||||||
gridTemplateColumns:
|
gridTemplateColumns:
|
||||||
@@ -884,7 +876,7 @@ export default function TerminalTabPanel({ terminal }: TerminalTabPanelProps) {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
</PanelShell>
|
</PanelShell>
|
||||||
</div>
|
</div> */}
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
+19
-12
@@ -40,7 +40,8 @@ function formatBytes(value: number | null) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatCpu(nanoCpus: number | null, cpuQuota: number | null) {
|
function formatCpu(nanoCpus: number | null, cpuQuota: number | null) {
|
||||||
if (nanoCpus && nanoCpus > 0) return `${(nanoCpus / 1_000_000_000).toFixed(2)} vCPU`;
|
if (nanoCpus && nanoCpus > 0)
|
||||||
|
return `${(nanoCpus / 1_000_000_000).toFixed(2)} vCPU`;
|
||||||
if (cpuQuota && cpuQuota > 0) return `${cpuQuota} quota`;
|
if (cpuQuota && cpuQuota > 0) return `${cpuQuota} quota`;
|
||||||
return "Unlimited";
|
return "Unlimited";
|
||||||
}
|
}
|
||||||
@@ -105,16 +106,16 @@ export function createAdvancedData(
|
|||||||
tone: restartName === "no" ? "amber" : "green",
|
tone: restartName === "no" ? "amber" : "green",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Runtime Guard",
|
label: "Root Filesystem",
|
||||||
value: runtimeLoaded ? "Loaded" : "Unavailable",
|
value: readOnlyRootfs ? "Read-only" : "Writable",
|
||||||
subvalue: runtimeLoaded ? "Docker inspect available" : "Using DB record",
|
subvalue: "Docker HostConfig.ReadonlyRootfs",
|
||||||
tone: runtimeLoaded ? "cyan" : "amber",
|
tone: readOnlyRootfs ? "green" : "amber",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Danger Zone",
|
label: "Auto Remove",
|
||||||
value: "Protected",
|
value: autoRemove ? "Enabled" : "Disabled",
|
||||||
subvalue: "Confirmation required",
|
subvalue: "Docker HostConfig.AutoRemove",
|
||||||
tone: "purple",
|
tone: autoRemove ? "amber" : "blue",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
metadata: [
|
metadata: [
|
||||||
@@ -134,7 +135,9 @@ export function createAdvancedData(
|
|||||||
label: "CPU Limit",
|
label: "CPU Limit",
|
||||||
value: formatCpu(nanoCpus, cpuQuota),
|
value: formatCpu(nanoCpus, cpuQuota),
|
||||||
usage: detail ? Math.min(100, Math.round(detail.stats.cpuPercent)) : 0,
|
usage: detail ? Math.min(100, Math.round(detail.stats.cpuPercent)) : 0,
|
||||||
helper: runtimeLoaded ? "Current Docker CPU sampling" : "Runtime unavailable",
|
helper: runtimeLoaded
|
||||||
|
? "Current Docker CPU sampling"
|
||||||
|
: "Runtime unavailable",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Memory Limit",
|
label: "Memory Limit",
|
||||||
@@ -147,7 +150,10 @@ export function createAdvancedData(
|
|||||||
value: pidsLimit && pidsLimit > 0 ? String(pidsLimit) : "Unlimited",
|
value: pidsLimit && pidsLimit > 0 ? String(pidsLimit) : "Unlimited",
|
||||||
usage:
|
usage:
|
||||||
pidsLimit && pidsLimit > 0
|
pidsLimit && pidsLimit > 0
|
||||||
? Math.min(100, Math.round((detail?.stats.pids ?? 0) / pidsLimit * 100))
|
? Math.min(
|
||||||
|
100,
|
||||||
|
Math.round(((detail?.stats.pids ?? 0) / pidsLimit) * 100),
|
||||||
|
)
|
||||||
: 0,
|
: 0,
|
||||||
helper: `${detail?.stats.pids ?? 0} process ID(s) currently visible`,
|
helper: `${detail?.stats.pids ?? 0} process ID(s) currently visible`,
|
||||||
},
|
},
|
||||||
@@ -202,7 +208,8 @@ export function createAdvancedData(
|
|||||||
{
|
{
|
||||||
id: "reconcile-runtime",
|
id: "reconcile-runtime",
|
||||||
label: "Reconcile runtime state",
|
label: "Reconcile runtime state",
|
||||||
description: "Stored metadata can be refreshed from Docker runtime data.",
|
description:
|
||||||
|
"Stored metadata can be refreshed from Docker runtime data.",
|
||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
+14
-4
@@ -53,6 +53,16 @@ function getBranch(container: Container) {
|
|||||||
return "-";
|
return "-";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getImageTag(image: string) {
|
||||||
|
if (!image.trim()) return "-";
|
||||||
|
if (image.includes("@")) return "digest";
|
||||||
|
|
||||||
|
const lastSegment = image.split("/").at(-1) ?? image;
|
||||||
|
const tagIndex = lastSegment.lastIndexOf(":");
|
||||||
|
|
||||||
|
return tagIndex >= 0 ? lastSegment.slice(tagIndex + 1) || "latest" : "latest";
|
||||||
|
}
|
||||||
|
|
||||||
export function createDeploymentsData(
|
export function createDeploymentsData(
|
||||||
container: Container,
|
container: Container,
|
||||||
detail: ContainerDetails | null,
|
detail: ContainerDetails | null,
|
||||||
@@ -88,10 +98,10 @@ export function createDeploymentsData(
|
|||||||
tone: isSuccessful ? "green" : "amber",
|
tone: isSuccessful ? "green" : "amber",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Success Rate",
|
label: "Image Tag",
|
||||||
value: isSuccessful ? "100%" : "0%",
|
value: getImageTag(container.image),
|
||||||
subvalue: "Based on current container record",
|
subvalue: container.image,
|
||||||
tone: isSuccessful ? "green" : "amber",
|
tone: "purple",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Deploy Mode",
|
label: "Deploy Mode",
|
||||||
|
|||||||
Reference in new issue
Block a user