T9: main UI shell + connection management

- session/TerminalSession: kit-free connect orchestrator (CONNECTING ->
  HOSTKEY_WAIT -> AUTHENTICATING/AUTH_REQUIRED -> READY/CLOSED/ERROR),
  fresh SshSession per attempt, inline password retry with optional
  remember+persist, friendly error mapping
- session/SessionManager: process-wide session registry with listener
  notify and active-session tracking
- ui/SessionLaunch: SessionDeps assembly (repos + TOFU dialog + crypto
  envelopes), host-key AlertDialog (save/once/reject), toast/clipboard,
  quick-connect and host-profile spec builders
- pages/Index: bottom Tabs shell (connections/terminal/keys/settings)
  with AppStorage-driven cross-page tab switching
- ui/ConnectionsPage: quick-connect bar, search, LazyForEach host list,
  long-press context menu (edit/copy/forget-password/delete), FAB +
  bindContentCover editor, delete/forget confirm dialogs
- ui/HostEditSheet: full-screen host editor (label/host/port/user,
  password/key auth chips, key Select, 8-color tag picker)
- ui/TerminalPage: session tab strip + per-state overlays (progress,
  inline password prompt, error/closed with reconnect)
- ui/KeysPage/SettingsPage: stage placeholders (diag entry kept)
- ssh/SshSession: optional onClosed callback for transport loss
- data/KnownHostRepository: fix missing KnownHostStore import (T8
  post-build regression)
This commit is contained in:
STRIX
2026-09-08 18:06:40 +08:00
parent b60f634b76
commit 12c73d7a87
12 changed files with 1869 additions and 16 deletions
+38 -15
View File
@@ -3,26 +3,49 @@
* Port of Haven by GlassHaven (AGPL-3.0). See LICENSE.
*/
import { ConnectionsPage } from '../ui/ConnectionsPage';
import { TerminalPage } from '../ui/TerminalPage';
import { KeysPage } from '../ui/KeysPage';
import { SettingsPage } from '../ui/SettingsPage';
/**
* App shell: bottom tab bar with 连接 / 终端 / 密钥 / 设置.
* Cross-page navigation (e.g. "connect" jumping to the terminal tab) goes
* through AppStorage key 'activeTabIndex'.
*/
@Entry
@Component
struct Index {
@StorageLink('activeTabIndex') @Watch('onTabRequested') activeTabIndex: number = 0;
controller: TabsController = new TabsController();
onTabRequested(): void {
this.controller.changeIndex(this.activeTabIndex);
}
build() {
Column({ space: 12 }) {
Text('Haven')
.fontSize(26)
.fontWeight(FontWeight.Bold)
Text('HarmonyOS port · SSH client')
.fontSize(14)
.fontColor('#666666')
Button('打开诊断页')
.width('60%')
.height(44)
.margin({ top: 16 })
.onClick(() => {
this.getUIContext().getRouter().pushUrl({ url: 'pages/DiagPage' });
})
Tabs({ barPosition: BarPosition.End, controller: this.controller }) {
TabContent() {
ConnectionsPage()
}.tabBar('连接')
TabContent() {
TerminalPage()
}.tabBar('终端')
TabContent() {
KeysPage()
}.tabBar('密钥')
TabContent() {
SettingsPage()
}.tabBar('设置')
}
.justifyContent(FlexAlign.Center)
.barMode(BarMode.Fixed)
.scrollable(true)
.onChange((index: number): void => {
this.activeTabIndex = index;
})
.width('100%')
.height('100%')
}