@yuku123/z-graph-component 0.0.0-stage → 0.1.0
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/GraphApp-C6N6khIq.js +1514 -0
- package/dist/index.js +11 -0
- package/dist/pages.js +2176 -0
- package/dist/z-graph-component.css +1 -0
- package/package.json +44 -4
- package/README.md +0 -3
|
@@ -0,0 +1,1514 @@
|
|
|
1
|
+
import Le, { useState as p, useCallback as ne, useEffect as ke, useMemo as te, useRef as De } from "react";
|
|
2
|
+
import { useNavigate as $e, useSearchParams as Ge, Routes as He, Route as le, Navigate as Ue } from "react-router-dom";
|
|
3
|
+
import { Breadcrumb as We, Button as B, Alert as L, Card as v, Descriptions as Te, Space as k, Select as Me, Row as pe, Col as W, Table as J, Empty as _e, Modal as Be, Tag as y, Input as Se, Statistic as xe, Tooltip as ye } from "antd";
|
|
4
|
+
import { InboxOutlined as Fe, ReloadOutlined as ve, TableOutlined as qe, NodeIndexOutlined as Je, ProfileOutlined as Ye, PlayCircleOutlined as Ve, ThunderboltOutlined as Xe, BranchesOutlined as Ie, HistoryOutlined as Ke } from "@ant-design/icons";
|
|
5
|
+
import N from "@yuku123/z-frontend-common";
|
|
6
|
+
const Ze = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1 };
|
|
7
|
+
let we = typeof window < "u" && window.__Z_GRAPH_API__ || Ze && void 0 || "/api";
|
|
8
|
+
function Qe(t, n) {
|
|
9
|
+
return !t || t === "/api" ? "/api" + n : t.replace(/\/$/, "") + n;
|
|
10
|
+
}
|
|
11
|
+
async function me(t, n = {}) {
|
|
12
|
+
const s = Qe(we, t), l = await fetch(s, {
|
|
13
|
+
headers: { Accept: "application/json", ...n.headers || {} },
|
|
14
|
+
...n
|
|
15
|
+
});
|
|
16
|
+
if (!l.ok) {
|
|
17
|
+
let d = "";
|
|
18
|
+
try {
|
|
19
|
+
d = await l.text();
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
throw new Error(`HTTP ${l.status} ${l.statusText}: ${d || s}`);
|
|
23
|
+
}
|
|
24
|
+
const i = await l.text(), h = l.headers.get("X-Response-Time");
|
|
25
|
+
if (!i) return { data: null, elapsed: h };
|
|
26
|
+
try {
|
|
27
|
+
return { data: JSON.parse(i), elapsed: h };
|
|
28
|
+
} catch {
|
|
29
|
+
return { data: i, elapsed: h };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async function V(t, n = {}) {
|
|
33
|
+
return (await me(t, n)).data;
|
|
34
|
+
}
|
|
35
|
+
const et = {
|
|
36
|
+
baseUrl: () => we,
|
|
37
|
+
setBaseUrl: (t) => {
|
|
38
|
+
we = t, typeof window < "u" && (window.__Z_GRAPH_API__ = t);
|
|
39
|
+
},
|
|
40
|
+
// 健康检查
|
|
41
|
+
health: () => V("/health"),
|
|
42
|
+
// 元数据
|
|
43
|
+
branches: () => V("/meta/branches"),
|
|
44
|
+
commits: () => V("/meta/commits"),
|
|
45
|
+
schema: (t = "main") => V("/meta/schema?branch=" + encodeURIComponent(t)),
|
|
46
|
+
stats: (t = "main") => V("/meta/stats?branch=" + encodeURIComponent(t)),
|
|
47
|
+
metrics: () => V("/meta/metrics"),
|
|
48
|
+
// 请求日志
|
|
49
|
+
logs: (t = {}) => {
|
|
50
|
+
const n = new URLSearchParams();
|
|
51
|
+
return t.limit && n.set("limit", t.limit), t.offset && n.set("offset", t.offset), t.method && n.set("method", t.method), t.status && n.set("status", t.status), t.path && n.set("path", t.path), V("/meta/logs" + (n.toString() ? "?" + n.toString() : ""));
|
|
52
|
+
},
|
|
53
|
+
// 导出 / 导入
|
|
54
|
+
exportData: (t = "main") => me("/meta/export?branch=" + encodeURIComponent(t)),
|
|
55
|
+
// 批量查询
|
|
56
|
+
batch: async (t) => me("/query/batch", {
|
|
57
|
+
method: "POST",
|
|
58
|
+
headers: { "Content-Type": "application/json" },
|
|
59
|
+
body: JSON.stringify({ statements: t })
|
|
60
|
+
}),
|
|
61
|
+
// 查询 — 直接返回数据数组(后端 /query 响应本身就是数组)
|
|
62
|
+
// 注意:后端会把 commit 字段当成字符串处理,"null" 字符串无法区分真正的 null,
|
|
63
|
+
// 所以 commit 为空时直接不发送该字段,避免触发"Unknown commit: null" 错误。
|
|
64
|
+
query: (t, n = "main", s = null) => me("/query", {
|
|
65
|
+
method: "POST",
|
|
66
|
+
headers: { "Content-Type": "application/json" },
|
|
67
|
+
body: JSON.stringify(s ? { cypher: t, branch: n, commit: s } : { cypher: t, branch: n })
|
|
68
|
+
}).then((i) => i.data)
|
|
69
|
+
};
|
|
70
|
+
function kt(t) {
|
|
71
|
+
if (!t) return "";
|
|
72
|
+
try {
|
|
73
|
+
return new Date(Number(t)).toLocaleString();
|
|
74
|
+
} catch {
|
|
75
|
+
return String(t);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function vt(t, n = 8) {
|
|
79
|
+
return t ? t.length > n ? t.substring(0, n) : t : "";
|
|
80
|
+
}
|
|
81
|
+
const $ = {
|
|
82
|
+
instance: () => N.get("/__instance").then((t) => t.data),
|
|
83
|
+
health: () => N.get("/health").then((t) => t.data),
|
|
84
|
+
branches: () => N.get("/meta/branches").then((t) => t.data),
|
|
85
|
+
commits: () => N.get("/meta/commits").then((t) => t.data),
|
|
86
|
+
schema: (t) => N.get("/meta/schema", { params: t ? { branch: t } : {} }).then((n) => n.data),
|
|
87
|
+
stats: (t) => N.get("/meta/stats", { params: t ? { branch: t } : {} }).then((n) => n.data),
|
|
88
|
+
metrics: () => N.get("/meta/metrics").then((t) => t.data),
|
|
89
|
+
logs: (t) => N.get("/meta/logs", { params: t }).then((n) => n.data),
|
|
90
|
+
/**
|
|
91
|
+
* 查询走 GET 而不是 POST:`handleQuery` 的 POST 分支用的是手搓的
|
|
92
|
+
* `parseJsonStringMap`(按引号外逗号切 token、再按第一个冒号切 kv),
|
|
93
|
+
* 而 GET 分支用的是 `URLDecoder.decode` —— 对含 `:`、`,`、`{}` 的 Cypher
|
|
94
|
+
* 只有前者会被解析器啃掉。所以这里统一走 GET。
|
|
95
|
+
*/
|
|
96
|
+
query: (t, n, s) => N.get("/query", { params: s ? { cypher: t, branch: n, commit: s } : { cypher: t, branch: n } }).then((l) => l.data),
|
|
97
|
+
explain: (t, n) => N.post("/query/explain", { cypher: t, branch: n }).then((s) => s.data)
|
|
98
|
+
};
|
|
99
|
+
function Ct(t = "/api") {
|
|
100
|
+
N.defaults.baseURL = t, et.setBaseUrl(t);
|
|
101
|
+
}
|
|
102
|
+
const tt = /^\s*(CREATE|MERGE|DELETE|DROP|ALTER|SET|REMOVE|REPLACE)\b/i;
|
|
103
|
+
function rt(t) {
|
|
104
|
+
if (!t) return !1;
|
|
105
|
+
const n = t.toUpperCase();
|
|
106
|
+
return !!(tt.test(t) || n.startsWith("MATCH") && (n.includes(" SET ") || n.includes(" DELETE ") || n.includes("DETACH DELETE")));
|
|
107
|
+
}
|
|
108
|
+
function se(t) {
|
|
109
|
+
var s;
|
|
110
|
+
const n = (s = t == null ? void 0 : t.response) == null ? void 0 : s.data;
|
|
111
|
+
if (n && typeof n == "object") {
|
|
112
|
+
const l = n.message || n.error, i = n.source ? ` (${n.source})` : "";
|
|
113
|
+
if (l) return `${l}${i}${n.hint ? ` — ${n.hint}` : ""}`;
|
|
114
|
+
}
|
|
115
|
+
return typeof n == "string" && n.trim() ? n.slice(0, 300) : (t == null ? void 0 : t.message) || String(t);
|
|
116
|
+
}
|
|
117
|
+
function Re(t) {
|
|
118
|
+
var n, s, l;
|
|
119
|
+
return ((n = t == null ? void 0 : t.response) == null ? void 0 : n.status) === 503 || /not bound in this JVM/.test(String(((l = (s = t == null ? void 0 : t.response) == null ? void 0 : s.data) == null ? void 0 : l.message) || ""));
|
|
120
|
+
}
|
|
121
|
+
const re = "main";
|
|
122
|
+
var he = { exports: {} }, ie = {};
|
|
123
|
+
/**
|
|
124
|
+
* @license React
|
|
125
|
+
* react-jsx-runtime.production.js
|
|
126
|
+
*
|
|
127
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
128
|
+
*
|
|
129
|
+
* This source code is licensed under the MIT license found in the
|
|
130
|
+
* LICENSE file in the root directory of this source tree.
|
|
131
|
+
*/
|
|
132
|
+
var Ae;
|
|
133
|
+
function nt() {
|
|
134
|
+
if (Ae) return ie;
|
|
135
|
+
Ae = 1;
|
|
136
|
+
var t = Symbol.for("react.transitional.element"), n = Symbol.for("react.fragment");
|
|
137
|
+
function s(l, i, h) {
|
|
138
|
+
var d = null;
|
|
139
|
+
if (h !== void 0 && (d = "" + h), i.key !== void 0 && (d = "" + i.key), "key" in i) {
|
|
140
|
+
h = {};
|
|
141
|
+
for (var c in i)
|
|
142
|
+
c !== "key" && (h[c] = i[c]);
|
|
143
|
+
} else h = i;
|
|
144
|
+
return i = h.ref, {
|
|
145
|
+
$$typeof: t,
|
|
146
|
+
type: l,
|
|
147
|
+
key: d,
|
|
148
|
+
ref: i !== void 0 ? i : null,
|
|
149
|
+
props: h
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
return ie.Fragment = n, ie.jsx = s, ie.jsxs = s, ie;
|
|
153
|
+
}
|
|
154
|
+
var oe = {};
|
|
155
|
+
/**
|
|
156
|
+
* @license React
|
|
157
|
+
* react-jsx-runtime.development.js
|
|
158
|
+
*
|
|
159
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
160
|
+
*
|
|
161
|
+
* This source code is licensed under the MIT license found in the
|
|
162
|
+
* LICENSE file in the root directory of this source tree.
|
|
163
|
+
*/
|
|
164
|
+
var Oe;
|
|
165
|
+
function st() {
|
|
166
|
+
return Oe || (Oe = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
167
|
+
function t(r) {
|
|
168
|
+
if (r == null) return null;
|
|
169
|
+
if (typeof r == "function")
|
|
170
|
+
return r.$$typeof === Q ? null : r.displayName || r.name || null;
|
|
171
|
+
if (typeof r == "string") return r;
|
|
172
|
+
switch (r) {
|
|
173
|
+
case o:
|
|
174
|
+
return "Fragment";
|
|
175
|
+
case M:
|
|
176
|
+
return "Profiler";
|
|
177
|
+
case R:
|
|
178
|
+
return "StrictMode";
|
|
179
|
+
case P:
|
|
180
|
+
return "Suspense";
|
|
181
|
+
case K:
|
|
182
|
+
return "SuspenseList";
|
|
183
|
+
case w:
|
|
184
|
+
return "Activity";
|
|
185
|
+
case O:
|
|
186
|
+
return "ViewTransition";
|
|
187
|
+
}
|
|
188
|
+
if (typeof r == "object")
|
|
189
|
+
switch (typeof r.tag == "number" && console.error(
|
|
190
|
+
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
191
|
+
), r.$$typeof) {
|
|
192
|
+
case a:
|
|
193
|
+
return "Portal";
|
|
194
|
+
case A:
|
|
195
|
+
return r.displayName || "Context";
|
|
196
|
+
case D:
|
|
197
|
+
return (r._context.displayName || "Context") + ".Consumer";
|
|
198
|
+
case Y:
|
|
199
|
+
var u = r.render;
|
|
200
|
+
return r = r.displayName, r || (r = u.displayName || u.name || "", r = r !== "" ? "ForwardRef(" + r + ")" : "ForwardRef"), r;
|
|
201
|
+
case Z:
|
|
202
|
+
return u = r.displayName || null, u !== null ? u : t(r.type) || "Memo";
|
|
203
|
+
case f:
|
|
204
|
+
u = r._payload, r = r._init;
|
|
205
|
+
try {
|
|
206
|
+
return t(r(u));
|
|
207
|
+
} catch {
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
function n(r) {
|
|
213
|
+
return "" + r;
|
|
214
|
+
}
|
|
215
|
+
function s(r) {
|
|
216
|
+
try {
|
|
217
|
+
n(r);
|
|
218
|
+
var u = !1;
|
|
219
|
+
} catch {
|
|
220
|
+
u = !0;
|
|
221
|
+
}
|
|
222
|
+
if (u) {
|
|
223
|
+
u = console;
|
|
224
|
+
var b = u.error, T = typeof Symbol == "function" && Symbol.toStringTag && r[Symbol.toStringTag] || r.constructor.name || "Object";
|
|
225
|
+
return b.call(
|
|
226
|
+
u,
|
|
227
|
+
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
228
|
+
T
|
|
229
|
+
), n(r);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
function l(r) {
|
|
233
|
+
if (r === o) return "<>";
|
|
234
|
+
if (typeof r == "object" && r !== null && r.$$typeof === f)
|
|
235
|
+
return "<...>";
|
|
236
|
+
try {
|
|
237
|
+
var u = t(r);
|
|
238
|
+
return u ? "<" + u + ">" : "<...>";
|
|
239
|
+
} catch {
|
|
240
|
+
return "<...>";
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
function i() {
|
|
244
|
+
var r = z.A;
|
|
245
|
+
return r === null ? null : r.getOwner();
|
|
246
|
+
}
|
|
247
|
+
function h() {
|
|
248
|
+
return Error("react-stack-top-frame");
|
|
249
|
+
}
|
|
250
|
+
function d(r) {
|
|
251
|
+
if (ae.call(r, "key")) {
|
|
252
|
+
var u = Object.getOwnPropertyDescriptor(r, "key").get;
|
|
253
|
+
if (u && u.isReactWarning) return !1;
|
|
254
|
+
}
|
|
255
|
+
return r.key !== void 0;
|
|
256
|
+
}
|
|
257
|
+
function c(r, u) {
|
|
258
|
+
function b() {
|
|
259
|
+
G || (G = !0, console.error(
|
|
260
|
+
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
261
|
+
u
|
|
262
|
+
));
|
|
263
|
+
}
|
|
264
|
+
b.isReactWarning = !0, Object.defineProperty(r, "key", {
|
|
265
|
+
get: b,
|
|
266
|
+
configurable: !0
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
function g() {
|
|
270
|
+
var r = t(this.type);
|
|
271
|
+
return H[r] || (H[r] = !0, console.error(
|
|
272
|
+
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
273
|
+
)), r = this.props.ref, r !== void 0 ? r : null;
|
|
274
|
+
}
|
|
275
|
+
function x(r, u, b, T, q, U) {
|
|
276
|
+
var S = b.ref;
|
|
277
|
+
return r = {
|
|
278
|
+
$$typeof: I,
|
|
279
|
+
type: r,
|
|
280
|
+
key: u,
|
|
281
|
+
props: b,
|
|
282
|
+
_owner: T
|
|
283
|
+
}, (S !== void 0 ? S : null) !== null ? Object.defineProperty(r, "ref", {
|
|
284
|
+
enumerable: !1,
|
|
285
|
+
get: g
|
|
286
|
+
}) : Object.defineProperty(r, "ref", { enumerable: !1, value: null }), r._store = {}, Object.defineProperty(r._store, "validated", {
|
|
287
|
+
configurable: !1,
|
|
288
|
+
enumerable: !1,
|
|
289
|
+
writable: !0,
|
|
290
|
+
value: 0
|
|
291
|
+
}), Object.defineProperty(r, "_debugInfo", {
|
|
292
|
+
configurable: !1,
|
|
293
|
+
enumerable: !1,
|
|
294
|
+
writable: !0,
|
|
295
|
+
value: null
|
|
296
|
+
}), Object.defineProperty(r, "_debugStack", {
|
|
297
|
+
configurable: !1,
|
|
298
|
+
enumerable: !1,
|
|
299
|
+
writable: !0,
|
|
300
|
+
value: q
|
|
301
|
+
}), Object.defineProperty(r, "_debugTask", {
|
|
302
|
+
configurable: !1,
|
|
303
|
+
enumerable: !1,
|
|
304
|
+
writable: !0,
|
|
305
|
+
value: U
|
|
306
|
+
}), Object.freeze && (Object.freeze(r.props), Object.freeze(r)), r;
|
|
307
|
+
}
|
|
308
|
+
function E(r, u, b, T, q, U) {
|
|
309
|
+
var S = u.children;
|
|
310
|
+
if (S !== void 0)
|
|
311
|
+
if (T)
|
|
312
|
+
if (de(S)) {
|
|
313
|
+
for (T = 0; T < S.length; T++)
|
|
314
|
+
C(S[T]);
|
|
315
|
+
Object.freeze && Object.freeze(S);
|
|
316
|
+
} else
|
|
317
|
+
console.error(
|
|
318
|
+
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
319
|
+
);
|
|
320
|
+
else C(S);
|
|
321
|
+
if (ae.call(u, "key")) {
|
|
322
|
+
S = t(r);
|
|
323
|
+
var ee = Object.keys(u).filter(function(ze) {
|
|
324
|
+
return ze !== "key";
|
|
325
|
+
});
|
|
326
|
+
T = 0 < ee.length ? "{key: someKey, " + ee.join(": ..., ") + ": ...}" : "{key: someKey}", Ce[S + T] || (ee = 0 < ee.length ? "{" + ee.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
327
|
+
`A props object containing a "key" prop is being spread into JSX:
|
|
328
|
+
let props = %s;
|
|
329
|
+
<%s {...props} />
|
|
330
|
+
React keys must be passed directly to JSX without using spread:
|
|
331
|
+
let props = %s;
|
|
332
|
+
<%s key={someKey} {...props} />`,
|
|
333
|
+
T,
|
|
334
|
+
S,
|
|
335
|
+
ee,
|
|
336
|
+
S
|
|
337
|
+
), Ce[S + T] = !0);
|
|
338
|
+
}
|
|
339
|
+
if (S = null, b !== void 0 && (s(b), S = "" + b), d(u) && (s(u.key), S = "" + u.key), "key" in u) {
|
|
340
|
+
b = {};
|
|
341
|
+
for (var fe in u)
|
|
342
|
+
fe !== "key" && (b[fe] = u[fe]);
|
|
343
|
+
} else b = u;
|
|
344
|
+
return S && c(
|
|
345
|
+
b,
|
|
346
|
+
typeof r == "function" ? r.displayName || r.name || "Unknown" : r
|
|
347
|
+
), x(
|
|
348
|
+
r,
|
|
349
|
+
S,
|
|
350
|
+
b,
|
|
351
|
+
i(),
|
|
352
|
+
q,
|
|
353
|
+
U
|
|
354
|
+
);
|
|
355
|
+
}
|
|
356
|
+
function C(r) {
|
|
357
|
+
j(r) ? r._store && (r._store.validated = 1) : typeof r == "object" && r !== null && r.$$typeof === f && (r._payload.status === "fulfilled" ? j(r._payload.value) && r._payload.value._store && (r._payload.value._store.validated = 1) : r._store && (r._store.validated = 1));
|
|
358
|
+
}
|
|
359
|
+
function j(r) {
|
|
360
|
+
return typeof r == "object" && r !== null && r.$$typeof === I;
|
|
361
|
+
}
|
|
362
|
+
var _ = Le, I = Symbol.for("react.transitional.element"), a = Symbol.for("react.portal"), o = Symbol.for("react.fragment"), R = Symbol.for("react.strict_mode"), M = Symbol.for("react.profiler"), D = Symbol.for("react.consumer"), A = Symbol.for("react.context"), Y = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), K = Symbol.for("react.suspense_list"), Z = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), w = Symbol.for("react.activity"), O = Symbol.for("react.view_transition"), Q = Symbol.for("react.client.reference"), z = _.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ae = Object.prototype.hasOwnProperty, de = Array.isArray, m = console.createTask ? console.createTask : function() {
|
|
363
|
+
return null;
|
|
364
|
+
};
|
|
365
|
+
_ = {
|
|
366
|
+
react_stack_bottom_frame: function(r) {
|
|
367
|
+
return r();
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
var G, H = {}, F = _.react_stack_bottom_frame.bind(
|
|
371
|
+
_,
|
|
372
|
+
h
|
|
373
|
+
)(), ue = m(l(h)), Ce = {};
|
|
374
|
+
oe.Fragment = o, oe.jsx = function(r, u, b) {
|
|
375
|
+
var T = 1e4 > z.recentlyCreatedOwnerStacks++;
|
|
376
|
+
if (T) {
|
|
377
|
+
var q = Error.stackTraceLimit;
|
|
378
|
+
Error.stackTraceLimit = 10;
|
|
379
|
+
var U = Error("react-stack-top-frame");
|
|
380
|
+
Error.stackTraceLimit = q;
|
|
381
|
+
} else U = F;
|
|
382
|
+
return E(
|
|
383
|
+
r,
|
|
384
|
+
u,
|
|
385
|
+
b,
|
|
386
|
+
!1,
|
|
387
|
+
U,
|
|
388
|
+
T ? m(l(r)) : ue
|
|
389
|
+
);
|
|
390
|
+
}, oe.jsxs = function(r, u, b) {
|
|
391
|
+
var T = 1e4 > z.recentlyCreatedOwnerStacks++;
|
|
392
|
+
if (T) {
|
|
393
|
+
var q = Error.stackTraceLimit;
|
|
394
|
+
Error.stackTraceLimit = 10;
|
|
395
|
+
var U = Error("react-stack-top-frame");
|
|
396
|
+
Error.stackTraceLimit = q;
|
|
397
|
+
} else U = F;
|
|
398
|
+
return E(
|
|
399
|
+
r,
|
|
400
|
+
u,
|
|
401
|
+
b,
|
|
402
|
+
!0,
|
|
403
|
+
U,
|
|
404
|
+
T ? m(l(r)) : ue
|
|
405
|
+
);
|
|
406
|
+
};
|
|
407
|
+
})()), oe;
|
|
408
|
+
}
|
|
409
|
+
var Pe;
|
|
410
|
+
function at() {
|
|
411
|
+
return Pe || (Pe = 1, process.env.NODE_ENV === "production" ? he.exports = nt() : he.exports = st()), he.exports;
|
|
412
|
+
}
|
|
413
|
+
var e = at();
|
|
414
|
+
const ge = {
|
|
415
|
+
// 卡片表面
|
|
416
|
+
surfaceAlt: "#fafbfc",
|
|
417
|
+
text: "#111827",
|
|
418
|
+
// 主文本
|
|
419
|
+
textMuted: "#6b7280"
|
|
420
|
+
}, lt = {
|
|
421
|
+
md: 12
|
|
422
|
+
};
|
|
423
|
+
function X({
|
|
424
|
+
icon: t,
|
|
425
|
+
title: n = "暂无数据",
|
|
426
|
+
description: s,
|
|
427
|
+
actionText: l,
|
|
428
|
+
onAction: i,
|
|
429
|
+
size: h = "md",
|
|
430
|
+
style: d
|
|
431
|
+
}) {
|
|
432
|
+
const c = { sm: 24, md: 40, lg: 64 }, g = { sm: 14, md: 16, lg: 20 };
|
|
433
|
+
return /* @__PURE__ */ e.jsxs(
|
|
434
|
+
"div",
|
|
435
|
+
{
|
|
436
|
+
role: "status",
|
|
437
|
+
"aria-live": "polite",
|
|
438
|
+
style: {
|
|
439
|
+
padding: c[h] || c.md,
|
|
440
|
+
textAlign: "center",
|
|
441
|
+
background: "#ffffff",
|
|
442
|
+
borderRadius: lt.md,
|
|
443
|
+
border: "1px dashed #e5e7eb",
|
|
444
|
+
...d
|
|
445
|
+
},
|
|
446
|
+
children: [
|
|
447
|
+
/* @__PURE__ */ e.jsx("div", { style: {
|
|
448
|
+
display: "inline-flex",
|
|
449
|
+
alignItems: "center",
|
|
450
|
+
justifyContent: "center",
|
|
451
|
+
width: 56,
|
|
452
|
+
height: 56,
|
|
453
|
+
borderRadius: "50%",
|
|
454
|
+
background: ge.surfaceAlt,
|
|
455
|
+
marginBottom: 16,
|
|
456
|
+
fontSize: 28,
|
|
457
|
+
color: "#9ca3af"
|
|
458
|
+
}, children: t || /* @__PURE__ */ e.jsx(Fe, {}) }),
|
|
459
|
+
/* @__PURE__ */ e.jsx("div", { style: {
|
|
460
|
+
fontSize: g[h],
|
|
461
|
+
fontWeight: 600,
|
|
462
|
+
color: ge.text,
|
|
463
|
+
marginBottom: s ? 6 : 16
|
|
464
|
+
}, children: n }),
|
|
465
|
+
s && /* @__PURE__ */ e.jsx("div", { style: {
|
|
466
|
+
fontSize: 13,
|
|
467
|
+
color: ge.textMuted,
|
|
468
|
+
lineHeight: 1.6,
|
|
469
|
+
maxWidth: 360,
|
|
470
|
+
margin: "0 auto 16px"
|
|
471
|
+
}, children: s }),
|
|
472
|
+
l && i && /* @__PURE__ */ e.jsx(
|
|
473
|
+
B,
|
|
474
|
+
{
|
|
475
|
+
type: "primary",
|
|
476
|
+
onClick: i,
|
|
477
|
+
style: {
|
|
478
|
+
background: "linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%)",
|
|
479
|
+
border: "none",
|
|
480
|
+
minHeight: 36
|
|
481
|
+
},
|
|
482
|
+
children: l
|
|
483
|
+
}
|
|
484
|
+
)
|
|
485
|
+
]
|
|
486
|
+
}
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
function ce({
|
|
490
|
+
title: t,
|
|
491
|
+
subtitle: n,
|
|
492
|
+
breadcrumb: s,
|
|
493
|
+
extra: l,
|
|
494
|
+
back: i,
|
|
495
|
+
onBack: h
|
|
496
|
+
}) {
|
|
497
|
+
const d = $e();
|
|
498
|
+
return /* @__PURE__ */ e.jsx("div", { style: {
|
|
499
|
+
marginBottom: 12,
|
|
500
|
+
paddingBottom: 10,
|
|
501
|
+
borderBottom: "1px solid #f1f5f9"
|
|
502
|
+
}, children: /* @__PURE__ */ e.jsxs("div", { style: {
|
|
503
|
+
display: "flex",
|
|
504
|
+
alignItems: "center",
|
|
505
|
+
justifyContent: "space-between",
|
|
506
|
+
gap: 12,
|
|
507
|
+
flexWrap: "wrap"
|
|
508
|
+
}, children: [
|
|
509
|
+
/* @__PURE__ */ e.jsxs("div", { style: {
|
|
510
|
+
display: "flex",
|
|
511
|
+
alignItems: "center",
|
|
512
|
+
gap: 10,
|
|
513
|
+
minWidth: 0,
|
|
514
|
+
flexWrap: "wrap"
|
|
515
|
+
}, children: [
|
|
516
|
+
i && /* @__PURE__ */ e.jsx(
|
|
517
|
+
"button",
|
|
518
|
+
{
|
|
519
|
+
onClick: () => {
|
|
520
|
+
h ? h() : d(-1);
|
|
521
|
+
},
|
|
522
|
+
"aria-label": "返回上一页",
|
|
523
|
+
style: {
|
|
524
|
+
width: 28,
|
|
525
|
+
height: 28,
|
|
526
|
+
borderRadius: 6,
|
|
527
|
+
border: "1px solid #e5e7eb",
|
|
528
|
+
background: "#ffffff",
|
|
529
|
+
color: "#6b7280",
|
|
530
|
+
cursor: "pointer",
|
|
531
|
+
display: "inline-flex",
|
|
532
|
+
alignItems: "center",
|
|
533
|
+
justifyContent: "center",
|
|
534
|
+
fontSize: 13,
|
|
535
|
+
transition: "all 150ms ease",
|
|
536
|
+
flexShrink: 0
|
|
537
|
+
},
|
|
538
|
+
onMouseEnter: (c) => {
|
|
539
|
+
c.currentTarget.style.background = "#f8fafc", c.currentTarget.style.color = "#111827", c.currentTarget.style.borderColor = "#7c3aed";
|
|
540
|
+
},
|
|
541
|
+
onMouseLeave: (c) => {
|
|
542
|
+
c.currentTarget.style.background = "#ffffff", c.currentTarget.style.color = "#6b7280", c.currentTarget.style.borderColor = "#e5e7eb";
|
|
543
|
+
},
|
|
544
|
+
children: "←"
|
|
545
|
+
}
|
|
546
|
+
),
|
|
547
|
+
s && s.length > 0 ? /* @__PURE__ */ e.jsx(
|
|
548
|
+
We,
|
|
549
|
+
{
|
|
550
|
+
items: s.map((c, g) => {
|
|
551
|
+
const x = g === s.length - 1;
|
|
552
|
+
return {
|
|
553
|
+
title: c.href && !x ? /* @__PURE__ */ e.jsx("a", { onClick: (E) => {
|
|
554
|
+
E.preventDefault(), d(c.href);
|
|
555
|
+
}, children: c.label }) : /* @__PURE__ */ e.jsx("span", { style: x ? {
|
|
556
|
+
fontWeight: 600,
|
|
557
|
+
color: "#111827"
|
|
558
|
+
} : void 0, children: c.label })
|
|
559
|
+
};
|
|
560
|
+
})
|
|
561
|
+
}
|
|
562
|
+
) : t && /* @__PURE__ */ e.jsx("span", { role: "heading", "aria-level": 1, style: {
|
|
563
|
+
fontSize: 15,
|
|
564
|
+
fontWeight: 600,
|
|
565
|
+
color: "#111827",
|
|
566
|
+
lineHeight: 1.4
|
|
567
|
+
}, children: t }),
|
|
568
|
+
n && /* @__PURE__ */ e.jsx("span", { title: n, style: {
|
|
569
|
+
fontSize: 12,
|
|
570
|
+
color: "#94a3b8",
|
|
571
|
+
lineHeight: 1.4,
|
|
572
|
+
whiteSpace: "nowrap",
|
|
573
|
+
overflow: "hidden",
|
|
574
|
+
textOverflow: "ellipsis",
|
|
575
|
+
maxWidth: 360
|
|
576
|
+
}, children: n })
|
|
577
|
+
] }),
|
|
578
|
+
l && /* @__PURE__ */ e.jsx("div", { style: {
|
|
579
|
+
display: "flex",
|
|
580
|
+
gap: 8,
|
|
581
|
+
flexShrink: 0
|
|
582
|
+
}, children: l })
|
|
583
|
+
] }) });
|
|
584
|
+
}
|
|
585
|
+
const it = [
|
|
586
|
+
{ title: "点类型 (Tag)", dataIndex: "Name", key: "Name", render: (t) => /* @__PURE__ */ e.jsx(y, { color: "blue", children: t }) },
|
|
587
|
+
{
|
|
588
|
+
title: "操作",
|
|
589
|
+
key: "action",
|
|
590
|
+
width: 110,
|
|
591
|
+
render: (t, n) => /* @__PURE__ */ e.jsx(B, { type: "link", size: "small", onClick: () => n.onFields(n.Name), children: "字段" })
|
|
592
|
+
}
|
|
593
|
+
], ot = [
|
|
594
|
+
{ title: "边类型 (EdgeType)", dataIndex: "Name", key: "Name", render: (t) => /* @__PURE__ */ e.jsx(y, { color: "purple", children: t }) },
|
|
595
|
+
{
|
|
596
|
+
title: "操作",
|
|
597
|
+
key: "action",
|
|
598
|
+
width: 110,
|
|
599
|
+
render: (t, n) => /* @__PURE__ */ e.jsx(B, { type: "link", size: "small", onClick: () => n.onFields(n.Name), children: "字段" })
|
|
600
|
+
}
|
|
601
|
+
], ct = [
|
|
602
|
+
{ title: "索引名", dataIndex: "Name", key: "Name", render: (t) => /* @__PURE__ */ e.jsx("code", { children: t }) },
|
|
603
|
+
{
|
|
604
|
+
title: "作用对象类型",
|
|
605
|
+
dataIndex: "Kind",
|
|
606
|
+
key: "Kind",
|
|
607
|
+
width: 130,
|
|
608
|
+
render: (t) => t ? /* @__PURE__ */ e.jsx(y, { color: t === "EDGE" ? "purple" : "blue", children: t }) : "-"
|
|
609
|
+
},
|
|
610
|
+
{ title: "挂在", dataIndex: "On", key: "On", width: 160 },
|
|
611
|
+
{ title: "属性", dataIndex: "Property", key: "Property", width: 160 }
|
|
612
|
+
], dt = [
|
|
613
|
+
{ title: "字段", dataIndex: "Field", key: "Field" },
|
|
614
|
+
{ title: "类型", dataIndex: "Type", key: "Type", width: 140, render: (t) => /* @__PURE__ */ e.jsx(y, { children: t }) },
|
|
615
|
+
{
|
|
616
|
+
title: "可空",
|
|
617
|
+
dataIndex: "Null",
|
|
618
|
+
key: "Null",
|
|
619
|
+
width: 100,
|
|
620
|
+
render: (t) => /* @__PURE__ */ e.jsx(y, { color: t === "NO" ? "warning" : "default", children: t })
|
|
621
|
+
}
|
|
622
|
+
];
|
|
623
|
+
function ut() {
|
|
624
|
+
const [t, n] = p([re]), [s, l] = p(re), [i, h] = p(null), [d, c] = p(null), [g, x] = p(!1), [E, C] = p(null), [j, _] = p(null), [I, a] = p(null), [o, R] = p(!1), M = ne(async (f) => {
|
|
625
|
+
x(!0);
|
|
626
|
+
try {
|
|
627
|
+
const w = f ?? s;
|
|
628
|
+
$.branches().then((z) => {
|
|
629
|
+
Array.isArray(z) && z.length > 0 && n(z);
|
|
630
|
+
}).catch(() => {
|
|
631
|
+
});
|
|
632
|
+
const [O, Q] = await Promise.all([
|
|
633
|
+
$.schema(w),
|
|
634
|
+
$.stats(w).catch(() => null)
|
|
635
|
+
]);
|
|
636
|
+
h(O), c(Q), C(null);
|
|
637
|
+
} catch (w) {
|
|
638
|
+
h(null), c(null), C(w);
|
|
639
|
+
} finally {
|
|
640
|
+
x(!1);
|
|
641
|
+
}
|
|
642
|
+
}, [s]);
|
|
643
|
+
ke(() => {
|
|
644
|
+
M(re);
|
|
645
|
+
}, []);
|
|
646
|
+
const D = ne(async (f, w) => {
|
|
647
|
+
_({ kind: f, name: w, rows: null }), a(null), R(!0);
|
|
648
|
+
try {
|
|
649
|
+
const O = await $.query(`SHOW ${f} ${w}`, s);
|
|
650
|
+
if (!Array.isArray(O))
|
|
651
|
+
throw new Error(`SHOW ${f} 返回的不是行数组:${JSON.stringify(O)}`);
|
|
652
|
+
_({ kind: f, name: w, rows: O });
|
|
653
|
+
} catch (O) {
|
|
654
|
+
a(O);
|
|
655
|
+
} finally {
|
|
656
|
+
R(!1);
|
|
657
|
+
}
|
|
658
|
+
}, [s]), A = te(() => {
|
|
659
|
+
const f = d == null ? void 0 : d.stats;
|
|
660
|
+
return Array.isArray(f) && f.length > 0 ? f[0] : null;
|
|
661
|
+
}, [d]), Y = Re(E), P = ((i == null ? void 0 : i.tags) ?? []).map((f) => ({ ...f, onFields: (w) => D("TAG", w) })), K = ((i == null ? void 0 : i.edges) ?? []).map((f) => ({ ...f, onFields: (w) => D("EDGE", w) })), Z = (i == null ? void 0 : i.indexes) ?? [];
|
|
662
|
+
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
663
|
+
/* @__PURE__ */ e.jsx(
|
|
664
|
+
ce,
|
|
665
|
+
{
|
|
666
|
+
title: "图 Schema",
|
|
667
|
+
subtitle: "z-graph 点类型 / 边类型 / 属性索引(数据源 GET /api/graph/meta/schema,由 GraphProxyController 转发到本 JVM 内嵌的 GraphControlServer)"
|
|
668
|
+
}
|
|
669
|
+
),
|
|
670
|
+
E && /* @__PURE__ */ e.jsx(
|
|
671
|
+
L,
|
|
672
|
+
{
|
|
673
|
+
style: { marginBottom: 16 },
|
|
674
|
+
type: Y ? "error" : "warning",
|
|
675
|
+
showIcon: !0,
|
|
676
|
+
message: `Schema 读取失败:${se(E)}`,
|
|
677
|
+
description: Y ? "503 = 本 JVM 的内嵌 GraphControlServer 没 bind 成功(不是「图里没有 schema」)。先去「实例与端口」页看 boundPort 与 foreignListenerSuspected。" : "上游 GraphControlServer 的 handleSchema 内部会跑 SHOW TAGS/EDGES/INDEXES 三次查询,任一抛错就整体 500,错误原文在上面的 message 里。"
|
|
678
|
+
}
|
|
679
|
+
),
|
|
680
|
+
/* @__PURE__ */ e.jsx(
|
|
681
|
+
v,
|
|
682
|
+
{
|
|
683
|
+
loading: g,
|
|
684
|
+
title: "当前分支概览",
|
|
685
|
+
extra: /* @__PURE__ */ e.jsxs(k, { children: [
|
|
686
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontSize: 12, color: "#64748b" }, children: "分支" }),
|
|
687
|
+
/* @__PURE__ */ e.jsx(
|
|
688
|
+
Me,
|
|
689
|
+
{
|
|
690
|
+
size: "small",
|
|
691
|
+
style: { width: 160 },
|
|
692
|
+
value: s,
|
|
693
|
+
options: t.map((f) => ({ value: f, label: f })),
|
|
694
|
+
onChange: (f) => {
|
|
695
|
+
l(f), M(f);
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
),
|
|
699
|
+
/* @__PURE__ */ e.jsx(B, { icon: /* @__PURE__ */ e.jsx(ve, {}), loading: g, onClick: () => M(), children: "刷新" })
|
|
700
|
+
] }),
|
|
701
|
+
children: /* @__PURE__ */ e.jsx(
|
|
702
|
+
Te,
|
|
703
|
+
{
|
|
704
|
+
bordered: !0,
|
|
705
|
+
size: "small",
|
|
706
|
+
column: 4,
|
|
707
|
+
items: [
|
|
708
|
+
{ key: "branch", label: "分支", children: (i == null ? void 0 : i.branch) ?? "-" },
|
|
709
|
+
{
|
|
710
|
+
key: "head",
|
|
711
|
+
label: "head commit",
|
|
712
|
+
children: i && (d != null && d.head) ? /* @__PURE__ */ e.jsx("a", { title: d.head, children: /* @__PURE__ */ e.jsxs("code", { children: [
|
|
713
|
+
d.head.slice(0, 12),
|
|
714
|
+
"…"
|
|
715
|
+
] }) }) : "-"
|
|
716
|
+
},
|
|
717
|
+
{ key: "nodes", label: "点数", children: (d == null ? void 0 : d.nodeCount) ?? "-" },
|
|
718
|
+
{ key: "edges", label: "边数", children: (d == null ? void 0 : d.edgeCount) ?? "-" },
|
|
719
|
+
{ key: "tags", label: "点类型数", children: i ? P.length : "-" },
|
|
720
|
+
{ key: "edgeTypes", label: "边类型数", children: i ? K.length : "-" },
|
|
721
|
+
{ key: "indexes", label: "索引数", children: i ? Z.length : "-" },
|
|
722
|
+
{
|
|
723
|
+
key: "labelCount",
|
|
724
|
+
label: "引擎自报统计 (/meta/stats)",
|
|
725
|
+
children: A ? /* @__PURE__ */ e.jsx("span", { title: JSON.stringify(A), children: `标签 ${A.labelCount} / 边类型 ${A.edgeTypeCount} / 属性索引 ${A.propertyIndexCount}` }) : "-"
|
|
726
|
+
}
|
|
727
|
+
]
|
|
728
|
+
}
|
|
729
|
+
)
|
|
730
|
+
}
|
|
731
|
+
),
|
|
732
|
+
/* @__PURE__ */ e.jsxs(pe, { gutter: 16, style: { marginTop: 16 }, children: [
|
|
733
|
+
/* @__PURE__ */ e.jsx(W, { span: 12, children: /* @__PURE__ */ e.jsx(v, { title: /* @__PURE__ */ e.jsxs(k, { children: [
|
|
734
|
+
/* @__PURE__ */ e.jsx(qe, {}),
|
|
735
|
+
"点类型 (TAG)"
|
|
736
|
+
] }), loading: g, children: /* @__PURE__ */ e.jsx(
|
|
737
|
+
J,
|
|
738
|
+
{
|
|
739
|
+
size: "small",
|
|
740
|
+
rowKey: "Name",
|
|
741
|
+
dataSource: P,
|
|
742
|
+
columns: it,
|
|
743
|
+
pagination: !1,
|
|
744
|
+
loading: g,
|
|
745
|
+
locale: { emptyText: je(!!i, "没有点类型") }
|
|
746
|
+
}
|
|
747
|
+
) }) }),
|
|
748
|
+
/* @__PURE__ */ e.jsx(W, { span: 12, children: /* @__PURE__ */ e.jsx(v, { title: /* @__PURE__ */ e.jsxs(k, { children: [
|
|
749
|
+
/* @__PURE__ */ e.jsx(Je, {}),
|
|
750
|
+
"边类型 (EDGE TYPE)"
|
|
751
|
+
] }), loading: g, children: /* @__PURE__ */ e.jsx(
|
|
752
|
+
J,
|
|
753
|
+
{
|
|
754
|
+
size: "small",
|
|
755
|
+
rowKey: "Name",
|
|
756
|
+
dataSource: K,
|
|
757
|
+
columns: ot,
|
|
758
|
+
pagination: !1,
|
|
759
|
+
loading: g,
|
|
760
|
+
locale: { emptyText: je(!!i, "没有边类型") }
|
|
761
|
+
}
|
|
762
|
+
) }) })
|
|
763
|
+
] }),
|
|
764
|
+
/* @__PURE__ */ e.jsx(v, { style: { marginTop: 16 }, title: /* @__PURE__ */ e.jsxs(k, { children: [
|
|
765
|
+
/* @__PURE__ */ e.jsx(Ye, {}),
|
|
766
|
+
"属性索引"
|
|
767
|
+
] }), loading: g, children: /* @__PURE__ */ e.jsx(
|
|
768
|
+
J,
|
|
769
|
+
{
|
|
770
|
+
size: "small",
|
|
771
|
+
rowKey: "Name",
|
|
772
|
+
dataSource: Z,
|
|
773
|
+
columns: ct,
|
|
774
|
+
pagination: !1,
|
|
775
|
+
loading: g,
|
|
776
|
+
locale: { emptyText: je(!!i, "没有属性索引") }
|
|
777
|
+
}
|
|
778
|
+
) }),
|
|
779
|
+
/* @__PURE__ */ e.jsx(v, { style: { marginTop: 16 }, title: "这页为什么可以什么都没有", children: /* @__PURE__ */ e.jsx(_e, { description: /* @__PURE__ */ e.jsxs("span", { style: { fontSize: 12, color: "#64748b", lineHeight: 1.9 }, children: [
|
|
780
|
+
"z-graph 的 schema 由 Cypher 的 DDL 建立,",
|
|
781
|
+
/* @__PURE__ */ e.jsx("b", { children: "没有独立的建表接口" }),
|
|
782
|
+
":",
|
|
783
|
+
/* @__PURE__ */ e.jsx("code", { children: " CREATE TAG name (f TYPE, …)" }),
|
|
784
|
+
" ·",
|
|
785
|
+
/* @__PURE__ */ e.jsx("code", { children: " CREATE EDGE TYPE name (f TYPE, …)" }),
|
|
786
|
+
" ·",
|
|
787
|
+
/* @__PURE__ */ e.jsx("code", { children: " CREATE INDEX ON tag(prop)" }),
|
|
788
|
+
"; 删除对应 ",
|
|
789
|
+
/* @__PURE__ */ e.jsx("code", { children: "DROP TAG / DROP EDGE TYPE / DROP INDEX" }),
|
|
790
|
+
"(取值与语法以 CypherEngine 的实现为准)。",
|
|
791
|
+
/* @__PURE__ */ e.jsx("br", {}),
|
|
792
|
+
"这些语句会",
|
|
793
|
+
/* @__PURE__ */ e.jsx("b", { children: "真的改图" }),
|
|
794
|
+
"(每个写语句在 GraphQueryService 上开一个事务并提交一个新 commit), 所以本页不提供执行入口 —— 要建 schema 请去「图查询」页,那里对写语句有二次确认。"
|
|
795
|
+
] }) }) }),
|
|
796
|
+
/* @__PURE__ */ e.jsx(
|
|
797
|
+
Be,
|
|
798
|
+
{
|
|
799
|
+
open: !!j,
|
|
800
|
+
width: 640,
|
|
801
|
+
title: j ? `字段明细 · SHOW ${j.kind} ${j.name}` : "",
|
|
802
|
+
footer: null,
|
|
803
|
+
onCancel: () => _(null),
|
|
804
|
+
children: I ? /* @__PURE__ */ e.jsx(L, { type: "error", showIcon: !0, message: `读取失败:${se(I)}` }) : /* @__PURE__ */ e.jsx(
|
|
805
|
+
J,
|
|
806
|
+
{
|
|
807
|
+
size: "small",
|
|
808
|
+
rowKey: "Field",
|
|
809
|
+
loading: o,
|
|
810
|
+
dataSource: (j == null ? void 0 : j.rows) ?? [],
|
|
811
|
+
columns: dt,
|
|
812
|
+
pagination: !1,
|
|
813
|
+
locale: { emptyText: /* @__PURE__ */ e.jsx(_e, { description: "该类型没有字段(schema 里有名字但属性列表为空)" }) }
|
|
814
|
+
}
|
|
815
|
+
)
|
|
816
|
+
}
|
|
817
|
+
)
|
|
818
|
+
] });
|
|
819
|
+
}
|
|
820
|
+
function je(t, n) {
|
|
821
|
+
return t ? /* @__PURE__ */ e.jsx(
|
|
822
|
+
X,
|
|
823
|
+
{
|
|
824
|
+
title: `${n}`,
|
|
825
|
+
description: "GET /api/graph/meta/schema 是通的、这一类确实是空数组。z-graph 的内存图刚启动时只有 Initial graph 一个提交,schema 需要显式建。"
|
|
826
|
+
}
|
|
827
|
+
) : /* @__PURE__ */ e.jsx(
|
|
828
|
+
X,
|
|
829
|
+
{
|
|
830
|
+
title: "没有拿到 schema 数据",
|
|
831
|
+
description: "schema 请求本身失败了,见页面顶部的错误条;这里不是「空」,是「没读通」。"
|
|
832
|
+
}
|
|
833
|
+
);
|
|
834
|
+
}
|
|
835
|
+
const { TextArea: ht } = Se, mt = [
|
|
836
|
+
{ label: "全量取样:MATCH (n) RETURN n LIMIT 20", value: "MATCH (n) RETURN n LIMIT 20" },
|
|
837
|
+
{ label: "Schema:SHOW TAGS", value: "SHOW TAGS" },
|
|
838
|
+
{ label: "Schema:SHOW EDGES", value: "SHOW EDGES" },
|
|
839
|
+
{ label: "Schema:SHOW INDEXES", value: "SHOW INDEXES" },
|
|
840
|
+
{ label: "统计:CALL db.stats()", value: "CALL db.stats()" },
|
|
841
|
+
{ label: "版本:SHOW BRANCHES", value: "SHOW BRANCHES" },
|
|
842
|
+
{ label: "定长跳:MATCH (a)-[r*1..2]->(b) RETURN a,r,b LIMIT 20", value: "MATCH (a)-[r*1..2]->(b) RETURN a,r,b LIMIT 20" }
|
|
843
|
+
];
|
|
844
|
+
function pt(t) {
|
|
845
|
+
return t === null || ["string", "number", "boolean"].includes(typeof t);
|
|
846
|
+
}
|
|
847
|
+
function ft(t) {
|
|
848
|
+
return t == null ? /* @__PURE__ */ e.jsx("span", { style: { color: "#94a3b8" }, children: "null" }) : pt(t) ? String(t) : /* @__PURE__ */ e.jsx("code", { style: { fontSize: 12, wordBreak: "break-all" }, children: JSON.stringify(t) });
|
|
849
|
+
}
|
|
850
|
+
function xt() {
|
|
851
|
+
var O, Q, z, ae, de;
|
|
852
|
+
const [t] = Ge(), [n, s] = p(t.get("cypher") || "MATCH (n) RETURN n LIMIT 20"), [l, i] = p(t.get("branch") || re), [h, d] = p(t.get("commit") || ""), [c, g] = p(null), [x, E] = p(null), [C, j] = p(null), [_, I] = p(!1), [a, o] = p(!1), [R, M] = p(null), [D, A] = p(!1), Y = De(0), P = te(() => rt(n), [n]), K = ne(async () => {
|
|
853
|
+
I(!0), Y.current = performance.now();
|
|
854
|
+
try {
|
|
855
|
+
const m = await $.query(n, l, h.trim() || void 0);
|
|
856
|
+
if (!Array.isArray(m))
|
|
857
|
+
throw new Error(`期望行数组,拿到 ${JSON.stringify(m)}`);
|
|
858
|
+
g(m), E(null), j(null), M(Math.round(performance.now() - Y.current)), A(!1);
|
|
859
|
+
} catch (m) {
|
|
860
|
+
g(null), j(m), M(null);
|
|
861
|
+
} finally {
|
|
862
|
+
I(!1);
|
|
863
|
+
}
|
|
864
|
+
}, [n, l, h]), Z = () => {
|
|
865
|
+
if (P && !D) {
|
|
866
|
+
A(!0);
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
K();
|
|
870
|
+
}, f = ne(async () => {
|
|
871
|
+
o(!0);
|
|
872
|
+
try {
|
|
873
|
+
const m = await $.explain(n, l);
|
|
874
|
+
E(m), j(null);
|
|
875
|
+
} catch (m) {
|
|
876
|
+
j(m), E(null);
|
|
877
|
+
} finally {
|
|
878
|
+
o(!1);
|
|
879
|
+
}
|
|
880
|
+
}, [n, l]), w = te(() => {
|
|
881
|
+
if (!Array.isArray(c)) return [];
|
|
882
|
+
const m = [], G = /* @__PURE__ */ new Set();
|
|
883
|
+
return c.forEach((H) => Object.keys(H || {}).forEach((F) => {
|
|
884
|
+
G.has(F) || (G.add(F), m.push(F));
|
|
885
|
+
})), m.map((H, F) => ({
|
|
886
|
+
title: H,
|
|
887
|
+
dataIndex: H,
|
|
888
|
+
key: H,
|
|
889
|
+
ellipsis: !1,
|
|
890
|
+
width: m.length > 4 ? void 0 : 240,
|
|
891
|
+
render: (ue) => ft(ue),
|
|
892
|
+
// 上游行对象允许同名 key 冲突吗:不会,Map 的 key 唯一;这里用序号兜底防止空 key
|
|
893
|
+
...H === "" ? { title: `(空列名 #${F})` } : {}
|
|
894
|
+
}));
|
|
895
|
+
}, [c]);
|
|
896
|
+
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
897
|
+
/* @__PURE__ */ e.jsx(
|
|
898
|
+
ce,
|
|
899
|
+
{
|
|
900
|
+
title: "图查询",
|
|
901
|
+
subtitle: "Cypher 执行与执行计划(数据源 GET /api/graph/query、POST /api/graph/query/explain)"
|
|
902
|
+
}
|
|
903
|
+
),
|
|
904
|
+
/* @__PURE__ */ e.jsxs(pe, { gutter: 16, children: [
|
|
905
|
+
/* @__PURE__ */ e.jsx(W, { span: 16, children: /* @__PURE__ */ e.jsx(v, { title: "查询语句", children: /* @__PURE__ */ e.jsxs(k, { direction: "vertical", style: { width: "100%" }, size: 12, children: [
|
|
906
|
+
/* @__PURE__ */ e.jsxs(k, { wrap: !0, children: [
|
|
907
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontSize: 12, color: "#64748b" }, children: "插入示例" }),
|
|
908
|
+
/* @__PURE__ */ e.jsx(
|
|
909
|
+
Me,
|
|
910
|
+
{
|
|
911
|
+
size: "small",
|
|
912
|
+
style: { width: 340 },
|
|
913
|
+
placeholder: "常用只读查询",
|
|
914
|
+
showSearch: !0,
|
|
915
|
+
optionFilterProp: "label",
|
|
916
|
+
options: mt.map((m) => ({ value: m.value, label: m.label })),
|
|
917
|
+
onChange: (m) => {
|
|
918
|
+
s(m), A(!1);
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
)
|
|
922
|
+
] }),
|
|
923
|
+
/* @__PURE__ */ e.jsx(
|
|
924
|
+
ht,
|
|
925
|
+
{
|
|
926
|
+
value: n,
|
|
927
|
+
rows: 4,
|
|
928
|
+
spellCheck: !1,
|
|
929
|
+
style: { fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace" },
|
|
930
|
+
onChange: (m) => {
|
|
931
|
+
s(m.target.value), A(!1);
|
|
932
|
+
},
|
|
933
|
+
placeholder: "MATCH (n:Person)-[r:KNOWS]->(m) RETURN n.name, r.since, m.name LIMIT 50"
|
|
934
|
+
}
|
|
935
|
+
),
|
|
936
|
+
/* @__PURE__ */ e.jsxs(k, { wrap: !0, children: [
|
|
937
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontSize: 12, color: "#64748b" }, children: "分支" }),
|
|
938
|
+
/* @__PURE__ */ e.jsx(
|
|
939
|
+
Se,
|
|
940
|
+
{
|
|
941
|
+
size: "small",
|
|
942
|
+
style: { width: 140 },
|
|
943
|
+
value: l,
|
|
944
|
+
onChange: (m) => i(m.target.value || re)
|
|
945
|
+
}
|
|
946
|
+
),
|
|
947
|
+
/* @__PURE__ */ e.jsx("span", { style: { fontSize: 12, color: "#64748b" }, children: "或按 commit 时间旅行(留空=按分支 head)" }),
|
|
948
|
+
/* @__PURE__ */ e.jsx(
|
|
949
|
+
Se,
|
|
950
|
+
{
|
|
951
|
+
size: "small",
|
|
952
|
+
style: { width: 260 },
|
|
953
|
+
value: h,
|
|
954
|
+
disabled: P,
|
|
955
|
+
placeholder: P ? "写语句不能带 commit" : "40 位 commit id",
|
|
956
|
+
onChange: (m) => d(m.target.value.trim())
|
|
957
|
+
}
|
|
958
|
+
)
|
|
959
|
+
] }),
|
|
960
|
+
P && /* @__PURE__ */ e.jsx(
|
|
961
|
+
L,
|
|
962
|
+
{
|
|
963
|
+
type: "warning",
|
|
964
|
+
showIcon: !0,
|
|
965
|
+
message: "这条语句会被上游判定为写操作",
|
|
966
|
+
description: D ? "已确认。再点一次「执行」就会真的改图:GraphControlServer 对写语句开一个事务并提交,产生一个新的不可撤回 commit。" : "上游按前缀/关键字判定写(CREATE / MERGE / MATCH…SET|DELETE / DETACH DELETE),执行时会开事务并落一个新 commit。第一次点击只出这条确认,不会执行。"
|
|
967
|
+
}
|
|
968
|
+
),
|
|
969
|
+
/* @__PURE__ */ e.jsxs(k, { children: [
|
|
970
|
+
/* @__PURE__ */ e.jsx(
|
|
971
|
+
B,
|
|
972
|
+
{
|
|
973
|
+
type: "primary",
|
|
974
|
+
icon: /* @__PURE__ */ e.jsx(Ve, {}),
|
|
975
|
+
loading: _,
|
|
976
|
+
danger: P && D,
|
|
977
|
+
onClick: Z,
|
|
978
|
+
children: P && D ? "确认执行(会改图)" : "执行"
|
|
979
|
+
}
|
|
980
|
+
),
|
|
981
|
+
/* @__PURE__ */ e.jsx(B, { icon: /* @__PURE__ */ e.jsx(Xe, {}), loading: a, onClick: f, children: "执行计划" })
|
|
982
|
+
] })
|
|
983
|
+
] }) }) }),
|
|
984
|
+
/* @__PURE__ */ e.jsxs(W, { span: 8, children: [
|
|
985
|
+
/* @__PURE__ */ e.jsxs(v, { title: "本次结果", children: [
|
|
986
|
+
/* @__PURE__ */ e.jsxs(pe, { gutter: 16, children: [
|
|
987
|
+
/* @__PURE__ */ e.jsx(W, { span: 8, children: /* @__PURE__ */ e.jsx(xe, { title: "返回行数", value: c ? c.length : "-" }) }),
|
|
988
|
+
/* @__PURE__ */ e.jsx(W, { span: 8, children: /* @__PURE__ */ e.jsx(
|
|
989
|
+
xe,
|
|
990
|
+
{
|
|
991
|
+
title: "往返耗时",
|
|
992
|
+
suffix: "ms",
|
|
993
|
+
value: R ?? "-"
|
|
994
|
+
}
|
|
995
|
+
) }),
|
|
996
|
+
/* @__PURE__ */ e.jsx(W, { span: 8, children: /* @__PURE__ */ e.jsx(xe, { title: "列数", value: w.length || "-" }) })
|
|
997
|
+
] }),
|
|
998
|
+
/* @__PURE__ */ e.jsxs("div", { style: { marginTop: 12, fontSize: 12, color: "#64748b" }, children: [
|
|
999
|
+
"耗时是前端 axios 往返(含 8888 的代理一跳),不是上游 ",
|
|
1000
|
+
/* @__PURE__ */ e.jsx("code", { children: "X-Response-Time" }),
|
|
1001
|
+
"; 后者是跨域响应头,axios 读不到,不拿它当自己的数。"
|
|
1002
|
+
] })
|
|
1003
|
+
] }),
|
|
1004
|
+
x && /* @__PURE__ */ e.jsxs(
|
|
1005
|
+
v,
|
|
1006
|
+
{
|
|
1007
|
+
style: { marginTop: 16 },
|
|
1008
|
+
title: "执行计划 (POST /query/explain)",
|
|
1009
|
+
extra: /* @__PURE__ */ e.jsxs(k, { size: 4, children: [
|
|
1010
|
+
/* @__PURE__ */ e.jsx(y, { children: ((O = x.plan) == null ? void 0 : O.queryType) ?? "-" }),
|
|
1011
|
+
/* @__PURE__ */ e.jsx(y, { color: ((Q = x.plan) == null ? void 0 : Q.estimatedComplexity) === "HIGH" ? "error" : ((z = x.plan) == null ? void 0 : z.estimatedComplexity) === "MEDIUM" ? "warning" : "success", children: ((ae = x.plan) == null ? void 0 : ae.estimatedComplexity) ?? "-" })
|
|
1012
|
+
] }),
|
|
1013
|
+
children: [
|
|
1014
|
+
/* @__PURE__ */ e.jsx(
|
|
1015
|
+
J,
|
|
1016
|
+
{
|
|
1017
|
+
size: "small",
|
|
1018
|
+
rowKey: (m, G) => `${m.operation}-${G}`,
|
|
1019
|
+
dataSource: ((de = x.plan) == null ? void 0 : de.steps) ?? [],
|
|
1020
|
+
pagination: !1,
|
|
1021
|
+
columns: [
|
|
1022
|
+
{ title: "算子", dataIndex: "operation", key: "operation", width: 140 },
|
|
1023
|
+
{ title: "说明", dataIndex: "description", key: "description" }
|
|
1024
|
+
],
|
|
1025
|
+
locale: { emptyText: /* @__PURE__ */ e.jsx(X, { title: "上游没有给出算子" }) }
|
|
1026
|
+
}
|
|
1027
|
+
),
|
|
1028
|
+
/* @__PURE__ */ e.jsxs("div", { style: { marginTop: 8, fontSize: 12, color: "#64748b" }, children: [
|
|
1029
|
+
"这份计划是 ",
|
|
1030
|
+
/* @__PURE__ */ e.jsx("code", { children: "handleExplain" }),
|
|
1031
|
+
" 按字符串前缀 + 关键字命中拼出来的 (MATCH→Scan、含 WHERE→Filter…),",
|
|
1032
|
+
/* @__PURE__ */ e.jsx("b", { children: "不是代价估算器" }),
|
|
1033
|
+
"; 复杂度只有 HIGH/MEDIUM/LOW 三档。别按真实执行成本解读。"
|
|
1034
|
+
] })
|
|
1035
|
+
]
|
|
1036
|
+
}
|
|
1037
|
+
)
|
|
1038
|
+
] })
|
|
1039
|
+
] }),
|
|
1040
|
+
/* @__PURE__ */ e.jsx(v, { style: { marginTop: 16 }, title: c ? `结果集(${c.length} 行)` : "结果集", children: C ? /* @__PURE__ */ e.jsx(
|
|
1041
|
+
L,
|
|
1042
|
+
{
|
|
1043
|
+
type: "error",
|
|
1044
|
+
showIcon: !0,
|
|
1045
|
+
message: `查询失败:${se(C)}`,
|
|
1046
|
+
description: "上游所有 catch 分支都只回 {error: msg}:Cypher 语法错、Tag 不存在、head 冲突(409 Stale head)都在这里。503 则是内嵌实例没 bind。"
|
|
1047
|
+
}
|
|
1048
|
+
) : /* @__PURE__ */ e.jsx(
|
|
1049
|
+
J,
|
|
1050
|
+
{
|
|
1051
|
+
size: "small",
|
|
1052
|
+
rowKey: (m, G) => G,
|
|
1053
|
+
loading: _,
|
|
1054
|
+
dataSource: c ?? [],
|
|
1055
|
+
columns: w,
|
|
1056
|
+
scroll: { x: "max-content" },
|
|
1057
|
+
pagination: { size: "small", pageSize: 20, showSizeChanger: !0 },
|
|
1058
|
+
locale: {
|
|
1059
|
+
emptyText: c === null ? /* @__PURE__ */ e.jsx(X, { title: "还没有执行过查询", description: "点「执行」或「执行计划」。这里没有预置示例数据。" }) : /* @__PURE__ */ e.jsx(X, { title: "返回 0 行", description: "查询成功执行、上游确实给了空数组(空图或未命中)。" })
|
|
1060
|
+
}
|
|
1061
|
+
}
|
|
1062
|
+
) }),
|
|
1063
|
+
c && c.length > 0 && /* @__PURE__ */ e.jsx(v, { style: { marginTop: 16 }, title: "原始响应(第一行,逐字段照上游 JSON 渲染)", children: /* @__PURE__ */ e.jsx("pre", { style: { margin: 0, fontSize: 12, overflow: "auto", maxHeight: 260 }, children: JSON.stringify(c[0], null, 2) }) })
|
|
1064
|
+
] });
|
|
1065
|
+
}
|
|
1066
|
+
function be(t) {
|
|
1067
|
+
if (t == null) return "-";
|
|
1068
|
+
const n = new Date(t);
|
|
1069
|
+
return Number.isNaN(n.getTime()) ? String(t) : n.toLocaleString("zh-CN", { hour12: !1 });
|
|
1070
|
+
}
|
|
1071
|
+
function yt() {
|
|
1072
|
+
const t = $e(), [n, s] = p([]), [l, i] = p([]), [h, d] = p(!1), [c, g] = p(null), [x, E] = p(null), C = ne(async () => {
|
|
1073
|
+
d(!0);
|
|
1074
|
+
try {
|
|
1075
|
+
const [a, o] = await Promise.all([$.branches(), $.commits()]);
|
|
1076
|
+
if (!Array.isArray(a)) throw new Error(`branches 应为字符串数组,拿到 ${JSON.stringify(a)}`);
|
|
1077
|
+
if (!Array.isArray(o)) throw new Error(`commits 应为对象数组,拿到 ${JSON.stringify(o)}`);
|
|
1078
|
+
s(a), i(o), g(null);
|
|
1079
|
+
} catch (a) {
|
|
1080
|
+
s([]), i([]), g(a);
|
|
1081
|
+
} finally {
|
|
1082
|
+
d(!1);
|
|
1083
|
+
}
|
|
1084
|
+
}, []);
|
|
1085
|
+
ke(() => {
|
|
1086
|
+
C();
|
|
1087
|
+
}, [C]);
|
|
1088
|
+
const j = te(() => {
|
|
1089
|
+
const a = /* @__PURE__ */ new Map();
|
|
1090
|
+
return l.forEach((o) => a.set(o.id, o)), a;
|
|
1091
|
+
}, [l]), _ = te(() => {
|
|
1092
|
+
const a = /* @__PURE__ */ new Map();
|
|
1093
|
+
return l.forEach((o) => {
|
|
1094
|
+
const R = a.get(o.branch);
|
|
1095
|
+
(!R || (o.timestamp ?? 0) >= (R.timestamp ?? 0)) && a.set(o.branch, o);
|
|
1096
|
+
}), a;
|
|
1097
|
+
}, [l]), I = te(() => [...x ? l.filter((o) => o.branch === x) : l].sort((o, R) => (R.timestamp ?? 0) - (o.timestamp ?? 0)), [l, x]);
|
|
1098
|
+
return c ? /* @__PURE__ */ e.jsxs("div", { children: [
|
|
1099
|
+
/* @__PURE__ */ e.jsx(ce, { title: "分支与提交", subtitle: "GET /api/graph/meta/branches + /api/graph/meta/commits" }),
|
|
1100
|
+
/* @__PURE__ */ e.jsx(
|
|
1101
|
+
L,
|
|
1102
|
+
{
|
|
1103
|
+
type: Re(c) ? "error" : "warning",
|
|
1104
|
+
showIcon: !0,
|
|
1105
|
+
message: `提交历史读取失败:${se(c)}`,
|
|
1106
|
+
description: Re(c) ? "503 = 本 JVM 的内嵌 GraphControlServer 没 bind 成功(不是「图里没有提交」)。去「实例与端口」页确认 boundPort 与 foreignListenerSuspected。" : void 0
|
|
1107
|
+
}
|
|
1108
|
+
)
|
|
1109
|
+
] }) : /* @__PURE__ */ e.jsxs("div", { children: [
|
|
1110
|
+
/* @__PURE__ */ e.jsx(
|
|
1111
|
+
ce,
|
|
1112
|
+
{
|
|
1113
|
+
title: "分支与提交",
|
|
1114
|
+
subtitle: "z-graph 的 Git 式版本面:分支 head 与全量 commit 图(数据源 /api/graph/meta/branches、/meta/commits)"
|
|
1115
|
+
}
|
|
1116
|
+
),
|
|
1117
|
+
/* @__PURE__ */ e.jsx(
|
|
1118
|
+
v,
|
|
1119
|
+
{
|
|
1120
|
+
title: /* @__PURE__ */ e.jsxs(k, { children: [
|
|
1121
|
+
/* @__PURE__ */ e.jsx(Ie, {}),
|
|
1122
|
+
"分支(",
|
|
1123
|
+
n.length,
|
|
1124
|
+
")"
|
|
1125
|
+
] }),
|
|
1126
|
+
extra: /* @__PURE__ */ e.jsx(B, { icon: /* @__PURE__ */ e.jsx(ve, {}), loading: h, onClick: C, children: "刷新" }),
|
|
1127
|
+
children: /* @__PURE__ */ e.jsxs(pe, { gutter: [16, 16], children: [
|
|
1128
|
+
n.length === 0 && !h && /* @__PURE__ */ e.jsx(W, { span: 24, children: /* @__PURE__ */ e.jsx(
|
|
1129
|
+
X,
|
|
1130
|
+
{
|
|
1131
|
+
title: "一个分支都没有",
|
|
1132
|
+
description: "GET /api/graph/meta/branches 是通的、返回了空数组。内嵌实例若刚启动,GraphVersionStore 构造函数会先落一个 Initial graph 根提交并把 main 指过去,所以真为空通常说明连的不是你以为的那个实例。"
|
|
1133
|
+
}
|
|
1134
|
+
) }),
|
|
1135
|
+
n.map((a) => {
|
|
1136
|
+
const o = _.get(a), R = l.filter((M) => M.branch === a).length;
|
|
1137
|
+
return /* @__PURE__ */ e.jsx(W, { span: 8, children: /* @__PURE__ */ e.jsx(
|
|
1138
|
+
v,
|
|
1139
|
+
{
|
|
1140
|
+
size: "small",
|
|
1141
|
+
hoverable: !0,
|
|
1142
|
+
onClick: () => E(x === a ? null : a),
|
|
1143
|
+
title: /* @__PURE__ */ e.jsxs(k, { children: [
|
|
1144
|
+
/* @__PURE__ */ e.jsx(Ie, {}),
|
|
1145
|
+
/* @__PURE__ */ e.jsx("code", { children: a })
|
|
1146
|
+
] }),
|
|
1147
|
+
extra: x === a ? /* @__PURE__ */ e.jsx(y, { color: "processing", children: "已筛选" }) : null,
|
|
1148
|
+
children: /* @__PURE__ */ e.jsxs(k, { direction: "vertical", size: 2, style: { width: "100%" }, children: [
|
|
1149
|
+
/* @__PURE__ */ e.jsxs("span", { style: { fontSize: 12 }, children: [
|
|
1150
|
+
"head:",
|
|
1151
|
+
/* @__PURE__ */ e.jsx("code", { children: o ? `${o.id.slice(0, 12)}…` : "未知" })
|
|
1152
|
+
] }),
|
|
1153
|
+
/* @__PURE__ */ e.jsxs("span", { style: { fontSize: 12, color: "#64748b" }, children: [
|
|
1154
|
+
"本分支提交 ",
|
|
1155
|
+
R,
|
|
1156
|
+
" · 点 ",
|
|
1157
|
+
(o == null ? void 0 : o.nodeCount) ?? "-",
|
|
1158
|
+
" · 边 ",
|
|
1159
|
+
(o == null ? void 0 : o.edgeCount) ?? "-"
|
|
1160
|
+
] }),
|
|
1161
|
+
/* @__PURE__ */ e.jsxs("span", { style: { fontSize: 12, color: "#64748b" }, children: [
|
|
1162
|
+
"最近提交:",
|
|
1163
|
+
o ? be(o.timestamp) : "-"
|
|
1164
|
+
] })
|
|
1165
|
+
] })
|
|
1166
|
+
}
|
|
1167
|
+
) }, a);
|
|
1168
|
+
})
|
|
1169
|
+
] })
|
|
1170
|
+
}
|
|
1171
|
+
),
|
|
1172
|
+
/* @__PURE__ */ e.jsx(
|
|
1173
|
+
v,
|
|
1174
|
+
{
|
|
1175
|
+
style: { marginTop: 16 },
|
|
1176
|
+
title: /* @__PURE__ */ e.jsxs(k, { children: [
|
|
1177
|
+
/* @__PURE__ */ e.jsx(Ke, {}),
|
|
1178
|
+
"提交历史(全量 commit 图,",
|
|
1179
|
+
I.length,
|
|
1180
|
+
" 条)"
|
|
1181
|
+
] }),
|
|
1182
|
+
extra: x ? /* @__PURE__ */ e.jsx(k, { children: /* @__PURE__ */ e.jsxs(y, { color: "processing", closable: !0, onClose: () => E(null), children: [
|
|
1183
|
+
"branch = ",
|
|
1184
|
+
x
|
|
1185
|
+
] }) }) : /* @__PURE__ */ e.jsx("span", { style: { fontSize: 12, color: "#64748b" }, children: "点分支卡片可筛选" }),
|
|
1186
|
+
children: /* @__PURE__ */ e.jsx(
|
|
1187
|
+
J,
|
|
1188
|
+
{
|
|
1189
|
+
size: "small",
|
|
1190
|
+
rowKey: "id",
|
|
1191
|
+
loading: h,
|
|
1192
|
+
dataSource: I,
|
|
1193
|
+
pagination: { size: "small", pageSize: 20, showSizeChanger: !0 },
|
|
1194
|
+
columns: [
|
|
1195
|
+
{
|
|
1196
|
+
title: "commit",
|
|
1197
|
+
dataIndex: "id",
|
|
1198
|
+
key: "id",
|
|
1199
|
+
width: 170,
|
|
1200
|
+
render: (a) => /* @__PURE__ */ e.jsx(ye, { title: a, children: /* @__PURE__ */ e.jsx("code", { children: `${String(a).slice(0, 12)}…` }) })
|
|
1201
|
+
},
|
|
1202
|
+
{
|
|
1203
|
+
title: "分支",
|
|
1204
|
+
dataIndex: "branch",
|
|
1205
|
+
key: "branch",
|
|
1206
|
+
width: 110,
|
|
1207
|
+
render: (a) => /* @__PURE__ */ e.jsx(y, { color: a === re ? "blue" : "geekblue", children: a })
|
|
1208
|
+
},
|
|
1209
|
+
{ title: "作者", dataIndex: "author", key: "author", width: 110 },
|
|
1210
|
+
{
|
|
1211
|
+
title: "说明",
|
|
1212
|
+
dataIndex: "message",
|
|
1213
|
+
key: "message",
|
|
1214
|
+
ellipsis: { showTitle: !1 },
|
|
1215
|
+
render: (a) => /* @__PURE__ */ e.jsx(ye, { title: a, placement: "topLeft", children: /* @__PURE__ */ e.jsx("span", { children: a || "-" }) })
|
|
1216
|
+
},
|
|
1217
|
+
{ title: "时间", dataIndex: "timestamp", key: "timestamp", width: 190, render: be },
|
|
1218
|
+
{ title: "点", dataIndex: "nodeCount", key: "nodeCount", width: 70 },
|
|
1219
|
+
{ title: "边", dataIndex: "edgeCount", key: "edgeCount", width: 70 },
|
|
1220
|
+
{
|
|
1221
|
+
title: "父提交",
|
|
1222
|
+
dataIndex: "parents",
|
|
1223
|
+
key: "parents",
|
|
1224
|
+
width: 150,
|
|
1225
|
+
render: (a) => !Array.isArray(a) || a.length === 0 ? /* @__PURE__ */ e.jsx(y, { children: "根提交" }) : /* @__PURE__ */ e.jsx(k, { direction: "vertical", size: 0, children: a.map((o) => /* @__PURE__ */ e.jsx(
|
|
1226
|
+
ye,
|
|
1227
|
+
{
|
|
1228
|
+
title: j.has(o) ? `${j.get(o).message} · ${be(j.get(o).timestamp)}` : o,
|
|
1229
|
+
children: /* @__PURE__ */ e.jsx("code", { style: { fontSize: 12 }, children: `${String(o).slice(0, 8)}…` })
|
|
1230
|
+
},
|
|
1231
|
+
o
|
|
1232
|
+
)) })
|
|
1233
|
+
},
|
|
1234
|
+
{
|
|
1235
|
+
title: "操作",
|
|
1236
|
+
key: "action",
|
|
1237
|
+
width: 130,
|
|
1238
|
+
render: (a, o) => /* @__PURE__ */ e.jsx(
|
|
1239
|
+
B,
|
|
1240
|
+
{
|
|
1241
|
+
type: "link",
|
|
1242
|
+
size: "small",
|
|
1243
|
+
onClick: () => t(`/graph/query?branch=${encodeURIComponent(o.branch)}&commit=${encodeURIComponent(o.id)}`),
|
|
1244
|
+
children: "按此版本查"
|
|
1245
|
+
}
|
|
1246
|
+
)
|
|
1247
|
+
}
|
|
1248
|
+
],
|
|
1249
|
+
locale: {
|
|
1250
|
+
emptyText: /* @__PURE__ */ e.jsx(
|
|
1251
|
+
X,
|
|
1252
|
+
{
|
|
1253
|
+
title: "没有任何提交",
|
|
1254
|
+
description: "GET /api/graph/meta/commits 通了但返回空数组 —— 上游 GraphVersionStore 构造时至少会有一个 Initial graph 根提交,所以这一格为空要去「实例与端口」页确认应答者。"
|
|
1255
|
+
}
|
|
1256
|
+
)
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
)
|
|
1260
|
+
}
|
|
1261
|
+
)
|
|
1262
|
+
] });
|
|
1263
|
+
}
|
|
1264
|
+
const gt = [
|
|
1265
|
+
{ title: "方法", dataIndex: "method", key: "method", width: 90, render: (t) => /* @__PURE__ */ e.jsx(y, { children: t }) },
|
|
1266
|
+
{ title: "路径", dataIndex: "path", key: "path", ellipsis: !0 },
|
|
1267
|
+
{ title: "来源 IP", dataIndex: "clientIp", key: "clientIp", width: 150 },
|
|
1268
|
+
{
|
|
1269
|
+
title: "状态",
|
|
1270
|
+
dataIndex: "status",
|
|
1271
|
+
key: "status",
|
|
1272
|
+
width: 90,
|
|
1273
|
+
render: (t) => /* @__PURE__ */ e.jsx(y, { color: t >= 500 ? "error" : t >= 400 ? "warning" : "success", children: t })
|
|
1274
|
+
},
|
|
1275
|
+
{ title: "耗时", dataIndex: "elapsedMs", key: "elapsedMs", width: 90, render: (t) => `${t} ms` },
|
|
1276
|
+
{ title: "请求 ID", dataIndex: "requestId", key: "requestId", width: 170, render: (t) => /* @__PURE__ */ e.jsx("code", { children: t }) },
|
|
1277
|
+
{ title: "线程", dataIndex: "thread", key: "thread", width: 160, render: (t) => /* @__PURE__ */ e.jsx("code", { children: t }) }
|
|
1278
|
+
];
|
|
1279
|
+
function jt(t) {
|
|
1280
|
+
if (t == null) return "-";
|
|
1281
|
+
const n = Math.floor(t / 86400), s = Math.floor(t % 86400 / 3600), l = Math.floor(t % 3600 / 60);
|
|
1282
|
+
return n > 0 ? `${n} 天 ${s} 时 ${l} 分` : s > 0 ? `${s} 时 ${l} 分 ${t % 60} 秒` : `${l} 分 ${t % 60} 秒`;
|
|
1283
|
+
}
|
|
1284
|
+
function Ee(t) {
|
|
1285
|
+
return t == null ? "-" : `${(t / 1024 / 1024).toFixed(1)} MiB`;
|
|
1286
|
+
}
|
|
1287
|
+
function Ne(t, n = "是", s = "否", l = "error") {
|
|
1288
|
+
return t == null ? "-" : t ? /* @__PURE__ */ e.jsx(y, { color: "success", children: n }) : /* @__PURE__ */ e.jsx(y, { color: l, children: s });
|
|
1289
|
+
}
|
|
1290
|
+
function bt() {
|
|
1291
|
+
const [t, n] = p(null), [s, l] = p(null), [i, h] = p(null), [d, c] = p(null), [g, x] = p(!1), [E, C] = p(null), j = ne(async () => {
|
|
1292
|
+
x(!0);
|
|
1293
|
+
try {
|
|
1294
|
+
const a = await $.instance();
|
|
1295
|
+
n(a), C(null);
|
|
1296
|
+
try {
|
|
1297
|
+
const [o, R] = await Promise.all([$.metrics(), $.logs({ limit: 20 })]);
|
|
1298
|
+
l(o), h(null), c(R);
|
|
1299
|
+
} catch (o) {
|
|
1300
|
+
l(null), c(null), h(o);
|
|
1301
|
+
}
|
|
1302
|
+
} catch (a) {
|
|
1303
|
+
n(null), C(a);
|
|
1304
|
+
} finally {
|
|
1305
|
+
x(!1);
|
|
1306
|
+
}
|
|
1307
|
+
}, []);
|
|
1308
|
+
ke(() => {
|
|
1309
|
+
j();
|
|
1310
|
+
}, [j]);
|
|
1311
|
+
const _ = !E && t && !t.embeddedRunning, I = !E && t && t.foreignListenerSuspected;
|
|
1312
|
+
return /* @__PURE__ */ e.jsxs("div", { children: [
|
|
1313
|
+
/* @__PURE__ */ e.jsx(
|
|
1314
|
+
ce,
|
|
1315
|
+
{
|
|
1316
|
+
title: "实例与端口",
|
|
1317
|
+
subtitle: "GraphProxyController 自省接口 GET /api/graph/__instance + 控制面自报的 /meta/metrics"
|
|
1318
|
+
}
|
|
1319
|
+
),
|
|
1320
|
+
/* @__PURE__ */ e.jsx(v, { extra: /* @__PURE__ */ e.jsx(k, { children: /* @__PURE__ */ e.jsx(B, { icon: /* @__PURE__ */ e.jsx(ve, {}), loading: g, onClick: j, children: "刷新" }) }), children: E ? /* @__PURE__ */ e.jsx(
|
|
1321
|
+
L,
|
|
1322
|
+
{
|
|
1323
|
+
type: "error",
|
|
1324
|
+
showIcon: !0,
|
|
1325
|
+
message: `自省接口调用失败:${se(E)}`,
|
|
1326
|
+
description: "/api/graph/__instance 由 z-opc 自己的 controller 直接应答,不经过内嵌服务;它都不通说明是 z-opc 侧的路由/认证问题(302 到登录页 = 没带会话 Cookie)。"
|
|
1327
|
+
}
|
|
1328
|
+
) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
1329
|
+
I && /* @__PURE__ */ e.jsx(
|
|
1330
|
+
L,
|
|
1331
|
+
{
|
|
1332
|
+
type: "error",
|
|
1333
|
+
showIcon: !0,
|
|
1334
|
+
style: { marginBottom: 16 },
|
|
1335
|
+
message: "配置端口上有监听者,但它不是本 JVM —— 这一路连的是外部进程,页面数据不能算孵化结果",
|
|
1336
|
+
description: `boundPort=0(本 JVM 的 GraphControlServer 没 bind 上)而 ${t.configuredPort} 端口 TCP 可连。用 lsof -nP -iTCP:${t.configuredPort} -sTCP:LISTEN 取属主 PID,与本页 jvm 字段(${t.jvm})比对;对不上就是假孵化。处理方式只有两种:让出该端口,或给 zgraph.server.port 换一个端口——两者都需要定夺,代理层不会替你去占端口。`
|
|
1337
|
+
}
|
|
1338
|
+
),
|
|
1339
|
+
_ && !I && /* @__PURE__ */ e.jsx(
|
|
1340
|
+
L,
|
|
1341
|
+
{
|
|
1342
|
+
type: "warning",
|
|
1343
|
+
showIcon: !0,
|
|
1344
|
+
style: { marginBottom: 16 },
|
|
1345
|
+
message: "内嵌 GraphControlServer 没有 bind 成功,其余三页的空数组是「没起」而不是「图里没数据」",
|
|
1346
|
+
description: `bindError = ${t.bindError ?? "null"}。proxy 只在 boundPort>0 时才转发,所以现在所有 /api/graph/meta* 与 /api/graph/query 都会拿到 503。`
|
|
1347
|
+
}
|
|
1348
|
+
),
|
|
1349
|
+
/* @__PURE__ */ e.jsx(
|
|
1350
|
+
Te,
|
|
1351
|
+
{
|
|
1352
|
+
bordered: !0,
|
|
1353
|
+
size: "small",
|
|
1354
|
+
column: 2,
|
|
1355
|
+
items: [
|
|
1356
|
+
{
|
|
1357
|
+
key: "jvm",
|
|
1358
|
+
label: "应答的 JVM (pid@host)",
|
|
1359
|
+
children: /* @__PURE__ */ e.jsx("code", { children: (t == null ? void 0 : t.jvm) ?? "-" })
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
key: "lifecycleBean",
|
|
1363
|
+
label: "内嵌配置已装载",
|
|
1364
|
+
children: t ? t.lifecycleBean ? /* @__PURE__ */ e.jsx(y, { color: "success", children: "是" }) : /* @__PURE__ */ e.jsx(y, { color: "error", children: "否(zgraph.enabled≠true)" }) : "-"
|
|
1365
|
+
},
|
|
1366
|
+
{
|
|
1367
|
+
key: "configuredPort",
|
|
1368
|
+
label: "配置端口",
|
|
1369
|
+
children: (t == null ? void 0 : t.configuredPort) ?? "-"
|
|
1370
|
+
},
|
|
1371
|
+
{
|
|
1372
|
+
key: "boundPort",
|
|
1373
|
+
label: "内嵌实例实际 bind 端口",
|
|
1374
|
+
children: t ? t.boundPort > 0 ? /* @__PURE__ */ e.jsx(y, { color: "success", children: t.boundPort }) : /* @__PURE__ */ e.jsx(y, { color: "error", children: "0(没 bind 上)" }) : "-"
|
|
1375
|
+
},
|
|
1376
|
+
{
|
|
1377
|
+
key: "embeddedRunning",
|
|
1378
|
+
label: "内嵌控制面在跑",
|
|
1379
|
+
children: Ne(t == null ? void 0 : t.embeddedRunning)
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
key: "acceptingNow",
|
|
1383
|
+
label: "本实例端口此刻可连",
|
|
1384
|
+
children: Ne(t == null ? void 0 : t.acceptingNow, "是", "否", "warning")
|
|
1385
|
+
},
|
|
1386
|
+
{
|
|
1387
|
+
key: "foreign",
|
|
1388
|
+
label: "外来监听者嫌疑",
|
|
1389
|
+
children: t ? t.foreignListenerSuspected ? /* @__PURE__ */ e.jsx(y, { color: "error", children: "有(应答者不是本 JVM)" }) : /* @__PURE__ */ e.jsx(y, { color: "success", children: "无" }) : "-"
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
key: "token",
|
|
1393
|
+
label: "上游 API Token (环境变量)",
|
|
1394
|
+
children: t ? t.apiTokenConfigured ? /* @__PURE__ */ e.jsx(y, { color: "success", children: "已设置" }) : /* @__PURE__ */ e.jsx(y, { color: "warning", children: "未设置 = 通配端口不鉴权" }) : "-"
|
|
1395
|
+
},
|
|
1396
|
+
{
|
|
1397
|
+
key: "bindError",
|
|
1398
|
+
label: "bind 失败原因",
|
|
1399
|
+
children: t != null && t.bindError ? /* @__PURE__ */ e.jsx("code", { children: t.bindError }) : "-"
|
|
1400
|
+
},
|
|
1401
|
+
{
|
|
1402
|
+
key: "path",
|
|
1403
|
+
label: "转发前缀",
|
|
1404
|
+
children: /* @__PURE__ */ e.jsx("code", { children: "/api/graph/** → 127.0.0.1:<boundPort>" })
|
|
1405
|
+
}
|
|
1406
|
+
]
|
|
1407
|
+
}
|
|
1408
|
+
),
|
|
1409
|
+
/* @__PURE__ */ e.jsxs("div", { style: { marginTop: 12, color: "#64748b", fontSize: 12 }, children: [
|
|
1410
|
+
"代理是逐字节透传,不在 z-opc 侧重拼 JSON。上游注册的端点:",
|
|
1411
|
+
((t == null ? void 0 : t.upstreamEndpoints) ?? []).map((a) => /* @__PURE__ */ e.jsx(
|
|
1412
|
+
"code",
|
|
1413
|
+
{
|
|
1414
|
+
style: { marginRight: 6 },
|
|
1415
|
+
children: a
|
|
1416
|
+
},
|
|
1417
|
+
a
|
|
1418
|
+
))
|
|
1419
|
+
] })
|
|
1420
|
+
] }) }),
|
|
1421
|
+
/* @__PURE__ */ e.jsx(
|
|
1422
|
+
v,
|
|
1423
|
+
{
|
|
1424
|
+
title: "控制面自报指标 (GET /api/graph/meta/metrics)",
|
|
1425
|
+
style: { marginTop: 16 },
|
|
1426
|
+
extra: /* @__PURE__ */ e.jsx(y, { color: "blue", children: "走上游转发,内嵌没起时这里必然报错" }),
|
|
1427
|
+
children: i ? /* @__PURE__ */ e.jsx(
|
|
1428
|
+
L,
|
|
1429
|
+
{
|
|
1430
|
+
type: "error",
|
|
1431
|
+
showIcon: !0,
|
|
1432
|
+
message: `读不到 /meta/metrics:${se(i)}`
|
|
1433
|
+
}
|
|
1434
|
+
) : /* @__PURE__ */ e.jsx(
|
|
1435
|
+
Te,
|
|
1436
|
+
{
|
|
1437
|
+
bordered: !0,
|
|
1438
|
+
size: "small",
|
|
1439
|
+
column: 3,
|
|
1440
|
+
items: [
|
|
1441
|
+
{
|
|
1442
|
+
key: "uptime",
|
|
1443
|
+
label: "控制面存活时长",
|
|
1444
|
+
children: `${jt(s == null ? void 0 : s.uptimeSeconds)}(${(s == null ? void 0 : s.uptimeFormatted) ?? "-"})`
|
|
1445
|
+
},
|
|
1446
|
+
{ key: "totalRequests", label: "累计请求", children: (s == null ? void 0 : s.totalRequests) ?? "-" },
|
|
1447
|
+
{ key: "errorResponses", label: "错误应答", children: (s == null ? void 0 : s.errorResponses) ?? "-" },
|
|
1448
|
+
{ key: "errorRate", label: "错误率", children: (s == null ? void 0 : s.errorRate) ?? "-" },
|
|
1449
|
+
{ key: "authFailures", label: "鉴权失败", children: (s == null ? void 0 : s.authFailures) ?? "-" },
|
|
1450
|
+
{ key: "rateLimited", label: "被限流", children: (s == null ? void 0 : s.rateLimitedRequests) ?? "-" },
|
|
1451
|
+
{
|
|
1452
|
+
key: "heap",
|
|
1453
|
+
label: "JVM 堆 (已用/已申请/上限)",
|
|
1454
|
+
children: s != null && s.jvmMemory ? `${Ee(s.jvmMemory.usedBytes)} / ${Ee(s.jvmMemory.totalBytes)} / ${Ee(s.jvmMemory.maxBytes)}` : "-"
|
|
1455
|
+
},
|
|
1456
|
+
{ key: "cpu", label: "可用核数", children: (s == null ? void 0 : s.availableProcessors) ?? "-" },
|
|
1457
|
+
{
|
|
1458
|
+
key: "rate",
|
|
1459
|
+
label: "限流阈值/活跃桶",
|
|
1460
|
+
children: `${(s == null ? void 0 : s.rateLimitPerMinute) ?? "-"} / ${(s == null ? void 0 : s.activeRateBuckets) ?? "-"}`
|
|
1461
|
+
}
|
|
1462
|
+
]
|
|
1463
|
+
}
|
|
1464
|
+
)
|
|
1465
|
+
}
|
|
1466
|
+
),
|
|
1467
|
+
/* @__PURE__ */ e.jsx(v, { title: "最近请求日志 (GET /api/graph/meta/logs?limit=20)", style: { marginTop: 16 }, children: d ? /* @__PURE__ */ e.jsx(
|
|
1468
|
+
J,
|
|
1469
|
+
{
|
|
1470
|
+
size: "small",
|
|
1471
|
+
rowKey: (a) => `${a.timestamp}-${a.requestId}`,
|
|
1472
|
+
loading: g,
|
|
1473
|
+
dataSource: d.entries ?? [],
|
|
1474
|
+
columns: gt,
|
|
1475
|
+
pagination: {
|
|
1476
|
+
size: "small",
|
|
1477
|
+
total: d.total ?? 0,
|
|
1478
|
+
pageSize: 20,
|
|
1479
|
+
showTotal: (a) => `环形缓冲 ${a} 条 / 容量 ${d.bufferSize ?? "-"}`
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
) : /* @__PURE__ */ e.jsx(
|
|
1483
|
+
L,
|
|
1484
|
+
{
|
|
1485
|
+
type: "info",
|
|
1486
|
+
showIcon: !0,
|
|
1487
|
+
message: i ? "读不到请求日志(同上)" : "日志缓冲为空 —— 控制面刚起或还没打过请求"
|
|
1488
|
+
}
|
|
1489
|
+
) })
|
|
1490
|
+
] });
|
|
1491
|
+
}
|
|
1492
|
+
function _t() {
|
|
1493
|
+
return /* @__PURE__ */ e.jsxs(He, { children: [
|
|
1494
|
+
/* @__PURE__ */ e.jsx(le, { index: !0, element: /* @__PURE__ */ e.jsx(Ue, { to: "schema", replace: !0 }) }),
|
|
1495
|
+
/* @__PURE__ */ e.jsx(le, { path: "schema", element: /* @__PURE__ */ e.jsx(ut, {}) }),
|
|
1496
|
+
/* @__PURE__ */ e.jsx(le, { path: "query", element: /* @__PURE__ */ e.jsx(xt, {}) }),
|
|
1497
|
+
/* @__PURE__ */ e.jsx(le, { path: "branches", element: /* @__PURE__ */ e.jsx(yt, {}) }),
|
|
1498
|
+
/* @__PURE__ */ e.jsx(le, { path: "instance", element: /* @__PURE__ */ e.jsx(bt, {}) })
|
|
1499
|
+
] });
|
|
1500
|
+
}
|
|
1501
|
+
export {
|
|
1502
|
+
re as D,
|
|
1503
|
+
_t as G,
|
|
1504
|
+
bt as I,
|
|
1505
|
+
et as a,
|
|
1506
|
+
se as b,
|
|
1507
|
+
Ct as c,
|
|
1508
|
+
Re as d,
|
|
1509
|
+
kt as f,
|
|
1510
|
+
$ as g,
|
|
1511
|
+
rt as i,
|
|
1512
|
+
e as j,
|
|
1513
|
+
vt as s
|
|
1514
|
+
};
|