Skip to content

DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.

feat(navbar): add 'Run Logs' action to copy logs to clipboard

hairyf77a01279a217
diff --git a/src/components/navbar.tsx b/src/components/navbar.tsx
index a7fb7171..0fe284bc 100644
--- a/src/components/navbar.tsx
+++ b/src/components/navbar.tsx
@@ -9,10 +9,12 @@ import {
Xmark,
} from '@gravity-ui/icons'
import { Button, Description, Dropdown, Label } from '@heroui/react'
+import { invoke } from '@tauri-apps/api/core'
import { getCurrentWindow } from '@tauri-apps/api/window'
import { useTranslation } from 'react-i18next'
import { If } from 'react-if-lite'
import { useStore } from 'valtio-define'
+import { toast } from '@/utils'
import { useDshPlugins } from '../hooks/use-dsh-plugins'
import { useIframeTauri } from '../hooks/use-iframe-tauri'
import { desktopUpdate } from '../store/modules/desktop-update'
@@ -77,6 +79,20 @@ export default function Navbar({ iframeRef }: NavbarProps) {
void desktopUpdate.openUpdateDialog()
else if (key === 'about')
void desktopUpdate.openAbout()
+ else if (key === 'copy-run-logs')
+ void copyRunLogs()
+ }
+
+ async function copyRunLogs() {
+ try {
+ const logs = await invoke<string>('read_run_logs')
+ await navigator.clipboard.writeText(logs)
+ toast(t('messages.logs_copied'), {})
+ }
+ catch (err) {
+ console.error('[Navbar] failed to copy run logs:', err)
+ toast(t('messages.copy_failed'), {})
+ }
}
return (
@@ -142,6 +158,14 @@ export default function Navbar({ iframeRef }: NavbarProps) {
</Button>
<Dropdown.Popover className="rounded-md w-5!">
<Dropdown.Menu>
+ <Dropdown.Item
+ className="rounded-md"
+ id="copy-run-logs"
+ textValue={t('menu.run_logs')}
+ onAction={() => handleHelpAction('copy-run-logs')}
+ >
+ <Label>{t('menu.run_logs')}</Label>
+ </Dropdown.Item>
<Dropdown.Item
className="rounded-md"
id="check-update"
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json
index 42dc56ab..4df64c53 100644
--- a/src/i18n/locales/en-US.json
+++ b/src/i18n/locales/en-US.json
@@ -60,6 +60,7 @@
"menu.check_update": "Check for Updates",
"menu.new_version": "New version available",
"menu.about": "About Desktop",
+ "menu.run_logs": "Run Logs",
"about.title": "About",
"about.powered_by": "Powered by {{name}}",
"about.release_date": "Release date",
diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json
index 190f45df..a3868829 100644
--- a/src/i18n/locales/zh-CN.json
+++ b/src/i18n/locales/zh-CN.json
@@ -60,6 +60,7 @@
"menu.check_update": "检查更新",
"menu.new_version": "存在新版本",
"menu.about": "关于 Desktop",
+ "menu.run_logs": "运行日志",
"about.title": "关于",
"about.powered_by": "由 {{name}} 驱动",
"about.release_date": "发布时间",