@vitalens/panel 0.1.0 → 0.1.1
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/README.md +6 -2
- package/dist/PerfPanel.vue.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +787 -600
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +13 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/thresholds.d.ts +34 -0
- package/dist/utils/thresholds.d.ts.map +1 -0
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { computed as
|
|
2
|
-
import { LineChart as
|
|
3
|
-
import { GridComponent as
|
|
4
|
-
import { use as
|
|
5
|
-
import { CanvasRenderer as
|
|
6
|
-
const
|
|
1
|
+
import { computed as T, shallowRef as lt, ref as D, watch as j, onBeforeUnmount as xe, defineComponent as it, onMounted as ut, nextTick as ct, onErrorCaptured as pt, openBlock as p, createElementBlock as f, createElementVNode as s, toDisplayString as h, Fragment as U, normalizeClass as B, unref as F, createTextVNode as Me, createCommentVNode as W, createStaticVNode as ft, renderList as H, withDirectives as dt, vModelText as _t } from "vue";
|
|
2
|
+
import { LineChart as mt } from "echarts/charts";
|
|
3
|
+
import { GridComponent as vt, TooltipComponent as ht, LegendComponent as yt } from "echarts/components";
|
|
4
|
+
import { use as bt, init as gt } from "echarts/core";
|
|
5
|
+
import { CanvasRenderer as kt } from "echarts/renderers";
|
|
6
|
+
const Ne = 60 * 1e3, Pe = 60 * Ne, Tt = 2 * Pe, wt = 1e3, Ct = 5, Rt = /* @__PURE__ */ new Set([
|
|
7
7
|
"error",
|
|
8
8
|
"request",
|
|
9
9
|
"longTask",
|
|
10
10
|
"event",
|
|
11
11
|
"exposure"
|
|
12
12
|
]);
|
|
13
|
-
function
|
|
14
|
-
var
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
const
|
|
18
|
-
return (
|
|
13
|
+
function Z(a, o) {
|
|
14
|
+
var b;
|
|
15
|
+
const r = a.filter((C) => Number.isFinite(C)).sort((C, I) => C - I);
|
|
16
|
+
if (r.length === 0) return null;
|
|
17
|
+
const l = Math.min(r.length - 1, Math.max(0, Math.ceil(r.length * o) - 1));
|
|
18
|
+
return (b = r[l]) != null ? b : null;
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function St() {
|
|
21
21
|
return {
|
|
22
22
|
vital: 0,
|
|
23
23
|
error: 0,
|
|
@@ -29,397 +29,434 @@ function mt() {
|
|
|
29
29
|
exposure: 0
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
return
|
|
32
|
+
function ue(a) {
|
|
33
|
+
return a < 10 ? `0${a}` : String(a);
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
37
|
-
return
|
|
35
|
+
function Lt(a, o) {
|
|
36
|
+
const r = new Date(a), l = ue(r.getMonth() + 1), b = ue(r.getDate()), C = ue(r.getHours());
|
|
37
|
+
return o === "hour" ? `${l}-${b} ${C}:00` : `${C}:${ue(r.getMinutes())}`;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
let
|
|
41
|
-
for (const
|
|
42
|
-
Number.isFinite(
|
|
43
|
-
return !Number.isFinite(
|
|
39
|
+
function $t(a) {
|
|
40
|
+
let o = Number.POSITIVE_INFINITY, r = Number.NEGATIVE_INFINITY;
|
|
41
|
+
for (const l of a)
|
|
42
|
+
Number.isFinite(l.timestamp) && (l.timestamp < o && (o = l.timestamp), l.timestamp > r && (r = l.timestamp));
|
|
43
|
+
return !Number.isFinite(o) || !Number.isFinite(r) ? "minute" : r - o >= Tt ? "hour" : "minute";
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
return Array.from(
|
|
47
|
-
const
|
|
48
|
-
key:
|
|
49
|
-
label:
|
|
50
|
-
count:
|
|
45
|
+
function ve(a, o) {
|
|
46
|
+
return Array.from(a, ([r, l]) => {
|
|
47
|
+
const b = {
|
|
48
|
+
key: r,
|
|
49
|
+
label: l.label,
|
|
50
|
+
count: l.count
|
|
51
51
|
};
|
|
52
|
-
return
|
|
53
|
-
}).sort((
|
|
52
|
+
return l.totalDuration > 0 && l.count > 0 && (b.avgDurationMs = l.totalDuration / l.count), b;
|
|
53
|
+
}).sort((r, l) => l.count - r.count || r.label.localeCompare(l.label)).slice(0, o);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
return
|
|
55
|
+
function he(a) {
|
|
56
|
+
return a.type !== "error" ? 1 : a.count && a.count > 0 ? a.count : 1;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
59
|
-
var
|
|
60
|
-
const
|
|
61
|
-
const
|
|
58
|
+
function Mt(a) {
|
|
59
|
+
var P;
|
|
60
|
+
const o = Math.max(1, Math.trunc((P = a.topLimit) != null ? P : Ct)), r = T(() => {
|
|
61
|
+
const v = St(), _ = {
|
|
62
62
|
LCP: [],
|
|
63
63
|
INP: [],
|
|
64
64
|
CLS: [],
|
|
65
65
|
FCP: [],
|
|
66
66
|
TTFB: []
|
|
67
67
|
};
|
|
68
|
-
let
|
|
69
|
-
for (const
|
|
70
|
-
switch (
|
|
68
|
+
let d = 0, y = 0, g = 0, m = 0;
|
|
69
|
+
for (const w of a.records())
|
|
70
|
+
switch (v[w.type] += 1, m += 1, w.type) {
|
|
71
71
|
case "vital":
|
|
72
|
-
|
|
72
|
+
_[w.name].push(w.value);
|
|
73
73
|
break;
|
|
74
74
|
case "error":
|
|
75
|
-
|
|
75
|
+
d += he(w);
|
|
76
76
|
break;
|
|
77
77
|
case "request":
|
|
78
|
-
|
|
78
|
+
w.durationMs > wt && (y += 1);
|
|
79
79
|
break;
|
|
80
80
|
case "longTask":
|
|
81
|
-
|
|
81
|
+
g += 1;
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
84
84
|
const S = {
|
|
85
|
-
LCP:
|
|
86
|
-
INP:
|
|
87
|
-
CLS:
|
|
88
|
-
FCP:
|
|
89
|
-
TTFB:
|
|
85
|
+
LCP: Z(_.LCP, 0.75),
|
|
86
|
+
INP: Z(_.INP, 0.75),
|
|
87
|
+
CLS: Z(_.CLS, 0.75),
|
|
88
|
+
FCP: Z(_.FCP, 0.75),
|
|
89
|
+
TTFB: Z(_.TTFB, 0.75)
|
|
90
90
|
};
|
|
91
91
|
return {
|
|
92
|
-
total:
|
|
92
|
+
total: m,
|
|
93
93
|
vitals: S,
|
|
94
|
-
errors:
|
|
95
|
-
slowRequests:
|
|
96
|
-
longTasks:
|
|
97
|
-
byType:
|
|
94
|
+
errors: d,
|
|
95
|
+
slowRequests: y,
|
|
96
|
+
longTasks: g,
|
|
97
|
+
byType: v
|
|
98
98
|
};
|
|
99
|
-
}),
|
|
100
|
-
const
|
|
101
|
-
for (const
|
|
102
|
-
if (!Number.isFinite(
|
|
103
|
-
const S = Math.floor(
|
|
104
|
-
let
|
|
105
|
-
switch (
|
|
99
|
+
}), l = T(() => {
|
|
100
|
+
const v = a.records().filter((m) => Rt.has(m.type)), _ = $t(v), d = _ === "hour" ? Pe : Ne, y = /* @__PURE__ */ new Map();
|
|
101
|
+
for (const m of v) {
|
|
102
|
+
if (!Number.isFinite(m.timestamp)) continue;
|
|
103
|
+
const S = Math.floor(m.timestamp / d) * d;
|
|
104
|
+
let w = y.get(S);
|
|
105
|
+
switch (w || (w = {
|
|
106
106
|
bucket: S,
|
|
107
|
-
label:
|
|
107
|
+
label: Lt(S, _),
|
|
108
108
|
errors: 0,
|
|
109
109
|
requests: 0,
|
|
110
110
|
longTasks: 0,
|
|
111
111
|
events: 0
|
|
112
|
-
},
|
|
112
|
+
}, y.set(S, w)), m.type) {
|
|
113
113
|
case "error":
|
|
114
|
-
|
|
114
|
+
w.errors += he(m);
|
|
115
115
|
break;
|
|
116
116
|
case "request":
|
|
117
|
-
|
|
117
|
+
w.requests += 1;
|
|
118
118
|
break;
|
|
119
119
|
case "longTask":
|
|
120
|
-
|
|
120
|
+
w.longTasks += 1;
|
|
121
121
|
break;
|
|
122
122
|
case "event":
|
|
123
123
|
case "exposure":
|
|
124
|
-
|
|
124
|
+
w.events += 1;
|
|
125
125
|
break;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
const
|
|
129
|
-
return { granularity:
|
|
130
|
-
}),
|
|
131
|
-
var
|
|
132
|
-
const
|
|
133
|
-
for (const
|
|
134
|
-
if (
|
|
135
|
-
const
|
|
136
|
-
|
|
128
|
+
const g = Array.from(y.values()).sort((m, S) => m.bucket - S.bucket);
|
|
129
|
+
return { granularity: _, points: g };
|
|
130
|
+
}), b = T(() => l.value.points), C = T(() => l.value.granularity), I = T(() => {
|
|
131
|
+
var _;
|
|
132
|
+
const v = /* @__PURE__ */ new Map();
|
|
133
|
+
for (const d of a.records()) {
|
|
134
|
+
if (d.type !== "route") continue;
|
|
135
|
+
const y = d.to.path || d.to.fullPath || "(未知路由)", g = (_ = v.get(y)) != null ? _ : { label: y, count: 0, totalDuration: 0 };
|
|
136
|
+
g.count += 1, g.totalDuration += Number.isFinite(d.durationMs) ? d.durationMs : 0, v.set(y, g);
|
|
137
137
|
}
|
|
138
|
-
return
|
|
139
|
-
}),
|
|
140
|
-
var
|
|
141
|
-
const
|
|
142
|
-
for (const
|
|
143
|
-
if (
|
|
144
|
-
const
|
|
145
|
-
|
|
138
|
+
return ve(v, o);
|
|
139
|
+
}), R = T(() => {
|
|
140
|
+
var _;
|
|
141
|
+
const v = /* @__PURE__ */ new Map();
|
|
142
|
+
for (const d of a.records()) {
|
|
143
|
+
if (d.type !== "error") continue;
|
|
144
|
+
const y = d.fingerprint || d.message, g = d.message || d.name || "(未知错误)", m = (_ = v.get(y)) != null ? _ : { label: g, count: 0, totalDuration: 0 };
|
|
145
|
+
m.count += he(d), v.set(y, m);
|
|
146
146
|
}
|
|
147
|
-
return
|
|
148
|
-
}),
|
|
149
|
-
var
|
|
150
|
-
const
|
|
151
|
-
for (const
|
|
152
|
-
if (
|
|
153
|
-
const
|
|
154
|
-
|
|
147
|
+
return ve(v, o);
|
|
148
|
+
}), $ = T(() => {
|
|
149
|
+
var _;
|
|
150
|
+
const v = /* @__PURE__ */ new Map();
|
|
151
|
+
for (const d of a.records()) {
|
|
152
|
+
if (d.type !== "event" && d.type !== "exposure") continue;
|
|
153
|
+
const y = d.name || "(未命名事件)", g = (_ = v.get(y)) != null ? _ : { label: y, count: 0, totalDuration: 0 };
|
|
154
|
+
g.count += 1, v.set(y, g);
|
|
155
155
|
}
|
|
156
|
-
return
|
|
156
|
+
return ve(v, o);
|
|
157
157
|
});
|
|
158
158
|
return {
|
|
159
|
-
overview:
|
|
160
|
-
trend:
|
|
159
|
+
overview: r,
|
|
160
|
+
trend: b,
|
|
161
161
|
trendGranularity: C,
|
|
162
|
-
topRoutes:
|
|
163
|
-
topErrors:
|
|
164
|
-
topEvents:
|
|
162
|
+
topRoutes: I,
|
|
163
|
+
topErrors: R,
|
|
164
|
+
topEvents: $
|
|
165
165
|
};
|
|
166
166
|
}
|
|
167
|
-
const
|
|
168
|
-
function
|
|
169
|
-
return
|
|
167
|
+
const ye = 5e3, Ee = 1e3, Ie = 1e3, Et = 1e3;
|
|
168
|
+
function ee(a) {
|
|
169
|
+
return a instanceof Error ? a.message : String(a);
|
|
170
170
|
}
|
|
171
|
-
function
|
|
172
|
-
return
|
|
171
|
+
function It(a, o) {
|
|
172
|
+
return a.timestamp !== o.timestamp ? o.timestamp - a.timestamp : a.id === o.id ? 0 : a.id < o.id ? -1 : 1;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
175
|
-
const
|
|
176
|
-
return `vitalens-${
|
|
174
|
+
function xt(a) {
|
|
175
|
+
const o = a.replace(/[^\w-]+/g, "-") || "export", r = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
176
|
+
return `vitalens-${o}-${r}.json`;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function Nt(a, o) {
|
|
179
179
|
try {
|
|
180
180
|
if (typeof document == "undefined" || typeof URL == "undefined" || typeof URL.createObjectURL != "function") return;
|
|
181
|
-
const
|
|
182
|
-
|
|
181
|
+
const r = URL.createObjectURL(a), l = document.createElement("a");
|
|
182
|
+
l.href = r, l.download = xt(o), l.rel = "noopener", document.body.appendChild(l), l.click(), l.remove(), setTimeout(() => {
|
|
183
183
|
try {
|
|
184
|
-
typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(
|
|
184
|
+
typeof URL.revokeObjectURL == "function" && URL.revokeObjectURL(r);
|
|
185
185
|
} catch {
|
|
186
186
|
}
|
|
187
187
|
}, 0);
|
|
188
188
|
} catch {
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
const
|
|
193
|
-
let C = [],
|
|
194
|
-
function
|
|
195
|
-
const
|
|
196
|
-
for (const
|
|
197
|
-
|
|
191
|
+
function Pt(a) {
|
|
192
|
+
const o = lt([]), r = D(!1), l = D(""), b = D(!0);
|
|
193
|
+
let C = [], I = [], R = /* @__PURE__ */ new Map(), $ = [], P = !1, v = 0, _, d, y = !1;
|
|
194
|
+
function g() {
|
|
195
|
+
const i = a.appId(), u = /* @__PURE__ */ new Map(), k = (A) => {
|
|
196
|
+
for (const x of A)
|
|
197
|
+
i && x.appId !== i || Number.isFinite(x.timestamp) && u.set(x.id, x);
|
|
198
198
|
};
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
|
|
199
|
+
k(C), k(I), k(Array.from(R.values()));
|
|
200
|
+
const M = Array.from(u.values()).sort(It);
|
|
201
|
+
o.value = M.length > ye ? M.slice(0, ye) : M;
|
|
202
202
|
}
|
|
203
|
-
function
|
|
204
|
-
if (
|
|
205
|
-
const
|
|
206
|
-
let
|
|
207
|
-
for (const
|
|
208
|
-
if (
|
|
203
|
+
function m() {
|
|
204
|
+
if (R.size <= Ee) return;
|
|
205
|
+
const i = R.size - Ee;
|
|
206
|
+
let u = 0;
|
|
207
|
+
for (const k of R.keys())
|
|
208
|
+
if (R.delete(k), u += 1, u >= i) break;
|
|
209
209
|
}
|
|
210
210
|
function S() {
|
|
211
|
-
if (
|
|
212
|
-
for (const
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
if ($.length !== 0) {
|
|
212
|
+
for (const i of $)
|
|
213
|
+
R.delete(i.id), R.set(i.id, i);
|
|
214
|
+
$ = [], m(), g();
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
function
|
|
218
|
-
!
|
|
217
|
+
function w() {
|
|
218
|
+
!b.value || P || typeof document != "undefined" && document.visibilityState === "hidden" || S();
|
|
219
219
|
}
|
|
220
|
-
function
|
|
221
|
-
if (
|
|
222
|
-
const
|
|
223
|
-
|
|
220
|
+
function ce(i) {
|
|
221
|
+
if (i.length === 0) return;
|
|
222
|
+
const u = $.concat(i);
|
|
223
|
+
$ = u.length > Ie ? u.slice(u.length - Ie) : u;
|
|
224
224
|
}
|
|
225
|
-
function
|
|
226
|
-
typeof document != "undefined" && document.visibilityState === "visible" &&
|
|
225
|
+
function te() {
|
|
226
|
+
typeof document != "undefined" && document.visibilityState === "visible" && w();
|
|
227
227
|
}
|
|
228
|
-
function
|
|
229
|
-
const
|
|
230
|
-
if (!(!
|
|
228
|
+
function ne() {
|
|
229
|
+
const i = a.perf();
|
|
230
|
+
if (!(!i || _ || !b.value)) {
|
|
231
231
|
try {
|
|
232
|
-
|
|
233
|
-
|
|
232
|
+
_ = i.subscribe((u) => {
|
|
233
|
+
ce(u);
|
|
234
234
|
});
|
|
235
|
-
} catch (
|
|
236
|
-
|
|
235
|
+
} catch (u) {
|
|
236
|
+
l.value = `订阅实时数据失败:${ee(u)}`;
|
|
237
237
|
return;
|
|
238
238
|
}
|
|
239
|
-
|
|
239
|
+
d = setInterval(w, Et), typeof document != "undefined" && !y && (document.addEventListener("visibilitychange", te), y = !0);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
function
|
|
243
|
-
if (
|
|
242
|
+
function O() {
|
|
243
|
+
if (_) {
|
|
244
244
|
try {
|
|
245
|
-
|
|
245
|
+
_();
|
|
246
246
|
} catch {
|
|
247
247
|
}
|
|
248
|
-
|
|
248
|
+
_ = void 0;
|
|
249
249
|
}
|
|
250
|
-
|
|
250
|
+
d !== void 0 && (clearInterval(d), d = void 0), typeof document != "undefined" && y && (document.removeEventListener("visibilitychange", te), y = !1);
|
|
251
251
|
}
|
|
252
|
-
async function
|
|
253
|
-
const
|
|
254
|
-
|
|
252
|
+
async function q() {
|
|
253
|
+
const i = ++v;
|
|
254
|
+
r.value = !0;
|
|
255
255
|
try {
|
|
256
|
-
const
|
|
257
|
-
if (!
|
|
258
|
-
if (
|
|
259
|
-
C = [],
|
|
256
|
+
const u = a.perf();
|
|
257
|
+
if (!u) {
|
|
258
|
+
if (i !== v) return;
|
|
259
|
+
C = [], l.value = "";
|
|
260
260
|
return;
|
|
261
261
|
}
|
|
262
|
-
const
|
|
263
|
-
if (
|
|
264
|
-
C =
|
|
265
|
-
} catch (
|
|
266
|
-
if (
|
|
267
|
-
|
|
262
|
+
const k = { order: "desc", limit: ye }, M = await u.query(k);
|
|
263
|
+
if (i !== v) return;
|
|
264
|
+
C = M, l.value = "";
|
|
265
|
+
} catch (u) {
|
|
266
|
+
if (i !== v) return;
|
|
267
|
+
l.value = `读取本地数据失败:${ee(u)}`;
|
|
268
268
|
} finally {
|
|
269
|
-
|
|
269
|
+
i === v && (r.value = !1, g());
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
function L(
|
|
273
|
-
if (
|
|
274
|
-
if (!
|
|
275
|
-
S(),
|
|
272
|
+
function L(i) {
|
|
273
|
+
if (i !== b.value) {
|
|
274
|
+
if (!i) {
|
|
275
|
+
S(), b.value = !1, O();
|
|
276
276
|
return;
|
|
277
277
|
}
|
|
278
|
-
|
|
278
|
+
b.value = !0, a.perf() && (ne(), q());
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
async function
|
|
282
|
-
const
|
|
283
|
-
if (!
|
|
284
|
-
return
|
|
285
|
-
|
|
281
|
+
async function G(i) {
|
|
282
|
+
const u = a.perf();
|
|
283
|
+
if (!u)
|
|
284
|
+
return l.value = "缺少 perf 实例,无法导入", 0;
|
|
285
|
+
P = !0, r.value = !0;
|
|
286
286
|
try {
|
|
287
|
-
const
|
|
288
|
-
return await
|
|
289
|
-
} catch (
|
|
290
|
-
return
|
|
287
|
+
const k = await u.importAll(i);
|
|
288
|
+
return await q(), k;
|
|
289
|
+
} catch (k) {
|
|
290
|
+
return l.value = `导入失败:${ee(k)}`, 0;
|
|
291
291
|
} finally {
|
|
292
|
-
|
|
292
|
+
P = !1, r.value = !1;
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
async function
|
|
296
|
-
var
|
|
295
|
+
async function V() {
|
|
296
|
+
var i, u, k, M;
|
|
297
297
|
try {
|
|
298
|
-
const
|
|
299
|
-
let
|
|
300
|
-
if (
|
|
301
|
-
|
|
298
|
+
const A = a.perf();
|
|
299
|
+
let x;
|
|
300
|
+
if (A)
|
|
301
|
+
x = await A.exportAll();
|
|
302
302
|
else {
|
|
303
|
-
const
|
|
303
|
+
const fe = {
|
|
304
304
|
formatVersion: 1,
|
|
305
|
-
appId: (
|
|
305
|
+
appId: (i = a.appId()) != null ? i : "",
|
|
306
306
|
exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
307
|
-
records:
|
|
307
|
+
records: o.value
|
|
308
308
|
};
|
|
309
|
-
|
|
309
|
+
x = new Blob([JSON.stringify(fe, null, 2)], { type: "application/json" });
|
|
310
310
|
}
|
|
311
|
-
const
|
|
312
|
-
return
|
|
313
|
-
} catch (
|
|
314
|
-
return
|
|
311
|
+
const pe = (M = (k = a.appId()) != null ? k : (u = a.perf()) == null ? void 0 : u.config.appId) != null ? M : "export";
|
|
312
|
+
return Nt(x, pe), x;
|
|
313
|
+
} catch (A) {
|
|
314
|
+
return l.value = `导出失败:${ee(A)}`, null;
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
|
-
async function
|
|
318
|
-
const
|
|
319
|
-
if (!
|
|
320
|
-
return
|
|
321
|
-
|
|
317
|
+
async function ae() {
|
|
318
|
+
const i = a.perf();
|
|
319
|
+
if (!i)
|
|
320
|
+
return l.value = "缺少 perf 实例,无法清空", !1;
|
|
321
|
+
r.value = !0;
|
|
322
322
|
try {
|
|
323
|
-
return await
|
|
324
|
-
} catch (
|
|
325
|
-
return
|
|
323
|
+
return await i.clear(), C = [], R = /* @__PURE__ */ new Map(), $ = [], l.value = "", g(), !0;
|
|
324
|
+
} catch (u) {
|
|
325
|
+
return l.value = `清空失败:${ee(u)}`, !1;
|
|
326
326
|
} finally {
|
|
327
|
-
|
|
327
|
+
r.value = !1;
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
|
-
return
|
|
331
|
-
() =>
|
|
332
|
-
(
|
|
333
|
-
|
|
330
|
+
return j(
|
|
331
|
+
() => a.perf(),
|
|
332
|
+
(i, u) => {
|
|
333
|
+
i !== u && (O(), $ = [], R = /* @__PURE__ */ new Map(), i ? (b.value && ne(), q()) : (C = [], g()));
|
|
334
334
|
},
|
|
335
335
|
{ immediate: !0 }
|
|
336
|
-
),
|
|
337
|
-
() =>
|
|
338
|
-
(
|
|
339
|
-
|
|
336
|
+
), j(
|
|
337
|
+
() => a.records(),
|
|
338
|
+
(i) => {
|
|
339
|
+
I = i != null ? i : [], g();
|
|
340
340
|
},
|
|
341
341
|
{ immediate: !0 }
|
|
342
|
-
),
|
|
343
|
-
() =>
|
|
342
|
+
), j(
|
|
343
|
+
() => a.appId(),
|
|
344
344
|
() => {
|
|
345
|
-
|
|
345
|
+
g();
|
|
346
346
|
}
|
|
347
|
-
),
|
|
348
|
-
|
|
347
|
+
), xe(() => {
|
|
348
|
+
O(), $ = [], R = /* @__PURE__ */ new Map(), C = [], I = [];
|
|
349
349
|
}), {
|
|
350
|
-
records:
|
|
351
|
-
loading:
|
|
352
|
-
error:
|
|
353
|
-
realtime:
|
|
354
|
-
refresh:
|
|
355
|
-
importFile:
|
|
356
|
-
exportFile:
|
|
357
|
-
clearLocal:
|
|
350
|
+
records: o,
|
|
351
|
+
loading: r,
|
|
352
|
+
error: l,
|
|
353
|
+
realtime: b,
|
|
354
|
+
refresh: q,
|
|
355
|
+
importFile: G,
|
|
356
|
+
exportFile: V,
|
|
357
|
+
clearLocal: ae,
|
|
358
358
|
setRealtime: L
|
|
359
359
|
};
|
|
360
360
|
}
|
|
361
|
-
const
|
|
361
|
+
const Ft = 1e3, Ot = 1e3, At = 2e3, Fe = {
|
|
362
|
+
LCP: { good: 2500, warn: 4e3, unit: "ms", hint: "≤2500ms 良好 / ≤4000ms 预警" },
|
|
363
|
+
INP: { good: 200, warn: 500, unit: "ms", hint: "≤200ms 良好 / ≤500ms 预警" },
|
|
364
|
+
CLS: { good: 0.1, warn: 0.25, unit: "", hint: "≤0.1 良好 / ≤0.25 预警" },
|
|
365
|
+
FCP: { good: 1800, warn: 3e3, unit: "ms", hint: "≤1800ms 良好 / ≤3000ms 预警" },
|
|
366
|
+
TTFB: { good: 800, warn: 1800, unit: "ms", hint: "≤800ms 良好 / ≤1800ms 预警" }
|
|
367
|
+
};
|
|
368
|
+
function Dt(a, o, r) {
|
|
369
|
+
return a === null || !Number.isFinite(a) ? "neutral" : a <= o ? "good" : a <= r ? "warn" : "poor";
|
|
370
|
+
}
|
|
371
|
+
function qt(a, o) {
|
|
372
|
+
const r = Fe[a];
|
|
373
|
+
return Dt(o, r.good, r.warn);
|
|
374
|
+
}
|
|
375
|
+
function Ut(a) {
|
|
376
|
+
return a === void 0 || !Number.isFinite(a) ? "neutral" : a >= 400 ? "poor" : "good";
|
|
377
|
+
}
|
|
378
|
+
function Vt(a) {
|
|
379
|
+
return !a.success || a.status !== void 0 && Number.isFinite(a.status) && a.status >= 400 ? "poor" : a.durationMs >= Ft ? "warn" : "good";
|
|
380
|
+
}
|
|
381
|
+
function zt(a) {
|
|
382
|
+
return a.durationMs >= Ot ? "warn" : "good";
|
|
383
|
+
}
|
|
384
|
+
function Bt(a) {
|
|
385
|
+
var o;
|
|
386
|
+
return a.failed ? "poor" : ((o = a.durationMs) != null ? o : 0) >= At ? "warn" : "good";
|
|
387
|
+
}
|
|
388
|
+
const Ht = {
|
|
362
389
|
class: "perf-panel",
|
|
363
390
|
"aria-label": "性能面板"
|
|
364
|
-
},
|
|
391
|
+
}, jt = {
|
|
365
392
|
key: 0,
|
|
366
393
|
class: "perf-panel__fallback",
|
|
367
394
|
role: "alert"
|
|
368
|
-
},
|
|
395
|
+
}, Gt = { class: "perf-panel__fallback-text" }, Wt = { class: "perf-panel__header" }, Yt = { class: "perf-panel__heading" }, Qt = { class: "perf-panel__title-row" }, Jt = { class: "perf-panel__subtitle" }, Xt = ["data-realtime"], Kt = { class: "perf-panel__subtitle-item" }, Zt = { class: "perf-panel__subtitle-item" }, en = {
|
|
396
|
+
key: 0,
|
|
397
|
+
class: "perf-panel__subtitle-item perf-panel__subtitle-item--loading"
|
|
398
|
+
}, tn = { class: "perf-panel__actions" }, nn = {
|
|
399
|
+
class: "perf-panel__action-group",
|
|
400
|
+
role: "group",
|
|
401
|
+
"aria-label": "刷新与导出"
|
|
402
|
+
}, an = ["disabled"], sn = {
|
|
403
|
+
class: "perf-panel__action-group",
|
|
404
|
+
role: "group",
|
|
405
|
+
"aria-label": "导入与清空"
|
|
406
|
+
}, rn = ["disabled"], on = ["disabled"], ln = { class: "perf-panel__switch" }, un = ["checked", "disabled"], cn = {
|
|
369
407
|
key: 0,
|
|
370
|
-
class: "perf-panel__status",
|
|
371
|
-
role: "status"
|
|
372
|
-
}, Nt = {
|
|
373
|
-
key: 1,
|
|
374
408
|
class: "perf-panel__notice",
|
|
375
409
|
role: "alert"
|
|
376
|
-
},
|
|
377
|
-
key:
|
|
410
|
+
}, pn = {
|
|
411
|
+
key: 1,
|
|
378
412
|
class: "perf-panel__empty"
|
|
379
|
-
},
|
|
380
|
-
key:
|
|
413
|
+
}, fn = {
|
|
414
|
+
key: 2,
|
|
381
415
|
class: "perf-panel__empty"
|
|
382
|
-
},
|
|
416
|
+
}, dn = {
|
|
383
417
|
class: "perf-panel__section",
|
|
384
418
|
"aria-label": "概览"
|
|
385
|
-
},
|
|
419
|
+
}, _n = { class: "perf-panel__overview" }, mn = ["data-metric", "data-tone"], vn = { class: "perf-panel__card-head" }, hn = { class: "perf-panel__card-label" }, yn = { class: "perf-panel__card-body" }, bn = { class: "perf-panel__card-value" }, gn = {
|
|
386
420
|
key: 0,
|
|
387
421
|
class: "perf-panel__card-unit"
|
|
388
|
-
},
|
|
422
|
+
}, kn = { class: "perf-panel__card-hint" }, Tn = {
|
|
389
423
|
class: "perf-panel__section",
|
|
390
424
|
"aria-label": "趋势"
|
|
391
|
-
},
|
|
425
|
+
}, wn = { class: "perf-panel__section-head" }, Cn = { class: "perf-panel__section-title-group" }, Rn = { class: "perf-panel__section-meta" }, Sn = { class: "perf-panel__section-meta" }, Ln = { class: "perf-panel__chart-wrap" }, $n = {
|
|
392
426
|
key: 0,
|
|
393
427
|
class: "perf-panel__chart-empty"
|
|
394
|
-
},
|
|
428
|
+
}, Mn = {
|
|
395
429
|
key: 0,
|
|
396
430
|
class: "perf-panel__notice"
|
|
397
|
-
},
|
|
431
|
+
}, En = {
|
|
398
432
|
class: "perf-panel__section",
|
|
399
433
|
"aria-label": "Top 排行"
|
|
400
|
-
},
|
|
434
|
+
}, In = { class: "perf-panel__top-grid" }, xn = { class: "perf-panel__top-title" }, Nn = {
|
|
401
435
|
key: 0,
|
|
402
436
|
class: "perf-panel__top-list"
|
|
403
|
-
},
|
|
437
|
+
}, Pn = ["title"], Fn = { class: "perf-panel__top-count" }, On = {
|
|
404
438
|
key: 1,
|
|
405
439
|
class: "perf-panel__top-empty"
|
|
406
|
-
},
|
|
407
|
-
class: "perf-panel__section
|
|
440
|
+
}, An = {
|
|
441
|
+
class: "perf-panel__section",
|
|
408
442
|
"aria-label": "明细"
|
|
409
|
-
},
|
|
443
|
+
}, Dn = { class: "perf-panel__details-head" }, qn = { class: "perf-panel__section-title-group" }, Un = { class: "perf-panel__section-meta" }, Vn = {
|
|
410
444
|
class: "perf-panel__tabs",
|
|
411
445
|
role: "tablist",
|
|
412
446
|
"aria-label": "明细分类"
|
|
413
|
-
},
|
|
447
|
+
}, zn = ["aria-selected", "data-tab", "onClick"], Bn = { class: "perf-panel__tab-count" }, Hn = { class: "perf-panel__table-wrap" }, jn = {
|
|
414
448
|
key: 0,
|
|
415
449
|
class: "perf-panel__table"
|
|
416
|
-
},
|
|
450
|
+
}, Gn = ["data-column"], Wn = ["data-column", "data-tone", "title"], Yn = {
|
|
417
451
|
key: 1,
|
|
418
|
-
class: "perf-
|
|
419
|
-
},
|
|
452
|
+
class: "perf-panel__cell-text"
|
|
453
|
+
}, Qn = {
|
|
454
|
+
key: 1,
|
|
455
|
+
class: "perf-panel__empty perf-panel__empty--inline"
|
|
456
|
+
}, Jn = {
|
|
420
457
|
key: 0,
|
|
421
458
|
class: "perf-panel__pagination"
|
|
422
|
-
},
|
|
459
|
+
}, Xn = { class: "perf-panel__pagination-info" }, Kn = { class: "perf-panel__pagination-actions" }, Zn = ["disabled"], ea = ["disabled"], be = 20, ta = /* @__PURE__ */ it({
|
|
423
460
|
name: "PerfPanel",
|
|
424
461
|
__name: "PerfPanel",
|
|
425
462
|
props: {
|
|
@@ -427,15 +464,15 @@ const Tt = {
|
|
|
427
464
|
records: { default: () => [] },
|
|
428
465
|
appId: {}
|
|
429
466
|
},
|
|
430
|
-
setup(
|
|
431
|
-
const
|
|
432
|
-
|
|
433
|
-
const
|
|
467
|
+
setup(a) {
|
|
468
|
+
const o = a;
|
|
469
|
+
bt([mt, vt, ht, yt, kt]);
|
|
470
|
+
const r = ["#d54941", "#3f6ad8", "#c87f2c", "#2f8f6b"], l = [
|
|
434
471
|
"--perf-panel-chart-error",
|
|
435
472
|
"--perf-panel-chart-request",
|
|
436
473
|
"--perf-panel-chart-long-task",
|
|
437
474
|
"--perf-panel-chart-event"
|
|
438
|
-
],
|
|
475
|
+
], b = {
|
|
439
476
|
error: ["error"],
|
|
440
477
|
request: ["request"],
|
|
441
478
|
route: ["route"],
|
|
@@ -447,9 +484,11 @@ const Tt = {
|
|
|
447
484
|
label: "错误",
|
|
448
485
|
columns: [
|
|
449
486
|
{ key: "time", label: "时间" },
|
|
450
|
-
{ key: "source", label: "来源" },
|
|
487
|
+
{ key: "source", label: "来源", kind: "chip" },
|
|
451
488
|
{ key: "name", label: "名称" },
|
|
452
|
-
{ key: "message", label: "消息" }
|
|
489
|
+
{ key: "message", label: "消息" },
|
|
490
|
+
{ key: "route", label: "路由" },
|
|
491
|
+
{ key: "component", label: "组件" }
|
|
453
492
|
]
|
|
454
493
|
},
|
|
455
494
|
{
|
|
@@ -457,10 +496,12 @@ const Tt = {
|
|
|
457
496
|
label: "请求",
|
|
458
497
|
columns: [
|
|
459
498
|
{ key: "time", label: "时间" },
|
|
460
|
-
{ key: "method", label: "方法" },
|
|
461
|
-
{ key: "url", label: "URL" },
|
|
462
|
-
{ key: "
|
|
463
|
-
{ key: "
|
|
499
|
+
{ key: "method", label: "方法", kind: "chip" },
|
|
500
|
+
{ key: "url", label: "URL", kind: "mono" },
|
|
501
|
+
{ key: "query", label: "Query", kind: "mono" },
|
|
502
|
+
{ key: "status", label: "状态", kind: "chip" },
|
|
503
|
+
{ key: "duration", label: "耗时" },
|
|
504
|
+
{ key: "result", label: "结果", kind: "chip" }
|
|
464
505
|
]
|
|
465
506
|
},
|
|
466
507
|
{
|
|
@@ -470,7 +511,7 @@ const Tt = {
|
|
|
470
511
|
{ key: "time", label: "时间" },
|
|
471
512
|
{ key: "from", label: "来源" },
|
|
472
513
|
{ key: "to", label: "目标" },
|
|
473
|
-
{ key: "navigation", label: "类型" },
|
|
514
|
+
{ key: "navigation", label: "类型", kind: "chip" },
|
|
474
515
|
{ key: "duration", label: "耗时" }
|
|
475
516
|
]
|
|
476
517
|
},
|
|
@@ -479,11 +520,10 @@ const Tt = {
|
|
|
479
520
|
label: "资源",
|
|
480
521
|
columns: [
|
|
481
522
|
{ key: "time", label: "时间" },
|
|
482
|
-
{ key: "url", label: "URL" },
|
|
523
|
+
{ key: "url", label: "URL", kind: "mono" },
|
|
483
524
|
{ key: "initiator", label: "发起方" },
|
|
484
|
-
{ key: "status", label: "状态" },
|
|
485
525
|
{ key: "duration", label: "耗时" },
|
|
486
|
-
{ key: "result", label: "结果" }
|
|
526
|
+
{ key: "result", label: "结果", kind: "chip" }
|
|
487
527
|
]
|
|
488
528
|
},
|
|
489
529
|
{
|
|
@@ -491,193 +531,261 @@ const Tt = {
|
|
|
491
531
|
label: "埋点",
|
|
492
532
|
columns: [
|
|
493
533
|
{ key: "time", label: "时间" },
|
|
494
|
-
{ key: "kind", label: "类型" },
|
|
534
|
+
{ key: "kind", label: "类型", kind: "chip" },
|
|
495
535
|
{ key: "name", label: "名称" },
|
|
496
|
-
{ key: "source", label: "来源" },
|
|
497
|
-
{ key: "
|
|
536
|
+
{ key: "source", label: "来源", kind: "chip" },
|
|
537
|
+
{ key: "route", label: "路由" },
|
|
538
|
+
{ key: "props", label: "属性", kind: "mono" }
|
|
498
539
|
]
|
|
499
540
|
}
|
|
500
541
|
], {
|
|
501
|
-
records:
|
|
502
|
-
loading:
|
|
503
|
-
error:
|
|
504
|
-
realtime:
|
|
505
|
-
refresh:
|
|
506
|
-
importFile:
|
|
507
|
-
exportFile:
|
|
508
|
-
clearLocal:
|
|
509
|
-
setRealtime:
|
|
510
|
-
} =
|
|
511
|
-
perf: () =>
|
|
512
|
-
records: () =>
|
|
513
|
-
appId: () =>
|
|
514
|
-
}), { overview:
|
|
515
|
-
records: () =>
|
|
516
|
-
}),
|
|
517
|
-
let
|
|
518
|
-
const
|
|
519
|
-
|
|
542
|
+
records: I,
|
|
543
|
+
loading: R,
|
|
544
|
+
error: $,
|
|
545
|
+
realtime: P,
|
|
546
|
+
refresh: v,
|
|
547
|
+
importFile: _,
|
|
548
|
+
exportFile: d,
|
|
549
|
+
clearLocal: y,
|
|
550
|
+
setRealtime: g
|
|
551
|
+
} = Pt({
|
|
552
|
+
perf: () => o.perf,
|
|
553
|
+
records: () => o.records,
|
|
554
|
+
appId: () => o.appId
|
|
555
|
+
}), { overview: m, trend: S, trendGranularity: w, topRoutes: ce, topErrors: te, topEvents: ne } = Mt({
|
|
556
|
+
records: () => I.value
|
|
557
|
+
}), O = D("error"), q = D(""), L = D(1), G = D(""), V = D(""), ae = D(null), i = D(null);
|
|
558
|
+
let u = null, k = null, M = !1;
|
|
559
|
+
const A = T(() => I.value.length), x = T(() => o.perf ? "本地数据" : "注入数据"), pe = T(() => o.perf ? P.value ? "实时已开启" : "实时已暂停" : "实时不可用"), fe = T(() => o.perf && P.value ? "perf-panel__dot--good" : "perf-panel__dot--neutral");
|
|
560
|
+
function Y(e, n) {
|
|
561
|
+
const t = Fe[e];
|
|
562
|
+
return {
|
|
563
|
+
key: e,
|
|
564
|
+
label: `${e} p75`,
|
|
565
|
+
value: Ve(e, n),
|
|
566
|
+
unit: t.unit,
|
|
567
|
+
tone: qt(e, n),
|
|
568
|
+
hint: t.hint
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
const Oe = T(() => {
|
|
572
|
+
const e = m.value.vitals, n = m.value.byType.request, t = m.value.total === 0 ? "neutral" : m.value.errors > 0 ? "poor" : "good", c = n === 0 ? "neutral" : m.value.slowRequests > 0 ? "warn" : "good", z = m.value.longTasks > 0 ? "warn" : "neutral";
|
|
520
573
|
return [
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
{
|
|
527
|
-
|
|
528
|
-
|
|
574
|
+
Y("LCP", e.LCP),
|
|
575
|
+
Y("INP", e.INP),
|
|
576
|
+
Y("CLS", e.CLS),
|
|
577
|
+
Y("FCP", e.FCP),
|
|
578
|
+
Y("TTFB", e.TTFB),
|
|
579
|
+
{
|
|
580
|
+
key: "errors",
|
|
581
|
+
label: "错误数",
|
|
582
|
+
value: String(m.value.errors),
|
|
583
|
+
unit: "条",
|
|
584
|
+
tone: t,
|
|
585
|
+
hint: ">0 标红"
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
key: "slowRequests",
|
|
589
|
+
label: "慢请求",
|
|
590
|
+
value: String(m.value.slowRequests),
|
|
591
|
+
unit: "条",
|
|
592
|
+
tone: c,
|
|
593
|
+
hint: "≥1000ms 标橙"
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
key: "longTasks",
|
|
597
|
+
label: "长任务",
|
|
598
|
+
value: String(m.value.longTasks),
|
|
599
|
+
unit: "个",
|
|
600
|
+
tone: z,
|
|
601
|
+
hint: "≥50ms 标橙"
|
|
602
|
+
}
|
|
529
603
|
];
|
|
530
|
-
}),
|
|
531
|
-
{ key: "routes", title: "Top 路由", items:
|
|
532
|
-
{ key: "errors", title: "Top 错误", items:
|
|
533
|
-
{ key: "events", title: "Top 埋点", items:
|
|
534
|
-
]),
|
|
535
|
-
const e =
|
|
536
|
-
return
|
|
537
|
-
}),
|
|
538
|
-
const e = (L.value - 1) *
|
|
539
|
-
return
|
|
540
|
-
}),
|
|
604
|
+
}), Ae = T(() => [
|
|
605
|
+
{ key: "routes", title: "Top 路由", items: ce.value },
|
|
606
|
+
{ key: "errors", title: "Top 错误", items: te.value },
|
|
607
|
+
{ key: "events", title: "Top 埋点", items: ne.value }
|
|
608
|
+
]), De = T(() => b[O.value]), qe = T(() => {
|
|
609
|
+
const e = De.value, n = q.value.trim().toLowerCase();
|
|
610
|
+
return I.value.filter((t) => e.includes(t.type) ? n.length === 0 ? !0 : ze(t).toLowerCase().includes(n) : !1);
|
|
611
|
+
}), ge = T(() => qe.value.map(Be)), se = T(() => ge.value.length), re = T(() => Math.max(1, Math.ceil(se.value / be))), ke = T(() => {
|
|
612
|
+
const e = (L.value - 1) * be;
|
|
613
|
+
return ge.value.slice(e, e + be);
|
|
614
|
+
}), Te = T(
|
|
541
615
|
() => {
|
|
542
|
-
var e,
|
|
543
|
-
return (
|
|
616
|
+
var e, n;
|
|
617
|
+
return (n = (e = C.find((t) => t.tab === O.value)) == null ? void 0 : e.columns) != null ? n : [];
|
|
544
618
|
}
|
|
545
619
|
);
|
|
546
|
-
function
|
|
620
|
+
function oe(e) {
|
|
547
621
|
return e instanceof Error ? e.message : String(e);
|
|
548
622
|
}
|
|
549
|
-
function
|
|
623
|
+
function Q(e) {
|
|
550
624
|
return e < 10 ? `0${e}` : String(e);
|
|
551
625
|
}
|
|
552
|
-
function
|
|
626
|
+
function Ue(e) {
|
|
553
627
|
if (!Number.isFinite(e)) return "—";
|
|
554
|
-
const
|
|
555
|
-
return `${
|
|
628
|
+
const n = new Date(e), t = Q(n.getMonth() + 1), c = Q(n.getDate());
|
|
629
|
+
return `${t}-${c} ${Q(n.getHours())}:${Q(n.getMinutes())}:${Q(n.getSeconds())}`;
|
|
556
630
|
}
|
|
557
|
-
function
|
|
631
|
+
function le(e) {
|
|
558
632
|
return Number.isFinite(e) ? e >= 1e3 ? `${(e / 1e3).toFixed(2)} s` : `${Math.round(e)} ms` : "—";
|
|
559
633
|
}
|
|
560
|
-
function
|
|
561
|
-
return
|
|
634
|
+
function Ve(e, n) {
|
|
635
|
+
return n === null || !Number.isFinite(n) ? "—" : e === "CLS" ? n.toFixed(3) : String(Math.round(n));
|
|
562
636
|
}
|
|
563
|
-
function
|
|
637
|
+
function N(e) {
|
|
564
638
|
return e && (e.path || e.fullPath || e.name) || "—";
|
|
565
639
|
}
|
|
566
|
-
function
|
|
640
|
+
function we(e) {
|
|
641
|
+
if (!e) return "—";
|
|
642
|
+
const n = Object.entries(e);
|
|
643
|
+
return n.length === 0 ? "—" : n.map(([t, c]) => `${t}=${c}`).join("&");
|
|
644
|
+
}
|
|
645
|
+
function ie(e) {
|
|
567
646
|
if (!e) return "—";
|
|
568
647
|
try {
|
|
569
|
-
const
|
|
570
|
-
return typeof
|
|
648
|
+
const n = JSON.stringify(e);
|
|
649
|
+
return typeof n == "string" ? n : "—";
|
|
571
650
|
} catch {
|
|
572
651
|
return "[无法序列化]";
|
|
573
652
|
}
|
|
574
653
|
}
|
|
575
|
-
function
|
|
576
|
-
var t,
|
|
654
|
+
function ze(e) {
|
|
655
|
+
var n, t, c, z, J, X, K, E;
|
|
577
656
|
switch (e.type) {
|
|
578
657
|
case "vital":
|
|
579
658
|
return `${e.name} ${e.value}`;
|
|
580
659
|
case "error":
|
|
581
|
-
return `${e.message} ${(
|
|
660
|
+
return `${e.message} ${(n = e.name) != null ? n : ""} ${e.source} ${e.fingerprint} ${(t = e.component) != null ? t : ""} ${(c = e.stack) != null ? c : ""} ${N(e.route)}`;
|
|
582
661
|
case "request":
|
|
583
|
-
return `${e.method} ${e.url} ${(
|
|
662
|
+
return `${e.method} ${e.url} ${we(e.query)} ${(z = e.status) != null ? z : ""}`;
|
|
584
663
|
case "route":
|
|
585
|
-
return `${
|
|
664
|
+
return `${N(e.to)} ${N(e.from)}`;
|
|
586
665
|
case "resource":
|
|
587
|
-
return `${e.url} ${(
|
|
666
|
+
return `${e.url} ${(J = e.initiatorType) != null ? J : ""}`;
|
|
588
667
|
case "longTask":
|
|
589
|
-
return `${(
|
|
668
|
+
return `${(X = e.name) != null ? X : ""} ${e.durationMs}`;
|
|
590
669
|
case "event":
|
|
591
|
-
return `${e.name} ${(
|
|
670
|
+
return `${e.name} ${(K = e.source) != null ? K : ""} ${N(e.route)} ${ie(e.props)}`;
|
|
592
671
|
case "exposure":
|
|
593
|
-
return `${e.name} ${(
|
|
672
|
+
return `${e.name} ${(E = e.target) != null ? E : ""} ${N(e.route)} ${ie(e.props)}`;
|
|
594
673
|
}
|
|
595
674
|
}
|
|
596
|
-
function
|
|
597
|
-
var
|
|
598
|
-
const
|
|
675
|
+
function Be(e) {
|
|
676
|
+
var t, c, z, J, X, K;
|
|
677
|
+
const n = Ue(e.timestamp);
|
|
599
678
|
switch (e.type) {
|
|
600
679
|
case "error":
|
|
601
680
|
return {
|
|
602
681
|
id: e.id,
|
|
603
682
|
timestamp: e.timestamp,
|
|
604
683
|
cells: {
|
|
605
|
-
time:
|
|
684
|
+
time: n,
|
|
606
685
|
source: e.source,
|
|
607
|
-
name: (
|
|
608
|
-
message: e.message
|
|
609
|
-
|
|
686
|
+
name: (t = e.name) != null ? t : "—",
|
|
687
|
+
message: e.message,
|
|
688
|
+
route: N(e.route),
|
|
689
|
+
component: (c = e.component) != null ? c : "—"
|
|
690
|
+
},
|
|
691
|
+
tones: { message: "poor", name: "poor" },
|
|
692
|
+
rowTone: "poor"
|
|
610
693
|
};
|
|
611
|
-
case "request":
|
|
694
|
+
case "request": {
|
|
695
|
+
const E = Vt(e);
|
|
612
696
|
return {
|
|
613
697
|
id: e.id,
|
|
614
698
|
timestamp: e.timestamp,
|
|
615
699
|
cells: {
|
|
616
|
-
time:
|
|
700
|
+
time: n,
|
|
617
701
|
method: e.method,
|
|
618
702
|
url: e.url,
|
|
703
|
+
query: we(e.query),
|
|
619
704
|
status: e.status === void 0 ? "—" : String(e.status),
|
|
620
|
-
duration:
|
|
621
|
-
|
|
705
|
+
duration: le(e.durationMs),
|
|
706
|
+
result: e.success ? "成功" : "失败"
|
|
707
|
+
},
|
|
708
|
+
tones: {
|
|
709
|
+
status: Ut(e.status),
|
|
710
|
+
duration: E,
|
|
711
|
+
result: e.success ? "good" : "poor"
|
|
712
|
+
},
|
|
713
|
+
rowTone: E === "poor" ? "poor" : E === "warn" ? "warn" : void 0
|
|
622
714
|
};
|
|
623
|
-
|
|
715
|
+
}
|
|
716
|
+
case "route": {
|
|
717
|
+
const E = zt(e);
|
|
624
718
|
return {
|
|
625
719
|
id: e.id,
|
|
626
720
|
timestamp: e.timestamp,
|
|
627
721
|
cells: {
|
|
628
|
-
time:
|
|
629
|
-
from:
|
|
630
|
-
to:
|
|
722
|
+
time: n,
|
|
723
|
+
from: N(e.from),
|
|
724
|
+
to: N(e.to),
|
|
631
725
|
navigation: e.navigation === "initial" ? "首次" : "SPA",
|
|
632
|
-
duration:
|
|
633
|
-
}
|
|
726
|
+
duration: le(e.durationMs)
|
|
727
|
+
},
|
|
728
|
+
tones: { duration: E },
|
|
729
|
+
rowTone: E === "warn" ? "warn" : void 0
|
|
634
730
|
};
|
|
635
|
-
|
|
731
|
+
}
|
|
732
|
+
case "resource": {
|
|
733
|
+
const E = Bt(e);
|
|
636
734
|
return {
|
|
637
735
|
id: e.id,
|
|
638
736
|
timestamp: e.timestamp,
|
|
639
737
|
cells: {
|
|
640
|
-
time:
|
|
738
|
+
time: n,
|
|
641
739
|
url: e.url,
|
|
642
|
-
initiator: (
|
|
643
|
-
|
|
644
|
-
duration: e.durationMs === void 0 ? "—" : ne(e.durationMs),
|
|
740
|
+
initiator: (z = e.initiatorType) != null ? z : "—",
|
|
741
|
+
duration: e.durationMs === void 0 ? "—" : le(e.durationMs),
|
|
645
742
|
result: e.failed ? "失败" : "成功"
|
|
646
|
-
}
|
|
743
|
+
},
|
|
744
|
+
tones: {
|
|
745
|
+
duration: E,
|
|
746
|
+
result: e.failed ? "poor" : "good"
|
|
747
|
+
},
|
|
748
|
+
rowTone: E === "poor" ? "poor" : E === "warn" ? "warn" : void 0
|
|
647
749
|
};
|
|
750
|
+
}
|
|
648
751
|
case "event":
|
|
649
752
|
return {
|
|
650
753
|
id: e.id,
|
|
651
754
|
timestamp: e.timestamp,
|
|
652
755
|
cells: {
|
|
653
|
-
time:
|
|
756
|
+
time: n,
|
|
654
757
|
kind: "事件",
|
|
655
758
|
name: e.name,
|
|
656
|
-
source: (
|
|
657
|
-
|
|
658
|
-
|
|
759
|
+
source: (J = e.source) != null ? J : "manual",
|
|
760
|
+
route: N(e.route),
|
|
761
|
+
props: ie(e.props)
|
|
762
|
+
},
|
|
763
|
+
tones: { kind: "neutral", source: "neutral" }
|
|
659
764
|
};
|
|
660
765
|
case "exposure":
|
|
661
766
|
return {
|
|
662
767
|
id: e.id,
|
|
663
768
|
timestamp: e.timestamp,
|
|
664
769
|
cells: {
|
|
665
|
-
time:
|
|
770
|
+
time: n,
|
|
666
771
|
kind: "曝光",
|
|
667
772
|
name: e.name,
|
|
668
773
|
source: "exposure",
|
|
669
|
-
|
|
670
|
-
|
|
774
|
+
route: N(e.route),
|
|
775
|
+
props: ie(e.props)
|
|
776
|
+
},
|
|
777
|
+
tones: { kind: "neutral", source: "neutral" }
|
|
671
778
|
};
|
|
672
779
|
case "vital":
|
|
673
780
|
return {
|
|
674
781
|
id: e.id,
|
|
675
782
|
timestamp: e.timestamp,
|
|
676
783
|
cells: {
|
|
677
|
-
time:
|
|
784
|
+
time: n,
|
|
678
785
|
kind: "Vital",
|
|
679
786
|
name: e.name,
|
|
680
|
-
source: (
|
|
787
|
+
source: (X = e.rating) != null ? X : "—",
|
|
788
|
+
route: N(e.route),
|
|
681
789
|
props: String(e.value)
|
|
682
790
|
}
|
|
683
791
|
};
|
|
@@ -686,64 +794,83 @@ const Tt = {
|
|
|
686
794
|
id: e.id,
|
|
687
795
|
timestamp: e.timestamp,
|
|
688
796
|
cells: {
|
|
689
|
-
time:
|
|
797
|
+
time: n,
|
|
690
798
|
kind: "长任务",
|
|
691
|
-
name: (
|
|
799
|
+
name: (K = e.name) != null ? K : "—",
|
|
692
800
|
source: "longTask",
|
|
693
|
-
|
|
801
|
+
route: N(e.route),
|
|
802
|
+
props: le(e.durationMs)
|
|
694
803
|
}
|
|
695
804
|
};
|
|
696
805
|
}
|
|
697
806
|
}
|
|
698
|
-
function
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
for (const y of M.value)
|
|
702
|
-
t.includes(y.type) && (a += 1);
|
|
703
|
-
return a;
|
|
807
|
+
function de(e, n) {
|
|
808
|
+
var t;
|
|
809
|
+
return (t = e.cells[n.key]) != null ? t : "—";
|
|
704
810
|
}
|
|
705
|
-
function
|
|
706
|
-
|
|
811
|
+
function Ce(e, n) {
|
|
812
|
+
var t;
|
|
813
|
+
return (t = e.tones) == null ? void 0 : t[n.key];
|
|
707
814
|
}
|
|
708
|
-
function
|
|
709
|
-
|
|
815
|
+
function He(e, n) {
|
|
816
|
+
var t, c;
|
|
817
|
+
return (c = (t = e.tones) == null ? void 0 : t[n.key]) != null ? c : "neutral";
|
|
710
818
|
}
|
|
711
|
-
function
|
|
819
|
+
function je(e, n) {
|
|
820
|
+
const t = [`perf-panel__cell--${n.key}`];
|
|
821
|
+
n.kind === "mono" && t.push("perf-panel__cell--mono"), n.kind === "chip" && t.push("perf-panel__cell--chip");
|
|
822
|
+
const c = Ce(e, n);
|
|
823
|
+
return c && t.push(`perf-panel__tone--${c}`), t;
|
|
824
|
+
}
|
|
825
|
+
function Ge(e) {
|
|
826
|
+
return e.rowTone ? [`perf-panel__row--${e.rowTone}`] : [];
|
|
827
|
+
}
|
|
828
|
+
function We(e) {
|
|
829
|
+
const n = b[e];
|
|
830
|
+
let t = 0;
|
|
831
|
+
for (const c of I.value)
|
|
832
|
+
n.includes(c.type) && (t += 1);
|
|
833
|
+
return t;
|
|
834
|
+
}
|
|
835
|
+
function Ye(e) {
|
|
836
|
+
O.value = e;
|
|
837
|
+
}
|
|
838
|
+
function Qe() {
|
|
712
839
|
L.value > 1 && (L.value -= 1);
|
|
713
840
|
}
|
|
714
|
-
function
|
|
715
|
-
L.value <
|
|
841
|
+
function Je() {
|
|
842
|
+
L.value < re.value && (L.value += 1);
|
|
716
843
|
}
|
|
717
|
-
function
|
|
718
|
-
|
|
844
|
+
function Xe() {
|
|
845
|
+
G.value = "";
|
|
719
846
|
}
|
|
720
|
-
async function
|
|
721
|
-
await
|
|
847
|
+
async function Ke() {
|
|
848
|
+
await v();
|
|
722
849
|
}
|
|
723
|
-
async function
|
|
724
|
-
await
|
|
850
|
+
async function Ze() {
|
|
851
|
+
await d();
|
|
725
852
|
}
|
|
726
|
-
function
|
|
853
|
+
function et() {
|
|
727
854
|
var e;
|
|
728
|
-
if (
|
|
855
|
+
if (o.perf)
|
|
729
856
|
try {
|
|
730
|
-
(e =
|
|
857
|
+
(e = ae.value) == null || e.click();
|
|
731
858
|
} catch {
|
|
732
859
|
}
|
|
733
860
|
}
|
|
734
|
-
async function
|
|
735
|
-
var
|
|
736
|
-
const
|
|
737
|
-
if (!(
|
|
738
|
-
const
|
|
861
|
+
async function tt(e) {
|
|
862
|
+
var c;
|
|
863
|
+
const n = e.target;
|
|
864
|
+
if (!(n instanceof HTMLInputElement)) return;
|
|
865
|
+
const t = (c = n.files) == null ? void 0 : c[0];
|
|
739
866
|
try {
|
|
740
|
-
|
|
867
|
+
n.value = "";
|
|
741
868
|
} catch {
|
|
742
869
|
}
|
|
743
|
-
|
|
870
|
+
t && await _(t);
|
|
744
871
|
}
|
|
745
|
-
async function
|
|
746
|
-
if (
|
|
872
|
+
async function nt() {
|
|
873
|
+
if (o.perf) {
|
|
747
874
|
if (typeof window != "undefined") {
|
|
748
875
|
let e = !1;
|
|
749
876
|
try {
|
|
@@ -753,33 +880,33 @@ const Tt = {
|
|
|
753
880
|
}
|
|
754
881
|
if (!e) return;
|
|
755
882
|
}
|
|
756
|
-
await
|
|
883
|
+
await y();
|
|
757
884
|
}
|
|
758
885
|
}
|
|
759
|
-
function
|
|
760
|
-
const
|
|
761
|
-
|
|
886
|
+
function at(e) {
|
|
887
|
+
const n = e.target;
|
|
888
|
+
n instanceof HTMLInputElement && g(n.checked);
|
|
762
889
|
}
|
|
763
|
-
function
|
|
764
|
-
if (!e) return [...
|
|
890
|
+
function st(e) {
|
|
891
|
+
if (!e) return [...r];
|
|
765
892
|
try {
|
|
766
|
-
const
|
|
767
|
-
return
|
|
893
|
+
const n = getComputedStyle(e);
|
|
894
|
+
return l.map((t, c) => n.getPropertyValue(t).trim() || r[c] || "#8f959e");
|
|
768
895
|
} catch {
|
|
769
|
-
return [...
|
|
896
|
+
return [...r];
|
|
770
897
|
}
|
|
771
898
|
}
|
|
772
|
-
function
|
|
899
|
+
function rt(e, n) {
|
|
773
900
|
return {
|
|
774
901
|
animation: !1,
|
|
775
|
-
color:
|
|
902
|
+
color: st(n),
|
|
776
903
|
grid: { top: 36, right: 16, bottom: 8, left: 8, containLabel: !0 },
|
|
777
904
|
legend: { top: 0, icon: "circle", itemWidth: 8, itemHeight: 8, textStyle: { fontSize: 12 } },
|
|
778
905
|
tooltip: { trigger: "axis" },
|
|
779
906
|
xAxis: {
|
|
780
907
|
type: "category",
|
|
781
908
|
boundaryGap: !1,
|
|
782
|
-
data: e.map((
|
|
909
|
+
data: e.map((t) => t.label),
|
|
783
910
|
axisLabel: { hideOverlap: !0 }
|
|
784
911
|
},
|
|
785
912
|
yAxis: {
|
|
@@ -788,292 +915,352 @@ const Tt = {
|
|
|
788
915
|
splitLine: { lineStyle: { type: "dashed" } }
|
|
789
916
|
},
|
|
790
917
|
series: [
|
|
791
|
-
{ name: "错误", type: "line", symbol: "circle", symbolSize: 5, data: e.map((
|
|
792
|
-
{ name: "请求", type: "line", symbol: "circle", symbolSize: 5, data: e.map((
|
|
793
|
-
{ name: "长任务", type: "line", symbol: "circle", symbolSize: 5, data: e.map((
|
|
794
|
-
{ name: "埋点", type: "line", symbol: "circle", symbolSize: 5, data: e.map((
|
|
918
|
+
{ name: "错误", type: "line", symbol: "circle", symbolSize: 5, data: e.map((t) => t.errors) },
|
|
919
|
+
{ name: "请求", type: "line", symbol: "circle", symbolSize: 5, data: e.map((t) => t.requests) },
|
|
920
|
+
{ name: "长任务", type: "line", symbol: "circle", symbolSize: 5, data: e.map((t) => t.longTasks) },
|
|
921
|
+
{ name: "埋点", type: "line", symbol: "circle", symbolSize: 5, data: e.map((t) => t.events) }
|
|
795
922
|
]
|
|
796
923
|
};
|
|
797
924
|
}
|
|
798
|
-
function
|
|
799
|
-
if (
|
|
925
|
+
function Re() {
|
|
926
|
+
if (u)
|
|
800
927
|
try {
|
|
801
|
-
|
|
928
|
+
u.setOption(rt(S.value, i.value), !0), V.value = "";
|
|
802
929
|
} catch (e) {
|
|
803
|
-
|
|
930
|
+
V.value = `图表渲染失败:${oe(e)}`;
|
|
804
931
|
}
|
|
805
932
|
}
|
|
806
|
-
function
|
|
807
|
-
if (
|
|
808
|
-
const e =
|
|
933
|
+
function ot() {
|
|
934
|
+
if (u) return;
|
|
935
|
+
const e = i.value;
|
|
809
936
|
if (!(!e || typeof window == "undefined") && !(e.clientWidth <= 0 || e.clientHeight <= 0))
|
|
810
937
|
try {
|
|
811
|
-
|
|
812
|
-
} catch (
|
|
813
|
-
|
|
938
|
+
u = gt(e), Re();
|
|
939
|
+
} catch (n) {
|
|
940
|
+
u = null, V.value = `图表初始化失败:${oe(n)}`;
|
|
814
941
|
}
|
|
815
942
|
}
|
|
816
|
-
function
|
|
817
|
-
|
|
943
|
+
function _e() {
|
|
944
|
+
ot(), Re();
|
|
818
945
|
}
|
|
819
|
-
function
|
|
820
|
-
if (
|
|
821
|
-
if (!
|
|
822
|
-
|
|
946
|
+
function me() {
|
|
947
|
+
if (i.value) {
|
|
948
|
+
if (!u) {
|
|
949
|
+
_e();
|
|
823
950
|
return;
|
|
824
951
|
}
|
|
825
952
|
try {
|
|
826
|
-
|
|
953
|
+
u.resize();
|
|
827
954
|
} catch (e) {
|
|
828
|
-
|
|
955
|
+
V.value = `图表尺寸更新失败:${oe(e)}`;
|
|
829
956
|
}
|
|
830
957
|
}
|
|
831
958
|
}
|
|
832
|
-
function
|
|
833
|
-
if (
|
|
834
|
-
const e =
|
|
959
|
+
function Se() {
|
|
960
|
+
if (k || M) return;
|
|
961
|
+
const e = i.value;
|
|
835
962
|
if (e) {
|
|
836
963
|
if (typeof ResizeObserver != "undefined")
|
|
837
964
|
try {
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
}),
|
|
965
|
+
k = new ResizeObserver(() => {
|
|
966
|
+
me();
|
|
967
|
+
}), k.observe(e);
|
|
841
968
|
return;
|
|
842
969
|
} catch {
|
|
843
|
-
|
|
970
|
+
k = null;
|
|
844
971
|
}
|
|
845
|
-
typeof window != "undefined" && (window.addEventListener("resize",
|
|
972
|
+
typeof window != "undefined" && (window.addEventListener("resize", me), M = !0);
|
|
846
973
|
}
|
|
847
974
|
}
|
|
848
|
-
function
|
|
849
|
-
|
|
975
|
+
function Le() {
|
|
976
|
+
k && (k.disconnect(), k = null), M && typeof window != "undefined" && (window.removeEventListener("resize", me), M = !1);
|
|
850
977
|
}
|
|
851
|
-
function
|
|
852
|
-
if (
|
|
978
|
+
function $e() {
|
|
979
|
+
if (u) {
|
|
853
980
|
try {
|
|
854
|
-
|
|
981
|
+
u.dispose();
|
|
855
982
|
} catch {
|
|
856
983
|
}
|
|
857
|
-
|
|
984
|
+
u = null;
|
|
858
985
|
}
|
|
859
986
|
}
|
|
860
|
-
return
|
|
987
|
+
return j(O, () => {
|
|
861
988
|
L.value = 1;
|
|
862
|
-
}),
|
|
989
|
+
}), j(q, () => {
|
|
863
990
|
L.value = 1;
|
|
864
|
-
}),
|
|
991
|
+
}), j(re, (e) => {
|
|
865
992
|
L.value > e && (L.value = e);
|
|
866
|
-
}),
|
|
993
|
+
}), j(
|
|
867
994
|
S,
|
|
868
995
|
() => {
|
|
869
|
-
if (!
|
|
870
|
-
|
|
996
|
+
if (!i.value) {
|
|
997
|
+
$e(), Le();
|
|
871
998
|
return;
|
|
872
999
|
}
|
|
873
|
-
|
|
1000
|
+
Se(), _e();
|
|
874
1001
|
},
|
|
875
1002
|
{ flush: "post" }
|
|
876
|
-
),
|
|
877
|
-
|
|
878
|
-
|
|
1003
|
+
), ut(() => {
|
|
1004
|
+
Se(), ct().then(() => {
|
|
1005
|
+
_e();
|
|
879
1006
|
});
|
|
880
|
-
}),
|
|
881
|
-
|
|
882
|
-
}),
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
1007
|
+
}), xe(() => {
|
|
1008
|
+
Le(), $e();
|
|
1009
|
+
}), pt((e) => (G.value = `面板内部错误:${oe(e)}`, !1)), (e, n) => (p(), f("section", Ht, [
|
|
1010
|
+
G.value ? (p(), f("div", jt, [
|
|
1011
|
+
n[1] || (n[1] = s("p", { class: "perf-panel__fallback-title" }, "性能面板渲染失败", -1)),
|
|
1012
|
+
s("p", Gt, h(G.value), 1),
|
|
1013
|
+
s("button", {
|
|
887
1014
|
class: "perf-panel__button",
|
|
888
1015
|
type: "button",
|
|
889
|
-
onClick:
|
|
1016
|
+
onClick: Xe
|
|
890
1017
|
}, "重试")
|
|
891
|
-
])) : (p(), f(
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
1018
|
+
])) : (p(), f(U, { key: 1 }, [
|
|
1019
|
+
s("header", Wt, [
|
|
1020
|
+
s("div", Yt, [
|
|
1021
|
+
s("div", Qt, [
|
|
1022
|
+
n[2] || (n[2] = s("h2", { class: "perf-panel__title" }, "性能面板", -1)),
|
|
1023
|
+
s("span", {
|
|
1024
|
+
class: B(["perf-panel__source-chip", a.perf ? "perf-panel__source-chip--local" : "perf-panel__source-chip--injected"])
|
|
1025
|
+
}, h(x.value), 3)
|
|
1026
|
+
]),
|
|
1027
|
+
s("p", Jt, [
|
|
1028
|
+
s("span", {
|
|
1029
|
+
class: "perf-panel__subtitle-item",
|
|
1030
|
+
"data-realtime": a.perf ? F(P) ? "on" : "off" : "unavailable"
|
|
1031
|
+
}, [
|
|
1032
|
+
s("i", {
|
|
1033
|
+
class: B(["perf-panel__dot", fe.value])
|
|
1034
|
+
}, null, 2),
|
|
1035
|
+
Me(" " + h(pe.value), 1)
|
|
1036
|
+
], 8, Xt),
|
|
1037
|
+
n[3] || (n[3] = s("span", {
|
|
1038
|
+
class: "perf-panel__sep",
|
|
1039
|
+
"aria-hidden": "true"
|
|
1040
|
+
}, "·", -1)),
|
|
1041
|
+
s("span", Kt, "共 " + h(A.value) + " 条记录", 1),
|
|
1042
|
+
n[4] || (n[4] = s("span", {
|
|
1043
|
+
class: "perf-panel__sep",
|
|
1044
|
+
"aria-hidden": "true"
|
|
1045
|
+
}, "·", -1)),
|
|
1046
|
+
s("span", Zt, h(x.value), 1),
|
|
1047
|
+
F(R) ? (p(), f("span", en, "加载中…")) : W("", !0)
|
|
1048
|
+
])
|
|
1049
|
+
]),
|
|
1050
|
+
s("div", tn, [
|
|
1051
|
+
s("div", nn, [
|
|
1052
|
+
s("button", {
|
|
1053
|
+
class: "perf-panel__button perf-panel__button--primary",
|
|
1054
|
+
type: "button",
|
|
1055
|
+
"data-action": "refresh",
|
|
1056
|
+
disabled: F(R),
|
|
1057
|
+
onClick: Ke
|
|
1058
|
+
}, " 刷新 ", 8, an),
|
|
1059
|
+
s("button", {
|
|
1060
|
+
class: "perf-panel__button",
|
|
1061
|
+
type: "button",
|
|
1062
|
+
"data-action": "export",
|
|
1063
|
+
onClick: Ze
|
|
1064
|
+
}, "导出 JSON")
|
|
1065
|
+
]),
|
|
1066
|
+
s("div", sn, [
|
|
1067
|
+
s("button", {
|
|
1068
|
+
class: "perf-panel__button",
|
|
1069
|
+
type: "button",
|
|
1070
|
+
"data-action": "import",
|
|
1071
|
+
disabled: !a.perf,
|
|
1072
|
+
onClick: et
|
|
1073
|
+
}, " 导入 JSON ", 8, rn),
|
|
1074
|
+
s("button", {
|
|
1075
|
+
class: "perf-panel__button perf-panel__button--danger",
|
|
1076
|
+
type: "button",
|
|
1077
|
+
"data-action": "clear",
|
|
1078
|
+
disabled: !a.perf || F(R),
|
|
1079
|
+
onClick: nt
|
|
1080
|
+
}, " 清空 ", 8, on)
|
|
1081
|
+
]),
|
|
1082
|
+
s("label", ln, [
|
|
1083
|
+
s("input", {
|
|
924
1084
|
type: "checkbox",
|
|
925
1085
|
"data-action": "realtime",
|
|
926
|
-
checked:
|
|
927
|
-
disabled: !
|
|
928
|
-
onChange:
|
|
929
|
-
}, null, 40,
|
|
930
|
-
|
|
1086
|
+
checked: F(P),
|
|
1087
|
+
disabled: !a.perf,
|
|
1088
|
+
onChange: at
|
|
1089
|
+
}, null, 40, un),
|
|
1090
|
+
n[5] || (n[5] = s("span", null, "实时", -1))
|
|
931
1091
|
]),
|
|
932
|
-
|
|
1092
|
+
s("input", {
|
|
933
1093
|
ref_key: "fileInput",
|
|
934
|
-
ref:
|
|
1094
|
+
ref: ae,
|
|
935
1095
|
class: "perf-panel__file-input",
|
|
936
1096
|
type: "file",
|
|
937
1097
|
accept: "application/json,.json",
|
|
938
|
-
onChange:
|
|
1098
|
+
onChange: tt
|
|
939
1099
|
}, null, 544)
|
|
940
1100
|
])
|
|
941
1101
|
]),
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
(p(!0), f(
|
|
948
|
-
key:
|
|
949
|
-
class: "perf-panel__card",
|
|
950
|
-
"data-metric":
|
|
1102
|
+
F($) ? (p(), f("p", cn, h(F($)), 1)) : W("", !0),
|
|
1103
|
+
F(R) && A.value === 0 ? (p(), f("p", pn, "加载中…")) : A.value === 0 ? (p(), f("p", fn, "暂无性能数据")) : (p(), f(U, { key: 3 }, [
|
|
1104
|
+
s("section", dn, [
|
|
1105
|
+
n[6] || (n[6] = ft('<div class="perf-panel__section-head" data-v-0a9a1651><div class="perf-panel__section-title-group" data-v-0a9a1651><h3 class="perf-panel__section-title" data-v-0a9a1651>概览</h3><span class="perf-panel__section-meta" data-v-0a9a1651>Web Vitals p75 · 按标准阈值着色</span></div><div class="perf-panel__legend" aria-label="状态图例" data-v-0a9a1651><span class="perf-panel__legend-item" data-v-0a9a1651><i class="perf-panel__dot perf-panel__dot--good" data-v-0a9a1651></i>良好 </span><span class="perf-panel__legend-item" data-v-0a9a1651><i class="perf-panel__dot perf-panel__dot--warn" data-v-0a9a1651></i>需关注 </span><span class="perf-panel__legend-item" data-v-0a9a1651><i class="perf-panel__dot perf-panel__dot--poor" data-v-0a9a1651></i>较差 </span><span class="perf-panel__legend-item" data-v-0a9a1651><i class="perf-panel__dot perf-panel__dot--neutral" data-v-0a9a1651></i>无数据 </span></div></div>', 1)),
|
|
1106
|
+
s("div", _n, [
|
|
1107
|
+
(p(!0), f(U, null, H(Oe.value, (t) => (p(), f("article", {
|
|
1108
|
+
key: t.key,
|
|
1109
|
+
class: B(["perf-panel__card", `perf-panel__card--${t.tone}`]),
|
|
1110
|
+
"data-metric": t.key,
|
|
1111
|
+
"data-tone": t.tone
|
|
951
1112
|
}, [
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
1113
|
+
s("div", vn, [
|
|
1114
|
+
s("i", {
|
|
1115
|
+
class: B(["perf-panel__dot", `perf-panel__dot--${t.tone}`])
|
|
1116
|
+
}, null, 2),
|
|
1117
|
+
s("span", hn, h(t.label), 1)
|
|
1118
|
+
]),
|
|
1119
|
+
s("div", yn, [
|
|
1120
|
+
s("span", bn, h(t.value), 1),
|
|
1121
|
+
t.unit ? (p(), f("span", gn, h(t.unit), 1)) : W("", !0)
|
|
1122
|
+
]),
|
|
1123
|
+
s("span", kn, h(t.hint), 1)
|
|
1124
|
+
], 10, mn))), 128))
|
|
956
1125
|
])
|
|
957
1126
|
]),
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
1127
|
+
s("section", Tn, [
|
|
1128
|
+
s("div", wn, [
|
|
1129
|
+
s("div", Cn, [
|
|
1130
|
+
n[7] || (n[7] = s("h3", { class: "perf-panel__section-title" }, "趋势", -1)),
|
|
1131
|
+
s("span", Rn, h(F(w) === "hour" ? "按小时聚合" : "按分钟聚合"), 1)
|
|
1132
|
+
]),
|
|
1133
|
+
s("span", Sn, h(F(S).length) + " 个时间桶", 1)
|
|
962
1134
|
]),
|
|
963
|
-
|
|
964
|
-
|
|
1135
|
+
s("div", Ln, [
|
|
1136
|
+
s("div", {
|
|
965
1137
|
ref_key: "chartEl",
|
|
966
|
-
ref:
|
|
1138
|
+
ref: i,
|
|
967
1139
|
class: "perf-panel__chart"
|
|
968
1140
|
}, null, 512),
|
|
969
|
-
|
|
1141
|
+
F(S).length === 0 ? (p(), f("p", $n, "暂无趋势数据")) : W("", !0)
|
|
970
1142
|
]),
|
|
971
|
-
|
|
1143
|
+
V.value ? (p(), f("p", Mn, h(V.value), 1)) : W("", !0)
|
|
972
1144
|
]),
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
(
|
|
977
|
-
|
|
1145
|
+
s("section", En, [
|
|
1146
|
+
n[8] || (n[8] = s("div", { class: "perf-panel__section-head" }, [
|
|
1147
|
+
s("h3", { class: "perf-panel__section-title" }, "Top 排行"),
|
|
1148
|
+
s("span", { class: "perf-panel__section-meta" }, "按出现次数排序")
|
|
1149
|
+
], -1)),
|
|
1150
|
+
s("div", In, [
|
|
1151
|
+
(p(!0), f(U, null, H(Ae.value, (t) => (p(), f("div", {
|
|
1152
|
+
key: t.key,
|
|
978
1153
|
class: "perf-panel__top"
|
|
979
1154
|
}, [
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
(p(!0), f(
|
|
983
|
-
key:
|
|
1155
|
+
s("h4", xn, h(t.title), 1),
|
|
1156
|
+
t.items.length > 0 ? (p(), f("ol", Nn, [
|
|
1157
|
+
(p(!0), f(U, null, H(t.items, (c) => (p(), f("li", {
|
|
1158
|
+
key: c.key,
|
|
984
1159
|
class: "perf-panel__top-item"
|
|
985
1160
|
}, [
|
|
986
|
-
|
|
1161
|
+
s("span", {
|
|
987
1162
|
class: "perf-panel__top-label",
|
|
988
|
-
title:
|
|
989
|
-
},
|
|
990
|
-
|
|
1163
|
+
title: c.label
|
|
1164
|
+
}, h(c.label), 9, Pn),
|
|
1165
|
+
s("span", Fn, h(c.count), 1)
|
|
991
1166
|
]))), 128))
|
|
992
|
-
])) : (p(), f("p",
|
|
1167
|
+
])) : (p(), f("p", On, "暂无"))
|
|
993
1168
|
]))), 128))
|
|
994
1169
|
])
|
|
995
1170
|
]),
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
"
|
|
1171
|
+
s("section", An, [
|
|
1172
|
+
s("div", Dn, [
|
|
1173
|
+
s("div", qn, [
|
|
1174
|
+
n[9] || (n[9] = s("h3", { class: "perf-panel__section-title" }, "明细", -1)),
|
|
1175
|
+
s("span", Un, "共 " + h(se.value) + " 条", 1)
|
|
1176
|
+
]),
|
|
1177
|
+
dt(s("input", {
|
|
1178
|
+
"onUpdate:modelValue": n[0] || (n[0] = (t) => q.value = t),
|
|
1001
1179
|
class: "perf-panel__search",
|
|
1002
1180
|
type: "search",
|
|
1003
|
-
placeholder: "搜索 URL / 消息 / 事件名",
|
|
1181
|
+
placeholder: "搜索 URL / Query / 消息 / 事件名",
|
|
1004
1182
|
"aria-label": "搜索明细"
|
|
1005
1183
|
}, null, 512), [
|
|
1006
|
-
[
|
|
1184
|
+
[_t, q.value]
|
|
1007
1185
|
])
|
|
1008
1186
|
]),
|
|
1009
|
-
|
|
1010
|
-
(p(), f(
|
|
1011
|
-
key:
|
|
1012
|
-
class:
|
|
1187
|
+
s("div", Vn, [
|
|
1188
|
+
(p(), f(U, null, H(C, (t) => s("button", {
|
|
1189
|
+
key: t.tab,
|
|
1190
|
+
class: B(["perf-panel__tab", { "perf-panel__tab--active": t.tab === O.value }]),
|
|
1013
1191
|
type: "button",
|
|
1014
1192
|
role: "tab",
|
|
1015
|
-
"aria-selected":
|
|
1016
|
-
"data-tab":
|
|
1017
|
-
onClick: (
|
|
1193
|
+
"aria-selected": t.tab === O.value,
|
|
1194
|
+
"data-tab": t.tab,
|
|
1195
|
+
onClick: (c) => Ye(t.tab)
|
|
1018
1196
|
}, [
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
], 10,
|
|
1197
|
+
Me(h(t.label) + " ", 1),
|
|
1198
|
+
s("span", Bn, h(We(t.tab)), 1)
|
|
1199
|
+
], 10, zn)), 64))
|
|
1022
1200
|
]),
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
(p(!0), f(
|
|
1028
|
-
key:
|
|
1029
|
-
scope: "col"
|
|
1030
|
-
|
|
1201
|
+
s("div", Hn, [
|
|
1202
|
+
ke.value.length > 0 ? (p(), f("table", jn, [
|
|
1203
|
+
s("thead", null, [
|
|
1204
|
+
s("tr", null, [
|
|
1205
|
+
(p(!0), f(U, null, H(Te.value, (t) => (p(), f("th", {
|
|
1206
|
+
key: t.key,
|
|
1207
|
+
scope: "col",
|
|
1208
|
+
"data-column": t.key
|
|
1209
|
+
}, h(t.label), 9, Gn))), 128))
|
|
1031
1210
|
])
|
|
1032
1211
|
]),
|
|
1033
|
-
|
|
1034
|
-
(p(!0), f(
|
|
1035
|
-
key:
|
|
1212
|
+
s("tbody", null, [
|
|
1213
|
+
(p(!0), f(U, null, H(ke.value, (t) => (p(), f("tr", {
|
|
1214
|
+
key: t.id,
|
|
1215
|
+
class: B(Ge(t))
|
|
1036
1216
|
}, [
|
|
1037
|
-
(p(!0), f(
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1217
|
+
(p(!0), f(U, null, H(Te.value, (c) => (p(), f("td", {
|
|
1218
|
+
key: c.key,
|
|
1219
|
+
class: B(je(t, c)),
|
|
1220
|
+
"data-column": c.key,
|
|
1221
|
+
"data-tone": Ce(t, c),
|
|
1222
|
+
title: de(t, c)
|
|
1223
|
+
}, [
|
|
1224
|
+
c.kind === "chip" ? (p(), f("span", {
|
|
1225
|
+
key: 0,
|
|
1226
|
+
class: B(["perf-panel__chip", `perf-panel__chip--${He(t, c)}`])
|
|
1227
|
+
}, h(de(t, c)), 3)) : (p(), f("span", Yn, h(de(t, c)), 1))
|
|
1228
|
+
], 10, Wn))), 128))
|
|
1229
|
+
], 2))), 128))
|
|
1045
1230
|
])
|
|
1046
|
-
])) : (p(), f("p",
|
|
1231
|
+
])) : (p(), f("p", Qn, "当前分类暂无数据"))
|
|
1047
1232
|
]),
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1233
|
+
se.value > 0 ? (p(), f("div", Jn, [
|
|
1234
|
+
s("span", Xn, "第 " + h(L.value) + " / " + h(re.value) + " 页,共 " + h(se.value) + " 条", 1),
|
|
1235
|
+
s("div", Kn, [
|
|
1236
|
+
s("button", {
|
|
1237
|
+
class: "perf-panel__button",
|
|
1238
|
+
type: "button",
|
|
1239
|
+
"data-action": "prev-page",
|
|
1240
|
+
disabled: L.value <= 1,
|
|
1241
|
+
onClick: Qe
|
|
1242
|
+
}, " 上一页 ", 8, Zn),
|
|
1243
|
+
s("button", {
|
|
1244
|
+
class: "perf-panel__button",
|
|
1245
|
+
type: "button",
|
|
1246
|
+
"data-action": "next-page",
|
|
1247
|
+
disabled: L.value >= re.value,
|
|
1248
|
+
onClick: Je
|
|
1249
|
+
}, " 下一页 ", 8, ea)
|
|
1250
|
+
])
|
|
1251
|
+
])) : W("", !0)
|
|
1065
1252
|
])
|
|
1066
1253
|
], 64))
|
|
1067
1254
|
], 64))
|
|
1068
1255
|
]));
|
|
1069
1256
|
}
|
|
1070
|
-
}),
|
|
1071
|
-
const
|
|
1072
|
-
for (const [
|
|
1073
|
-
|
|
1074
|
-
return
|
|
1075
|
-
},
|
|
1257
|
+
}), na = (a, o) => {
|
|
1258
|
+
const r = a.__vccOpts || a;
|
|
1259
|
+
for (const [l, b] of o)
|
|
1260
|
+
r[l] = b;
|
|
1261
|
+
return r;
|
|
1262
|
+
}, ia = /* @__PURE__ */ na(ta, [["__scopeId", "data-v-0a9a1651"]]);
|
|
1076
1263
|
export {
|
|
1077
|
-
|
|
1264
|
+
ia as PerfPanel
|
|
1078
1265
|
};
|
|
1079
1266
|
//# sourceMappingURL=index.js.map
|