@topdatasec/probe 1.0.6 → 1.0.8
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/lib/t-probe-ui.es.js +104 -101
- package/lib/t-probe-ui.umd.js +1 -1
- package/package.json +1 -1
package/lib/t-probe-ui.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as K, useModel as re, resolveComponent as d, openBlock as y, createElementBlock as
|
|
1
|
+
import { defineComponent as K, useModel as re, resolveComponent as d, openBlock as y, createElementBlock as x, Fragment as B, renderList as W, createVNode as e, withCtx as T, unref as q, createCommentVNode as O, ref as w, reactive as H, createTextVNode as F, createElementVNode as f, toDisplayString as C, mergeProps as Y, createBlock as G } from "vue";
|
|
2
2
|
import { CircleClose as ae, UploadFilled as se } from "@element-plus/icons-vue";
|
|
3
3
|
import { TdsTable as ue, TdsForm as ee } from "topdatasec-ui";
|
|
4
4
|
import ie from "spark-md5";
|
|
@@ -23,9 +23,9 @@ const pe = {
|
|
|
23
23
|
n.splice(v, 1), l.value = n;
|
|
24
24
|
}
|
|
25
25
|
return (v, n) => {
|
|
26
|
-
const m = d("el-input"), E = d("el-form-item"),
|
|
27
|
-
return y(),
|
|
28
|
-
(y(!0),
|
|
26
|
+
const m = d("el-input"), E = d("el-form-item"), b = d("el-icon"), s = d("el-button");
|
|
27
|
+
return y(), x("div", null, [
|
|
28
|
+
(y(!0), x(B, null, W(l.value, (p, $) => (y(), x("div", {
|
|
29
29
|
key: $,
|
|
30
30
|
class: "flex form-m0 w-100% mb-5px"
|
|
31
31
|
}, [
|
|
@@ -51,8 +51,8 @@ const pe = {
|
|
|
51
51
|
]),
|
|
52
52
|
_: 2
|
|
53
53
|
}, 1024),
|
|
54
|
-
l.value.length > 1 ? (y(),
|
|
55
|
-
e(
|
|
54
|
+
l.value.length > 1 ? (y(), x("div", pe, [
|
|
55
|
+
e(b, {
|
|
56
56
|
onClick: (M) => c($)
|
|
57
57
|
}, {
|
|
58
58
|
default: T(() => [
|
|
@@ -81,9 +81,9 @@ function ce(t, l) {
|
|
|
81
81
|
return new Promise((a, r) => {
|
|
82
82
|
const c = new ie.ArrayBuffer(), v = new FileReader(), n = Math.ceil(t.size / P);
|
|
83
83
|
let m = 0;
|
|
84
|
-
v.onload = (
|
|
84
|
+
v.onload = (b) => {
|
|
85
85
|
var s;
|
|
86
|
-
if (c.append((s =
|
|
86
|
+
if (c.append((s = b.target) == null ? void 0 : s.result), m++, l) {
|
|
87
87
|
const p = Math.floor(m / n * 100);
|
|
88
88
|
l(p);
|
|
89
89
|
}
|
|
@@ -97,15 +97,15 @@ function ce(t, l) {
|
|
|
97
97
|
r(new Error("MD5计算失败"));
|
|
98
98
|
};
|
|
99
99
|
function E() {
|
|
100
|
-
const
|
|
101
|
-
v.readAsArrayBuffer(t.slice(
|
|
100
|
+
const b = m * P, s = Math.min(b + P, t.size);
|
|
101
|
+
v.readAsArrayBuffer(t.slice(b, s));
|
|
102
102
|
}
|
|
103
103
|
E();
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
106
|
async function me(t, l, a, r, c, v = "/api/upload/chunk") {
|
|
107
|
-
const n = l * P, m = Math.min(n + P, t.size), E = t.slice(n, m),
|
|
108
|
-
s.append("file", E, t.name), s.append("chunkIndex", String(l + 1)), s.append("totalChunkNum", String(a)), s.append("fileMd5", r), s.append("tds_token", c), s.append("fileName", t.name), s.append("fileSize", String(t.size)), s.append("fileExt", t.name.substring(t.name.lastIndexOf(".") + 1)), s.append("chunkSize", String(P)), s.append("currentChunkSize", String(
|
|
107
|
+
const n = l * P, m = Math.min(n + P, t.size), E = t.slice(n, m), b = m - n, s = new FormData();
|
|
108
|
+
s.append("file", E, t.name), s.append("chunkIndex", String(l + 1)), s.append("totalChunkNum", String(a)), s.append("fileMd5", r), s.append("tds_token", c), s.append("fileName", t.name), s.append("fileSize", String(t.size)), s.append("fileExt", t.name.substring(t.name.lastIndexOf(".") + 1)), s.append("chunkSize", String(P)), s.append("currentChunkSize", String(b));
|
|
109
109
|
try {
|
|
110
110
|
const p = await fetch(v, {
|
|
111
111
|
method: "POST",
|
|
@@ -197,12 +197,12 @@ async function fe(t) {
|
|
|
197
197
|
status: "success",
|
|
198
198
|
fileMd5: s
|
|
199
199
|
}), X.success(`${a.name} 上传成功`), m == null || m(s);
|
|
200
|
-
} catch (
|
|
200
|
+
} catch (b) {
|
|
201
201
|
n == null || n({
|
|
202
202
|
progress: 0,
|
|
203
|
-
statusText:
|
|
203
|
+
statusText: b.message || "上传失败",
|
|
204
204
|
status: "error"
|
|
205
|
-
}), X.error(`${a.name} 上传失败: ${
|
|
205
|
+
}), X.error(`${a.name} 上传失败: ${b.message}`), E == null || E(b);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
function ye(t) {
|
|
@@ -301,7 +301,7 @@ const L = {
|
|
|
301
301
|
}
|
|
302
302
|
},
|
|
303
303
|
setup(t) {
|
|
304
|
-
const l =
|
|
304
|
+
const l = w(), a = w(), r = w("快速部署"), c = w({}), {
|
|
305
305
|
$t: v,
|
|
306
306
|
$messageBox: n
|
|
307
307
|
} = window, m = t;
|
|
@@ -310,34 +310,34 @@ const L = {
|
|
|
310
310
|
id: u.id
|
|
311
311
|
}, a.value.open();
|
|
312
312
|
}
|
|
313
|
-
const
|
|
313
|
+
const b = w([{
|
|
314
314
|
ip: "",
|
|
315
315
|
port: ""
|
|
316
|
-
}]), s =
|
|
316
|
+
}]), s = w([{
|
|
317
317
|
ip: "",
|
|
318
318
|
port: ""
|
|
319
|
-
}]), p =
|
|
319
|
+
}]), p = w([{
|
|
320
320
|
ip: "",
|
|
321
321
|
port: ""
|
|
322
|
-
}]), $ =
|
|
322
|
+
}]), $ = w([{
|
|
323
323
|
ip: "",
|
|
324
324
|
port: ""
|
|
325
325
|
}]);
|
|
326
326
|
async function M(u) {
|
|
327
|
-
const
|
|
327
|
+
const g = (o, i) => {
|
|
328
328
|
const _ = Math.max(o.length, i.length);
|
|
329
329
|
return Array.from({
|
|
330
330
|
length: _
|
|
331
|
-
}, (
|
|
332
|
-
var
|
|
331
|
+
}, (h, k) => {
|
|
332
|
+
var D, N, z, R;
|
|
333
333
|
return {
|
|
334
|
-
src_ip: ((
|
|
334
|
+
src_ip: ((D = o[k]) == null ? void 0 : D.ip) || "",
|
|
335
335
|
src_port: Number((N = o[k]) == null ? void 0 : N.port) || 0,
|
|
336
336
|
dst_ip: ((z = i[k]) == null ? void 0 : z.ip) || "",
|
|
337
337
|
dst_port: Number((R = i[k]) == null ? void 0 : R.port) || 0
|
|
338
338
|
};
|
|
339
339
|
});
|
|
340
|
-
},
|
|
340
|
+
}, A = {
|
|
341
341
|
packages_id: [c.value.id],
|
|
342
342
|
server_id: u.server_id,
|
|
343
343
|
service_type: window.$prodType,
|
|
@@ -347,18 +347,19 @@ const L = {
|
|
|
347
347
|
interface: u.interface || "",
|
|
348
348
|
engine_ip: u.engine_ip || "",
|
|
349
349
|
engine_port: u.engine_port || "",
|
|
350
|
-
filterWhitelist:
|
|
351
|
-
filterBlacklist:
|
|
350
|
+
filterWhitelist: g(b.value, s.value),
|
|
351
|
+
filterBlacklist: g(p.value, $.value)
|
|
352
352
|
}
|
|
353
353
|
};
|
|
354
354
|
await le({
|
|
355
|
-
data:
|
|
355
|
+
data: A
|
|
356
356
|
}), l.value.getTableList(), a.value.close();
|
|
357
357
|
}
|
|
358
358
|
async function I(u) {
|
|
359
359
|
n(u, "file_name", v("button.delete"), "error").then(async () => {
|
|
360
|
+
const g = u.map((A) => A.id);
|
|
360
361
|
await he({
|
|
361
|
-
data:
|
|
362
|
+
data: g
|
|
362
363
|
}), l.value.getTableList();
|
|
363
364
|
});
|
|
364
365
|
}
|
|
@@ -367,7 +368,9 @@ const L = {
|
|
|
367
368
|
{
|
|
368
369
|
field: "server_id",
|
|
369
370
|
name: "选择服务器",
|
|
370
|
-
enum: ne
|
|
371
|
+
enum: () => ne({
|
|
372
|
+
service_type: window.$prodType
|
|
373
|
+
}),
|
|
371
374
|
fieldNames: {
|
|
372
375
|
value: "id",
|
|
373
376
|
label: "server_name"
|
|
@@ -404,8 +407,8 @@ const L = {
|
|
|
404
407
|
field: "deployment_server",
|
|
405
408
|
name: "已部署服务器数",
|
|
406
409
|
render: (u) => {
|
|
407
|
-
var
|
|
408
|
-
return ((
|
|
410
|
+
var g;
|
|
411
|
+
return ((g = u.row.deployment_server) == null ? void 0 : g.length) || 0;
|
|
409
412
|
}
|
|
410
413
|
},
|
|
411
414
|
{
|
|
@@ -488,18 +491,18 @@ const L = {
|
|
|
488
491
|
show: {
|
|
489
492
|
type: "input",
|
|
490
493
|
tooltip: "白名单配置后,仅采集白名单内相关流量,如不填写,则采集所有流量",
|
|
491
|
-
render: () => e(
|
|
494
|
+
render: () => e(B, null, [e("div", {
|
|
492
495
|
style: "width: 100%"
|
|
493
496
|
}, [e("p", {
|
|
494
497
|
class: "color-[var(--el-text-color-regular)]"
|
|
495
|
-
}, [
|
|
496
|
-
modelValue:
|
|
497
|
-
"onUpdate:modelValue": (u) =>
|
|
498
|
+
}, [F("源ip端口:")]), e(V, {
|
|
499
|
+
modelValue: b.value,
|
|
500
|
+
"onUpdate:modelValue": (u) => b.value = u
|
|
498
501
|
}, null)]), e("div", {
|
|
499
502
|
style: "width: 100%"
|
|
500
503
|
}, [e("p", {
|
|
501
504
|
class: "color-[var(--el-text-color-regular)]"
|
|
502
|
-
}, [
|
|
505
|
+
}, [F("目的ip端口:")]), e(V, {
|
|
503
506
|
modelValue: s.value,
|
|
504
507
|
"onUpdate:modelValue": (u) => s.value = u
|
|
505
508
|
}, null)])])
|
|
@@ -512,14 +515,14 @@ const L = {
|
|
|
512
515
|
show: {
|
|
513
516
|
type: "input",
|
|
514
517
|
tooltip: "黑名单配置后,将不再采集黑名单内相关流量",
|
|
515
|
-
render: () => e(
|
|
518
|
+
render: () => e(B, null, [e("p", {
|
|
516
519
|
class: "color-[var(--el-text-color-regular)]"
|
|
517
|
-
}, [
|
|
520
|
+
}, [F("源ip端口:")]), e(V, {
|
|
518
521
|
modelValue: p.value,
|
|
519
522
|
"onUpdate:modelValue": (u) => p.value = u
|
|
520
523
|
}, null), e("p", {
|
|
521
524
|
class: "color-[var(--el-text-color-regular)]"
|
|
522
|
-
}, [
|
|
525
|
+
}, [F("目的ip端口:")]), e(V, {
|
|
523
526
|
modelValue: $.value,
|
|
524
527
|
"onUpdate:modelValue": (u) => $.value = u
|
|
525
528
|
}, null)])
|
|
@@ -549,22 +552,22 @@ const L = {
|
|
|
549
552
|
onClick: () => I([u.row])
|
|
550
553
|
}, null)])
|
|
551
554
|
}
|
|
552
|
-
]), U =
|
|
555
|
+
]), U = w([]);
|
|
553
556
|
function j(u) {
|
|
554
|
-
const
|
|
555
|
-
if (!
|
|
557
|
+
const g = u.raw;
|
|
558
|
+
if (!g)
|
|
556
559
|
return;
|
|
557
|
-
const
|
|
558
|
-
fileName:
|
|
559
|
-
fileSize:
|
|
560
|
+
const A = {
|
|
561
|
+
fileName: g.name,
|
|
562
|
+
fileSize: g.size,
|
|
560
563
|
progress: 0,
|
|
561
564
|
progressStatus: "",
|
|
562
565
|
statusText: "准备上传..."
|
|
563
566
|
};
|
|
564
|
-
U.value.push(
|
|
567
|
+
U.value.push(A);
|
|
565
568
|
const o = U.value.length - 1;
|
|
566
569
|
fe({
|
|
567
|
-
file:
|
|
570
|
+
file: g,
|
|
568
571
|
fileDesc: "探针安装包",
|
|
569
572
|
// 替换为你实际的接口地址
|
|
570
573
|
uploadUrl: L.deployURL + "/service_deploy/deployment/packages/upload",
|
|
@@ -580,8 +583,8 @@ const L = {
|
|
|
580
583
|
var _;
|
|
581
584
|
const i = U.value[o];
|
|
582
585
|
i && (i.progress = 100, i.progressStatus = "success", i.statusText = "上传成功"), (_ = l.value) == null || _.getTableList(), setTimeout(() => {
|
|
583
|
-
const
|
|
584
|
-
|
|
586
|
+
const h = U.value.findIndex((k) => k.fileName === g.name);
|
|
587
|
+
h !== -1 && U.value.splice(h, 1);
|
|
585
588
|
}, 3e3);
|
|
586
589
|
},
|
|
587
590
|
// 失败回调
|
|
@@ -592,34 +595,34 @@ const L = {
|
|
|
592
595
|
}
|
|
593
596
|
});
|
|
594
597
|
}
|
|
595
|
-
return (u,
|
|
596
|
-
const
|
|
597
|
-
return y(),
|
|
598
|
+
return (u, g) => {
|
|
599
|
+
const A = d("el-icon"), o = d("el-upload"), i = d("el-progress"), _ = d("el-table-column");
|
|
600
|
+
return y(), x("div", $e, [e(o, {
|
|
598
601
|
class: "upload-demo mt-10px",
|
|
599
602
|
drag: "",
|
|
600
603
|
action: "",
|
|
601
604
|
"auto-upload": !1,
|
|
602
|
-
accept: ".tar.gz,.
|
|
605
|
+
accept: ".tar.gz,.zip",
|
|
603
606
|
"on-change": j,
|
|
604
607
|
"show-file-list": !1,
|
|
605
608
|
multiple: ""
|
|
606
609
|
}, {
|
|
607
|
-
default: T(() => [e(
|
|
610
|
+
default: T(() => [e(A, {
|
|
608
611
|
class: "el-icon--upload"
|
|
609
612
|
}, {
|
|
610
613
|
default: T(() => [e(q(se))]),
|
|
611
614
|
_: 1
|
|
612
|
-
}),
|
|
615
|
+
}), g[0] || (g[0] = f("div", {
|
|
613
616
|
class: "el-upload__text"
|
|
614
|
-
}, [
|
|
617
|
+
}, [F(" 点击或拖拽文件到此处上传 "), f("br"), f("em", null, "支持的格式: tar.gz, zip")], -1))]),
|
|
615
618
|
_: 1
|
|
616
|
-
}), U.value.length > 0 ? (y(),
|
|
617
|
-
key:
|
|
619
|
+
}), U.value.length > 0 ? (y(), x("div", Ee, [(y(!0), x(B, null, W(U.value, (h) => (y(), x("div", {
|
|
620
|
+
key: h.fileName,
|
|
618
621
|
class: "upload-progress-item"
|
|
619
|
-
}, [f("div", Se, [f("span", Ue, C(
|
|
620
|
-
percentage:
|
|
621
|
-
status:
|
|
622
|
-
}, null, 8, ["percentage", "status"]), f("div", Me, C(
|
|
622
|
+
}, [f("div", Se, [f("span", Ue, C(h.fileName), 1), f("span", Le, C(q(ye)(h.fileSize)), 1)]), e(i, {
|
|
623
|
+
percentage: h.progress,
|
|
624
|
+
status: h.progressStatus
|
|
625
|
+
}, null, 8, ["percentage", "status"]), f("div", Me, C(h.statusText), 1)]))), 128))])) : O("", !0), f("div", Ce, [e(q(ue), {
|
|
623
626
|
ref_key: "refTdsTable",
|
|
624
627
|
ref: l,
|
|
625
628
|
columns: S,
|
|
@@ -629,12 +632,12 @@ const L = {
|
|
|
629
632
|
default: T(() => [e(_, {
|
|
630
633
|
type: "expand"
|
|
631
634
|
}, {
|
|
632
|
-
default: T((
|
|
635
|
+
default: T((h) => [h.row.deployment_server && h.row.deployment_server.length > 0 ? (y(), x("div", qe, [g[1] || (g[1] = f("div", {
|
|
633
636
|
class: "font-bold text-14px mt-12px"
|
|
634
|
-
}, "已部署的服务器", -1)), f("div", Ae, [(y(!0),
|
|
637
|
+
}, "已部署的服务器", -1)), f("div", Ae, [(y(!0), x(B, null, W(h.row.deployment_server, (k) => (y(), x("div", {
|
|
635
638
|
key: k.id,
|
|
636
639
|
class: "w-30% px-20px py-10px rounded-8px bg-[var(--el-fill-color-light)] border border-solid border-[var(--el-border-color-lighter)] hover:shadow-md transition-shadow"
|
|
637
|
-
}, [f("div", Fe, C(k.server_name), 1), f("div", Be, [f("p", null, "IP: " + C(k.ip_address), 1), f("p", null, "部署时间: " + C(k.deployment_time), 1)])]))), 128))])])) : (y(),
|
|
640
|
+
}, [f("div", Fe, C(k.server_name), 1), f("div", Be, [f("p", null, "IP: " + C(k.ip_address), 1), f("p", null, "部署时间: " + C(k.deployment_time), 1)])]))), 128))])])) : (y(), x("div", De, "暂无部署服务器记录"))]),
|
|
638
641
|
_: 1
|
|
639
642
|
})]),
|
|
640
643
|
_: 1
|
|
@@ -671,10 +674,10 @@ const L = {
|
|
|
671
674
|
const {
|
|
672
675
|
$t: l,
|
|
673
676
|
$messageBox: a
|
|
674
|
-
} = window, r =
|
|
677
|
+
} = window, r = w(), c = w(), v = w(""), n = w({}), m = w("show"), E = H({
|
|
675
678
|
service_type: window.$prodType
|
|
676
679
|
});
|
|
677
|
-
function
|
|
680
|
+
function b() {
|
|
678
681
|
n.value = {}, m.value = "show", v.value = "添加服务器", c.value.open();
|
|
679
682
|
}
|
|
680
683
|
const s = (o) => {
|
|
@@ -690,16 +693,16 @@ const L = {
|
|
|
690
693
|
id: o.id
|
|
691
694
|
}, m.value = "deploy", v.value = "快速部署", c.value.open();
|
|
692
695
|
}
|
|
693
|
-
const $ =
|
|
696
|
+
const $ = w([{
|
|
694
697
|
ip: "",
|
|
695
698
|
port: ""
|
|
696
|
-
}]), M =
|
|
699
|
+
}]), M = w([{
|
|
697
700
|
ip: "",
|
|
698
701
|
port: ""
|
|
699
|
-
}]), I =
|
|
702
|
+
}]), I = w([{
|
|
700
703
|
ip: "",
|
|
701
704
|
port: ""
|
|
702
|
-
}]), S =
|
|
705
|
+
}]), S = w([{
|
|
703
706
|
ip: "",
|
|
704
707
|
port: ""
|
|
705
708
|
}]);
|
|
@@ -710,15 +713,15 @@ const L = {
|
|
|
710
713
|
}), r.value.getTableList(), c.value.close();
|
|
711
714
|
return;
|
|
712
715
|
}
|
|
713
|
-
const i = (
|
|
714
|
-
const
|
|
716
|
+
const i = (h, k) => {
|
|
717
|
+
const D = Math.max(h.length, k.length);
|
|
715
718
|
return Array.from({
|
|
716
|
-
length:
|
|
719
|
+
length: D
|
|
717
720
|
}, (N, z) => {
|
|
718
721
|
var R, J, Z, Q;
|
|
719
722
|
return {
|
|
720
|
-
src_ip: ((R =
|
|
721
|
-
src_port: Number((J =
|
|
723
|
+
src_ip: ((R = h[z]) == null ? void 0 : R.ip) || "",
|
|
724
|
+
src_port: Number((J = h[z]) == null ? void 0 : J.port) || 0,
|
|
722
725
|
dst_ip: ((Z = k[z]) == null ? void 0 : Z.ip) || "",
|
|
723
726
|
dst_port: Number((Q = k[z]) == null ? void 0 : Q.port) || 0
|
|
724
727
|
};
|
|
@@ -751,12 +754,12 @@ const L = {
|
|
|
751
754
|
data: [o.id]
|
|
752
755
|
}), r.value.getTableList();
|
|
753
756
|
}
|
|
754
|
-
function
|
|
757
|
+
function g(o) {
|
|
755
758
|
Te({
|
|
756
759
|
data: [o.id]
|
|
757
760
|
}), r.value.getTableList();
|
|
758
761
|
}
|
|
759
|
-
const
|
|
762
|
+
const A = H([{
|
|
760
763
|
field: "server_name",
|
|
761
764
|
name: "服务器名称",
|
|
762
765
|
show: {
|
|
@@ -937,14 +940,14 @@ const L = {
|
|
|
937
940
|
deploy: {
|
|
938
941
|
type: "input",
|
|
939
942
|
tooltip: "白名单配置后,仅采集白名单内相关流量,如不填写,则采集所有流量",
|
|
940
|
-
render: () => e(
|
|
943
|
+
render: () => e(B, null, [e("p", {
|
|
941
944
|
class: "color-[var(--el-text-color-regular)]"
|
|
942
|
-
}, [
|
|
945
|
+
}, [F("源ip端口:")]), e(V, {
|
|
943
946
|
modelValue: $.value,
|
|
944
947
|
"onUpdate:modelValue": (o) => $.value = o
|
|
945
948
|
}, null), e("p", {
|
|
946
949
|
class: "color-[var(--el-text-color-regular)]"
|
|
947
|
-
}, [
|
|
950
|
+
}, [F("目的ip端口:")]), e(V, {
|
|
948
951
|
modelValue: M.value,
|
|
949
952
|
"onUpdate:modelValue": (o) => M.value = o
|
|
950
953
|
}, null)])
|
|
@@ -956,14 +959,14 @@ const L = {
|
|
|
956
959
|
deploy: {
|
|
957
960
|
type: "input",
|
|
958
961
|
tooltip: "黑名单配置后,将不再采集黑名单内相关流量",
|
|
959
|
-
render: () => e(
|
|
962
|
+
render: () => e(B, null, [e("p", {
|
|
960
963
|
class: "color-[var(--el-text-color-regular)]"
|
|
961
|
-
}, [
|
|
964
|
+
}, [F("源ip端口:")]), e(V, {
|
|
962
965
|
modelValue: I.value,
|
|
963
966
|
"onUpdate:modelValue": (o) => I.value = o
|
|
964
967
|
}, null), e("p", {
|
|
965
968
|
class: "color-[var(--el-text-color-regular)]"
|
|
966
|
-
}, [
|
|
969
|
+
}, [F("目的ip端口:")]), e(V, {
|
|
967
970
|
modelValue: S.value,
|
|
968
971
|
"onUpdate:modelValue": (o) => S.value = o
|
|
969
972
|
}, null)])
|
|
@@ -995,7 +998,7 @@ const L = {
|
|
|
995
998
|
link: !0,
|
|
996
999
|
type: "primary",
|
|
997
1000
|
class: "custom-btn",
|
|
998
|
-
onClick: () =>
|
|
1001
|
+
onClick: () => g(o.row)
|
|
999
1002
|
}, {
|
|
1000
1003
|
icon: () => e(d("tds-svg-icon"), {
|
|
1001
1004
|
name: "docker",
|
|
@@ -1020,11 +1023,11 @@ const L = {
|
|
|
1020
1023
|
}, null)])
|
|
1021
1024
|
}]);
|
|
1022
1025
|
return (o, i) => {
|
|
1023
|
-
const _ = d("el-button"),
|
|
1024
|
-
return y(),
|
|
1026
|
+
const _ = d("el-button"), h = d("el-table-column"), k = d("TdsTable");
|
|
1027
|
+
return y(), x("div", Ve, [e(k, {
|
|
1025
1028
|
ref_key: "refTdsTable",
|
|
1026
1029
|
ref: r,
|
|
1027
|
-
columns:
|
|
1030
|
+
columns: A,
|
|
1028
1031
|
"request-api": q(ne),
|
|
1029
1032
|
"search-col": 4,
|
|
1030
1033
|
"init-param": E,
|
|
@@ -1036,20 +1039,20 @@ const L = {
|
|
|
1036
1039
|
type: "primary",
|
|
1037
1040
|
icon: "Plus",
|
|
1038
1041
|
plain: "",
|
|
1039
|
-
onClick: i[0] || (i[0] = (
|
|
1042
|
+
onClick: i[0] || (i[0] = (D) => b())
|
|
1040
1043
|
}, {
|
|
1041
|
-
default: T(() => [
|
|
1044
|
+
default: T(() => [F(C(q(l)("button.add")), 1)]),
|
|
1042
1045
|
_: 1
|
|
1043
1046
|
})])]),
|
|
1044
|
-
default: T(() => [e(
|
|
1047
|
+
default: T(() => [e(h, {
|
|
1045
1048
|
type: "expand"
|
|
1046
1049
|
}, {
|
|
1047
|
-
default: T((
|
|
1050
|
+
default: T((D) => [D.row.deployment_packages && D.row.deployment_packages.length > 0 ? (y(), x("div", Pe, [i[1] || (i[1] = f("div", {
|
|
1048
1051
|
class: "font-bold text-14px mt-12px"
|
|
1049
|
-
}, "已部署的探针包", -1)), f("div", Ie, [(y(!0),
|
|
1052
|
+
}, "已部署的探针包", -1)), f("div", Ie, [(y(!0), x(B, null, W(D.row.deployment_packages, (N) => (y(), x("div", {
|
|
1050
1053
|
key: N.id,
|
|
1051
1054
|
class: "w-30% px-20px py-10px rounded-8px bg-[var(--el-fill-color-light)] border border-solid border-[var(--el-border-color-lighter)] hover:shadow-md transition-shadow"
|
|
1052
|
-
}, [f("div", Re, C(N.file_name), 1), f("div", Oe, [f("p", null, "版本: " + C(N.version), 1), f("p", null, "部署时间: " + C(N.deployment_time), 1)])]))), 128))])])) : (y(),
|
|
1055
|
+
}, [f("div", Re, C(N.file_name), 1), f("div", Oe, [f("p", null, "版本: " + C(N.version), 1), f("p", null, "部署时间: " + C(N.deployment_time), 1)])]))), 128))])])) : (y(), x("div", He, "暂无部署服务器记录"))]),
|
|
1053
1056
|
_: 1
|
|
1054
1057
|
})]),
|
|
1055
1058
|
_: 1
|
|
@@ -1059,7 +1062,7 @@ const L = {
|
|
|
1059
1062
|
}, o.$formBindProps({
|
|
1060
1063
|
title: v.value,
|
|
1061
1064
|
form: n.value,
|
|
1062
|
-
columns:
|
|
1065
|
+
columns: A,
|
|
1063
1066
|
formKey: m.value
|
|
1064
1067
|
}), {
|
|
1065
1068
|
onSubmit: U
|
|
@@ -1080,7 +1083,7 @@ const L = {
|
|
|
1080
1083
|
}), a = H([{
|
|
1081
1084
|
field: "packages_name",
|
|
1082
1085
|
name: "探针包",
|
|
1083
|
-
render: (r) => e(
|
|
1086
|
+
render: (r) => e(B, null, [e("p", {
|
|
1084
1087
|
class: "font-bold"
|
|
1085
1088
|
}, [r.row.packages_name]), e("p", {
|
|
1086
1089
|
class: "text-gray-400"
|
|
@@ -1088,7 +1091,7 @@ const L = {
|
|
|
1088
1091
|
}, {
|
|
1089
1092
|
field: "server_name",
|
|
1090
1093
|
name: "服务器",
|
|
1091
|
-
render: (r) => e(
|
|
1094
|
+
render: (r) => e(B, null, [e("p", {
|
|
1092
1095
|
class: "font-bold"
|
|
1093
1096
|
}, [r.row.server_name]), e("p", {
|
|
1094
1097
|
class: "text-gray-400"
|
|
@@ -1116,7 +1119,7 @@ const L = {
|
|
|
1116
1119
|
}]);
|
|
1117
1120
|
return (r, c) => {
|
|
1118
1121
|
const v = d("el-table-column"), n = d("TdsTable");
|
|
1119
|
-
return y(),
|
|
1122
|
+
return y(), x("div", We, [e(n, {
|
|
1120
1123
|
ref: "refTdsTable",
|
|
1121
1124
|
columns: a,
|
|
1122
1125
|
"search-col": 4,
|
|
@@ -1145,10 +1148,10 @@ const L = {
|
|
|
1145
1148
|
}
|
|
1146
1149
|
},
|
|
1147
1150
|
setup(t) {
|
|
1148
|
-
const l =
|
|
1151
|
+
const l = w("package");
|
|
1149
1152
|
return (a, r) => {
|
|
1150
1153
|
const c = d("el-tab-pane"), v = d("el-tabs");
|
|
1151
|
-
return y(),
|
|
1154
|
+
return y(), x("div", Je, [
|
|
1152
1155
|
e(v, {
|
|
1153
1156
|
modelValue: l.value,
|
|
1154
1157
|
"onUpdate:modelValue": r[0] || (r[0] = (n) => l.value = n),
|
package/lib/t-probe-ui.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(N,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@element-plus/icons-vue"),require("topdatasec-ui"),require("spark-md5"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","@element-plus/icons-vue","topdatasec-ui","spark-md5","element-plus"],e):(N=typeof globalThis<"u"?globalThis:N||self,e(N.TProbeUI={},N.Vue,N.IconsVue,N.TopdatasecUI,N.SparkMD5,N.ElementPlus))})(this,function(N,e,D,F,W,A){"use strict";const De="",G={key:0,class:"absolute right--13px text-#f56c6c hover:cursor-pointer"},J=e.defineComponent({__name:"IpPortList",props:{modelValue:{default:()=>[{ip:"",port:""}]},modelModifiers:{}},emits:["update:modelValue"],setup(t){const o=e.useModel(t,"modelValue"),{$t:a}=window;function n(){o.value=[...o.value,{ip:"",port:""}]}function p(_){const l=[...o.value];l.splice(_,1),o.value=l}return(_,l)=>{const u=e.resolveComponent("el-input"),b=e.resolveComponent("el-form-item"),y=e.resolveComponent("el-icon"),s=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(c,w)=>(e.openBlock(),e.createElementBlock("div",{key:w,class:"flex form-m0 w-100% mb-5px"},[e.createVNode(b,{class:"w-70%"},{default:e.withCtx(()=>[e.createVNode(u,{modelValue:c.ip,"onUpdate:modelValue":T=>c.ip=T,class:"min-w-300px w-100%",placeholder:"IP"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),e.createVNode(b,{class:"ml-auto w-30%"},{default:e.withCtx(()=>[e.createVNode(u,{modelValue:c.port,"onUpdate:modelValue":T=>c.port=T,class:"ml-10",placeholder:e.unref(a)("global.port")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1024),o.value.length>1?(e.openBlock(),e.createElementBlock("div",G,[e.createVNode(y,{onClick:T=>p(w)},{default:e.withCtx(()=>[e.createVNode(e.unref(D.CircleClose))]),_:1},8,["onClick"])])):e.createCommentVNode("",!0)]))),128)),e.createVNode(s,{class:"w-100% mt-10px border-dashed!",icon:"Plus",onClick:n})])}}}),Ae="",P=(t,o)=>{const a=t.__vccOpts||t;for(const[n,p]of o)a[n]=p;return a},C=P(J,[["__scopeId","data-v-16fc9c64"]]),S=5*1024*1024;function Z(t,o){return new Promise((a,n)=>{const p=new W.ArrayBuffer,_=new FileReader,l=Math.ceil(t.size/S);let u=0;_.onload=y=>{var s;if(p.append((s=y.target)==null?void 0:s.result),u++,o){const c=Math.floor(u/l*100);o(c)}if(u<l)b();else{const c=p.end();a(c)}},_.onerror=()=>{n(new Error("MD5计算失败"))};function b(){const y=u*S,s=Math.min(y+S,t.size);_.readAsArrayBuffer(t.slice(y,s))}b()})}async function Q(t,o,a,n,p,_="/api/upload/chunk"){const l=o*S,u=Math.min(l+S,t.size),b=t.slice(l,u),y=u-l,s=new FormData;s.append("file",b,t.name),s.append("chunkIndex",String(o+1)),s.append("totalChunkNum",String(a)),s.append("fileMd5",n),s.append("tds_token",p),s.append("fileName",t.name),s.append("fileSize",String(t.size)),s.append("fileExt",t.name.substring(t.name.lastIndexOf(".")+1)),s.append("chunkSize",String(S)),s.append("currentChunkSize",String(y));try{const c=await fetch(_,{method:"POST",body:s});if(console.log(c,"upload response"),!c.ok)throw new Error(`分片 ${o+1} 上传失败,HTTP状态码: ${c.status}`);const w=await c.json();if(console.log(w,"upload result"),w.recode!==0)throw new Error(`上传失败: ${w.remsg||"未知错误"}`);return!0}catch(c){throw console.error(`上传分片 ${o+1} 时出错:`,c),c}}async function X(t,o="/api/upload/merge"){try{if(!(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).ok)throw new Error("文件合并失败");return!0}catch(a){return console.error("合并分片时出错:",a),!1}}async function Y(t){const{token:o,file:a,fileDesc:n="",uploadUrl:p="/api/upload/chunk",mergeUrl:_="/api/upload/merge",onProgress:l,onSuccess:u,onError:b}=t;try{l==null||l({progress:0,statusText:"正在计算文件MD5...",status:"preparing"});const s=await Z(a,k=>{l==null||l({progress:Math.floor(k*.1),statusText:`正在计算文件MD5... ${k}%`,status:"preparing"})});l==null||l({progress:10,statusText:"MD5计算完成",status:"preparing",fileMd5:s});const c=Math.ceil(a.size/S);l==null||l({progress:10,statusText:`开始上传 (共${c}个分片)`,status:"uploading",fileMd5:s});for(let k=0;k<c;k++){const V=Math.floor(k/c*80);l==null||l({progress:10+V,statusText:`正在上传分片 ${k+1}/${c}`,status:"uploading",fileMd5:s}),await Q(a,k,c,s,o,p)}l==null||l({progress:90,statusText:"正在合并文件...",status:"merging",fileMd5:s});const w=a.name.substring(a.name.lastIndexOf(".")+1),T={fileDesc:n,fileExt:w,fileMd5:s,fileName:a.name,fileSize:String(a.size),tds_token:o,totalChunkNum:String(c)};if(!await X(T,_))throw new Error("文件合并失败");l==null||l({progress:100,statusText:"上传成功",status:"success",fileMd5:s}),A.ElMessage.success(`${a.name} 上传成功`),u==null||u(s)}catch(y){l==null||l({progress:0,statusText:y.message||"上传失败",status:"error"}),A.ElMessage.error(`${a.name} 上传失败: ${y.message}`),b==null||b(y)}}function v(t){if(t===0)return"0 B";const o=1024,a=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(t)/Math.log(o));return Math.round(t/Math.pow(o,n)*100)/100+" "+a[n]}const x={get deployURL(){return window.$probeURL||""}},I=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/deploy`,method:"post",data:t}),ee=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/add`,method:"post",data:t}),z=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/packages/get`,method:"post",data:t,isError:!1}),R=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/get`,method:"post",data:t,isError:!1}),te=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/del`,method:"post",data:t}),oe=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/packages/del`,method:"post",data:t}),re=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/get_arch`,method:"post",data:t,isError:!1}),le=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/deployment_history/get`,method:"post",data:t,isError:!1}),ne=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/test_ssh`,method:"post",data:t}),ae=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/check_env`,method:"post",data:t}),se=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/install_env`,method:"post",data:t}),de={class:"h-100%"},ie={key:0,class:"upload-progress-list"},ce={class:"file-info"},pe={class:"file-name"},ue={class:"file-size"},me={class:"progress-text"},_e={class:"table-box h-[calc(100%-220px)]",style:{height:"calc(100% - 220px)"}},fe={key:0},ye={class:"flex flex-wrap gap-12px p-12px"},ge={class:"font-bold text-14px mb-8px text-[var(--el-text-color-primary)]"},he={class:"text-12px text-[var(--el-text-color-regular)] space-y-4px"},we={key:1,class:"font-bold text-center text-gray-500 py-20"},be=e.defineComponent({__name:"index",props:{token:{type:String,default:""}},setup(t){const o=e.ref(),a=e.ref(),n=e.ref("快速部署"),p=e.ref({}),{$t:_,$messageBox:l}=window,u=t;function b(d){p.value={id:d.id},a.value.open()}const y=e.ref([{ip:"",port:""}]),s=e.ref([{ip:"",port:""}]),c=e.ref([{ip:"",port:""}]),w=e.ref([{ip:"",port:""}]);async function T(d){const g=(r,i)=>{const m=Math.max(r.length,i.length);return Array.from({length:m},(f,h)=>{var E,B,q,M;return{src_ip:((E=r[h])==null?void 0:E.ip)||"",src_port:Number((B=r[h])==null?void 0:B.port)||0,dst_ip:((q=i[h])==null?void 0:q.ip)||"",dst_port:Number((M=i[h])==null?void 0:M.port)||0}})},$={packages_id:[p.value.id],server_id:d.server_id,service_type:window.$prodType,deploy_params:{probe_name:d.probe_name||"",collection_mode:d.collection_mode,interface:d.interface||"",engine_ip:d.engine_ip||"",engine_port:d.engine_port||"",filterWhitelist:g(y.value,s.value),filterBlacklist:g(c.value,w.value)}};await I({data:$}),o.value.getTableList(),a.value.close()}async function L(d){l(d,"file_name",_("button.delete"),"error").then(async()=>{await oe({data:[d.id]}),o.value.getTableList()})}const k=e.reactive([{field:"server_id",name:"选择服务器",enum:R,fieldNames:{value:"id",label:"server_name"},show:{type:"select",prop:{multiple:!0},dataType:"any"},hide:!0,rules:[{required:!0}]},{field:"file_name",name:"文件名称"},{field:"version",name:"版本"},{field:"file_size",name:"大小"},{field:"upload_time",name:"上传时间"},{field:"deployment_server",name:"已部署服务器数",render:d=>{var g;return((g=d.row.deployment_server)==null?void 0:g.length)||0}},{field:"upload_status",name:"状态",tag:!0,enum:[{label:"上传失败",value:0,tagType:"danger"},{label:"上传中",value:1,tagType:"warning"},{label:"上传成功",value:2,tagType:"success"}]},{field:"probe_name",name:"探针名称",show:{type:"input"},hide:!0,rules:[{required:!0}]},{field:"collection_mode",name:"采集模式",show:{type:"input",value:"DPDK",disabled:!0},hide:!0,rules:[{required:!0}]},{field:"interface",name:"采集网卡",show:{type:"input"},hide:!0,rules:[{required:!0}]},{field:"engine_ip",name:"流量接收引擎IP",show:{type:"input"},hide:!0},{field:"engine_port",name:"流量接收引擎端口",show:{type:"input",dataType:"number"},hide:!0,rules:[{required:!0,type:"any"}]},{field:"whitelist",name:"探针过滤白名单",show:{type:"input",tooltip:"白名单配置后,仅采集白名单内相关流量,如不填写,则采集所有流量",render:()=>e.createVNode(e.Fragment,null,[e.createVNode("div",{style:"width: 100%"},[e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("源ip端口:")]),e.createVNode(C,{modelValue:y.value,"onUpdate:modelValue":d=>y.value=d},null)]),e.createVNode("div",{style:"width: 100%"},[e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode(C,{modelValue:s.value,"onUpdate:modelValue":d=>s.value=d},null)])])},hide:!0},{field:"blacklist",name:"探针过滤黑名单",show:{type:"input",tooltip:"黑名单配置后,将不再采集黑名单内相关流量",render:()=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("源ip端口:")]),e.createVNode(C,{modelValue:c.value,"onUpdate:modelValue":d=>c.value=d},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode(C,{modelValue:w.value,"onUpdate:modelValue":d=>w.value=d},null)])},hide:!0},{field:"operation",name:window.$t("global.operate"),width:140,fixed:"right",render:d=>e.createVNode("div",null,[e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",class:"custom-btn",onClick:()=>b(d.row)},{icon:()=>e.createVNode(e.resolveComponent("tds-svg-icon"),{name:"deployed",tip:"部署"},null)}),e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"danger",icon:"Delete",title:_("button.delete"),onClick:()=>L([d.row])},null)])}]),V=e.ref([]);function U(d){const g=d.raw;if(!g)return;const $={fileName:g.name,fileSize:g.size,progress:0,progressStatus:"",statusText:"准备上传..."};V.value.push($);const r=V.value.length-1;Y({file:g,fileDesc:"探针安装包",uploadUrl:x.deployURL+"/service_deploy/deployment/packages/upload",mergeUrl:x.deployURL+"/service_deploy/deployment/packages/upload_merge",token:u.token,onProgress:i=>{const m=V.value[r];m&&(m.progress=i.progress,m.statusText=i.statusText,i.fileMd5&&(m.fileMd5=i.fileMd5),i.status==="error"?m.progressStatus="exception":i.status==="success"?m.progressStatus="success":m.progressStatus="")},onSuccess:()=>{var m;const i=V.value[r];i&&(i.progress=100,i.progressStatus="success",i.statusText="上传成功"),(m=o.value)==null||m.getTableList(),setTimeout(()=>{const f=V.value.findIndex(h=>h.fileName===g.name);f!==-1&&V.value.splice(f,1)},3e3)},onError:i=>{console.error("文件上传失败:",i);const m=V.value[r];m&&(m.progressStatus="exception",m.statusText=i.message||"上传失败")}})}return(d,g)=>{const $=e.resolveComponent("el-icon"),r=e.resolveComponent("el-upload"),i=e.resolveComponent("el-progress"),m=e.resolveComponent("el-table-column");return e.openBlock(),e.createElementBlock("div",de,[e.createVNode(r,{class:"upload-demo mt-10px",drag:"",action:"","auto-upload":!1,accept:".tar.gz,.tgz","on-change":U,"show-file-list":!1,multiple:""},{default:e.withCtx(()=>[e.createVNode($,{class:"el-icon--upload"},{default:e.withCtx(()=>[e.createVNode(e.unref(D.UploadFilled))]),_:1}),g[0]||(g[0]=e.createElementVNode("div",{class:"el-upload__text"},[e.createTextVNode(" 点击或拖拽文件到此处上传 "),e.createElementVNode("br"),e.createElementVNode("em",null,"支持的格式: tar.gz, tgz")],-1))]),_:1}),V.value.length>0?(e.openBlock(),e.createElementBlock("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f.fileName,class:"upload-progress-item"},[e.createElementVNode("div",ce,[e.createElementVNode("span",pe,e.toDisplayString(f.fileName),1),e.createElementVNode("span",ue,e.toDisplayString(e.unref(v)(f.fileSize)),1)]),e.createVNode(i,{percentage:f.progress,status:f.progressStatus},null,8,["percentage","status"]),e.createElementVNode("div",me,e.toDisplayString(f.statusText),1)]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",_e,[e.createVNode(e.unref(F.TdsTable),{ref_key:"refTdsTable",ref:o,columns:k,"request-api":e.unref(z),options:d.$tableOptions()},{default:e.withCtx(()=>[e.createVNode(m,{type:"expand"},{default:e.withCtx(f=>[f.row.deployment_server&&f.row.deployment_server.length>0?(e.openBlock(),e.createElementBlock("div",fe,[g[1]||(g[1]=e.createElementVNode("div",{class:"font-bold text-14px mt-12px"},"已部署的服务器",-1)),e.createElementVNode("div",ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.row.deployment_server,h=>(e.openBlock(),e.createElementBlock("div",{key:h.id,class:"w-30% px-20px py-10px rounded-8px bg-[var(--el-fill-color-light)] border border-solid border-[var(--el-border-color-lighter)] hover:shadow-md transition-shadow"},[e.createElementVNode("div",ge,e.toDisplayString(h.server_name),1),e.createElementVNode("div",he,[e.createElementVNode("p",null,"IP: "+e.toDisplayString(h.ip_address),1),e.createElementVNode("p",null,"部署时间: "+e.toDisplayString(h.deployment_time),1)])]))),128))])])):(e.openBlock(),e.createElementBlock("div",we,"暂无部署服务器记录"))]),_:1})]),_:1},8,["columns","request-api","options"])]),e.createVNode(e.unref(F.TdsForm),e.mergeProps({ref_key:"refTdsForm",ref:a},d.$formBindProps({title:n.value,form:p.value,columns:k}),{onSubmit:T}),null,16)])}}}),ke={class:"table-box"},xe={class:"flex items-center"},Ve={key:0},Ne={class:"flex flex-wrap gap-12px p-12px"},Te={class:"font-bold text-14px mb-8px text-[var(--el-text-color-primary)]"},Ee={class:"text-12px text-[var(--el-text-color-regular)] space-y-4px"},Ce={key:1,class:"font-bold text-center text-gray-500 py-20"},$e=e.defineComponent({__name:"index",setup(t){const{$t:o,$messageBox:a}=window,n=e.ref(),p=e.ref(),_=e.ref(""),l=e.ref({}),u=e.ref("show"),b=e.reactive({service_type:window.$prodType});function y(){l.value={},u.value="show",_.value="添加服务器",p.value.open()}const s=r=>{a(r,"server_name",o("button.delete"),"error").then(async()=>{await te({data:r.map(i=>i.id),service_type:window.$prodType}),n.value.getTableList()})};function c(r){l.value={id:r.id},u.value="deploy",_.value="快速部署",p.value.open()}const w=e.ref([{ip:"",port:""}]),T=e.ref([{ip:"",port:""}]),L=e.ref([{ip:"",port:""}]),k=e.ref([{ip:"",port:""}]);async function V(r){if(u.value==="show"){await ee({data:r}),n.value.getTableList(),p.value.close();return}const i=(f,h)=>{const E=Math.max(f.length,h.length);return Array.from({length:E},(B,q)=>{var M,j,H,K;return{src_ip:((M=f[q])==null?void 0:M.ip)||"",src_port:Number((j=f[q])==null?void 0:j.port)||0,dst_ip:((H=h[q])==null?void 0:H.ip)||"",dst_port:Number((K=h[q])==null?void 0:K.port)||0}})},m={packages_id:[r.packages_id],server_id:[l.value.id],service_type:window.$prodType,deploy_params:{probe_name:r.probe_name||"",collection_mode:r.collection_mode,interface:r.interface||"",engine_ip:r.engine_ip||"",engine_port:r.engine_port||"",filterWhitelist:i(w.value,T.value),filterBlacklist:i(L.value,k.value)}};await I({data:m}),n.value.getTableList(),p.value.close()}function U(r){ne({data:[r.id]}),n.value.getTableList()}function d(r){ae({data:[r.id]}),n.value.getTableList()}function g(r){se({data:[r.id]}),n.value.getTableList()}const $=e.reactive([{field:"server_name",name:"服务器名称",show:{type:"input"},rules:[{required:!0}]},{field:"ip_address",name:"IP地址",show:{type:"input"},rules:[{required:!0}]},{field:"ssh_port",name:"端口",show:{type:"input",dataType:"number"},rules:[{required:!0,type:"any"}]},{field:"ssh_username",name:"SSH用户",show:{type:"input"},rules:[{required:!0}]},{field:"ssh_password",name:"SSH登录密码",hide:!0,show:{type:"input",prop:{type:"password",showPassword:!0}},rules:[{required:!0}]},{field:"arch",name:"架构",enum:re,show:{type:"select"},rules:[{required:!0}]},{field:"deployed_count",name:"已部署探针数量",render:r=>e.createVNode("span",null,[r.row.deployment_packages.length])},{field:"status",name:"状态",tag:!0,enum:[{label:"在线",value:1,tagType:"success"},{label:"不在线",value:0,tagType:"danger"}]},{field:"ssh_status",name:"连通性检查",tag:!0,enum:[{label:"成功",value:1,tagType:"success"},{label:"失败",value:0,tagType:"danger"}]},{field:"check_env_ok",name:"安装环境",tag:!0,enum:[{label:"具备",value:1,tagType:"success"},{label:"不具备",value:0,tagType:"danger"}]},{field:"packages_id",name:"安装包",enum:z,fieldNames:{value:"id",label:"file_name"},deploy:{type:"select"},hide:!0,rules:[{required:!0}]},{field:"probe_name",name:"探针名称",deploy:{type:"input"},hide:!0,rules:[{required:!0}]},{field:"collection_mode",name:"采集模式",deploy:{type:"input",value:"DPDK",disabled:!0},hide:!0,rules:[{required:!0}]},{field:"interface",name:"采集网卡",deploy:{type:"input"},hide:!0,rules:[{required:!0}]},{field:"engine_ip",name:"流量接收引擎IP",deploy:{type:"input"},rules:[{required:!0,type:"any"}],hide:!0},{field:"engine_port",name:"流量接收引擎端口",deploy:{type:"input",dataType:"number"},hide:!0,rules:[{required:!0,type:"any"}]},{field:"whitelist",name:"探针过滤白名单",deploy:{type:"input",tooltip:"白名单配置后,仅采集白名单内相关流量,如不填写,则采集所有流量",render:()=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("源ip端口:")]),e.createVNode(C,{modelValue:w.value,"onUpdate:modelValue":r=>w.value=r},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode(C,{modelValue:T.value,"onUpdate:modelValue":r=>T.value=r},null)])},hide:!0},{field:"blacklist",name:"探针过滤黑名单",deploy:{type:"input",tooltip:"黑名单配置后,将不再采集黑名单内相关流量",render:()=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("源ip端口:")]),e.createVNode(C,{modelValue:L.value,"onUpdate:modelValue":r=>L.value=r},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode(C,{modelValue:k.value,"onUpdate:modelValue":r=>k.value=r},null)])},hide:!0},{field:"operation",name:window.$t("global.operate"),width:180,fixed:"right",render:r=>e.createVNode("div",null,[e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",icon:"Connection",title:"连通性检查",class:"custom-btn",onClick:()=>U(r.row)},null),e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",class:"custom-btn",onClick:()=>d(r.row)},{icon:()=>e.createVNode(e.resolveComponent("tds-svg-icon"),{name:"install_env",tip:"测试安装环境"},null)}),e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",class:"custom-btn",onClick:()=>g(r.row)},{icon:()=>e.createVNode(e.resolveComponent("tds-svg-icon"),{name:"docker",tip:"自动安装docker环境"},null)}),e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",class:"custom-btn",onClick:()=>c(r.row)},{icon:()=>e.createVNode(e.resolveComponent("tds-svg-icon"),{name:"deployed",tip:"部署"},null)}),e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"danger",icon:"Delete",title:o("button.delete"),onClick:()=>s([r.row])},null)])}]);return(r,i)=>{const m=e.resolveComponent("el-button"),f=e.resolveComponent("el-table-column"),h=e.resolveComponent("TdsTable");return e.openBlock(),e.createElementBlock("div",ke,[e.createVNode(h,{ref_key:"refTdsTable",ref:n,columns:$,"request-api":e.unref(R),"search-col":4,"init-param":b,options:r.$tableOptions(),"reserve-selection":""},{tableHeader:e.withCtx(()=>[e.createElementVNode("div",xe,[e.createVNode(m,{class:"custom-btn",type:"primary",icon:"Plus",plain:"",onClick:i[0]||(i[0]=E=>y())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("button.add")),1)]),_:1})])]),default:e.withCtx(()=>[e.createVNode(f,{type:"expand"},{default:e.withCtx(E=>[E.row.deployment_packages&&E.row.deployment_packages.length>0?(e.openBlock(),e.createElementBlock("div",Ve,[i[1]||(i[1]=e.createElementVNode("div",{class:"font-bold text-14px mt-12px"},"已部署的探针包",-1)),e.createElementVNode("div",Ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.row.deployment_packages,B=>(e.openBlock(),e.createElementBlock("div",{key:B.id,class:"w-30% px-20px py-10px rounded-8px bg-[var(--el-fill-color-light)] border border-solid border-[var(--el-border-color-lighter)] hover:shadow-md transition-shadow"},[e.createElementVNode("div",Te,e.toDisplayString(B.file_name),1),e.createElementVNode("div",Ee,[e.createElementVNode("p",null,"版本: "+e.toDisplayString(B.version),1),e.createElementVNode("p",null,"部署时间: "+e.toDisplayString(B.deployment_time),1)])]))),128))])])):(e.openBlock(),e.createElementBlock("div",Ce,"暂无部署服务器记录"))]),_:1})]),_:1},8,["columns","request-api","init-param","options"]),e.createVNode(e.unref(F.TdsForm),e.mergeProps({ref_key:"refTdsForm",ref:p},r.$formBindProps({title:_.value,form:l.value,columns:$,formKey:u.value}),{onSubmit:V}),null,16)])}}}),Be={class:"table-box"},Se={style:{padding:"0 50px"}},qe=e.defineComponent({__name:"index",setup(t){const o=e.reactive({service_type:window.$prodType}),a=e.reactive([{field:"packages_name",name:"探针包",render:n=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"font-bold"},[n.row.packages_name]),e.createVNode("p",{class:"text-gray-400"},[n.row.packages_version])])},{field:"server_name",name:"服务器",render:n=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"font-bold"},[n.row.server_name]),e.createVNode("p",{class:"text-gray-400"},[n.row.ip_address])])},{field:"deployment_time",name:"部署时间"},{field:"deployment_status",name:"状态",tag:!0,enum:[{label:"部署失败",value:0,tagType:"danger"},{label:"部署中",value:1,tagType:"warning"},{label:"部署成功",value:2,tagType:"success"}]}]);return(n,p)=>{const _=e.resolveComponent("el-table-column"),l=e.resolveComponent("TdsTable");return e.openBlock(),e.createElementBlock("div",Be,[e.createVNode(l,{ref:"refTdsTable",columns:a,"search-col":4,"request-api":e.unref(le),options:n.$tableOptions(),"init-param":o,"reserve-selection":""},{default:e.withCtx(()=>[e.createVNode(_,{type:"expand"},{default:e.withCtx(u=>[e.createElementVNode("div",Se,e.toDisplayString(u.row.deployment_log),1)]),_:1})]),_:1},8,["columns","request-api","options","init-param"])])}}}),Le={class:"main-wrapper"},Me=e.defineComponent({name:"TCProbe",__name:"index",props:{token:{type:String,default:""}},setup(t){const o=e.ref("package");return(a,n)=>{const p=e.resolveComponent("el-tab-pane"),_=e.resolveComponent("el-tabs");return e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(_,{modelValue:o.value,"onUpdate:modelValue":n[0]||(n[0]=l=>o.value=l),class:"demo-tabs"},{default:e.withCtx(()=>[e.createVNode(p,{label:"安装包管理",name:"package"},{default:e.withCtx(()=>[o.value==="package"?(e.openBlock(),e.createBlock(be,{key:0,token:t.token},null,8,["token"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(p,{label:"探针部署",name:"deploy"},{default:e.withCtx(()=>[o.value==="deploy"?(e.openBlock(),e.createBlock($e,{key:0})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(p,{label:"部署历史",name:"history"},{default:e.withCtx(()=>[o.value==="history"?(e.openBlock(),e.createBlock(qe,{key:0})):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["modelValue"])])}}}),Pe="",O=((t,o)=>{if(t.install=a=>{for(const n of[t,...Object.values(o??{})])a.component(n.name,n)},o)for(const[a,n]of Object.entries(o))t[a]=n;return t})(P(Me,[["__scopeId","data-v-f99b9b23"]])),Fe={TCProbe:O},Ue={install(t,o){Object.entries(Fe).forEach(([a,n])=>{t.component(a,n)}),o!=null&&o.prodType&&(window.$prodType=o.prodType),o!=null&&o.envURL&&(window.$probeURL=o.envURL)}};N.TCProbe=O,N.default=Ue,Object.defineProperties(N,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(N,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@element-plus/icons-vue"),require("topdatasec-ui"),require("spark-md5"),require("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","@element-plus/icons-vue","topdatasec-ui","spark-md5","element-plus"],e):(N=typeof globalThis<"u"?globalThis:N||self,e(N.TProbeUI={},N.Vue,N.IconsVue,N.TopdatasecUI,N.SparkMD5,N.ElementPlus))})(this,function(N,e,D,F,W,A){"use strict";const De="",G={key:0,class:"absolute right--13px text-#f56c6c hover:cursor-pointer"},J=e.defineComponent({__name:"IpPortList",props:{modelValue:{default:()=>[{ip:"",port:""}]},modelModifiers:{}},emits:["update:modelValue"],setup(t){const o=e.useModel(t,"modelValue"),{$t:a}=window;function n(){o.value=[...o.value,{ip:"",port:""}]}function p(_){const l=[...o.value];l.splice(_,1),o.value=l}return(_,l)=>{const u=e.resolveComponent("el-input"),b=e.resolveComponent("el-form-item"),h=e.resolveComponent("el-icon"),s=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(c,w)=>(e.openBlock(),e.createElementBlock("div",{key:w,class:"flex form-m0 w-100% mb-5px"},[e.createVNode(b,{class:"w-70%"},{default:e.withCtx(()=>[e.createVNode(u,{modelValue:c.ip,"onUpdate:modelValue":T=>c.ip=T,class:"min-w-300px w-100%",placeholder:"IP"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),e.createVNode(b,{class:"ml-auto w-30%"},{default:e.withCtx(()=>[e.createVNode(u,{modelValue:c.port,"onUpdate:modelValue":T=>c.port=T,class:"ml-10",placeholder:e.unref(a)("global.port")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1024),o.value.length>1?(e.openBlock(),e.createElementBlock("div",G,[e.createVNode(h,{onClick:T=>p(w)},{default:e.withCtx(()=>[e.createVNode(e.unref(D.CircleClose))]),_:1},8,["onClick"])])):e.createCommentVNode("",!0)]))),128)),e.createVNode(s,{class:"w-100% mt-10px border-dashed!",icon:"Plus",onClick:n})])}}}),Ae="",P=(t,o)=>{const a=t.__vccOpts||t;for(const[n,p]of o)a[n]=p;return a},$=P(J,[["__scopeId","data-v-16fc9c64"]]),S=5*1024*1024;function Z(t,o){return new Promise((a,n)=>{const p=new W.ArrayBuffer,_=new FileReader,l=Math.ceil(t.size/S);let u=0;_.onload=h=>{var s;if(p.append((s=h.target)==null?void 0:s.result),u++,o){const c=Math.floor(u/l*100);o(c)}if(u<l)b();else{const c=p.end();a(c)}},_.onerror=()=>{n(new Error("MD5计算失败"))};function b(){const h=u*S,s=Math.min(h+S,t.size);_.readAsArrayBuffer(t.slice(h,s))}b()})}async function Q(t,o,a,n,p,_="/api/upload/chunk"){const l=o*S,u=Math.min(l+S,t.size),b=t.slice(l,u),h=u-l,s=new FormData;s.append("file",b,t.name),s.append("chunkIndex",String(o+1)),s.append("totalChunkNum",String(a)),s.append("fileMd5",n),s.append("tds_token",p),s.append("fileName",t.name),s.append("fileSize",String(t.size)),s.append("fileExt",t.name.substring(t.name.lastIndexOf(".")+1)),s.append("chunkSize",String(S)),s.append("currentChunkSize",String(h));try{const c=await fetch(_,{method:"POST",body:s});if(console.log(c,"upload response"),!c.ok)throw new Error(`分片 ${o+1} 上传失败,HTTP状态码: ${c.status}`);const w=await c.json();if(console.log(w,"upload result"),w.recode!==0)throw new Error(`上传失败: ${w.remsg||"未知错误"}`);return!0}catch(c){throw console.error(`上传分片 ${o+1} 时出错:`,c),c}}async function X(t,o="/api/upload/merge"){try{if(!(await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})).ok)throw new Error("文件合并失败");return!0}catch(a){return console.error("合并分片时出错:",a),!1}}async function Y(t){const{token:o,file:a,fileDesc:n="",uploadUrl:p="/api/upload/chunk",mergeUrl:_="/api/upload/merge",onProgress:l,onSuccess:u,onError:b}=t;try{l==null||l({progress:0,statusText:"正在计算文件MD5...",status:"preparing"});const s=await Z(a,k=>{l==null||l({progress:Math.floor(k*.1),statusText:`正在计算文件MD5... ${k}%`,status:"preparing"})});l==null||l({progress:10,statusText:"MD5计算完成",status:"preparing",fileMd5:s});const c=Math.ceil(a.size/S);l==null||l({progress:10,statusText:`开始上传 (共${c}个分片)`,status:"uploading",fileMd5:s});for(let k=0;k<c;k++){const V=Math.floor(k/c*80);l==null||l({progress:10+V,statusText:`正在上传分片 ${k+1}/${c}`,status:"uploading",fileMd5:s}),await Q(a,k,c,s,o,p)}l==null||l({progress:90,statusText:"正在合并文件...",status:"merging",fileMd5:s});const w=a.name.substring(a.name.lastIndexOf(".")+1),T={fileDesc:n,fileExt:w,fileMd5:s,fileName:a.name,fileSize:String(a.size),tds_token:o,totalChunkNum:String(c)};if(!await X(T,_))throw new Error("文件合并失败");l==null||l({progress:100,statusText:"上传成功",status:"success",fileMd5:s}),A.ElMessage.success(`${a.name} 上传成功`),u==null||u(s)}catch(h){l==null||l({progress:0,statusText:h.message||"上传失败",status:"error"}),A.ElMessage.error(`${a.name} 上传失败: ${h.message}`),b==null||b(h)}}function v(t){if(t===0)return"0 B";const o=1024,a=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(t)/Math.log(o));return Math.round(t/Math.pow(o,n)*100)/100+" "+a[n]}const x={get deployURL(){return window.$probeURL||""}},I=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/deploy`,method:"post",data:t}),ee=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/add`,method:"post",data:t}),z=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/packages/get`,method:"post",data:t,isError:!1}),R=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/get`,method:"post",data:t,isError:!1}),te=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/del`,method:"post",data:t}),oe=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/packages/del`,method:"post",data:t}),re=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/get_arch`,method:"post",data:t,isError:!1}),le=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/deployment_history/get`,method:"post",data:t,isError:!1}),ne=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/test_ssh`,method:"post",data:t}),ae=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/check_env`,method:"post",data:t}),se=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/install_env`,method:"post",data:t}),de={class:"h-100%"},ie={key:0,class:"upload-progress-list"},ce={class:"file-info"},pe={class:"file-name"},ue={class:"file-size"},me={class:"progress-text"},_e={class:"table-box h-[calc(100%-220px)]",style:{height:"calc(100% - 220px)"}},fe={key:0},ye={class:"flex flex-wrap gap-12px p-12px"},he={class:"font-bold text-14px mb-8px text-[var(--el-text-color-primary)]"},ge={class:"text-12px text-[var(--el-text-color-regular)] space-y-4px"},we={key:1,class:"font-bold text-center text-gray-500 py-20"},be=e.defineComponent({__name:"index",props:{token:{type:String,default:""}},setup(t){const o=e.ref(),a=e.ref(),n=e.ref("快速部署"),p=e.ref({}),{$t:_,$messageBox:l}=window,u=t;function b(d){p.value={id:d.id},a.value.open()}const h=e.ref([{ip:"",port:""}]),s=e.ref([{ip:"",port:""}]),c=e.ref([{ip:"",port:""}]),w=e.ref([{ip:"",port:""}]);async function T(d){const f=(r,i)=>{const m=Math.max(r.length,i.length);return Array.from({length:m},(y,g)=>{var C,B,q,M;return{src_ip:((C=r[g])==null?void 0:C.ip)||"",src_port:Number((B=r[g])==null?void 0:B.port)||0,dst_ip:((q=i[g])==null?void 0:q.ip)||"",dst_port:Number((M=i[g])==null?void 0:M.port)||0}})},E={packages_id:[p.value.id],server_id:d.server_id,service_type:window.$prodType,deploy_params:{probe_name:d.probe_name||"",collection_mode:d.collection_mode,interface:d.interface||"",engine_ip:d.engine_ip||"",engine_port:d.engine_port||"",filterWhitelist:f(h.value,s.value),filterBlacklist:f(c.value,w.value)}};await I({data:E}),o.value.getTableList(),a.value.close()}async function L(d){l(d,"file_name",_("button.delete"),"error").then(async()=>{const f=d.map(E=>E.id);await oe({data:f}),o.value.getTableList()})}const k=e.reactive([{field:"server_id",name:"选择服务器",enum:()=>R({service_type:window.$prodType}),fieldNames:{value:"id",label:"server_name"},show:{type:"select",prop:{multiple:!0},dataType:"any"},hide:!0,rules:[{required:!0}]},{field:"file_name",name:"文件名称"},{field:"version",name:"版本"},{field:"file_size",name:"大小"},{field:"upload_time",name:"上传时间"},{field:"deployment_server",name:"已部署服务器数",render:d=>{var f;return((f=d.row.deployment_server)==null?void 0:f.length)||0}},{field:"upload_status",name:"状态",tag:!0,enum:[{label:"上传失败",value:0,tagType:"danger"},{label:"上传中",value:1,tagType:"warning"},{label:"上传成功",value:2,tagType:"success"}]},{field:"probe_name",name:"探针名称",show:{type:"input"},hide:!0,rules:[{required:!0}]},{field:"collection_mode",name:"采集模式",show:{type:"input",value:"DPDK",disabled:!0},hide:!0,rules:[{required:!0}]},{field:"interface",name:"采集网卡",show:{type:"input"},hide:!0,rules:[{required:!0}]},{field:"engine_ip",name:"流量接收引擎IP",show:{type:"input"},hide:!0},{field:"engine_port",name:"流量接收引擎端口",show:{type:"input",dataType:"number"},hide:!0,rules:[{required:!0,type:"any"}]},{field:"whitelist",name:"探针过滤白名单",show:{type:"input",tooltip:"白名单配置后,仅采集白名单内相关流量,如不填写,则采集所有流量",render:()=>e.createVNode(e.Fragment,null,[e.createVNode("div",{style:"width: 100%"},[e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("源ip端口:")]),e.createVNode($,{modelValue:h.value,"onUpdate:modelValue":d=>h.value=d},null)]),e.createVNode("div",{style:"width: 100%"},[e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode($,{modelValue:s.value,"onUpdate:modelValue":d=>s.value=d},null)])])},hide:!0},{field:"blacklist",name:"探针过滤黑名单",show:{type:"input",tooltip:"黑名单配置后,将不再采集黑名单内相关流量",render:()=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("源ip端口:")]),e.createVNode($,{modelValue:c.value,"onUpdate:modelValue":d=>c.value=d},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode($,{modelValue:w.value,"onUpdate:modelValue":d=>w.value=d},null)])},hide:!0},{field:"operation",name:window.$t("global.operate"),width:140,fixed:"right",render:d=>e.createVNode("div",null,[e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",class:"custom-btn",onClick:()=>b(d.row)},{icon:()=>e.createVNode(e.resolveComponent("tds-svg-icon"),{name:"deployed",tip:"部署"},null)}),e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"danger",icon:"Delete",title:_("button.delete"),onClick:()=>L([d.row])},null)])}]),V=e.ref([]);function U(d){const f=d.raw;if(!f)return;const E={fileName:f.name,fileSize:f.size,progress:0,progressStatus:"",statusText:"准备上传..."};V.value.push(E);const r=V.value.length-1;Y({file:f,fileDesc:"探针安装包",uploadUrl:x.deployURL+"/service_deploy/deployment/packages/upload",mergeUrl:x.deployURL+"/service_deploy/deployment/packages/upload_merge",token:u.token,onProgress:i=>{const m=V.value[r];m&&(m.progress=i.progress,m.statusText=i.statusText,i.fileMd5&&(m.fileMd5=i.fileMd5),i.status==="error"?m.progressStatus="exception":i.status==="success"?m.progressStatus="success":m.progressStatus="")},onSuccess:()=>{var m;const i=V.value[r];i&&(i.progress=100,i.progressStatus="success",i.statusText="上传成功"),(m=o.value)==null||m.getTableList(),setTimeout(()=>{const y=V.value.findIndex(g=>g.fileName===f.name);y!==-1&&V.value.splice(y,1)},3e3)},onError:i=>{console.error("文件上传失败:",i);const m=V.value[r];m&&(m.progressStatus="exception",m.statusText=i.message||"上传失败")}})}return(d,f)=>{const E=e.resolveComponent("el-icon"),r=e.resolveComponent("el-upload"),i=e.resolveComponent("el-progress"),m=e.resolveComponent("el-table-column");return e.openBlock(),e.createElementBlock("div",de,[e.createVNode(r,{class:"upload-demo mt-10px",drag:"",action:"","auto-upload":!1,accept:".tar.gz,.zip","on-change":U,"show-file-list":!1,multiple:""},{default:e.withCtx(()=>[e.createVNode(E,{class:"el-icon--upload"},{default:e.withCtx(()=>[e.createVNode(e.unref(D.UploadFilled))]),_:1}),f[0]||(f[0]=e.createElementVNode("div",{class:"el-upload__text"},[e.createTextVNode(" 点击或拖拽文件到此处上传 "),e.createElementVNode("br"),e.createElementVNode("em",null,"支持的格式: tar.gz, zip")],-1))]),_:1}),V.value.length>0?(e.openBlock(),e.createElementBlock("div",ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y.fileName,class:"upload-progress-item"},[e.createElementVNode("div",ce,[e.createElementVNode("span",pe,e.toDisplayString(y.fileName),1),e.createElementVNode("span",ue,e.toDisplayString(e.unref(v)(y.fileSize)),1)]),e.createVNode(i,{percentage:y.progress,status:y.progressStatus},null,8,["percentage","status"]),e.createElementVNode("div",me,e.toDisplayString(y.statusText),1)]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",_e,[e.createVNode(e.unref(F.TdsTable),{ref_key:"refTdsTable",ref:o,columns:k,"request-api":e.unref(z),options:d.$tableOptions()},{default:e.withCtx(()=>[e.createVNode(m,{type:"expand"},{default:e.withCtx(y=>[y.row.deployment_server&&y.row.deployment_server.length>0?(e.openBlock(),e.createElementBlock("div",fe,[f[1]||(f[1]=e.createElementVNode("div",{class:"font-bold text-14px mt-12px"},"已部署的服务器",-1)),e.createElementVNode("div",ye,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.row.deployment_server,g=>(e.openBlock(),e.createElementBlock("div",{key:g.id,class:"w-30% px-20px py-10px rounded-8px bg-[var(--el-fill-color-light)] border border-solid border-[var(--el-border-color-lighter)] hover:shadow-md transition-shadow"},[e.createElementVNode("div",he,e.toDisplayString(g.server_name),1),e.createElementVNode("div",ge,[e.createElementVNode("p",null,"IP: "+e.toDisplayString(g.ip_address),1),e.createElementVNode("p",null,"部署时间: "+e.toDisplayString(g.deployment_time),1)])]))),128))])])):(e.openBlock(),e.createElementBlock("div",we,"暂无部署服务器记录"))]),_:1})]),_:1},8,["columns","request-api","options"])]),e.createVNode(e.unref(F.TdsForm),e.mergeProps({ref_key:"refTdsForm",ref:a},d.$formBindProps({title:n.value,form:p.value,columns:k}),{onSubmit:T}),null,16)])}}}),ke={class:"table-box"},xe={class:"flex items-center"},Ve={key:0},Ne={class:"flex flex-wrap gap-12px p-12px"},Te={class:"font-bold text-14px mb-8px text-[var(--el-text-color-primary)]"},Ee={class:"text-12px text-[var(--el-text-color-regular)] space-y-4px"},Ce={key:1,class:"font-bold text-center text-gray-500 py-20"},$e=e.defineComponent({__name:"index",setup(t){const{$t:o,$messageBox:a}=window,n=e.ref(),p=e.ref(),_=e.ref(""),l=e.ref({}),u=e.ref("show"),b=e.reactive({service_type:window.$prodType});function h(){l.value={},u.value="show",_.value="添加服务器",p.value.open()}const s=r=>{a(r,"server_name",o("button.delete"),"error").then(async()=>{await te({data:r.map(i=>i.id),service_type:window.$prodType}),n.value.getTableList()})};function c(r){l.value={id:r.id},u.value="deploy",_.value="快速部署",p.value.open()}const w=e.ref([{ip:"",port:""}]),T=e.ref([{ip:"",port:""}]),L=e.ref([{ip:"",port:""}]),k=e.ref([{ip:"",port:""}]);async function V(r){if(u.value==="show"){await ee({data:r}),n.value.getTableList(),p.value.close();return}const i=(y,g)=>{const C=Math.max(y.length,g.length);return Array.from({length:C},(B,q)=>{var M,j,H,K;return{src_ip:((M=y[q])==null?void 0:M.ip)||"",src_port:Number((j=y[q])==null?void 0:j.port)||0,dst_ip:((H=g[q])==null?void 0:H.ip)||"",dst_port:Number((K=g[q])==null?void 0:K.port)||0}})},m={packages_id:[r.packages_id],server_id:[l.value.id],service_type:window.$prodType,deploy_params:{probe_name:r.probe_name||"",collection_mode:r.collection_mode,interface:r.interface||"",engine_ip:r.engine_ip||"",engine_port:r.engine_port||"",filterWhitelist:i(w.value,T.value),filterBlacklist:i(L.value,k.value)}};await I({data:m}),n.value.getTableList(),p.value.close()}function U(r){ne({data:[r.id]}),n.value.getTableList()}function d(r){ae({data:[r.id]}),n.value.getTableList()}function f(r){se({data:[r.id]}),n.value.getTableList()}const E=e.reactive([{field:"server_name",name:"服务器名称",show:{type:"input"},rules:[{required:!0}]},{field:"ip_address",name:"IP地址",show:{type:"input"},rules:[{required:!0}]},{field:"ssh_port",name:"端口",show:{type:"input",dataType:"number"},rules:[{required:!0,type:"any"}]},{field:"ssh_username",name:"SSH用户",show:{type:"input"},rules:[{required:!0}]},{field:"ssh_password",name:"SSH登录密码",hide:!0,show:{type:"input",prop:{type:"password",showPassword:!0}},rules:[{required:!0}]},{field:"arch",name:"架构",enum:re,show:{type:"select"},rules:[{required:!0}]},{field:"deployed_count",name:"已部署探针数量",render:r=>e.createVNode("span",null,[r.row.deployment_packages.length])},{field:"status",name:"状态",tag:!0,enum:[{label:"在线",value:1,tagType:"success"},{label:"不在线",value:0,tagType:"danger"}]},{field:"ssh_status",name:"连通性检查",tag:!0,enum:[{label:"成功",value:1,tagType:"success"},{label:"失败",value:0,tagType:"danger"}]},{field:"check_env_ok",name:"安装环境",tag:!0,enum:[{label:"具备",value:1,tagType:"success"},{label:"不具备",value:0,tagType:"danger"}]},{field:"packages_id",name:"安装包",enum:z,fieldNames:{value:"id",label:"file_name"},deploy:{type:"select"},hide:!0,rules:[{required:!0}]},{field:"probe_name",name:"探针名称",deploy:{type:"input"},hide:!0,rules:[{required:!0}]},{field:"collection_mode",name:"采集模式",deploy:{type:"input",value:"DPDK",disabled:!0},hide:!0,rules:[{required:!0}]},{field:"interface",name:"采集网卡",deploy:{type:"input"},hide:!0,rules:[{required:!0}]},{field:"engine_ip",name:"流量接收引擎IP",deploy:{type:"input"},rules:[{required:!0,type:"any"}],hide:!0},{field:"engine_port",name:"流量接收引擎端口",deploy:{type:"input",dataType:"number"},hide:!0,rules:[{required:!0,type:"any"}]},{field:"whitelist",name:"探针过滤白名单",deploy:{type:"input",tooltip:"白名单配置后,仅采集白名单内相关流量,如不填写,则采集所有流量",render:()=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("源ip端口:")]),e.createVNode($,{modelValue:w.value,"onUpdate:modelValue":r=>w.value=r},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode($,{modelValue:T.value,"onUpdate:modelValue":r=>T.value=r},null)])},hide:!0},{field:"blacklist",name:"探针过滤黑名单",deploy:{type:"input",tooltip:"黑名单配置后,将不再采集黑名单内相关流量",render:()=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("源ip端口:")]),e.createVNode($,{modelValue:L.value,"onUpdate:modelValue":r=>L.value=r},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode($,{modelValue:k.value,"onUpdate:modelValue":r=>k.value=r},null)])},hide:!0},{field:"operation",name:window.$t("global.operate"),width:180,fixed:"right",render:r=>e.createVNode("div",null,[e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",icon:"Connection",title:"连通性检查",class:"custom-btn",onClick:()=>U(r.row)},null),e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",class:"custom-btn",onClick:()=>d(r.row)},{icon:()=>e.createVNode(e.resolveComponent("tds-svg-icon"),{name:"install_env",tip:"测试安装环境"},null)}),e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",class:"custom-btn",onClick:()=>f(r.row)},{icon:()=>e.createVNode(e.resolveComponent("tds-svg-icon"),{name:"docker",tip:"自动安装docker环境"},null)}),e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",class:"custom-btn",onClick:()=>c(r.row)},{icon:()=>e.createVNode(e.resolveComponent("tds-svg-icon"),{name:"deployed",tip:"部署"},null)}),e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"danger",icon:"Delete",title:o("button.delete"),onClick:()=>s([r.row])},null)])}]);return(r,i)=>{const m=e.resolveComponent("el-button"),y=e.resolveComponent("el-table-column"),g=e.resolveComponent("TdsTable");return e.openBlock(),e.createElementBlock("div",ke,[e.createVNode(g,{ref_key:"refTdsTable",ref:n,columns:E,"request-api":e.unref(R),"search-col":4,"init-param":b,options:r.$tableOptions(),"reserve-selection":""},{tableHeader:e.withCtx(()=>[e.createElementVNode("div",xe,[e.createVNode(m,{class:"custom-btn",type:"primary",icon:"Plus",plain:"",onClick:i[0]||(i[0]=C=>h())},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("button.add")),1)]),_:1})])]),default:e.withCtx(()=>[e.createVNode(y,{type:"expand"},{default:e.withCtx(C=>[C.row.deployment_packages&&C.row.deployment_packages.length>0?(e.openBlock(),e.createElementBlock("div",Ve,[i[1]||(i[1]=e.createElementVNode("div",{class:"font-bold text-14px mt-12px"},"已部署的探针包",-1)),e.createElementVNode("div",Ne,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.row.deployment_packages,B=>(e.openBlock(),e.createElementBlock("div",{key:B.id,class:"w-30% px-20px py-10px rounded-8px bg-[var(--el-fill-color-light)] border border-solid border-[var(--el-border-color-lighter)] hover:shadow-md transition-shadow"},[e.createElementVNode("div",Te,e.toDisplayString(B.file_name),1),e.createElementVNode("div",Ee,[e.createElementVNode("p",null,"版本: "+e.toDisplayString(B.version),1),e.createElementVNode("p",null,"部署时间: "+e.toDisplayString(B.deployment_time),1)])]))),128))])])):(e.openBlock(),e.createElementBlock("div",Ce,"暂无部署服务器记录"))]),_:1})]),_:1},8,["columns","request-api","init-param","options"]),e.createVNode(e.unref(F.TdsForm),e.mergeProps({ref_key:"refTdsForm",ref:p},r.$formBindProps({title:_.value,form:l.value,columns:E,formKey:u.value}),{onSubmit:V}),null,16)])}}}),Be={class:"table-box"},Se={style:{padding:"0 50px"}},qe=e.defineComponent({__name:"index",setup(t){const o=e.reactive({service_type:window.$prodType}),a=e.reactive([{field:"packages_name",name:"探针包",render:n=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"font-bold"},[n.row.packages_name]),e.createVNode("p",{class:"text-gray-400"},[n.row.packages_version])])},{field:"server_name",name:"服务器",render:n=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"font-bold"},[n.row.server_name]),e.createVNode("p",{class:"text-gray-400"},[n.row.ip_address])])},{field:"deployment_time",name:"部署时间"},{field:"deployment_status",name:"状态",tag:!0,enum:[{label:"部署失败",value:0,tagType:"danger"},{label:"部署中",value:1,tagType:"warning"},{label:"部署成功",value:2,tagType:"success"}]}]);return(n,p)=>{const _=e.resolveComponent("el-table-column"),l=e.resolveComponent("TdsTable");return e.openBlock(),e.createElementBlock("div",Be,[e.createVNode(l,{ref:"refTdsTable",columns:a,"search-col":4,"request-api":e.unref(le),options:n.$tableOptions(),"init-param":o,"reserve-selection":""},{default:e.withCtx(()=>[e.createVNode(_,{type:"expand"},{default:e.withCtx(u=>[e.createElementVNode("div",Se,e.toDisplayString(u.row.deployment_log),1)]),_:1})]),_:1},8,["columns","request-api","options","init-param"])])}}}),Le={class:"main-wrapper"},Me=e.defineComponent({name:"TCProbe",__name:"index",props:{token:{type:String,default:""}},setup(t){const o=e.ref("package");return(a,n)=>{const p=e.resolveComponent("el-tab-pane"),_=e.resolveComponent("el-tabs");return e.openBlock(),e.createElementBlock("div",Le,[e.createVNode(_,{modelValue:o.value,"onUpdate:modelValue":n[0]||(n[0]=l=>o.value=l),class:"demo-tabs"},{default:e.withCtx(()=>[e.createVNode(p,{label:"安装包管理",name:"package"},{default:e.withCtx(()=>[o.value==="package"?(e.openBlock(),e.createBlock(be,{key:0,token:t.token},null,8,["token"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(p,{label:"探针部署",name:"deploy"},{default:e.withCtx(()=>[o.value==="deploy"?(e.openBlock(),e.createBlock($e,{key:0})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(p,{label:"部署历史",name:"history"},{default:e.withCtx(()=>[o.value==="history"?(e.openBlock(),e.createBlock(qe,{key:0})):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["modelValue"])])}}}),Pe="",O=((t,o)=>{if(t.install=a=>{for(const n of[t,...Object.values(o??{})])a.component(n.name,n)},o)for(const[a,n]of Object.entries(o))t[a]=n;return t})(P(Me,[["__scopeId","data-v-f99b9b23"]])),Fe={TCProbe:O},Ue={install(t,o){Object.entries(Fe).forEach(([a,n])=>{t.component(a,n)}),o!=null&&o.prodType&&(window.$prodType=o.prodType),o!=null&&o.envURL&&(window.$probeURL=o.envURL)}};N.TCProbe=O,N.default=Ue,Object.defineProperties(N,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|