Merge branch 'dev' of ssh://git.commumedia.org:2222/alex/headquarter into dev
This commit is contained in:
@@ -1483,6 +1483,7 @@ async def get_user_sessions(
|
|||||||
"url": instance.url,
|
"url": instance.url,
|
||||||
"clone_mode": instance.clone_mode,
|
"clone_mode": instance.clone_mode,
|
||||||
"branch": instance.branch,
|
"branch": instance.branch,
|
||||||
|
"created_at": instance.created_at.isoformat() if instance.created_at else None,
|
||||||
})
|
})
|
||||||
|
|
||||||
return {"sessions": sessions}
|
return {"sessions": sessions}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ export interface Session {
|
|||||||
probe_status?: string;
|
probe_status?: string;
|
||||||
clone_mode?: string;
|
clone_mode?: string;
|
||||||
branch?: string | null;
|
branch?: string | null;
|
||||||
|
created_at?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listInstances(
|
export async function listInstances(
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ interface MobileTerminalHeaderProps {
|
|||||||
onBack?: () => void;
|
onBack?: () => void;
|
||||||
onMenuToggle?: () => void;
|
onMenuToggle?: () => void;
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
|
onFontSizeChange?: (delta: number) => void;
|
||||||
isVisible: boolean;
|
isVisible: boolean;
|
||||||
connectionStatus?: "connecting" | "connected" | "disconnected" | "error";
|
connectionStatus?: "connecting" | "connected" | "disconnected" | "error";
|
||||||
}
|
}
|
||||||
@@ -15,6 +16,7 @@ export const MobileTerminalHeader: React.FC<MobileTerminalHeaderProps> = ({
|
|||||||
onBack,
|
onBack,
|
||||||
onMenuToggle,
|
onMenuToggle,
|
||||||
onClose,
|
onClose,
|
||||||
|
onFontSizeChange,
|
||||||
isVisible,
|
isVisible,
|
||||||
connectionStatus = "connecting",
|
connectionStatus = "connecting",
|
||||||
}) => {
|
}) => {
|
||||||
@@ -56,6 +58,26 @@ export const MobileTerminalHeader: React.FC<MobileTerminalHeaderProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="mobile-terminal-header-right">
|
<div className="mobile-terminal-header-right">
|
||||||
|
{onFontSizeChange && (
|
||||||
|
<>
|
||||||
|
<button
|
||||||
|
className="mobile-terminal-header-button"
|
||||||
|
onClick={() => onFontSizeChange(-1)}
|
||||||
|
type="button"
|
||||||
|
aria-label="Decrease font size"
|
||||||
|
>
|
||||||
|
<span style={{ fontSize: "0.75rem" }}>A-</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
className="mobile-terminal-header-button"
|
||||||
|
onClick={() => onFontSizeChange(1)}
|
||||||
|
type="button"
|
||||||
|
aria-label="Increase font size"
|
||||||
|
>
|
||||||
|
<span style={{ fontSize: "1rem" }}>A+</span>
|
||||||
|
</button>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
{onClose && (
|
{onClose && (
|
||||||
<button
|
<button
|
||||||
className="mobile-terminal-header-button"
|
className="mobile-terminal-header-button"
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export const MobileTerminalWrapper: React.FC<MobileTerminalWrapperProps> = ({
|
|||||||
sendData: (data: string) => void;
|
sendData: (data: string) => void;
|
||||||
connectionStatus: "connecting" | "connected" | "disconnected" | "error";
|
connectionStatus: "connecting" | "connected" | "disconnected" | "error";
|
||||||
focusInput: () => void;
|
focusInput: () => void;
|
||||||
|
changeFontSize: (delta: number) => void;
|
||||||
} | null>(null);
|
} | null>(null);
|
||||||
|
|
||||||
const headerAutoHide = useAutoHide({ timeout: 3000, enabled: isMobile });
|
const headerAutoHide = useAutoHide({ timeout: 3000, enabled: isMobile });
|
||||||
@@ -41,8 +42,8 @@ export const MobileTerminalWrapper: React.FC<MobileTerminalWrapperProps> = ({
|
|||||||
}, [headerAutoHide]);
|
}, [headerAutoHide]);
|
||||||
|
|
||||||
const handleTerminalReady = useCallback(
|
const handleTerminalReady = useCallback(
|
||||||
(sendData: (data: string) => void, connectionStatus: "connecting" | "connected" | "disconnected" | "error", focusInput: () => void) => {
|
(sendData: (data: string) => void, connectionStatus: "connecting" | "connected" | "disconnected" | "error", focusInput: () => void, changeFontSize: (delta: number) => void) => {
|
||||||
setTerminalRef({ sendData, connectionStatus, focusInput });
|
setTerminalRef({ sendData, connectionStatus, focusInput, changeFontSize });
|
||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
);
|
);
|
||||||
@@ -71,6 +72,7 @@ export const MobileTerminalWrapper: React.FC<MobileTerminalWrapperProps> = ({
|
|||||||
onBack={onBack}
|
onBack={onBack}
|
||||||
onMenuToggle={onMenuToggle}
|
onMenuToggle={onMenuToggle}
|
||||||
onClose={onClose}
|
onClose={onClose}
|
||||||
|
onFontSizeChange={(delta) => terminalRef?.changeFontSize(delta)}
|
||||||
isVisible={headerAutoHide.isVisible}
|
isVisible={headerAutoHide.isVisible}
|
||||||
connectionStatus={terminalRef?.connectionStatus}
|
connectionStatus={terminalRef?.connectionStatus}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ interface TerminalProps {
|
|||||||
onTerminalReady?: (
|
onTerminalReady?: (
|
||||||
sendData: (data: string) => void,
|
sendData: (data: string) => void,
|
||||||
connectionStatus: "connecting" | "connected" | "disconnected" | "error",
|
connectionStatus: "connecting" | "connected" | "disconnected" | "error",
|
||||||
focusInput: () => void
|
focusInput: () => void,
|
||||||
|
changeFontSize: (delta: number) => void
|
||||||
) => void;
|
) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +220,10 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
|
|||||||
const focusInput = () => {
|
const focusInput = () => {
|
||||||
termRef.current?.focus();
|
termRef.current?.focus();
|
||||||
};
|
};
|
||||||
onTerminalReadyRef.current(sendData, status, focusInput);
|
const changeFontSize = (delta: number) => {
|
||||||
|
handleFontSizeChange(delta);
|
||||||
|
};
|
||||||
|
onTerminalReadyRef.current(sendData, status, focusInput, changeFontSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Visibility API for reconnection
|
// Visibility API for reconnection
|
||||||
@@ -251,7 +255,10 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
|
|||||||
const focusInput = () => {
|
const focusInput = () => {
|
||||||
termRef.current?.focus();
|
termRef.current?.focus();
|
||||||
};
|
};
|
||||||
onTerminalReady(sendData, status, focusInput);
|
const changeFontSize = (delta: number) => {
|
||||||
|
handleFontSizeChange(delta);
|
||||||
|
};
|
||||||
|
onTerminalReady(sendData, status, focusInput, changeFontSize);
|
||||||
}
|
}
|
||||||
}, [status, onTerminalReady]);
|
}, [status, onTerminalReady]);
|
||||||
|
|
||||||
|
|||||||
@@ -95,11 +95,12 @@ export const SessionsPage = () => {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Poll health every 30 seconds for active instances
|
// Poll health every 30 seconds for active web-enabled instances
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const checkHealth = async () => {
|
const checkHealth = async () => {
|
||||||
const activeSessions = sessions.filter(
|
const activeSessions = sessions.filter(
|
||||||
(s) => ["running", "starting", "unhealthy", "probing"].includes(s.status)
|
(s) => ["running", "starting", "unhealthy", "probing"].includes(s.status)
|
||||||
|
&& s.tool_type_interfaces?.includes("web")
|
||||||
);
|
);
|
||||||
for (const session of activeSessions) {
|
for (const session of activeSessions) {
|
||||||
try {
|
try {
|
||||||
@@ -335,13 +336,25 @@ export const SessionsPage = () => {
|
|||||||
<p className="muted">No active sessions</p>
|
<p className="muted">No active sessions</p>
|
||||||
) : (
|
) : (
|
||||||
<div className="sessions-grid">
|
<div className="sessions-grid">
|
||||||
{activeSessions.map((session) => (
|
{activeSessions.map((session) => {
|
||||||
|
const isTerminalOnly = session.tool_type_interfaces?.includes("terminal") && !session.tool_type_interfaces?.includes("web");
|
||||||
|
return (
|
||||||
<div className="card session-card" key={session.id}>
|
<div className="card session-card" key={session.id}>
|
||||||
<div className="session-info">
|
<div className="session-info">
|
||||||
<h4>{session.display_name}</h4>
|
<h4>{session.display_name}</h4>
|
||||||
<p className="muted">
|
<p className="muted">
|
||||||
{session.tool_type_name} · {session.project_name}
|
{session.tool_type_name} · {session.project_name}
|
||||||
</p>
|
</p>
|
||||||
|
{session.created_at && (
|
||||||
|
<p className="session-meta">
|
||||||
|
Started: {new Date(session.created_at).toLocaleString()}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
|
{session.clone_mode && (
|
||||||
|
<p className="session-meta">
|
||||||
|
Repo: {session.clone_mode === "clone" ? `clone (${session.branch || "main"})` : "mount"}
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
{session.url && (
|
{session.url && (
|
||||||
<p className="session-url">
|
<p className="session-url">
|
||||||
<a href={session.url} target="_blank" rel="noopener noreferrer">
|
<a href={session.url} target="_blank" rel="noopener noreferrer">
|
||||||
@@ -356,13 +369,13 @@ export const SessionsPage = () => {
|
|||||||
{session.status === "probing" && (
|
{session.status === "probing" && (
|
||||||
<span className="status-badge probing">checking...</span>
|
<span className="status-badge probing">checking...</span>
|
||||||
)}
|
)}
|
||||||
{tunnelHealth[session.id] && tunnelHealth[session.id].tunnel_status === "unreachable" && (
|
{!isTerminalOnly && tunnelHealth[session.id] && tunnelHealth[session.id].tunnel_status === "unreachable" && (
|
||||||
<span className="status-badge error">tunnel error</span>
|
<span className="status-badge error">tunnel error</span>
|
||||||
)}
|
)}
|
||||||
{tunnelHealth[session.id] && tunnelHealth[session.id].tunnel_status === "error_response" && (
|
{!isTerminalOnly && tunnelHealth[session.id] && tunnelHealth[session.id].tunnel_status === "error_response" && (
|
||||||
<span className="status-badge warning">app error ({tunnelHealth[session.id].tunnel_status_code})</span>
|
<span className="status-badge warning">app error ({tunnelHealth[session.id].tunnel_status_code})</span>
|
||||||
)}
|
)}
|
||||||
{tunnelHealth[session.id]?.probe_status && tunnelHealth[session.id]?.probe_status !== "not_applicable" && (
|
{!isTerminalOnly && tunnelHealth[session.id]?.probe_status && tunnelHealth[session.id]?.probe_status !== "not_applicable" && (
|
||||||
<div className="probe-output-section">
|
<div className="probe-output-section">
|
||||||
<button
|
<button
|
||||||
className={`probe-toggle probe-${tunnelHealth[session.id].probe_status}`}
|
className={`probe-toggle probe-${tunnelHealth[session.id].probe_status}`}
|
||||||
@@ -402,7 +415,7 @@ export const SessionsPage = () => {
|
|||||||
Open
|
Open
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{tunnelHealth[session.id] && tunnelHealth[session.id].tunnel_status === "unreachable" && (
|
{!isTerminalOnly && tunnelHealth[session.id] && tunnelHealth[session.id].tunnel_status === "unreachable" && (
|
||||||
<button
|
<button
|
||||||
className="secondary-button small"
|
className="secondary-button small"
|
||||||
onClick={() => void handleRecreateTunnel(session)}
|
onClick={() => void handleRecreateTunnel(session)}
|
||||||
@@ -481,7 +494,7 @@ export const SessionsPage = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
)})}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+10
-1
@@ -2960,19 +2960,28 @@ a.nav-item,
|
|||||||
background: #2d2d2d;
|
background: #2d2d2d;
|
||||||
border-bottom: 1px solid #3e3e3e;
|
border-bottom: 1px solid #3e3e3e;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
transition: transform 0.3s ease, opacity 0.3s ease;
|
transition: transform 0.3s ease, opacity 0.3s ease, height 0.3s ease, padding 0.3s ease, margin 0.3s ease;
|
||||||
z-index: 100;
|
z-index: 100;
|
||||||
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mobile-terminal-header.hidden {
|
.mobile-terminal-header.hidden {
|
||||||
transform: translateY(-100%);
|
transform: translateY(-100%);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
height: 0;
|
||||||
|
padding-top: 0;
|
||||||
|
padding-bottom: 0;
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 0;
|
||||||
|
border-width: 0;
|
||||||
|
flex-shrink: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mobile-terminal-header.visible {
|
.mobile-terminal-header.visible {
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
height: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mobile-terminal-header-left,
|
.mobile-terminal-header-left,
|
||||||
|
|||||||
Reference in New Issue
Block a user