feat: OpsxDB 桌面数据库客户端首版入库
含工作台/连库多引擎字段与 SSH·SSL、结果编辑、Redis 键浏览、 Tauri 桌面与 docs/落地页;排除本地构建产物与 sidecar 二进制。
This commit is contained in:
commit
f8740d27f7
240 files changed
+21625
No files matched your search
@@ -0,0 +1,39 @@
|
||||
:root {
|
||||
--bg: #0e1116; --panel: #151a21; --border: #243044;
|
||||
--text: #e6edf7; --muted: #8b9bb4; --accent: #3b82f6;
|
||||
}
|
||||
* { box-sizing: border-box; }
|
||||
body { margin: 0; font: 13px/1.55 ui-sans-serif, system-ui, sans-serif; background: var(--bg); color: var(--text); }
|
||||
.top {
|
||||
height: 44px; border-bottom: 1px solid var(--border); background: var(--panel);
|
||||
display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
|
||||
}
|
||||
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 600; }
|
||||
.brand em { color: var(--muted); font-style: normal; font-weight: 500; }
|
||||
.logo {
|
||||
width: 24px; height: 24px; border-radius: 6px; background: var(--accent);
|
||||
display: grid; place-items: center; font-size: 10px; font-weight: 700; color: #fff;
|
||||
}
|
||||
.top a { color: var(--muted); text-decoration: none; font-size: 12.5px; }
|
||||
.layout { display: flex; min-height: calc(100vh - 44px); }
|
||||
.side {
|
||||
width: 200px; border-right: 1px solid var(--border); padding: 12px 10px;
|
||||
background: var(--panel); display: flex; flex-direction: column; gap: 2px;
|
||||
}
|
||||
.nav-link {
|
||||
display: block; padding: 6px 8px; border-radius: 6px; color: var(--muted);
|
||||
text-decoration: none; font-size: 12.5px;
|
||||
}
|
||||
.nav-link:hover { color: var(--text); background: #1a2230; }
|
||||
.nav-link.active { color: var(--text); background: color-mix(in srgb, var(--accent) 18%, transparent); }
|
||||
.content { flex: 1; padding: 24px 28px; max-width: 720px; }
|
||||
.content h1 { font-size: 20px; margin: 0 0 14px; }
|
||||
.content h2 { font-size: 15px; margin: 22px 0 8px; }
|
||||
.content p, .content li { color: #c5d0e0; }
|
||||
.content code, .content pre {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px;
|
||||
}
|
||||
.content pre {
|
||||
background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px;
|
||||
}
|
||||
.content code { background: #1a2230; padding: 1px 5px; border-radius: 4px; }
|
||||
@@ -0,0 +1,7 @@
|
||||
<h1>连库入门</h1>
|
||||
<p>在连库页选择驱动,填写主机 / 端口 / 账号,测试通过后保存并打开。</p>
|
||||
<ul>
|
||||
<li>密码仅存本机(本地加密存储)。</li>
|
||||
<li>会话由本地后端维护;后端未启动时顶部会提示,不会白屏。</li>
|
||||
<li>断线后可在底栏重连,恢复当前库上下文。</li>
|
||||
</ul>
|
||||
@@ -0,0 +1,7 @@
|
||||
<h1>常见问题</h1>
|
||||
<h2>打开后提示本地后端未就绪?</h2>
|
||||
<p>确认应用已拉起 sidecar;或手动 <code>./run.sh server</code> 后重试。默认只监听 <code>127.0.0.1:8788</code>。</p>
|
||||
<h2>浏览器也能用吗?</h2>
|
||||
<p>可以调试,但<strong>产品说明与对外沟通应以桌面版为准</strong>,不要暗示 Web 即产品。</p>
|
||||
<h2>官网 / 文档在哪?</h2>
|
||||
<p>本地后端提供:<code>http://127.0.0.1:8788/</code>(官网)、<code>/docs</code>(文档)。</p>
|
||||
@@ -0,0 +1,13 @@
|
||||
<h1>安装与启动</h1>
|
||||
<p>OpsxDB <strong>正式形态是桌面 GUI</strong>(Tauri)。开发态浏览器 <code>:5174</code> 只用于调试,不是产品交付。</p>
|
||||
<h2>桌面版</h2>
|
||||
<ol>
|
||||
<li>安装本机构建产物(macOS <code>.dmg</code> / <code>.app</code>,或 <code>npm run build:desktop</code> 产出)。</li>
|
||||
<li>双击启动:应用会拉起本地后端(默认 <code>127.0.0.1:8788</code>),进入工作台。</li>
|
||||
<li>无需手动执行 <code>./run.sh web</code>。</li>
|
||||
</ol>
|
||||
<h2>开发调试</h2>
|
||||
<pre><code>./run.sh gui # 或 ./run.sh web
|
||||
</code></pre>
|
||||
<p>开发壳地址:<code>http://127.0.0.1:5174</code>。</p>
|
||||
<p>改后端(<code>apps/server</code>)后请执行 <code>./run.sh restart</code>(或等价重启 Gin),避免 <code>:8788</code> 仍跑旧二进制。</p>
|
||||
@@ -0,0 +1,7 @@
|
||||
<h1>工作台简介</h1>
|
||||
<p>深色密度布局:左侧连接与对象树,中间编辑器与多结果 Tab,可选 AI 侧栏。</p>
|
||||
<ul>
|
||||
<li>多结果集:成功结果保留;失败不盖掉已有成功集。</li>
|
||||
<li>执行计划:有则展示,无则禁用。</li>
|
||||
<li>书签:紧凑列表,回填 SQL,本地持久化。</li>
|
||||
</ul>
|
||||
@@ -0,0 +1,89 @@
|
||||
// Package docs:用户文档骨架(嵌入 HTML,侧栏+正文密度对齐工作台)。
|
||||
package docs
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
//go:embed content assets template.html
|
||||
var files embed.FS
|
||||
|
||||
type page struct {
|
||||
Slug string
|
||||
Title string
|
||||
Body string
|
||||
}
|
||||
|
||||
var order = []page{
|
||||
{Slug: "install", Title: "安装与启动"},
|
||||
{Slug: "connect", Title: "连库入门"},
|
||||
{Slug: "workbench", Title: "工作台简介"},
|
||||
{Slug: "faq", Title: "常见问题"},
|
||||
}
|
||||
|
||||
type Handler struct {
|
||||
tpl string
|
||||
}
|
||||
|
||||
func New() *Handler {
|
||||
raw, err := files.ReadFile("template.html")
|
||||
if err != nil {
|
||||
panic("docs: template.html 缺失: " + err.Error())
|
||||
}
|
||||
return &Handler{tpl: string(raw)}
|
||||
}
|
||||
|
||||
func (h *Handler) Register(r *gin.Engine) {
|
||||
r.GET("/docs", func(c *gin.Context) { c.Redirect(http.StatusFound, "/docs/install") })
|
||||
r.GET("/docs/:slug", h.Page)
|
||||
r.GET("/docs/assets/*file", h.Asset)
|
||||
}
|
||||
|
||||
func (h *Handler) Page(c *gin.Context) {
|
||||
slug := c.Param("slug")
|
||||
bodyBytes, err := files.ReadFile("content/" + slug + ".html")
|
||||
if err != nil {
|
||||
c.Status(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
title := slug
|
||||
nav := strings.Builder{}
|
||||
for _, p := range order {
|
||||
cls := "nav-link"
|
||||
if p.Slug == slug {
|
||||
cls += " active"
|
||||
title = p.Title
|
||||
}
|
||||
nav.WriteString(`<a class="` + cls + `" href="/docs/` + p.Slug + `">` + p.Title + `</a>`)
|
||||
}
|
||||
html := h.tpl
|
||||
html = strings.ReplaceAll(html, "{{TITLE}}", title)
|
||||
html = strings.ReplaceAll(html, "{{NAV}}", nav.String())
|
||||
html = strings.ReplaceAll(html, "{{BODY}}", string(bodyBytes))
|
||||
c.Header("Content-Type", "text/html; charset=utf-8")
|
||||
c.Header("Cache-Control", "no-cache")
|
||||
_, _ = c.Writer.WriteString(html)
|
||||
}
|
||||
|
||||
func (h *Handler) Asset(c *gin.Context) {
|
||||
name := strings.TrimPrefix(c.Param("file"), "/")
|
||||
if strings.Contains(name, "..") {
|
||||
c.Status(http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
data, err := files.ReadFile("assets/" + name)
|
||||
if err != nil {
|
||||
c.Status(http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
ct := "application/octet-stream"
|
||||
if strings.HasSuffix(name, ".css") {
|
||||
ct = "text/css; charset=utf-8"
|
||||
}
|
||||
c.Header("Content-Type", ct)
|
||||
c.Data(http.StatusOK, ct, data)
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{TITLE}} · OpsxDB 文档</title>
|
||||
<link rel="stylesheet" href="/docs/assets/docs.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="top">
|
||||
<a class="brand" href="/docs"><span class="logo">DB</span> OpsxDB <em>文档</em></a>
|
||||
<nav><a href="/home">官网</a></nav>
|
||||
</header>
|
||||
<div class="layout">
|
||||
<aside class="side">{{NAV}}</aside>
|
||||
<main class="content">{{BODY}}</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user