feat(frontend): 添加 SSH 终端运行中标记

为 SSH 顶部服务器标签和内部终端标签补充 `%` 运行中提示,
并基于发送命令、shell prompt、断连与错误链路派生运行态。
This commit is contained in:
yinjianm
2026-04-19 21:33:24 +08:00
parent 940c8babc2
commit 6253b90151
15 changed files with 530 additions and 230 deletions
@@ -654,6 +654,13 @@ onBeforeUnmount(() => {
<span class="whitespace-nowrap">
{{ t('terminalTabBar.terminalBadge', { index: session.terminalIndex }) }}
</span>
<span
v-if="session.isCommandRunning"
class="ml-2 rounded-sm px-1 text-[10px] font-semibold uppercase tracking-wide text-amber-400"
:title="t('terminalTabBar.commandRunningIndicator')"
>
%
</span>
<button
type="button"
class="ml-2 rounded-full p-0.5 text-text-secondary opacity-0 transition-opacity duration-150 hover:bg-header hover:text-foreground group-hover:opacity-100"
@@ -100,6 +100,14 @@ const getRepresentativeSessionId = (connectionId: string, fallbackSessionId: str
const getConnectionSessionCount = (connectionId: string) => getConnectionSessions(connectionId).length;
const getConnectionRunningSessionCount = (connectionId: string) =>
getConnectionSessions(connectionId).filter((session) => session.isCommandRunning).length;
const isConnectionRunning = (connectionId: string) => getConnectionRunningSessionCount(connectionId) > 0;
const getConnectionRunningIndicatorTitle = (connectionId: string) =>
t('terminalTabBar.commandRunningIndicatorCount', { count: getConnectionRunningSessionCount(connectionId) });
const shouldRenderTopLevelItem = (session: SessionTabInfoWithStatus, index: number) => {
if (!isSshConnection(session.connectionId)) {
return true;
@@ -564,6 +572,13 @@ onBeforeUnmount(() => {
<span class="max-w-[180px] truncate text-xs font-semibold tracking-wide">
{{ session.connectionName }}
</span>
<span
v-if="isConnectionRunning(session.connectionId)"
class="rounded-sm px-1 text-[10px] font-semibold uppercase tracking-wide text-amber-400"
:title="getConnectionRunningIndicatorTitle(session.connectionId)"
>
%
</span>
<span
:class="[
'rounded-full px-1.5 py-0.5 text-[10px] font-semibold',