@yuku123/z-graph-component 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ComponentDoc-yLmdiyDK.js +1334 -0
- package/dist/index.js +8 -7
- package/dist/pages.js +374 -361
- package/dist/z-graph-component.css +1 -1
- package/package.json +4 -3
- package/dist/GraphApp-C6N6khIq.js +0 -1514
package/dist/pages.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { j as e, a as W, s as Y, f as ae, G as
|
|
2
|
-
import { c as
|
|
3
|
-
import { UserOutlined as
|
|
1
|
+
import { j as e, a as W, s as Y, f as ae, C as Ne, G as Se, I as ve } from "./ComponentDoc-yLmdiyDK.js";
|
|
2
|
+
import { c as St } from "./ComponentDoc-yLmdiyDK.js";
|
|
3
|
+
import { UserOutlined as Te, LockOutlined as Ee, HomeOutlined as Ce, DashboardOutlined as Ae, PartitionOutlined as we, BranchesOutlined as ke, HistoryOutlined as Ie, CodeOutlined as Re, DatabaseOutlined as Le, ProfileOutlined as Oe, FileTextOutlined as De, ReadOutlined as Me } from "@ant-design/icons";
|
|
4
4
|
import { useState as N, useEffect as $, useRef as te, useCallback as K, useMemo as X } from "react";
|
|
5
|
-
import { Typography as
|
|
6
|
-
import { useNavigate as
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
import { Typography as He, Card as re, Space as oe, Tag as Pe, Row as ze, Col as We, Form as Z, Input as le, Button as Ge, message as ie } from "antd";
|
|
6
|
+
import { useNavigate as qe } from "react-router-dom";
|
|
7
|
+
import "@yuku123/z-frontend-common/ui";
|
|
8
|
+
function $e(t) {
|
|
9
|
+
const [r, o] = N({
|
|
9
10
|
status: "unknown",
|
|
10
11
|
head: null,
|
|
11
12
|
nodeCount: 0,
|
|
12
13
|
edgeCount: 0,
|
|
13
14
|
error: null
|
|
14
|
-
}), [
|
|
15
|
+
}), [a, d] = N(null);
|
|
15
16
|
return $(() => {
|
|
16
17
|
let p = !1;
|
|
17
18
|
async function S() {
|
|
@@ -38,18 +39,24 @@ function We(s) {
|
|
|
38
39
|
return () => {
|
|
39
40
|
p = !0, clearInterval(f);
|
|
40
41
|
};
|
|
41
|
-
}, [
|
|
42
|
+
}, [t]), { server: r, metrics: a };
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function je(t) {
|
|
44
45
|
return function() {
|
|
45
|
-
const { server: o, metrics:
|
|
46
|
-
return /* @__PURE__ */ e.jsx(
|
|
46
|
+
const { server: o, metrics: a } = $e();
|
|
47
|
+
return /* @__PURE__ */ e.jsx(t, { server: o, metrics: a });
|
|
47
48
|
};
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
-
const
|
|
50
|
+
function F(t) {
|
|
51
|
+
const r = je(t);
|
|
52
|
+
return function() {
|
|
53
|
+
return /* @__PURE__ */ e.jsx("div", { className: "zgc", children: /* @__PURE__ */ e.jsx(r, {}) });
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function Ue({ server: t }) {
|
|
57
|
+
const [r, o] = N([]), [a, d] = N([]), [p, S] = N(null), [f, x] = N(!0), [l, C] = N(null), [j, v] = N([]), A = te(null);
|
|
51
58
|
$(() => {
|
|
52
|
-
let
|
|
59
|
+
let s = !1;
|
|
53
60
|
async function m() {
|
|
54
61
|
try {
|
|
55
62
|
x(!0);
|
|
@@ -66,12 +73,12 @@ function Ge({ server: s }) {
|
|
|
66
73
|
}
|
|
67
74
|
}
|
|
68
75
|
m();
|
|
69
|
-
}, [
|
|
70
|
-
let
|
|
76
|
+
}, [t.head]), $(() => {
|
|
77
|
+
let s = !1;
|
|
71
78
|
async function m() {
|
|
72
79
|
try {
|
|
73
80
|
const c = await W.metrics().catch(() => null);
|
|
74
|
-
if (
|
|
81
|
+
if (s || !c) return;
|
|
75
82
|
const b = Date.now();
|
|
76
83
|
let E = 0;
|
|
77
84
|
if (A.current) {
|
|
@@ -88,16 +95,16 @@ function Ge({ server: s }) {
|
|
|
88
95
|
m();
|
|
89
96
|
const i = setInterval(m, 5e3);
|
|
90
97
|
return () => {
|
|
91
|
-
|
|
98
|
+
s = !0, clearInterval(i);
|
|
92
99
|
};
|
|
93
100
|
}, []);
|
|
94
|
-
const k =
|
|
101
|
+
const k = a.slice(-5).reverse(), g = (p == null ? void 0 : p.tags) || [], h = (p == null ? void 0 : p.edges) || [], n = (p == null ? void 0 : p.indexes) || [];
|
|
95
102
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
96
103
|
/* @__PURE__ */ e.jsxs("div", { className: "kpi-grid", children: [
|
|
97
|
-
/* @__PURE__ */ e.jsx(Q, { label: "节点数", value:
|
|
98
|
-
/* @__PURE__ */ e.jsx(Q, { label: "边数", value:
|
|
99
|
-
/* @__PURE__ */ e.jsx(Q, { label: "分支数", value:
|
|
100
|
-
/* @__PURE__ */ e.jsx(Q, { label: "总提交", value:
|
|
104
|
+
/* @__PURE__ */ e.jsx(Q, { label: "节点数", value: t.nodeCount, icon: "N", color: "#60a5fa" }),
|
|
105
|
+
/* @__PURE__ */ e.jsx(Q, { label: "边数", value: t.edgeCount, icon: "E", color: "#34d399" }),
|
|
106
|
+
/* @__PURE__ */ e.jsx(Q, { label: "分支数", value: r.length, icon: "B", color: "#a78bfa" }),
|
|
107
|
+
/* @__PURE__ */ e.jsx(Q, { label: "总提交", value: a.length, icon: "C", color: "#fbbf24" })
|
|
101
108
|
] }),
|
|
102
109
|
j.length > 1 && /* @__PURE__ */ e.jsxs("div", { className: "card", children: [
|
|
103
110
|
/* @__PURE__ */ e.jsx("h2", { children: "实时指标" }),
|
|
@@ -120,7 +127,7 @@ function Ge({ server: s }) {
|
|
|
120
127
|
title: "JVM 内存",
|
|
121
128
|
color: "#a78bfa",
|
|
122
129
|
unit: "MB",
|
|
123
|
-
format: (
|
|
130
|
+
format: (s) => Math.round(s / 1024 / 1024)
|
|
124
131
|
}
|
|
125
132
|
)
|
|
126
133
|
] })
|
|
@@ -136,7 +143,7 @@ function Ge({ server: s }) {
|
|
|
136
143
|
g.length,
|
|
137
144
|
")"
|
|
138
145
|
] }),
|
|
139
|
-
/* @__PURE__ */ e.jsx("div", { className: "chip-list", children: g.map((
|
|
146
|
+
/* @__PURE__ */ e.jsx("div", { className: "chip-list", children: g.map((s, m) => /* @__PURE__ */ e.jsx("span", { className: "chip tag-chip", children: s.Name || s.name || JSON.stringify(s) }, m)) })
|
|
140
147
|
] }),
|
|
141
148
|
h.length > 0 && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
142
149
|
/* @__PURE__ */ e.jsxs("h3", { style: { marginTop: 12 }, children: [
|
|
@@ -144,7 +151,7 @@ function Ge({ server: s }) {
|
|
|
144
151
|
h.length,
|
|
145
152
|
")"
|
|
146
153
|
] }),
|
|
147
|
-
/* @__PURE__ */ e.jsx("div", { className: "chip-list", children: h.map((
|
|
154
|
+
/* @__PURE__ */ e.jsx("div", { className: "chip-list", children: h.map((s, m) => /* @__PURE__ */ e.jsx("span", { className: "chip edge-chip", children: s.Name || s.name || JSON.stringify(s) }, m)) })
|
|
148
155
|
] }),
|
|
149
156
|
n.length > 0 && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
150
157
|
/* @__PURE__ */ e.jsxs("h3", { style: { marginTop: 12 }, children: [
|
|
@@ -158,10 +165,10 @@ function Ge({ server: s }) {
|
|
|
158
165
|
/* @__PURE__ */ e.jsx("th", { children: "类型" }),
|
|
159
166
|
/* @__PURE__ */ e.jsx("th", { children: "标签" })
|
|
160
167
|
] }) }),
|
|
161
|
-
/* @__PURE__ */ e.jsx("tbody", { children: n.map((
|
|
162
|
-
/* @__PURE__ */ e.jsx("td", { className: "mono", children:
|
|
163
|
-
/* @__PURE__ */ e.jsx("td", { children:
|
|
164
|
-
/* @__PURE__ */ e.jsx("td", { children:
|
|
168
|
+
/* @__PURE__ */ e.jsx("tbody", { children: n.map((s, m) => /* @__PURE__ */ e.jsxs("tr", { children: [
|
|
169
|
+
/* @__PURE__ */ e.jsx("td", { className: "mono", children: s.Name || s.name || "-" }),
|
|
170
|
+
/* @__PURE__ */ e.jsx("td", { children: s.Type || s.type || "-" }),
|
|
171
|
+
/* @__PURE__ */ e.jsx("td", { children: s.Label || s.label || "-" })
|
|
165
172
|
] }, m)) })
|
|
166
173
|
] })
|
|
167
174
|
] })
|
|
@@ -219,65 +226,65 @@ function Ge({ server: s }) {
|
|
|
219
226
|
/* @__PURE__ */ e.jsx("th", { children: "边" }),
|
|
220
227
|
/* @__PURE__ */ e.jsx("th", { children: "时间" })
|
|
221
228
|
] }) }),
|
|
222
|
-
/* @__PURE__ */ e.jsx("tbody", { children: k.map((
|
|
223
|
-
/* @__PURE__ */ e.jsx("td", { className: "mono", children: Y(
|
|
224
|
-
/* @__PURE__ */ e.jsx("td", { children: /* @__PURE__ */ e.jsx("span", { className: "tag", children:
|
|
225
|
-
/* @__PURE__ */ e.jsx("td", { children:
|
|
226
|
-
/* @__PURE__ */ e.jsx("td", { children:
|
|
227
|
-
/* @__PURE__ */ e.jsx("td", { children:
|
|
228
|
-
/* @__PURE__ */ e.jsx("td", { children:
|
|
229
|
-
/* @__PURE__ */ e.jsx("td", { children: ae(
|
|
230
|
-
] },
|
|
229
|
+
/* @__PURE__ */ e.jsx("tbody", { children: k.map((s) => /* @__PURE__ */ e.jsxs("tr", { children: [
|
|
230
|
+
/* @__PURE__ */ e.jsx("td", { className: "mono", children: Y(s.id, 10) }),
|
|
231
|
+
/* @__PURE__ */ e.jsx("td", { children: /* @__PURE__ */ e.jsx("span", { className: "tag", children: s.branch }) }),
|
|
232
|
+
/* @__PURE__ */ e.jsx("td", { children: s.author }),
|
|
233
|
+
/* @__PURE__ */ e.jsx("td", { children: s.message }),
|
|
234
|
+
/* @__PURE__ */ e.jsx("td", { children: s.nodeCount }),
|
|
235
|
+
/* @__PURE__ */ e.jsx("td", { children: s.edgeCount }),
|
|
236
|
+
/* @__PURE__ */ e.jsx("td", { children: ae(s.timestamp) })
|
|
237
|
+
] }, s.id)) })
|
|
231
238
|
] })
|
|
232
239
|
] })
|
|
233
240
|
] });
|
|
234
241
|
}
|
|
235
|
-
function Q({ label:
|
|
242
|
+
function Q({ label: t, value: r, icon: o, color: a }) {
|
|
236
243
|
return /* @__PURE__ */ e.jsxs("div", { className: "kpi", children: [
|
|
237
|
-
/* @__PURE__ */ e.jsx("div", { className: "kpi-icon", style: { background:
|
|
244
|
+
/* @__PURE__ */ e.jsx("div", { className: "kpi-icon", style: { background: a + "20", color: a }, children: o }),
|
|
238
245
|
/* @__PURE__ */ e.jsxs("div", { className: "kpi-content", children: [
|
|
239
|
-
/* @__PURE__ */ e.jsx("div", { className: "kpi-value", children:
|
|
240
|
-
/* @__PURE__ */ e.jsx("div", { className: "kpi-label", children:
|
|
246
|
+
/* @__PURE__ */ e.jsx("div", { className: "kpi-value", children: r ?? "-" }),
|
|
247
|
+
/* @__PURE__ */ e.jsx("div", { className: "kpi-label", children: t })
|
|
241
248
|
] })
|
|
242
249
|
] });
|
|
243
250
|
}
|
|
244
|
-
function ee({ title:
|
|
251
|
+
function ee({ title: t, desc: r, color: o }) {
|
|
245
252
|
return /* @__PURE__ */ e.jsxs("div", { className: "action-card", style: { borderTopColor: o }, children: [
|
|
246
|
-
/* @__PURE__ */ e.jsx("div", { className: "action-title", children:
|
|
247
|
-
/* @__PURE__ */ e.jsx("div", { className: "action-desc mono", children:
|
|
253
|
+
/* @__PURE__ */ e.jsx("div", { className: "action-title", children: t }),
|
|
254
|
+
/* @__PURE__ */ e.jsx("div", { className: "action-desc mono", children: r })
|
|
248
255
|
] });
|
|
249
256
|
}
|
|
250
|
-
function ce({ data:
|
|
251
|
-
if (!
|
|
252
|
-
const S = 400, f = 120, x = 30, l =
|
|
253
|
-
const i = x + m / (l.length - 1) * (S - x * 2), c = f - x - (
|
|
254
|
-
return { x: i, y: c, v:
|
|
255
|
-
}), k = A.map((
|
|
256
|
-
value: Math.round(j +
|
|
257
|
-
y: f - x -
|
|
257
|
+
function ce({ data: t, dataKey: r, title: o, color: a, unit: d, format: p }) {
|
|
258
|
+
if (!t || t.length < 2) return null;
|
|
259
|
+
const S = 400, f = 120, x = 30, l = t.map((s) => p ? p(s[r]) : s[r]), C = Math.max(...l, 1), j = 0, v = C - j || 1, A = l.map((s, m) => {
|
|
260
|
+
const i = x + m / (l.length - 1) * (S - x * 2), c = f - x - (s - j) / v * (f - x * 2);
|
|
261
|
+
return { x: i, y: c, v: s };
|
|
262
|
+
}), k = A.map((s, m) => `${m === 0 ? "M" : "L"}${s.x},${s.y}`).join(" "), g = k + ` L${A[A.length - 1].x},${f - x} L${A[0].x},${f - x} Z`, h = l[l.length - 1], n = [0, 0.5, 1].map((s) => ({
|
|
263
|
+
value: Math.round(j + s * v),
|
|
264
|
+
y: f - x - s * (f - x * 2)
|
|
258
265
|
}));
|
|
259
266
|
return /* @__PURE__ */ e.jsxs("div", { className: "metrics-chart", children: [
|
|
260
267
|
/* @__PURE__ */ e.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "baseline", marginBottom: 8 }, children: [
|
|
261
268
|
/* @__PURE__ */ e.jsx("span", { style: { fontSize: 13, color: "#94a3b8" }, children: o }),
|
|
262
|
-
/* @__PURE__ */ e.jsxs("span", { className: "mono", style: { fontSize: 18, fontWeight: 600, color:
|
|
269
|
+
/* @__PURE__ */ e.jsxs("span", { className: "mono", style: { fontSize: 18, fontWeight: 600, color: a }, children: [
|
|
263
270
|
h,
|
|
264
271
|
d ? " " + d : ""
|
|
265
272
|
] })
|
|
266
273
|
] }),
|
|
267
274
|
/* @__PURE__ */ e.jsxs("svg", { viewBox: `0 0 ${S} ${f}`, style: { width: "100%", height: f }, children: [
|
|
268
|
-
n.map((
|
|
269
|
-
/* @__PURE__ */ e.jsx("line", { x1: x, y1:
|
|
270
|
-
/* @__PURE__ */ e.jsx("text", { x: x - 4, y:
|
|
275
|
+
n.map((s, m) => /* @__PURE__ */ e.jsxs("g", { children: [
|
|
276
|
+
/* @__PURE__ */ e.jsx("line", { x1: x, y1: s.y, x2: S - x, y2: s.y, stroke: "#1e293b", strokeWidth: "1" }),
|
|
277
|
+
/* @__PURE__ */ e.jsx("text", { x: x - 4, y: s.y + 4, textAnchor: "end", fontSize: "9", fill: "#475569", children: s.value })
|
|
271
278
|
] }, m)),
|
|
272
|
-
/* @__PURE__ */ e.jsx("path", { d: g, fill:
|
|
273
|
-
/* @__PURE__ */ e.jsx("path", { d: k, fill: "none", stroke:
|
|
274
|
-
/* @__PURE__ */ e.jsx("circle", { cx: A[A.length - 1].x, cy: A[A.length - 1].y, r: "3", fill:
|
|
279
|
+
/* @__PURE__ */ e.jsx("path", { d: g, fill: a, fillOpacity: "0.1" }),
|
|
280
|
+
/* @__PURE__ */ e.jsx("path", { d: k, fill: "none", stroke: a, strokeWidth: "2", strokeLinejoin: "round" }),
|
|
281
|
+
/* @__PURE__ */ e.jsx("circle", { cx: A[A.length - 1].x, cy: A[A.length - 1].y, r: "3", fill: a })
|
|
275
282
|
] })
|
|
276
283
|
] });
|
|
277
284
|
}
|
|
278
285
|
const de = ["#3b82f6", "#10b981", "#f59e0b", "#ef4444", "#8b5cf6", "#06b6d4", "#ec4899", "#84cc16"], B = 24;
|
|
279
|
-
function
|
|
280
|
-
const [
|
|
286
|
+
function Be({ server: t }) {
|
|
287
|
+
const [r, o] = N(null), [a, d] = N(!1), [p, S] = N(null), [f, x] = N(null), [l, C] = N(null), j = te(null), [v, A] = N({ width: 800, height: 500 });
|
|
281
288
|
$(() => {
|
|
282
289
|
var c;
|
|
283
290
|
const i = (c = j.current) == null ? void 0 : c.parentElement;
|
|
@@ -303,14 +310,14 @@ function qe({ server: s }) {
|
|
|
303
310
|
const y = w.Name || w.name || "";
|
|
304
311
|
if (y)
|
|
305
312
|
try {
|
|
306
|
-
const
|
|
307
|
-
for (const
|
|
308
|
-
const O = typeof
|
|
313
|
+
const R = await W.query(`MATCH (a)-[r:${y}]->(b) RETURN a, r, b`, "main");
|
|
314
|
+
for (const L of R || []) {
|
|
315
|
+
const O = typeof L.a == "string" ? V(L.a) : L.a, z = typeof L.b == "string" ? V(L.b) : L.b, M = typeof L.r == "string" ? Fe(L.r) : L.r;
|
|
309
316
|
b.push({
|
|
310
317
|
source: O._id,
|
|
311
318
|
target: z._id,
|
|
312
319
|
type: y,
|
|
313
|
-
props:
|
|
320
|
+
props: M
|
|
314
321
|
});
|
|
315
322
|
}
|
|
316
323
|
} catch {
|
|
@@ -321,9 +328,9 @@ function qe({ server: s }) {
|
|
|
321
328
|
try {
|
|
322
329
|
const y = await W.query(`MATCH (a)-[r:${w}]->(b) RETURN a, r, b`, "main");
|
|
323
330
|
if (Array.isArray(y) && y.length > 0)
|
|
324
|
-
for (const
|
|
325
|
-
const
|
|
326
|
-
b.push({ source:
|
|
331
|
+
for (const R of y) {
|
|
332
|
+
const L = typeof R.a == "string" ? V(R.a) : R.a, O = typeof R.b == "string" ? V(R.b) : R.b;
|
|
333
|
+
b.push({ source: L._id, target: O._id, type: w, props: {} });
|
|
327
334
|
}
|
|
328
335
|
} catch {
|
|
329
336
|
}
|
|
@@ -338,18 +345,18 @@ function qe({ server: s }) {
|
|
|
338
345
|
}, []);
|
|
339
346
|
$(() => {
|
|
340
347
|
k();
|
|
341
|
-
}, [
|
|
342
|
-
if (!
|
|
348
|
+
}, [t.head]), $(() => {
|
|
349
|
+
if (!r || r.nodes.length === 0) {
|
|
343
350
|
C(null);
|
|
344
351
|
return;
|
|
345
352
|
}
|
|
346
|
-
const i =
|
|
353
|
+
const i = r.nodes.map((T, w) => ({
|
|
347
354
|
...T,
|
|
348
355
|
x: v.width / 2 + (Math.random() - 0.5) * 200,
|
|
349
356
|
y: v.height / 2 + (Math.random() - 0.5) * 200,
|
|
350
357
|
vx: 0,
|
|
351
358
|
vy: 0
|
|
352
|
-
})), c =
|
|
359
|
+
})), c = r.edges.map((T) => ({
|
|
353
360
|
...T,
|
|
354
361
|
sourceIdx: i.findIndex((w) => w.id === T.source),
|
|
355
362
|
targetIdx: i.findIndex((w) => w.id === T.target)
|
|
@@ -357,14 +364,14 @@ function qe({ server: s }) {
|
|
|
357
364
|
for (let T = 0; T < 120; T++) {
|
|
358
365
|
const w = 1 - T / 120;
|
|
359
366
|
for (let y = 0; y < i.length; y++)
|
|
360
|
-
for (let
|
|
361
|
-
let
|
|
362
|
-
i[y].vx -=
|
|
367
|
+
for (let R = y + 1; R < i.length; R++) {
|
|
368
|
+
let L = i[R].x - i[y].x, O = i[R].y - i[y].y, z = Math.sqrt(L * L + O * O) || 1, M = 800 * w / z;
|
|
369
|
+
i[y].vx -= L / z * M, i[y].vy -= O / z * M, i[R].vx += L / z * M, i[R].vy += O / z * M;
|
|
363
370
|
}
|
|
364
371
|
for (const y of c) {
|
|
365
|
-
const
|
|
366
|
-
let O =
|
|
367
|
-
|
|
372
|
+
const R = i[y.sourceIdx], L = i[y.targetIdx];
|
|
373
|
+
let O = L.x - R.x, z = L.y - R.y, M = Math.sqrt(O * O + z * z) || 1, G = (M - 120) * 0.05 * w;
|
|
374
|
+
R.vx += O / M * G, R.vy += z / M * G, L.vx -= O / M * G, L.vy -= z / M * G;
|
|
368
375
|
}
|
|
369
376
|
for (const y of i)
|
|
370
377
|
y.vx += (b - y.x) * 0.01 * w, y.vy += (E - y.y) * 0.01 * w;
|
|
@@ -372,13 +379,13 @@ function qe({ server: s }) {
|
|
|
372
379
|
y.vx *= 0.6, y.vy *= 0.6, y.x += y.vx, y.y += y.vy, y.x = Math.max(B, Math.min(v.width - B, y.x)), y.y = Math.max(B, Math.min(v.height - B, y.y));
|
|
373
380
|
}
|
|
374
381
|
C({ nodes: i, edges: c });
|
|
375
|
-
}, [
|
|
382
|
+
}, [r, v]);
|
|
376
383
|
const g = {};
|
|
377
384
|
let h = 0;
|
|
378
385
|
function n(i) {
|
|
379
386
|
return g[i] || (g[i] = de[h++ % de.length]), g[i];
|
|
380
387
|
}
|
|
381
|
-
function
|
|
388
|
+
function s(i, c) {
|
|
382
389
|
const b = n(i.label), E = f === c, T = (l == null ? void 0 : l.edges.filter((y) => y.sourceIdx === c || y.targetIdx === c)) || [], w = f !== null && !E && !T.some((y) => y.sourceIdx === f || y.targetIdx === f);
|
|
383
390
|
return /* @__PURE__ */ e.jsxs(
|
|
384
391
|
"g",
|
|
@@ -398,17 +405,17 @@ function qe({ server: s }) {
|
|
|
398
405
|
function m(i, c) {
|
|
399
406
|
const b = l.nodes[i.sourceIdx], E = l.nodes[i.targetIdx];
|
|
400
407
|
if (!b || !E) return null;
|
|
401
|
-
const T = E.x - b.x, w = E.y - b.y, y = Math.sqrt(T * T + w * w) || 1,
|
|
408
|
+
const T = E.x - b.x, w = E.y - b.y, y = Math.sqrt(T * T + w * w) || 1, R = T / y, L = w / y, O = b.x + R * B, z = b.y + L * B, M = E.x - R * B, G = E.y - L * B, u = f !== null && (i.sourceIdx === f || i.targetIdx === f), P = f !== null && !u, I = 10, D = Math.atan2(G - z, M - O), H = M - I * Math.cos(D - 0.35), q = G - I * Math.sin(D - 0.35), se = M - I * Math.cos(D + 0.35), be = G - I * Math.sin(D + 0.35);
|
|
402
409
|
return /* @__PURE__ */ e.jsxs("g", { style: { opacity: P ? 0.15 : 1 }, children: [
|
|
403
|
-
/* @__PURE__ */ e.jsx("line", { x1: O, y1: z, x2:
|
|
404
|
-
/* @__PURE__ */ e.jsx("polygon", { points: `${
|
|
405
|
-
i.type && /* @__PURE__ */ e.jsx("text", { x: (O +
|
|
410
|
+
/* @__PURE__ */ e.jsx("line", { x1: O, y1: z, x2: M, y2: G, stroke: u ? "#60a5fa" : "#475569", strokeWidth: u ? 2.5 : 1.5 }),
|
|
411
|
+
/* @__PURE__ */ e.jsx("polygon", { points: `${M},${G} ${H},${q} ${se},${be}`, fill: u ? "#60a5fa" : "#475569" }),
|
|
412
|
+
i.type && /* @__PURE__ */ e.jsx("text", { x: (O + M) / 2, y: (z + G) / 2 - 6, textAnchor: "middle", fill: "#64748b", fontSize: "9", style: { pointerEvents: "none" }, children: i.type })
|
|
406
413
|
] }, c);
|
|
407
414
|
}
|
|
408
415
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
409
416
|
/* @__PURE__ */ e.jsxs("div", { className: "card", children: [
|
|
410
417
|
/* @__PURE__ */ e.jsxs("div", { className: "toolbar", children: [
|
|
411
|
-
/* @__PURE__ */ e.jsx("button", { className: "primary", onClick: k, disabled:
|
|
418
|
+
/* @__PURE__ */ e.jsx("button", { className: "primary", onClick: k, disabled: a, children: a ? "加载中…" : "刷新图" }),
|
|
412
419
|
/* @__PURE__ */ e.jsx("span", { className: "muted", children: l ? `${l.nodes.length} 节点 · ${l.edges.length} 边` : "无数据" }),
|
|
413
420
|
f !== null && (l == null ? void 0 : l.nodes[f]) && /* @__PURE__ */ e.jsxs("span", { className: "tag", style: { marginLeft: 8 }, children: [
|
|
414
421
|
"选中: ",
|
|
@@ -421,7 +428,7 @@ function qe({ server: s }) {
|
|
|
421
428
|
p && /* @__PURE__ */ e.jsx("div", { className: "error", style: { marginTop: 8 }, children: p })
|
|
422
429
|
] }),
|
|
423
430
|
/* @__PURE__ */ e.jsxs("div", { className: "card", style: { padding: 0, overflow: "hidden" }, children: [
|
|
424
|
-
(!l || l.nodes.length === 0) && !
|
|
431
|
+
(!l || l.nodes.length === 0) && !a && /* @__PURE__ */ e.jsx("div", { className: "empty", children: "暂无图数据。请先在 Cypher 查询页创建节点和边。" }),
|
|
425
432
|
/* @__PURE__ */ e.jsxs(
|
|
426
433
|
"svg",
|
|
427
434
|
{
|
|
@@ -433,7 +440,7 @@ function qe({ server: s }) {
|
|
|
433
440
|
/* @__PURE__ */ e.jsx("defs", { children: /* @__PURE__ */ e.jsx("pattern", { id: "grid", width: "40", height: "40", patternUnits: "userSpaceOnUse", children: /* @__PURE__ */ e.jsx("path", { d: "M 40 0 L 0 0 0 40", fill: "none", stroke: "#1e293b", strokeWidth: "0.5" }) }) }),
|
|
434
441
|
/* @__PURE__ */ e.jsx("rect", { width: "100%", height: "100%", fill: "url(#grid)" }),
|
|
435
442
|
/* @__PURE__ */ e.jsx("g", { children: l == null ? void 0 : l.edges.map((i, c) => m(i, c)) }),
|
|
436
|
-
/* @__PURE__ */ e.jsx("g", { children: l == null ? void 0 : l.nodes.map((i, c) =>
|
|
443
|
+
/* @__PURE__ */ e.jsx("g", { children: l == null ? void 0 : l.nodes.map((i, c) => s(i, c)) })
|
|
437
444
|
]
|
|
438
445
|
}
|
|
439
446
|
)
|
|
@@ -447,22 +454,22 @@ function qe({ server: s }) {
|
|
|
447
454
|
] })
|
|
448
455
|
] });
|
|
449
456
|
}
|
|
450
|
-
function V(
|
|
451
|
-
const
|
|
452
|
-
return
|
|
457
|
+
function V(t) {
|
|
458
|
+
const r = t.match(/\((\d+):/), o = t.match(/:\[(\w+)\]/), a = t.match(/\{(.+)\}/), d = { _id: r ? parseInt(r[1]) : 0, _label: o ? o[1] : "Node" };
|
|
459
|
+
return a && a[1].split(",").forEach((p) => {
|
|
453
460
|
const [S, f] = p.split("=").map((x) => x.trim());
|
|
454
461
|
S && f && (d[S] = isNaN(f) ? f.replace(/^'|'$/g, "") : Number(f));
|
|
455
462
|
}), d;
|
|
456
463
|
}
|
|
457
|
-
function
|
|
458
|
-
const
|
|
459
|
-
return
|
|
460
|
-
const [d, p] =
|
|
464
|
+
function Fe(t) {
|
|
465
|
+
const r = t.match(/\}\s*\{(.*?)\}/) || t.match(/\{(.*)\}/), o = {};
|
|
466
|
+
return r && r[1] && r[1].split(",").forEach((a) => {
|
|
467
|
+
const [d, p] = a.split("=").map((S) => S.trim());
|
|
461
468
|
d && p && (o[d] = isNaN(p) ? p.replace(/^'|'$/g, "") : Number(p));
|
|
462
469
|
}), o;
|
|
463
470
|
}
|
|
464
|
-
function
|
|
465
|
-
const [
|
|
471
|
+
function _e({ server: t }) {
|
|
472
|
+
const [r, o] = N([]), [a, d] = N({}), [p, S] = N([]), [f, x] = N(!0), [l, C] = N(null);
|
|
466
473
|
$(() => {
|
|
467
474
|
let v = !1;
|
|
468
475
|
async function A() {
|
|
@@ -474,10 +481,10 @@ function Ue({ server: s }) {
|
|
|
474
481
|
W.query("CALL db.branches()").catch(() => [])
|
|
475
482
|
]), n = Array.isArray(k) ? k : k && k.Name ? [k.Name] : [];
|
|
476
483
|
o(n), S(Array.isArray(g) ? g : []);
|
|
477
|
-
const
|
|
484
|
+
const s = {};
|
|
478
485
|
(Array.isArray(h) ? h : []).forEach((m) => {
|
|
479
|
-
m && m.Name && (
|
|
480
|
-
}), d(
|
|
486
|
+
m && m.Name && (s[m.Name] = m);
|
|
487
|
+
}), d(s), C(null);
|
|
481
488
|
} catch (k) {
|
|
482
489
|
C(k.message);
|
|
483
490
|
} finally {
|
|
@@ -485,7 +492,7 @@ function Ue({ server: s }) {
|
|
|
485
492
|
}
|
|
486
493
|
}
|
|
487
494
|
A();
|
|
488
|
-
}, [
|
|
495
|
+
}, [t.head]);
|
|
489
496
|
const j = p.reduce((v, A) => (v.has(A.branch) || v.set(A.branch, []), v.get(A.branch).push(A), v), /* @__PURE__ */ new Map());
|
|
490
497
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
491
498
|
/* @__PURE__ */ e.jsxs("div", { className: "card", children: [
|
|
@@ -493,8 +500,8 @@ function Ue({ server: s }) {
|
|
|
493
500
|
/* @__PURE__ */ e.jsx("div", { className: "muted", children: "每个分支指向一个 commit head;切换分支不会丢历史。" }),
|
|
494
501
|
f && /* @__PURE__ */ e.jsx("div", { className: "muted", children: "加载中…" }),
|
|
495
502
|
l && /* @__PURE__ */ e.jsx("div", { className: "error", children: l }),
|
|
496
|
-
!f &&
|
|
497
|
-
!f &&
|
|
503
|
+
!f && r.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "empty", children: "尚无分支" }),
|
|
504
|
+
!f && r.length > 0 && /* @__PURE__ */ e.jsxs("table", { children: [
|
|
498
505
|
/* @__PURE__ */ e.jsx("thead", { children: /* @__PURE__ */ e.jsxs("tr", { children: [
|
|
499
506
|
/* @__PURE__ */ e.jsx("th", { children: "分支" }),
|
|
500
507
|
/* @__PURE__ */ e.jsx("th", { children: "Head commit" }),
|
|
@@ -502,9 +509,9 @@ function Ue({ server: s }) {
|
|
|
502
509
|
/* @__PURE__ */ e.jsx("th", { children: "节点" }),
|
|
503
510
|
/* @__PURE__ */ e.jsx("th", { children: "边" })
|
|
504
511
|
] }) }),
|
|
505
|
-
/* @__PURE__ */ e.jsx("tbody", { children:
|
|
512
|
+
/* @__PURE__ */ e.jsx("tbody", { children: r.map((v) => {
|
|
506
513
|
var g;
|
|
507
|
-
const A = (g =
|
|
514
|
+
const A = (g = a[v]) == null ? void 0 : g.Head, k = p.find((h) => h.id === A);
|
|
508
515
|
return /* @__PURE__ */ e.jsxs("tr", { children: [
|
|
509
516
|
/* @__PURE__ */ e.jsx("td", { children: /* @__PURE__ */ e.jsx("span", { className: "tag", children: v }) }),
|
|
510
517
|
/* @__PURE__ */ e.jsx("td", { className: "mono", children: Y(A, 12) || "-" }),
|
|
@@ -553,8 +560,8 @@ const he = [
|
|
|
553
560
|
"#f472b6"
|
|
554
561
|
// pink
|
|
555
562
|
];
|
|
556
|
-
function
|
|
557
|
-
const [
|
|
563
|
+
function Ke({ server: t }) {
|
|
564
|
+
const [r, o] = N([]), [a, d] = N(!0), [p, S] = N(null), [f, x] = N(""), [l, C] = N(""), [j, v] = N(null);
|
|
558
565
|
$(() => {
|
|
559
566
|
let g = !1;
|
|
560
567
|
async function h() {
|
|
@@ -569,13 +576,13 @@ function Be({ server: s }) {
|
|
|
569
576
|
}
|
|
570
577
|
}
|
|
571
578
|
h();
|
|
572
|
-
}, [
|
|
579
|
+
}, [t.head]);
|
|
573
580
|
const A = X(
|
|
574
|
-
() => Array.from(new Set(
|
|
575
|
-
[
|
|
581
|
+
() => Array.from(new Set(r.map((g) => g.branch))),
|
|
582
|
+
[r]
|
|
576
583
|
), k = X(
|
|
577
|
-
() =>
|
|
578
|
-
[
|
|
584
|
+
() => r.filter((g) => !f || g.branch === f).filter((g) => !l || (g.message || "").toLowerCase().includes(l.toLowerCase()) || (g.author || "").toLowerCase().includes(l.toLowerCase()) || (g.id || "").startsWith(l)),
|
|
585
|
+
[r, f, l]
|
|
579
586
|
);
|
|
580
587
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
581
588
|
/* @__PURE__ */ e.jsxs("div", { className: "card", children: [
|
|
@@ -597,11 +604,11 @@ function Be({ server: s }) {
|
|
|
597
604
|
x(""), C(""), v(null);
|
|
598
605
|
}, children: "清空" })
|
|
599
606
|
] }),
|
|
600
|
-
|
|
607
|
+
a && /* @__PURE__ */ e.jsx("div", { className: "muted", children: "加载中…" }),
|
|
601
608
|
p && /* @__PURE__ */ e.jsx("div", { className: "error-banner", children: p }),
|
|
602
|
-
!
|
|
603
|
-
!
|
|
604
|
-
|
|
609
|
+
!a && k.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "empty", children: "没有匹配的 commit" }),
|
|
610
|
+
!a && k.length > 0 && /* @__PURE__ */ e.jsx(
|
|
611
|
+
Je,
|
|
605
612
|
{
|
|
606
613
|
commits: k,
|
|
607
614
|
branches: A,
|
|
@@ -668,24 +675,24 @@ function Be({ server: s }) {
|
|
|
668
675
|
] })
|
|
669
676
|
] });
|
|
670
677
|
}
|
|
671
|
-
function _(
|
|
672
|
-
const o =
|
|
678
|
+
function _(t, r) {
|
|
679
|
+
const o = t.indexOf(r);
|
|
673
680
|
return he[o % he.length];
|
|
674
681
|
}
|
|
675
|
-
function
|
|
682
|
+
function Je({ commits: t, branches: r, selected: o, onSelect: a }) {
|
|
676
683
|
const d = X(
|
|
677
|
-
() => [...
|
|
678
|
-
[
|
|
684
|
+
() => [...t].sort((h, n) => (n.timestamp || 0) - (h.timestamp || 0)),
|
|
685
|
+
[t]
|
|
679
686
|
), p = 130, S = 70, f = 7, x = 30, l = 50, C = 140, j = X(() => {
|
|
680
|
-
const h = /* @__PURE__ */ new Map(), n = [...
|
|
681
|
-
return n.forEach((
|
|
682
|
-
}, [
|
|
687
|
+
const h = /* @__PURE__ */ new Map(), n = [...r].sort((s, m) => s === "main" ? -1 : m === "main" ? 1 : r.indexOf(s) - r.indexOf(m));
|
|
688
|
+
return n.forEach((s, m) => h.set(s, m)), { lanes: h, totalLanes: n.length };
|
|
689
|
+
}, [r]), v = X(() => {
|
|
683
690
|
const h = /* @__PURE__ */ new Map();
|
|
684
|
-
return d.forEach((n,
|
|
691
|
+
return d.forEach((n, s) => {
|
|
685
692
|
const m = j.lanes.get(n.branch) || 0;
|
|
686
693
|
h.set(n.id, {
|
|
687
|
-
col:
|
|
688
|
-
x: x +
|
|
694
|
+
col: s,
|
|
695
|
+
x: x + s * p + p / 2,
|
|
689
696
|
y: l + m * S + S / 2,
|
|
690
697
|
lane: m,
|
|
691
698
|
branch: n.branch
|
|
@@ -694,22 +701,22 @@ function Fe({ commits: s, branches: a, selected: o, onSelect: r }) {
|
|
|
694
701
|
}, [d, j]), A = X(() => {
|
|
695
702
|
const h = [];
|
|
696
703
|
for (const n of d) {
|
|
697
|
-
const
|
|
698
|
-
if (!
|
|
704
|
+
const s = v.get(n.id);
|
|
705
|
+
if (!s) continue;
|
|
699
706
|
const m = n.parents || [];
|
|
700
707
|
m.forEach((i, c) => {
|
|
701
708
|
const b = v.get(i);
|
|
702
709
|
b && h.push({
|
|
703
|
-
from:
|
|
710
|
+
from: s,
|
|
704
711
|
to: b,
|
|
705
|
-
color: _(
|
|
712
|
+
color: _(r, n.branch),
|
|
706
713
|
isMainParent: c === 0,
|
|
707
714
|
isMerge: m.length > 1
|
|
708
715
|
});
|
|
709
716
|
});
|
|
710
717
|
}
|
|
711
718
|
return h;
|
|
712
|
-
}, [d, v, j,
|
|
719
|
+
}, [d, v, j, r]), k = x + d.length * p + C, g = l + j.totalLanes * S + 30;
|
|
713
720
|
return /* @__PURE__ */ e.jsxs("div", { className: "commit-flow-graph", style: { overflowX: "auto", overflowY: "hidden", padding: "12px 0" }, children: [
|
|
714
721
|
/* @__PURE__ */ e.jsxs("div", { style: { minWidth: k, position: "relative" }, children: [
|
|
715
722
|
/* @__PURE__ */ e.jsxs(
|
|
@@ -748,15 +755,15 @@ function Fe({ commits: s, branches: a, selected: o, onSelect: r }) {
|
|
|
748
755
|
)
|
|
749
756
|
] }),
|
|
750
757
|
[...j.lanes.entries()].map(([h, n]) => {
|
|
751
|
-
const
|
|
758
|
+
const s = l + n * S + S / 2;
|
|
752
759
|
return /* @__PURE__ */ e.jsx("g", { children: /* @__PURE__ */ e.jsx(
|
|
753
760
|
"line",
|
|
754
761
|
{
|
|
755
762
|
x1: x - 10,
|
|
756
|
-
y1:
|
|
763
|
+
y1: s,
|
|
757
764
|
x2: x + d.length * p + 10,
|
|
758
|
-
y2:
|
|
759
|
-
stroke: _(
|
|
765
|
+
y2: s,
|
|
766
|
+
stroke: _(r, h),
|
|
760
767
|
strokeWidth: 1.5,
|
|
761
768
|
strokeDasharray: "6,4",
|
|
762
769
|
opacity: 0.4
|
|
@@ -787,22 +794,22 @@ function Fe({ commits: s, branches: a, selected: o, onSelect: r }) {
|
|
|
787
794
|
),
|
|
788
795
|
A.map((h, n) => {
|
|
789
796
|
var P, I;
|
|
790
|
-
const { from:
|
|
791
|
-
if (
|
|
797
|
+
const { from: s, to: m, color: i, isMerge: c, isMainParent: b } = h, E = (o == null ? void 0 : o.id) === ((P = s.commit) == null ? void 0 : P.id) || (o == null ? void 0 : o.id) === ((I = m.commit) == null ? void 0 : I.id), T = s.x - f - 2, w = s.y, y = m.x + f + 2, R = m.y;
|
|
798
|
+
if (s.lane === m.lane)
|
|
792
799
|
return /* @__PURE__ */ e.jsx(
|
|
793
800
|
"line",
|
|
794
801
|
{
|
|
795
802
|
x1: T,
|
|
796
803
|
y1: w,
|
|
797
804
|
x2: y,
|
|
798
|
-
y2:
|
|
805
|
+
y2: R,
|
|
799
806
|
stroke: E ? "#60a5fa" : i,
|
|
800
807
|
strokeWidth: E ? 2.5 : 2,
|
|
801
808
|
markerEnd: E ? "url(#arrowhead-active)" : "url(#arrowhead)"
|
|
802
809
|
},
|
|
803
810
|
n
|
|
804
811
|
);
|
|
805
|
-
const
|
|
812
|
+
const L = y - T, O = T + L * 0.3, z = w, M = y - L * 0.3, u = `M ${T},${w} C ${O},${z} ${M},${R} ${y},${R}`;
|
|
806
813
|
return /* @__PURE__ */ e.jsx(
|
|
807
814
|
"path",
|
|
808
815
|
{
|
|
@@ -820,8 +827,8 @@ function Fe({ commits: s, branches: a, selected: o, onSelect: r }) {
|
|
|
820
827
|
d.map((h) => {
|
|
821
828
|
const n = v.get(h.id);
|
|
822
829
|
if (!n) return null;
|
|
823
|
-
const
|
|
824
|
-
return
|
|
830
|
+
const s = (h.parents || []).length > 1, m = (o == null ? void 0 : o.id) === h.id, i = _(r, h.branch), c = m ? f + 2 : f;
|
|
831
|
+
return s ? /* @__PURE__ */ e.jsxs("g", { children: [
|
|
825
832
|
/* @__PURE__ */ e.jsx(
|
|
826
833
|
"polygon",
|
|
827
834
|
{
|
|
@@ -830,7 +837,7 @@ function Fe({ commits: s, branches: a, selected: o, onSelect: r }) {
|
|
|
830
837
|
stroke: m ? "#fff" : "#0b1220",
|
|
831
838
|
strokeWidth: m ? 2 : 1.5,
|
|
832
839
|
style: { cursor: "pointer" },
|
|
833
|
-
onClick: () =>
|
|
840
|
+
onClick: () => a(m ? null : h)
|
|
834
841
|
}
|
|
835
842
|
),
|
|
836
843
|
m && /* @__PURE__ */ e.jsx(
|
|
@@ -856,7 +863,7 @@ function Fe({ commits: s, branches: a, selected: o, onSelect: r }) {
|
|
|
856
863
|
stroke: m ? "#fff" : "#0b1220",
|
|
857
864
|
strokeWidth: m ? 2 : 1.5,
|
|
858
865
|
style: { cursor: "pointer" },
|
|
859
|
-
onClick: () =>
|
|
866
|
+
onClick: () => a(m ? null : h)
|
|
860
867
|
}
|
|
861
868
|
),
|
|
862
869
|
m && /* @__PURE__ */ e.jsx(
|
|
@@ -874,15 +881,15 @@ function Fe({ commits: s, branches: a, selected: o, onSelect: r }) {
|
|
|
874
881
|
] }, h.id);
|
|
875
882
|
}),
|
|
876
883
|
[...j.lanes.entries()].map(([h, n]) => {
|
|
877
|
-
const
|
|
884
|
+
const s = l + n * S + S / 2, m = x + d.length * p + 10, i = _(r, h), b = d.filter((E) => E.branch === h)[0];
|
|
878
885
|
return /* @__PURE__ */ e.jsxs("g", { children: [
|
|
879
886
|
/* @__PURE__ */ e.jsx(
|
|
880
887
|
"line",
|
|
881
888
|
{
|
|
882
889
|
x1: m - 10,
|
|
883
|
-
y1:
|
|
890
|
+
y1: s,
|
|
884
891
|
x2: m + 10,
|
|
885
|
-
y2:
|
|
892
|
+
y2: s,
|
|
886
893
|
stroke: i,
|
|
887
894
|
strokeWidth: 2
|
|
888
895
|
}
|
|
@@ -891,7 +898,7 @@ function Fe({ commits: s, branches: a, selected: o, onSelect: r }) {
|
|
|
891
898
|
"rect",
|
|
892
899
|
{
|
|
893
900
|
x: m + 12,
|
|
894
|
-
y:
|
|
901
|
+
y: s - 11,
|
|
895
902
|
width: Math.max(60, h.length * 8 + 16),
|
|
896
903
|
height: 22,
|
|
897
904
|
rx: 4,
|
|
@@ -899,32 +906,32 @@ function Fe({ commits: s, branches: a, selected: o, onSelect: r }) {
|
|
|
899
906
|
stroke: i,
|
|
900
907
|
strokeWidth: 1.5,
|
|
901
908
|
style: { cursor: "pointer" },
|
|
902
|
-
onClick: () => b &&
|
|
909
|
+
onClick: () => b && a(b)
|
|
903
910
|
}
|
|
904
911
|
),
|
|
905
912
|
/* @__PURE__ */ e.jsx(
|
|
906
913
|
"text",
|
|
907
914
|
{
|
|
908
915
|
x: m + 22,
|
|
909
|
-
y:
|
|
916
|
+
y: s + 4,
|
|
910
917
|
fontSize: 12,
|
|
911
918
|
fill: i,
|
|
912
919
|
fontFamily: "'SFMono-Regular', Menlo, Consolas, monospace",
|
|
913
920
|
fontWeight: 600,
|
|
914
921
|
style: { cursor: "pointer" },
|
|
915
|
-
onClick: () => b &&
|
|
922
|
+
onClick: () => b && a(b),
|
|
916
923
|
children: h
|
|
917
924
|
}
|
|
918
925
|
)
|
|
919
926
|
] }, h);
|
|
920
927
|
}),
|
|
921
928
|
[...j.lanes.entries()].map(([h, n]) => {
|
|
922
|
-
const
|
|
929
|
+
const s = l + n * S + S / 2, m = _(r, h);
|
|
923
930
|
return /* @__PURE__ */ e.jsx(
|
|
924
931
|
"text",
|
|
925
932
|
{
|
|
926
933
|
x: 5,
|
|
927
|
-
y:
|
|
934
|
+
y: s + 4,
|
|
928
935
|
fontSize: 11,
|
|
929
936
|
fill: m,
|
|
930
937
|
fontFamily: "'SFMono-Regular', Menlo, Consolas, monospace",
|
|
@@ -937,17 +944,17 @@ function Fe({ commits: s, branches: a, selected: o, onSelect: r }) {
|
|
|
937
944
|
}
|
|
938
945
|
),
|
|
939
946
|
/* @__PURE__ */ e.jsx("div", { style: { position: "relative", pointerEvents: "none" }, children: d.map((h, n) => {
|
|
940
|
-
const
|
|
941
|
-
if (!
|
|
947
|
+
const s = v.get(h.id);
|
|
948
|
+
if (!s) return null;
|
|
942
949
|
const m = (o == null ? void 0 : o.id) === h.id;
|
|
943
950
|
return /* @__PURE__ */ e.jsxs(
|
|
944
951
|
"div",
|
|
945
952
|
{
|
|
946
|
-
onClick: () =>
|
|
953
|
+
onClick: () => a(m ? null : h),
|
|
947
954
|
style: {
|
|
948
955
|
position: "absolute",
|
|
949
|
-
left:
|
|
950
|
-
top:
|
|
956
|
+
left: s.x - p / 2 + 12,
|
|
957
|
+
top: s.y - 26,
|
|
951
958
|
width: p - 14,
|
|
952
959
|
fontSize: 11,
|
|
953
960
|
color: m ? "#f8fafc" : "#cbd5e1",
|
|
@@ -962,7 +969,7 @@ function Fe({ commits: s, branches: a, selected: o, onSelect: r }) {
|
|
|
962
969
|
className: "mono",
|
|
963
970
|
style: {
|
|
964
971
|
fontSize: 10,
|
|
965
|
-
color: _(
|
|
972
|
+
color: _(r, h.branch),
|
|
966
973
|
fontWeight: 600,
|
|
967
974
|
whiteSpace: "nowrap",
|
|
968
975
|
overflow: "hidden",
|
|
@@ -992,12 +999,12 @@ function Fe({ commits: s, branches: a, selected: o, onSelect: r }) {
|
|
|
992
999
|
}) })
|
|
993
1000
|
] }),
|
|
994
1001
|
/* @__PURE__ */ e.jsxs("div", { style: { marginTop: 16, display: "flex", flexWrap: "wrap", gap: 12, padding: "8px 0", borderTop: "1px solid #1e293b" }, children: [
|
|
995
|
-
|
|
1002
|
+
r.map((h) => /* @__PURE__ */ e.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 6, fontSize: 12 }, children: [
|
|
996
1003
|
/* @__PURE__ */ e.jsx("span", { style: {
|
|
997
1004
|
display: "inline-block",
|
|
998
1005
|
width: 14,
|
|
999
1006
|
height: 3,
|
|
1000
|
-
background: _(
|
|
1007
|
+
background: _(r, h)
|
|
1001
1008
|
} }),
|
|
1002
1009
|
/* @__PURE__ */ e.jsx("span", { className: "mono", children: h }),
|
|
1003
1010
|
/* @__PURE__ */ e.jsxs("span", { className: "muted", children: [
|
|
@@ -1010,7 +1017,7 @@ function Fe({ commits: s, branches: a, selected: o, onSelect: r }) {
|
|
|
1010
1017
|
] })
|
|
1011
1018
|
] });
|
|
1012
1019
|
}
|
|
1013
|
-
const
|
|
1020
|
+
const Xe = /* @__PURE__ */ new Set([
|
|
1014
1021
|
"MATCH",
|
|
1015
1022
|
"RETURN",
|
|
1016
1023
|
"CREATE",
|
|
@@ -1084,7 +1091,7 @@ const _e = /* @__PURE__ */ new Set([
|
|
|
1084
1091
|
"db.tags",
|
|
1085
1092
|
"db.edges",
|
|
1086
1093
|
"db.indexes"
|
|
1087
|
-
]),
|
|
1094
|
+
]), Ve = [
|
|
1088
1095
|
// 关键字
|
|
1089
1096
|
{ text: "MATCH", desc: "模式匹配", category: "keyword" },
|
|
1090
1097
|
{ text: "RETURN", desc: "返回结果", category: "keyword" },
|
|
@@ -1150,7 +1157,7 @@ const _e = /* @__PURE__ */ new Set([
|
|
|
1150
1157
|
pattern: "#86efac",
|
|
1151
1158
|
ddl: "#fbbf24"
|
|
1152
1159
|
};
|
|
1153
|
-
function
|
|
1160
|
+
function Ye({ value: t, onChange: r, onKeyDown: o, rows: a = 10 }) {
|
|
1154
1161
|
const d = te(null), p = te(null), [S, f] = N([]), [x, l] = N(0), [C, j] = N(!1), [v, A] = N({ top: 0, left: 0 }), k = K(() => {
|
|
1155
1162
|
d.current && p.current && (d.current.scrollTop = p.current.scrollTop, d.current.scrollLeft = p.current.scrollLeft);
|
|
1156
1163
|
}, []);
|
|
@@ -1168,16 +1175,16 @@ function Je({ value: s, onChange: a, onKeyDown: o, rows: r = 10 }) {
|
|
|
1168
1175
|
}
|
|
1169
1176
|
const n = K((c) => {
|
|
1170
1177
|
const b = c.target.value;
|
|
1171
|
-
|
|
1178
|
+
r(b);
|
|
1172
1179
|
const E = c.target.selectionStart, T = g(b, E);
|
|
1173
1180
|
if (T.length >= 1) {
|
|
1174
|
-
const w =
|
|
1181
|
+
const w = Ve.filter(
|
|
1175
1182
|
(y) => y.text.toLowerCase().startsWith(T.toLowerCase()) || y.desc.includes(T)
|
|
1176
1183
|
).slice(0, 12);
|
|
1177
1184
|
w.length > 0 ? (f(w), l(0), j(!0), A(h(c.target, E))) : j(!1);
|
|
1178
1185
|
} else
|
|
1179
1186
|
j(!1);
|
|
1180
|
-
}, [
|
|
1187
|
+
}, [r]), s = K((c) => {
|
|
1181
1188
|
if (C && S.length > 0) {
|
|
1182
1189
|
if (c.key === "ArrowDown") {
|
|
1183
1190
|
c.preventDefault(), l((b) => (b + 1) % S.length);
|
|
@@ -1201,8 +1208,8 @@ function Je({ value: s, onChange: a, onKeyDown: o, rows: r = 10 }) {
|
|
|
1201
1208
|
function m(c) {
|
|
1202
1209
|
const b = p.current;
|
|
1203
1210
|
if (!b) return;
|
|
1204
|
-
const E = b.selectionStart, T = b.value, w = g(T, E), y = T.substring(0, E - w.length),
|
|
1205
|
-
|
|
1211
|
+
const E = b.selectionStart, T = b.value, w = g(T, E), y = T.substring(0, E - w.length), R = T.substring(E), L = y + c.text + R;
|
|
1212
|
+
r(L), j(!1), setTimeout(() => {
|
|
1206
1213
|
const O = E - w.length + c.text.length;
|
|
1207
1214
|
b.setSelectionRange(O, O), b.focus();
|
|
1208
1215
|
}, 0);
|
|
@@ -1214,7 +1221,7 @@ function Je({ value: s, onChange: a, onKeyDown: o, rows: r = 10 }) {
|
|
|
1214
1221
|
}
|
|
1215
1222
|
return document.addEventListener("mousedown", c), () => document.removeEventListener("mousedown", c);
|
|
1216
1223
|
}, [C]);
|
|
1217
|
-
const i =
|
|
1224
|
+
const i = Ze(t || "");
|
|
1218
1225
|
return /* @__PURE__ */ e.jsxs("div", { className: "cypher-editor-wrap", style: { position: "relative" }, children: [
|
|
1219
1226
|
/* @__PURE__ */ e.jsx(
|
|
1220
1227
|
"pre",
|
|
@@ -1250,12 +1257,12 @@ function Je({ value: s, onChange: a, onKeyDown: o, rows: r = 10 }) {
|
|
|
1250
1257
|
"textarea",
|
|
1251
1258
|
{
|
|
1252
1259
|
ref: p,
|
|
1253
|
-
value:
|
|
1260
|
+
value: t,
|
|
1254
1261
|
onChange: n,
|
|
1255
1262
|
onScroll: k,
|
|
1256
|
-
onKeyDown:
|
|
1263
|
+
onKeyDown: s,
|
|
1257
1264
|
spellCheck: !1,
|
|
1258
|
-
rows:
|
|
1265
|
+
rows: a,
|
|
1259
1266
|
placeholder: "MATCH (n:Person) RETURN n LIMIT 10",
|
|
1260
1267
|
style: {
|
|
1261
1268
|
width: "100%",
|
|
@@ -1333,53 +1340,53 @@ function Je({ value: s, onChange: a, onKeyDown: o, rows: r = 10 }) {
|
|
|
1333
1340
|
)
|
|
1334
1341
|
] });
|
|
1335
1342
|
}
|
|
1336
|
-
function
|
|
1337
|
-
const
|
|
1343
|
+
function Ze(t) {
|
|
1344
|
+
const r = [];
|
|
1338
1345
|
let o = 0;
|
|
1339
|
-
for (; o <
|
|
1340
|
-
if (
|
|
1341
|
-
const
|
|
1342
|
-
`, o), d =
|
|
1343
|
-
|
|
1346
|
+
for (; o < t.length; ) {
|
|
1347
|
+
if (t[o] === "-" && t[o + 1] === "-") {
|
|
1348
|
+
const a = t.indexOf(`
|
|
1349
|
+
`, o), d = a === -1 ? t.substring(o) : t.substring(o, a);
|
|
1350
|
+
r.push(`<span class="hl-comment">${U(d)}</span>`), o = a === -1 ? t.length : a;
|
|
1344
1351
|
continue;
|
|
1345
1352
|
}
|
|
1346
|
-
if (
|
|
1347
|
-
let
|
|
1348
|
-
for (;
|
|
1349
|
-
|
|
1350
|
-
|
|
1353
|
+
if (t[o] === "'") {
|
|
1354
|
+
let a = o + 1;
|
|
1355
|
+
for (; a < t.length && t[a] !== "'"; )
|
|
1356
|
+
t[a] === "\\" && a++, a++;
|
|
1357
|
+
a = Math.min(a + 1, t.length), r.push(`<span class="hl-string">${U(t.substring(o, a))}</span>`), o = a;
|
|
1351
1358
|
continue;
|
|
1352
1359
|
}
|
|
1353
|
-
if (
|
|
1354
|
-
let
|
|
1355
|
-
for (;
|
|
1356
|
-
|
|
1357
|
-
|
|
1360
|
+
if (t[o] === '"') {
|
|
1361
|
+
let a = o + 1;
|
|
1362
|
+
for (; a < t.length && t[a] !== '"'; )
|
|
1363
|
+
t[a] === "\\" && a++, a++;
|
|
1364
|
+
a = Math.min(a + 1, t.length), r.push(`<span class="hl-string">${U(t.substring(o, a))}</span>`), o = a;
|
|
1358
1365
|
continue;
|
|
1359
1366
|
}
|
|
1360
|
-
if (/[0-9]/.test(
|
|
1361
|
-
let
|
|
1362
|
-
for (;
|
|
1363
|
-
|
|
1367
|
+
if (/[0-9]/.test(t[o]) && (o === 0 || /[\s,({\-:[=<>!]/.test(t[o - 1]))) {
|
|
1368
|
+
let a = o;
|
|
1369
|
+
for (; a < t.length && /[0-9.]/.test(t[a]); ) a++;
|
|
1370
|
+
r.push(`<span class="hl-number">${U(t.substring(o, a))}</span>`), o = a;
|
|
1364
1371
|
continue;
|
|
1365
1372
|
}
|
|
1366
|
-
if (/[a-zA-Z_]/.test(
|
|
1367
|
-
let
|
|
1368
|
-
for (;
|
|
1369
|
-
const d =
|
|
1370
|
-
|
|
1373
|
+
if (/[a-zA-Z_]/.test(t[o])) {
|
|
1374
|
+
let a = o;
|
|
1375
|
+
for (; a < t.length && /[a-zA-Z0-9_]/.test(t[a]); ) a++;
|
|
1376
|
+
const d = t.substring(o, a), p = d.toUpperCase();
|
|
1377
|
+
Xe.has(p) ? r.push(`<span class="hl-keyword">${U(d)}</span>`) : me.has(p) || me.has(d.toLowerCase()) ? r.push(`<span class="hl-builtin">${U(d)}</span>`) : a < t.length && t[a] === "(" ? r.push(`<span class="hl-function">${U(d)}</span>`) : p === "ASC" || p === "DESC" ? r.push(`<span class="hl-keyword">${U(d)}</span>`) : r.push(U(d)), o = a;
|
|
1371
1378
|
continue;
|
|
1372
1379
|
}
|
|
1373
|
-
if ("-><-[]{}(),:.;=<>!+".includes(
|
|
1374
|
-
|
|
1380
|
+
if ("-><-[]{}(),:.;=<>!+".includes(t[o])) {
|
|
1381
|
+
r.push(`<span class="hl-op">${U(t[o])}</span>`), o++;
|
|
1375
1382
|
continue;
|
|
1376
1383
|
}
|
|
1377
|
-
|
|
1384
|
+
r.push(U(t[o])), o++;
|
|
1378
1385
|
}
|
|
1379
|
-
return
|
|
1386
|
+
return r.join("");
|
|
1380
1387
|
}
|
|
1381
|
-
function U(
|
|
1382
|
-
return
|
|
1388
|
+
function U(t) {
|
|
1389
|
+
return t === "&" ? "&" : t === "<" ? "<" : t === ">" ? ">" : t === '"' ? """ : t;
|
|
1383
1390
|
}
|
|
1384
1391
|
const ne = {
|
|
1385
1392
|
节点与边: `CREATE (a:Person {name: 'Alice', age: 30}),
|
|
@@ -1400,8 +1407,8 @@ const ne = {
|
|
|
1400
1407
|
"SHOW STATS": "CALL db.stats()",
|
|
1401
1408
|
EXPLAIN: "EXPLAIN MATCH (n:Person) WHERE n.age > 20 RETURN n"
|
|
1402
1409
|
};
|
|
1403
|
-
function
|
|
1404
|
-
const [
|
|
1410
|
+
function Qe({ server: t }) {
|
|
1411
|
+
const [r, o] = N(ne.节点与边), [a, d] = N("main"), [p, S] = N(""), [f, x] = N([]), [l, C] = N([]), [j, v] = N("branch"), [A, k] = N(!1), [g, h] = N(null), [n, s] = N(null), [m, i] = N(null), [c, b] = N(() => {
|
|
1405
1412
|
try {
|
|
1406
1413
|
return JSON.parse(localStorage.getItem("z-graph-history") || "[]");
|
|
1407
1414
|
} catch {
|
|
@@ -1412,42 +1419,42 @@ function Ve({ server: s }) {
|
|
|
1412
1419
|
let u = !1;
|
|
1413
1420
|
async function P() {
|
|
1414
1421
|
try {
|
|
1415
|
-
const [I,
|
|
1416
|
-
x(H), C(q), H.length && !H.find((se) => se ===
|
|
1422
|
+
const [I, D] = await Promise.all([W.branches(), W.commits()]), H = Array.isArray(I) ? I : I && I.Name ? [I.Name] : [], q = Array.isArray(D) ? D : [];
|
|
1423
|
+
x(H), C(q), H.length && !H.find((se) => se === a) && d(H[0]);
|
|
1417
1424
|
} catch {
|
|
1418
1425
|
}
|
|
1419
1426
|
}
|
|
1420
1427
|
P();
|
|
1421
|
-
}, [
|
|
1428
|
+
}, [t.head]);
|
|
1422
1429
|
function w(u, P) {
|
|
1423
|
-
const I = { cypher: u.substring(0, 200), time: Date.now(), elapsed: P, branch:
|
|
1424
|
-
b(
|
|
1430
|
+
const I = { cypher: u.substring(0, 200), time: Date.now(), elapsed: P, branch: a }, D = [I, ...c.filter((H) => H.cypher !== I.cypher)].slice(0, 50);
|
|
1431
|
+
b(D);
|
|
1425
1432
|
try {
|
|
1426
|
-
localStorage.setItem("z-graph-history", JSON.stringify(
|
|
1433
|
+
localStorage.setItem("z-graph-history", JSON.stringify(D));
|
|
1427
1434
|
} catch {
|
|
1428
1435
|
}
|
|
1429
1436
|
}
|
|
1430
1437
|
const y = K(async () => {
|
|
1431
|
-
if (!
|
|
1432
|
-
k(!0),
|
|
1438
|
+
if (!r.trim()) return;
|
|
1439
|
+
k(!0), s(null), h(null), i(null);
|
|
1433
1440
|
const u = performance.now();
|
|
1434
1441
|
try {
|
|
1435
1442
|
const P = await W.query(
|
|
1436
|
-
|
|
1437
|
-
j === "branch" ?
|
|
1443
|
+
r,
|
|
1444
|
+
j === "branch" ? a : null,
|
|
1438
1445
|
j === "commit" ? p : null
|
|
1439
1446
|
), I = Math.round(performance.now() - u) + "ms";
|
|
1440
|
-
h(P), i(I), w(
|
|
1447
|
+
h(P), i(I), w(r, I);
|
|
1441
1448
|
} catch (P) {
|
|
1442
|
-
|
|
1449
|
+
s(P.message), w(r, "error");
|
|
1443
1450
|
} finally {
|
|
1444
1451
|
k(!1);
|
|
1445
1452
|
}
|
|
1446
|
-
}, [
|
|
1447
|
-
function
|
|
1453
|
+
}, [r, a, p, j]);
|
|
1454
|
+
function R(u) {
|
|
1448
1455
|
o(ne[u]);
|
|
1449
1456
|
}
|
|
1450
|
-
function
|
|
1457
|
+
function L(u) {
|
|
1451
1458
|
o(u.cypher), u.branch && d(u.branch), T(!1);
|
|
1452
1459
|
}
|
|
1453
1460
|
function O(u) {
|
|
@@ -1455,20 +1462,20 @@ function Ve({ server: s }) {
|
|
|
1455
1462
|
if (typeof u == "string") return /* @__PURE__ */ e.jsx("pre", { children: u });
|
|
1456
1463
|
if (Array.isArray(u)) {
|
|
1457
1464
|
if (u.length === 0) return /* @__PURE__ */ e.jsx("div", { className: "empty", children: "0 行结果" });
|
|
1458
|
-
const P = Array.from(u.reduce((I,
|
|
1465
|
+
const P = Array.from(u.reduce((I, D) => (D && typeof D == "object" && Object.keys(D).forEach((H) => I.add(H)), I), /* @__PURE__ */ new Set()));
|
|
1459
1466
|
return /* @__PURE__ */ e.jsxs("table", { children: [
|
|
1460
1467
|
/* @__PURE__ */ e.jsx("thead", { children: /* @__PURE__ */ e.jsx("tr", { children: P.map((I) => /* @__PURE__ */ e.jsx("th", { children: I }, I)) }) }),
|
|
1461
|
-
/* @__PURE__ */ e.jsx("tbody", { children: u.map((I,
|
|
1468
|
+
/* @__PURE__ */ e.jsx("tbody", { children: u.map((I, D) => /* @__PURE__ */ e.jsx("tr", { children: P.map((H) => /* @__PURE__ */ e.jsx("td", { className: "mono", children: et(I[H]) }, H)) }, D)) })
|
|
1462
1469
|
] });
|
|
1463
1470
|
}
|
|
1464
1471
|
return /* @__PURE__ */ e.jsx("pre", { children: JSON.stringify(u, null, 2) });
|
|
1465
1472
|
}
|
|
1466
1473
|
function z() {
|
|
1467
1474
|
if (!g || !Array.isArray(g) || g.length === 0) return;
|
|
1468
|
-
const u = Array.from(g.reduce((I,
|
|
1475
|
+
const u = Array.from(g.reduce((I, D) => (D && typeof D == "object" && Object.keys(D).forEach((H) => I.add(H)), I), /* @__PURE__ */ new Set())), P = [u.join(",")];
|
|
1469
1476
|
for (const I of g)
|
|
1470
|
-
P.push(u.map((
|
|
1471
|
-
const H = I[
|
|
1477
|
+
P.push(u.map((D) => {
|
|
1478
|
+
const H = I[D];
|
|
1472
1479
|
if (H == null) return "";
|
|
1473
1480
|
const q = typeof H == "object" ? JSON.stringify(H) : String(H);
|
|
1474
1481
|
return q.includes(",") || q.includes('"') || q.includes(`
|
|
@@ -1477,21 +1484,21 @@ function Ve({ server: s }) {
|
|
|
1477
1484
|
G(P.join(`
|
|
1478
1485
|
`), "z-graph-query.csv", "text/csv;charset=utf-8");
|
|
1479
1486
|
}
|
|
1480
|
-
function
|
|
1487
|
+
function M() {
|
|
1481
1488
|
if (!g) return;
|
|
1482
1489
|
const u = JSON.stringify(g, null, 2);
|
|
1483
1490
|
G(u, "z-graph-query.json", "application/json;charset=utf-8");
|
|
1484
1491
|
}
|
|
1485
1492
|
function G(u, P, I) {
|
|
1486
|
-
const
|
|
1493
|
+
const D = new Blob([u], { type: I }), H = URL.createObjectURL(D), q = document.createElement("a");
|
|
1487
1494
|
q.href = H, q.download = P, document.body.appendChild(q), q.click(), document.body.removeChild(q), URL.revokeObjectURL(H);
|
|
1488
1495
|
}
|
|
1489
1496
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1490
1497
|
/* @__PURE__ */ e.jsxs("div", { className: "card", children: [
|
|
1491
1498
|
/* @__PURE__ */ e.jsxs("div", { className: "toolbar", children: [
|
|
1492
|
-
/* @__PURE__ */ e.jsx("button", { className: "primary", disabled: A || !
|
|
1499
|
+
/* @__PURE__ */ e.jsx("button", { className: "primary", disabled: A || !r.trim(), onClick: y, children: A ? "执行中…" : "执行" }),
|
|
1493
1500
|
/* @__PURE__ */ e.jsx("button", { onClick: () => o(""), disabled: A, children: "清空" }),
|
|
1494
|
-
/* @__PURE__ */ e.jsxs("select", { onChange: (u) =>
|
|
1501
|
+
/* @__PURE__ */ e.jsxs("select", { onChange: (u) => R(u.target.value), value: "", children: [
|
|
1495
1502
|
/* @__PURE__ */ e.jsx("option", { value: "", disabled: !0, children: "载入示例…" }),
|
|
1496
1503
|
Object.keys(ne).map((u) => /* @__PURE__ */ e.jsx("option", { value: u, children: u }, u))
|
|
1497
1504
|
] }),
|
|
@@ -1508,7 +1515,7 @@ function Ve({ server: s }) {
|
|
|
1508
1515
|
] }),
|
|
1509
1516
|
E && /* @__PURE__ */ e.jsxs("div", { className: "history-panel", children: [
|
|
1510
1517
|
c.length === 0 && /* @__PURE__ */ e.jsx("div", { className: "muted", children: "暂无历史" }),
|
|
1511
|
-
c.slice(0, 20).map((u, P) => /* @__PURE__ */ e.jsxs("div", { className: "history-item", onClick: () =>
|
|
1518
|
+
c.slice(0, 20).map((u, P) => /* @__PURE__ */ e.jsxs("div", { className: "history-item", onClick: () => L(u), children: [
|
|
1512
1519
|
/* @__PURE__ */ e.jsxs("span", { className: "history-cypher mono", children: [
|
|
1513
1520
|
u.cypher.substring(0, 80),
|
|
1514
1521
|
u.cypher.length > 80 ? "…" : ""
|
|
@@ -1519,7 +1526,7 @@ function Ve({ server: s }) {
|
|
|
1519
1526
|
] })
|
|
1520
1527
|
] }, P))
|
|
1521
1528
|
] }),
|
|
1522
|
-
/* @__PURE__ */ e.jsx("div", { style: { marginTop: 12 }, children: j === "branch" ? /* @__PURE__ */ e.jsx("select", { value:
|
|
1529
|
+
/* @__PURE__ */ e.jsx("div", { style: { marginTop: 12 }, children: j === "branch" ? /* @__PURE__ */ e.jsx("select", { value: a, onChange: (u) => d(u.target.value), children: f.map((u) => /* @__PURE__ */ e.jsx("option", { value: u, children: u }, u)) }) : /* @__PURE__ */ e.jsxs("select", { value: p, onChange: (u) => S(u.target.value), children: [
|
|
1523
1530
|
/* @__PURE__ */ e.jsx("option", { value: "", children: "选择一个 commit" }),
|
|
1524
1531
|
l.slice().reverse().map((u) => /* @__PURE__ */ e.jsxs("option", { value: u.id, children: [
|
|
1525
1532
|
u.id.substring(0, 12),
|
|
@@ -1530,9 +1537,9 @@ function Ve({ server: s }) {
|
|
|
1530
1537
|
] }, u.id))
|
|
1531
1538
|
] }) }),
|
|
1532
1539
|
/* @__PURE__ */ e.jsx(
|
|
1533
|
-
|
|
1540
|
+
Ye,
|
|
1534
1541
|
{
|
|
1535
|
-
value:
|
|
1542
|
+
value: r,
|
|
1536
1543
|
onChange: o,
|
|
1537
1544
|
onKeyDown: (u) => {
|
|
1538
1545
|
(u.ctrlKey || u.metaKey) && u.key === "Enter" && (u.preventDefault(), y());
|
|
@@ -1554,7 +1561,7 @@ function Ve({ server: s }) {
|
|
|
1554
1561
|
] }),
|
|
1555
1562
|
g && Array.isArray(g) && g.length > 0 && /* @__PURE__ */ e.jsxs("div", { className: "toolbar", children: [
|
|
1556
1563
|
/* @__PURE__ */ e.jsx("button", { onClick: z, children: "📥 CSV" }),
|
|
1557
|
-
/* @__PURE__ */ e.jsx("button", { onClick:
|
|
1564
|
+
/* @__PURE__ */ e.jsx("button", { onClick: M, children: "📥 JSON" })
|
|
1558
1565
|
] })
|
|
1559
1566
|
] }),
|
|
1560
1567
|
n && /* @__PURE__ */ e.jsx("div", { className: "results", children: /* @__PURE__ */ e.jsx("pre", { className: "error", children: n }) }),
|
|
@@ -1563,8 +1570,8 @@ function Ve({ server: s }) {
|
|
|
1563
1570
|
] })
|
|
1564
1571
|
] });
|
|
1565
1572
|
}
|
|
1566
|
-
function
|
|
1567
|
-
return
|
|
1573
|
+
function et(t) {
|
|
1574
|
+
return t == null ? "" : typeof t == "object" ? JSON.stringify(t) : String(t);
|
|
1568
1575
|
}
|
|
1569
1576
|
const ue = [
|
|
1570
1577
|
{ label: "创建 TAG", cypher: "CREATE TAG IF NOT EXISTS Person (name string, age int)", category: "DDL" },
|
|
@@ -1585,25 +1592,25 @@ RETURN n.age AS age, count(n) AS count ORDER BY age`, category: "查询" },
|
|
|
1585
1592
|
{ label: "OPTIONAL MATCH", cypher: `MATCH (a:Person)-[r?:KNOWS]->(b:Person)
|
|
1586
1593
|
RETURN a.name AS from, b.name AS to`, category: "查询" }
|
|
1587
1594
|
];
|
|
1588
|
-
function
|
|
1589
|
-
const [
|
|
1595
|
+
function tt({ server: t }) {
|
|
1596
|
+
const [r, o] = N("TAGS"), [a, d] = N([]), [p, S] = N(!1), [f, x] = N(null), [l, C] = N(null), [j, v] = N(null), [A, k] = N(!1), g = K(async () => {
|
|
1590
1597
|
S(!0), x(null);
|
|
1591
1598
|
try {
|
|
1592
|
-
const
|
|
1593
|
-
d(Array.isArray(
|
|
1594
|
-
} catch (
|
|
1595
|
-
x(
|
|
1599
|
+
const s = await W.query(xe(r), "main", null);
|
|
1600
|
+
d(Array.isArray(s) ? s : []);
|
|
1601
|
+
} catch (s) {
|
|
1602
|
+
x(s.message), d([]);
|
|
1596
1603
|
} finally {
|
|
1597
1604
|
S(!1);
|
|
1598
1605
|
}
|
|
1599
|
-
}, [
|
|
1606
|
+
}, [r]);
|
|
1600
1607
|
$(() => {
|
|
1601
1608
|
g();
|
|
1602
|
-
}, [
|
|
1603
|
-
async function h(
|
|
1609
|
+
}, [r, t.head]);
|
|
1610
|
+
async function h(s) {
|
|
1604
1611
|
k(!0), v(null), C(null);
|
|
1605
1612
|
try {
|
|
1606
|
-
const m = await W.query(
|
|
1613
|
+
const m = await W.query(s);
|
|
1607
1614
|
C(m), setTimeout(g, 500);
|
|
1608
1615
|
} catch (m) {
|
|
1609
1616
|
v(m.message);
|
|
@@ -1611,80 +1618,80 @@ function Ze({ server: s }) {
|
|
|
1611
1618
|
k(!1);
|
|
1612
1619
|
}
|
|
1613
1620
|
}
|
|
1614
|
-
const n = [...new Set(ue.map((
|
|
1621
|
+
const n = [...new Set(ue.map((s) => s.category))];
|
|
1615
1622
|
return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1616
1623
|
/* @__PURE__ */ e.jsxs("div", { className: "card", children: [
|
|
1617
1624
|
/* @__PURE__ */ e.jsx("h2", { children: "DDL 快捷操作" }),
|
|
1618
1625
|
/* @__PURE__ */ e.jsx("div", { className: "muted", style: { marginBottom: 12 }, children: "点击按钮直接执行 DDL 语句,写入操作会在 main 分支产生新 commit。" }),
|
|
1619
|
-
n.map((
|
|
1620
|
-
/* @__PURE__ */ e.jsx("h3", { style: { marginTop: 12, marginBottom: 6 }, children:
|
|
1621
|
-
/* @__PURE__ */ e.jsx("div", { className: "chip-list", children: ue.filter((m) => m.category ===
|
|
1622
|
-
] },
|
|
1626
|
+
n.map((s) => /* @__PURE__ */ e.jsxs("div", { children: [
|
|
1627
|
+
/* @__PURE__ */ e.jsx("h3", { style: { marginTop: 12, marginBottom: 6 }, children: s }),
|
|
1628
|
+
/* @__PURE__ */ e.jsx("div", { className: "chip-list", children: ue.filter((m) => m.category === s).map((m, i) => /* @__PURE__ */ e.jsx("button", { className: "chip ddl-chip", onClick: () => h(m.cypher), disabled: A, children: m.label }, i)) })
|
|
1629
|
+
] }, s)),
|
|
1623
1630
|
A && /* @__PURE__ */ e.jsx("div", { className: "muted", style: { marginTop: 8 }, children: "执行中…" }),
|
|
1624
1631
|
j && /* @__PURE__ */ e.jsx("pre", { className: "error", style: { marginTop: 8 }, children: j }),
|
|
1625
1632
|
l && /* @__PURE__ */ e.jsx("pre", { className: "results", style: { marginTop: 8 }, children: JSON.stringify(l, null, 2) })
|
|
1626
1633
|
] }),
|
|
1627
1634
|
/* @__PURE__ */ e.jsxs("div", { className: "card", children: [
|
|
1628
1635
|
/* @__PURE__ */ e.jsxs("div", { className: "toolbar", children: [
|
|
1629
|
-
["TAGS", "EDGES", "INDEXES"].map((
|
|
1636
|
+
["TAGS", "EDGES", "INDEXES"].map((s) => /* @__PURE__ */ e.jsxs(
|
|
1630
1637
|
"button",
|
|
1631
1638
|
{
|
|
1632
|
-
className:
|
|
1633
|
-
onClick: () => o(
|
|
1639
|
+
className: r === s ? "primary" : "",
|
|
1640
|
+
onClick: () => o(s),
|
|
1634
1641
|
children: [
|
|
1635
1642
|
"SHOW ",
|
|
1636
|
-
|
|
1643
|
+
s
|
|
1637
1644
|
]
|
|
1638
1645
|
},
|
|
1639
|
-
|
|
1646
|
+
s
|
|
1640
1647
|
)),
|
|
1641
1648
|
/* @__PURE__ */ e.jsx("button", { onClick: g, disabled: p, children: p ? "刷新中…" : "刷新" })
|
|
1642
1649
|
] }),
|
|
1643
1650
|
/* @__PURE__ */ e.jsxs("div", { className: "muted", style: { marginTop: 8 }, children: [
|
|
1644
1651
|
"执行:",
|
|
1645
|
-
xe(
|
|
1652
|
+
xe(r)
|
|
1646
1653
|
] })
|
|
1647
1654
|
] }),
|
|
1648
1655
|
/* @__PURE__ */ e.jsxs("div", { className: "card", children: [
|
|
1649
1656
|
f && /* @__PURE__ */ e.jsx("div", { className: "error", children: f }),
|
|
1650
|
-
!f &&
|
|
1657
|
+
!f && a.length === 0 && /* @__PURE__ */ e.jsxs("div", { className: "empty", children: [
|
|
1651
1658
|
"尚无 ",
|
|
1652
|
-
|
|
1659
|
+
r.toLowerCase()
|
|
1653
1660
|
] }),
|
|
1654
|
-
!f &&
|
|
1661
|
+
!f && a.length > 0 && /* @__PURE__ */ e.jsx(st, { rows: a })
|
|
1655
1662
|
] })
|
|
1656
1663
|
] });
|
|
1657
1664
|
}
|
|
1658
|
-
function xe(
|
|
1659
|
-
return
|
|
1665
|
+
function xe(t) {
|
|
1666
|
+
return t === "TAGS" ? "SHOW TAGS" : t === "EDGES" ? "SHOW EDGES" : "SHOW INDEXES";
|
|
1660
1667
|
}
|
|
1661
|
-
function
|
|
1662
|
-
const
|
|
1668
|
+
function st({ rows: t }) {
|
|
1669
|
+
const r = Array.from(t.reduce((o, a) => (Object.keys(a || {}).forEach((d) => o.add(d)), o), /* @__PURE__ */ new Set()));
|
|
1663
1670
|
return /* @__PURE__ */ e.jsxs("table", { children: [
|
|
1664
|
-
/* @__PURE__ */ e.jsx("thead", { children: /* @__PURE__ */ e.jsx("tr", { children:
|
|
1665
|
-
/* @__PURE__ */ e.jsx("tbody", { children:
|
|
1671
|
+
/* @__PURE__ */ e.jsx("thead", { children: /* @__PURE__ */ e.jsx("tr", { children: r.map((o) => /* @__PURE__ */ e.jsx("th", { children: o }, o)) }) }),
|
|
1672
|
+
/* @__PURE__ */ e.jsx("tbody", { children: t.map((o, a) => /* @__PURE__ */ e.jsx("tr", { children: r.map((d) => /* @__PURE__ */ e.jsx("td", { className: "mono", children: nt(o[d]) }, d)) }, a)) })
|
|
1666
1673
|
] });
|
|
1667
1674
|
}
|
|
1668
|
-
function
|
|
1669
|
-
return
|
|
1675
|
+
function nt(t) {
|
|
1676
|
+
return t == null ? "" : typeof t == "object" ? JSON.stringify(t) : String(t);
|
|
1670
1677
|
}
|
|
1671
|
-
const
|
|
1678
|
+
const rt = {
|
|
1672
1679
|
GET: "#86efac",
|
|
1673
1680
|
POST: "#93c5fd",
|
|
1674
1681
|
OPTIONS: "#94a3b8"
|
|
1675
1682
|
};
|
|
1676
|
-
function
|
|
1683
|
+
function at() {
|
|
1677
1684
|
var g, h;
|
|
1678
|
-
const [
|
|
1685
|
+
const [t, r] = N(null), [o, a] = N(!0), [d, p] = N(null), [S, f] = N(!0), [x, l] = N({ method: "", status: "", path: "", requestId: "" }), [C, j] = N(null), v = K(async () => {
|
|
1679
1686
|
try {
|
|
1680
1687
|
const n = {};
|
|
1681
1688
|
x.method && (n.method = x.method), x.status && (n.status = x.status), x.path && (n.path = x.path), x.requestId && (n.requestId = x.requestId), n.limit = 200;
|
|
1682
|
-
const
|
|
1683
|
-
|
|
1689
|
+
const s = await W.logs(n);
|
|
1690
|
+
r(s), p(null);
|
|
1684
1691
|
} catch (n) {
|
|
1685
1692
|
p(n.message);
|
|
1686
1693
|
} finally {
|
|
1687
|
-
|
|
1694
|
+
a(!1);
|
|
1688
1695
|
}
|
|
1689
1696
|
}, [x]);
|
|
1690
1697
|
$(() => {
|
|
@@ -1694,8 +1701,8 @@ function st() {
|
|
|
1694
1701
|
}, [v, S]);
|
|
1695
1702
|
function A(n) {
|
|
1696
1703
|
if (!n) return "";
|
|
1697
|
-
const
|
|
1698
|
-
return
|
|
1704
|
+
const s = new Date(n);
|
|
1705
|
+
return s.toLocaleTimeString("zh-CN", { hour12: !1 }) + "." + String(s.getMilliseconds()).padStart(3, "0");
|
|
1699
1706
|
}
|
|
1700
1707
|
function k(n) {
|
|
1701
1708
|
return n >= 500 ? "log-status-error" : n >= 400 ? "log-status-warn" : "log-status-ok";
|
|
@@ -1706,7 +1713,7 @@ function st() {
|
|
|
1706
1713
|
/* @__PURE__ */ e.jsx("h2", { children: "请求日志" }),
|
|
1707
1714
|
/* @__PURE__ */ e.jsxs("div", { className: "muted", children: [
|
|
1708
1715
|
"环形缓冲区最近 ",
|
|
1709
|
-
(
|
|
1716
|
+
(t == null ? void 0 : t.bufferSize) || 500,
|
|
1710
1717
|
" 条请求记录,自动刷新。"
|
|
1711
1718
|
] })
|
|
1712
1719
|
] }),
|
|
@@ -1723,13 +1730,13 @@ function st() {
|
|
|
1723
1730
|
] })
|
|
1724
1731
|
] }) }),
|
|
1725
1732
|
/* @__PURE__ */ e.jsx("div", { className: "card", children: /* @__PURE__ */ e.jsxs("div", { className: "toolbar", children: [
|
|
1726
|
-
/* @__PURE__ */ e.jsxs("select", { value: x.method, onChange: (n) => l((
|
|
1733
|
+
/* @__PURE__ */ e.jsxs("select", { value: x.method, onChange: (n) => l((s) => ({ ...s, method: n.target.value })), children: [
|
|
1727
1734
|
/* @__PURE__ */ e.jsx("option", { value: "", children: "全部方法" }),
|
|
1728
1735
|
/* @__PURE__ */ e.jsx("option", { value: "GET", children: "GET" }),
|
|
1729
1736
|
/* @__PURE__ */ e.jsx("option", { value: "POST", children: "POST" }),
|
|
1730
1737
|
/* @__PURE__ */ e.jsx("option", { value: "OPTIONS", children: "OPTIONS" })
|
|
1731
1738
|
] }),
|
|
1732
|
-
/* @__PURE__ */ e.jsxs("select", { value: x.status, onChange: (n) => l((
|
|
1739
|
+
/* @__PURE__ */ e.jsxs("select", { value: x.status, onChange: (n) => l((s) => ({ ...s, status: n.target.value })), children: [
|
|
1733
1740
|
/* @__PURE__ */ e.jsx("option", { value: "", children: "全部状态" }),
|
|
1734
1741
|
/* @__PURE__ */ e.jsx("option", { value: "2xx", children: "2xx 成功" }),
|
|
1735
1742
|
/* @__PURE__ */ e.jsx("option", { value: "4xx", children: "4xx 客户端错误" }),
|
|
@@ -1745,7 +1752,7 @@ function st() {
|
|
|
1745
1752
|
{
|
|
1746
1753
|
placeholder: "路径过滤…",
|
|
1747
1754
|
value: x.path,
|
|
1748
|
-
onChange: (n) => l((
|
|
1755
|
+
onChange: (n) => l((s) => ({ ...s, path: n.target.value })),
|
|
1749
1756
|
style: { width: 200 }
|
|
1750
1757
|
}
|
|
1751
1758
|
),
|
|
@@ -1754,15 +1761,15 @@ function st() {
|
|
|
1754
1761
|
{
|
|
1755
1762
|
placeholder: "Request ID…",
|
|
1756
1763
|
value: x.requestId,
|
|
1757
|
-
onChange: (n) => l((
|
|
1764
|
+
onChange: (n) => l((s) => ({ ...s, requestId: n.target.value })),
|
|
1758
1765
|
style: { width: 160 }
|
|
1759
1766
|
}
|
|
1760
1767
|
),
|
|
1761
|
-
|
|
1768
|
+
t && /* @__PURE__ */ e.jsxs("span", { style: { fontSize: 12, color: "#64748b" }, children: [
|
|
1762
1769
|
"共 ",
|
|
1763
|
-
|
|
1770
|
+
t.total,
|
|
1764
1771
|
" 条记录,显示 ",
|
|
1765
|
-
((g =
|
|
1772
|
+
((g = t.entries) == null ? void 0 : g.length) || 0,
|
|
1766
1773
|
" 条"
|
|
1767
1774
|
] })
|
|
1768
1775
|
] }) }),
|
|
@@ -1771,7 +1778,7 @@ function st() {
|
|
|
1771
1778
|
"加载失败: ",
|
|
1772
1779
|
d
|
|
1773
1780
|
] }),
|
|
1774
|
-
|
|
1781
|
+
t && t.entries && /* @__PURE__ */ e.jsx("div", { className: "card", style: { padding: 0, overflow: "hidden" }, children: /* @__PURE__ */ e.jsx("div", { className: "log-table-wrap", children: /* @__PURE__ */ e.jsxs("table", { className: "log-table", children: [
|
|
1775
1782
|
/* @__PURE__ */ e.jsx("thead", { children: /* @__PURE__ */ e.jsxs("tr", { children: [
|
|
1776
1783
|
/* @__PURE__ */ e.jsx("th", { style: { width: 110 }, children: "时间" }),
|
|
1777
1784
|
/* @__PURE__ */ e.jsx("th", { style: { width: 90 }, children: "Request ID" }),
|
|
@@ -1782,11 +1789,11 @@ function st() {
|
|
|
1782
1789
|
/* @__PURE__ */ e.jsx("th", { style: { width: 100 }, children: "客户端" })
|
|
1783
1790
|
] }) }),
|
|
1784
1791
|
/* @__PURE__ */ e.jsxs("tbody", { children: [
|
|
1785
|
-
|
|
1792
|
+
t.entries.map((n, s) => /* @__PURE__ */ e.jsxs(
|
|
1786
1793
|
"tr",
|
|
1787
1794
|
{
|
|
1788
|
-
className: `log-row ${C ===
|
|
1789
|
-
onClick: () => j(C ===
|
|
1795
|
+
className: `log-row ${C === s ? "selected" : ""}`,
|
|
1796
|
+
onClick: () => j(C === s ? null : s),
|
|
1790
1797
|
children: [
|
|
1791
1798
|
/* @__PURE__ */ e.jsx("td", { className: "mono", style: { fontSize: 11, color: "#64748b" }, children: A(n.timestamp) }),
|
|
1792
1799
|
/* @__PURE__ */ e.jsx(
|
|
@@ -1805,7 +1812,7 @@ function st() {
|
|
|
1805
1812
|
"span",
|
|
1806
1813
|
{
|
|
1807
1814
|
className: "log-method",
|
|
1808
|
-
style: { color:
|
|
1815
|
+
style: { color: rt[n.method] || "#94a3b8" },
|
|
1809
1816
|
children: n.method
|
|
1810
1817
|
}
|
|
1811
1818
|
) }),
|
|
@@ -1818,14 +1825,14 @@ function st() {
|
|
|
1818
1825
|
/* @__PURE__ */ e.jsx("td", { className: "mono", style: { fontSize: 11, color: "#64748b" }, children: n.clientIp })
|
|
1819
1826
|
]
|
|
1820
1827
|
},
|
|
1821
|
-
|
|
1828
|
+
s
|
|
1822
1829
|
)),
|
|
1823
|
-
|
|
1830
|
+
t.entries.length === 0 && /* @__PURE__ */ e.jsx("tr", { children: /* @__PURE__ */ e.jsx("td", { colSpan: 7, style: { textAlign: "center", padding: 30, color: "#64748b" }, children: "暂无日志记录" }) })
|
|
1824
1831
|
] })
|
|
1825
1832
|
] }) }) }),
|
|
1826
|
-
C !== null && ((h =
|
|
1833
|
+
C !== null && ((h = t == null ? void 0 : t.entries) == null ? void 0 : h[C]) && /* @__PURE__ */ e.jsxs("div", { className: "card", children: [
|
|
1827
1834
|
/* @__PURE__ */ e.jsx("h3", { style: { margin: "0 0 8px", fontSize: 14, color: "#94a3b8" }, children: "请求详情" }),
|
|
1828
|
-
/* @__PURE__ */ e.jsx("pre", { className: "results", style: { fontSize: 12, maxHeight: 200 }, children: JSON.stringify(
|
|
1835
|
+
/* @__PURE__ */ e.jsx("pre", { className: "results", style: { fontSize: 12, maxHeight: 200 }, children: JSON.stringify(t.entries[C], null, 2) })
|
|
1829
1836
|
] })
|
|
1830
1837
|
] });
|
|
1831
1838
|
}
|
|
@@ -1951,10 +1958,10 @@ const ge = [
|
|
|
1951
1958
|
response: "{ imported, branch, elapsedMs }"
|
|
1952
1959
|
}
|
|
1953
1960
|
];
|
|
1954
|
-
function
|
|
1955
|
-
const [
|
|
1961
|
+
function ot() {
|
|
1962
|
+
const [t, r] = N(null), [o, a] = N(null), [d, p] = N(!1), [S, f] = N(null);
|
|
1956
1963
|
async function x(l) {
|
|
1957
|
-
p(!0),
|
|
1964
|
+
p(!0), a(null), f(null);
|
|
1958
1965
|
try {
|
|
1959
1966
|
let C;
|
|
1960
1967
|
if (l.method === "GET")
|
|
@@ -1969,7 +1976,7 @@ function nt() {
|
|
|
1969
1976
|
body: JSON.stringify(j)
|
|
1970
1977
|
});
|
|
1971
1978
|
}
|
|
1972
|
-
|
|
1979
|
+
a(C);
|
|
1973
1980
|
} catch (C) {
|
|
1974
1981
|
f(C.message);
|
|
1975
1982
|
} finally {
|
|
@@ -1986,14 +1993,14 @@ function nt() {
|
|
|
1986
1993
|
] })
|
|
1987
1994
|
] }),
|
|
1988
1995
|
ge.map((l, C) => /* @__PURE__ */ e.jsxs("div", { className: "card api-endpoint-card", children: [
|
|
1989
|
-
/* @__PURE__ */ e.jsxs("div", { className: "api-endpoint-header", onClick: () =>
|
|
1996
|
+
/* @__PURE__ */ e.jsxs("div", { className: "api-endpoint-header", onClick: () => r(t === C ? null : C), children: [
|
|
1990
1997
|
/* @__PURE__ */ e.jsx("span", { className: `api-method ${l.method.toLowerCase()}`, children: l.method }),
|
|
1991
1998
|
/* @__PURE__ */ e.jsx("code", { className: "api-path", children: l.path }),
|
|
1992
1999
|
/* @__PURE__ */ e.jsx("span", { className: "api-name", children: l.name }),
|
|
1993
2000
|
/* @__PURE__ */ e.jsx("span", { style: { flex: 1 } }),
|
|
1994
|
-
/* @__PURE__ */ e.jsx("span", { className: "api-expand", children:
|
|
2001
|
+
/* @__PURE__ */ e.jsx("span", { className: "api-expand", children: t === C ? "▲" : "▼" })
|
|
1995
2002
|
] }),
|
|
1996
|
-
|
|
2003
|
+
t === C && /* @__PURE__ */ e.jsxs("div", { className: "api-endpoint-detail", children: [
|
|
1997
2004
|
/* @__PURE__ */ e.jsx("p", { children: l.desc }),
|
|
1998
2005
|
l.params.length > 0 && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1999
2006
|
/* @__PURE__ */ e.jsx("h3", { children: "参数" }),
|
|
@@ -2025,24 +2032,24 @@ function nt() {
|
|
|
2025
2032
|
] });
|
|
2026
2033
|
}
|
|
2027
2034
|
function ye() {
|
|
2028
|
-
const
|
|
2029
|
-
return
|
|
2035
|
+
const t = typeof window < "u" && window.__Z_GRAPH_API__ || "/api";
|
|
2036
|
+
return t === "/api" ? window.location.host : t.replace(/^https?:\/\//, "");
|
|
2030
2037
|
}
|
|
2031
|
-
async function fe(
|
|
2032
|
-
const
|
|
2033
|
-
headers: { Accept: "application/json", ...
|
|
2034
|
-
...
|
|
2038
|
+
async function fe(t, r = {}) {
|
|
2039
|
+
const a = await (await fetch(t, {
|
|
2040
|
+
headers: { Accept: "application/json", ...r.headers || {} },
|
|
2041
|
+
...r
|
|
2035
2042
|
})).text();
|
|
2036
|
-
if (!
|
|
2043
|
+
if (!a) return null;
|
|
2037
2044
|
try {
|
|
2038
|
-
return JSON.parse(
|
|
2045
|
+
return JSON.parse(a);
|
|
2039
2046
|
} catch {
|
|
2040
|
-
return
|
|
2047
|
+
return a;
|
|
2041
2048
|
}
|
|
2042
2049
|
}
|
|
2043
|
-
const { Title:
|
|
2044
|
-
function
|
|
2045
|
-
const
|
|
2050
|
+
const { Title: lt, Paragraph: it } = He;
|
|
2051
|
+
function ct() {
|
|
2052
|
+
const t = qe(), [r, o] = N(null);
|
|
2046
2053
|
$(() => {
|
|
2047
2054
|
const d = localStorage.getItem("userInfo");
|
|
2048
2055
|
if (d)
|
|
@@ -2052,17 +2059,17 @@ function ot() {
|
|
|
2052
2059
|
o({ name: d });
|
|
2053
2060
|
}
|
|
2054
2061
|
}, []);
|
|
2055
|
-
const
|
|
2062
|
+
const a = dt.filter((d) => d.key !== "/z-graph/home");
|
|
2056
2063
|
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
2057
2064
|
/* @__PURE__ */ e.jsx(re, { style: { marginBottom: 16, background: "linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%)", border: "none" }, children: /* @__PURE__ */ e.jsxs(oe, { direction: "vertical", size: 4, style: { color: "#fff" }, children: [
|
|
2058
|
-
/* @__PURE__ */ e.jsxs(
|
|
2065
|
+
/* @__PURE__ */ e.jsxs(lt, { level: 3, style: { color: "#fff", margin: 0 }, children: [
|
|
2059
2066
|
"欢迎",
|
|
2060
|
-
|
|
2067
|
+
r != null && r.name ? `,${r.name}` : ""
|
|
2061
2068
|
] }),
|
|
2062
|
-
/* @__PURE__ */ e.jsx(
|
|
2063
|
-
(
|
|
2069
|
+
/* @__PURE__ */ e.jsx(it, { style: { color: "rgba(255,255,255,0.85)", margin: 0 }, children: "z-graph 图存储控制台 管理台" }),
|
|
2070
|
+
(r == null ? void 0 : r.role) && /* @__PURE__ */ e.jsx(Pe, { style: { marginTop: 8, background: "rgba(255,255,255,0.2)", color: "#fff", border: "none" }, children: r.role })
|
|
2064
2071
|
] }) }),
|
|
2065
|
-
/* @__PURE__ */ e.jsx(
|
|
2072
|
+
/* @__PURE__ */ e.jsx(ze, { gutter: [16, 16], children: a.map((d) => /* @__PURE__ */ e.jsx(We, { xs: 24, sm: 12, md: 12, lg: 8, children: /* @__PURE__ */ e.jsx(re, { hoverable: !0, onClick: () => t(d.key), style: { borderTop: "3px solid #7c3aed" }, children: /* @__PURE__ */ e.jsxs(oe, { align: "start", size: 12, children: [
|
|
2066
2073
|
/* @__PURE__ */ e.jsx("div", { style: {
|
|
2067
2074
|
width: 44,
|
|
2068
2075
|
height: 44,
|
|
@@ -2083,13 +2090,13 @@ function ot() {
|
|
|
2083
2090
|
] });
|
|
2084
2091
|
}
|
|
2085
2092
|
const J = { username: "admin", password: "123456", user: { name: "admin", role: "管理员" } };
|
|
2086
|
-
function
|
|
2087
|
-
const [
|
|
2088
|
-
|
|
2093
|
+
function yt() {
|
|
2094
|
+
const [t, r] = N(!1), o = async (a) => {
|
|
2095
|
+
r(!0);
|
|
2089
2096
|
try {
|
|
2090
|
-
|
|
2097
|
+
a.username === J.username && a.password === J.password ? (localStorage.setItem("token", "mock-" + J.username), localStorage.setItem("userInfo", JSON.stringify(J.user)), ie.success("登录成功(mock 模式,待 CTC/SSO 接入)"), window.location.href = "/z-graph/home") : ie.error("用户名或密码错误(默认 admin/123456)");
|
|
2091
2098
|
} finally {
|
|
2092
|
-
|
|
2099
|
+
r(!1);
|
|
2093
2100
|
}
|
|
2094
2101
|
};
|
|
2095
2102
|
return /* @__PURE__ */ e.jsx("div", { style: {
|
|
@@ -2116,14 +2123,14 @@ function pt() {
|
|
|
2116
2123
|
/* @__PURE__ */ e.jsx("div", { style: { fontSize: 18, fontWeight: 600, color: "#0f172a" }, children: "z-graph 管理台" })
|
|
2117
2124
|
] }),
|
|
2118
2125
|
/* @__PURE__ */ e.jsxs(Z, { onFinish: o, size: "large", children: [
|
|
2119
|
-
/* @__PURE__ */ e.jsx(Z.Item, { name: "username", rules: [{ required: !0, message: "请输入用户名" }], children: /* @__PURE__ */ e.jsx(le, { prefix: /* @__PURE__ */ e.jsx(
|
|
2120
|
-
/* @__PURE__ */ e.jsx(Z.Item, { name: "password", rules: [{ required: !0, message: "请输入密码" }], children: /* @__PURE__ */ e.jsx(le.Password, { prefix: /* @__PURE__ */ e.jsx(
|
|
2126
|
+
/* @__PURE__ */ e.jsx(Z.Item, { name: "username", rules: [{ required: !0, message: "请输入用户名" }], children: /* @__PURE__ */ e.jsx(le, { prefix: /* @__PURE__ */ e.jsx(Te, {}), placeholder: "用户名" }) }),
|
|
2127
|
+
/* @__PURE__ */ e.jsx(Z.Item, { name: "password", rules: [{ required: !0, message: "请输入密码" }], children: /* @__PURE__ */ e.jsx(le.Password, { prefix: /* @__PURE__ */ e.jsx(Ee, {}), placeholder: "密码" }) }),
|
|
2121
2128
|
/* @__PURE__ */ e.jsx(Z.Item, { style: { marginBottom: 8 }, children: /* @__PURE__ */ e.jsx(
|
|
2122
|
-
|
|
2129
|
+
Ge,
|
|
2123
2130
|
{
|
|
2124
2131
|
type: "primary",
|
|
2125
2132
|
htmlType: "submit",
|
|
2126
|
-
loading:
|
|
2133
|
+
loading: t,
|
|
2127
2134
|
block: !0,
|
|
2128
2135
|
style: { background: "linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%)", border: "none" },
|
|
2129
2136
|
children: "登 录"
|
|
@@ -2138,39 +2145,45 @@ function pt() {
|
|
|
2138
2145
|
] })
|
|
2139
2146
|
] }) });
|
|
2140
2147
|
}
|
|
2141
|
-
const
|
|
2142
|
-
{ key: "/z-graph/home", label: "首页", icon: /* @__PURE__ */ e.jsx(
|
|
2143
|
-
{ key: "/z-graph/dashboard", label: "总览", icon: /* @__PURE__ */ e.jsx(
|
|
2144
|
-
{ key: "/z-graph/graph", label: "图视图", icon: /* @__PURE__ */ e.jsx(
|
|
2145
|
-
{ key: "/z-graph/branches", label: "分支", icon: /* @__PURE__ */ e.jsx(
|
|
2146
|
-
{ key: "/z-graph/commits", label: "提交历史", icon: /* @__PURE__ */ e.jsx(
|
|
2147
|
-
{ key: "/z-graph/query", label: "Cypher 查询", icon: /* @__PURE__ */ e.jsx(
|
|
2148
|
-
{ key: "/z-graph/schema", label: "Schema", icon: /* @__PURE__ */ e.jsx(
|
|
2149
|
-
{ key: "/z-graph/logs", label: "请求日志", icon: /* @__PURE__ */ e.jsx(
|
|
2150
|
-
{ key: "/z-graph/api-docs", label: "API 文档", icon: /* @__PURE__ */ e.jsx(
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
{ path: "/z-graph/
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
{ path: "/z-graph/
|
|
2157
|
-
{ path: "/z-graph/
|
|
2158
|
-
{ path: "/z-graph/
|
|
2159
|
-
{ path: "/z-graph/
|
|
2160
|
-
{ path: "/z-graph/
|
|
2161
|
-
{ path: "/z-graph/
|
|
2148
|
+
const ft = { title: "z-graph 图存储控制台", short: "z-graph" }, dt = [
|
|
2149
|
+
{ key: "/z-graph/home", label: "首页", icon: /* @__PURE__ */ e.jsx(Ce, {}) },
|
|
2150
|
+
{ key: "/z-graph/dashboard", label: "总览", icon: /* @__PURE__ */ e.jsx(Ae, {}) },
|
|
2151
|
+
{ key: "/z-graph/graph", label: "图视图", icon: /* @__PURE__ */ e.jsx(we, {}) },
|
|
2152
|
+
{ key: "/z-graph/branches", label: "分支", icon: /* @__PURE__ */ e.jsx(ke, {}) },
|
|
2153
|
+
{ key: "/z-graph/commits", label: "提交历史", icon: /* @__PURE__ */ e.jsx(Ie, {}) },
|
|
2154
|
+
{ key: "/z-graph/query", label: "Cypher 查询", icon: /* @__PURE__ */ e.jsx(Re, {}) },
|
|
2155
|
+
{ key: "/z-graph/schema", label: "Schema", icon: /* @__PURE__ */ e.jsx(Le, {}) },
|
|
2156
|
+
{ key: "/z-graph/logs", label: "请求日志", icon: /* @__PURE__ */ e.jsx(Oe, {}) },
|
|
2157
|
+
{ key: "/z-graph/api-docs", label: "API 文档", icon: /* @__PURE__ */ e.jsx(De, {}) },
|
|
2158
|
+
{ key: "/z-graph/docs", label: "组件文档", icon: /* @__PURE__ */ e.jsx(Me, {}) }
|
|
2159
|
+
], jt = [
|
|
2160
|
+
{ path: "/z-graph/home", Component: ct },
|
|
2161
|
+
// 旧版 console 页面(吃 src/console/styles.css)⇒ 必须走 withGraphConsole,
|
|
2162
|
+
// 否则那份样式表里的裸元素选择器会泄漏到主壳(详见 console/serverHook.jsx 注释)。
|
|
2163
|
+
{ path: "/z-graph/dashboard", Component: F(Ue) },
|
|
2164
|
+
{ path: "/z-graph/graph", Component: F(Be) },
|
|
2165
|
+
{ path: "/z-graph/branches", Component: F(_e) },
|
|
2166
|
+
{ path: "/z-graph/commits", Component: F(Ke) },
|
|
2167
|
+
{ path: "/z-graph/query", Component: F(Qe) },
|
|
2168
|
+
{ path: "/z-graph/schema", Component: F(tt) },
|
|
2169
|
+
{ path: "/z-graph/logs", Component: F(at) },
|
|
2170
|
+
{ path: "/z-graph/api-docs", Component: F(ot) },
|
|
2171
|
+
// 新版页面(antd 实现)不吃 console 样式表 ⇒ 不加作用域
|
|
2172
|
+
{ path: "/z-graph/instance", Component: je(ve) },
|
|
2173
|
+
{ path: "/z-graph/docs", Component: Ne },
|
|
2162
2174
|
// catchall 放最后 —— 否则 `:rest*` 会先于具体路由匹配,导致 /z-graph/query
|
|
2163
2175
|
// 全部跳进 GraphApp 的内层 /schema 路由(URL 变成 /z-graph/query/schema)。
|
|
2164
|
-
{ path: "/z-graph/:rest*", Component:
|
|
2176
|
+
{ path: "/z-graph/:rest*", Component: Se }
|
|
2165
2177
|
];
|
|
2166
2178
|
export {
|
|
2167
|
-
|
|
2168
|
-
|
|
2179
|
+
Ne as ComponentDocPage,
|
|
2180
|
+
ct as HomePage,
|
|
2181
|
+
yt as LoginPage,
|
|
2169
2182
|
W as api,
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2183
|
+
ft as appMeta,
|
|
2184
|
+
St as configureGraph,
|
|
2185
|
+
dt as menuItems,
|
|
2186
|
+
jt as routes,
|
|
2187
|
+
$e as useGraphServer,
|
|
2188
|
+
je as withGraphServer
|
|
2176
2189
|
};
|