@topdatasec/probe 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/style.css +1 -1
- package/lib/t-probe-ui.es.js +95 -94
- package/lib/t-probe-ui.umd.js +1 -1
- package/package.json +1 -1
package/lib/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.ip-port-item[data-v-16fc9c64]{border-style:dashed}.el-tab-pane[data-v-7172e806]{height:100%}
|
|
1
|
+
.flex{display:flex}.flex-wrap{flex-wrap:wrap}.items-center{align-items:center}.mt-10px{margin-top:10px}.mt-12px{margin-top:12px}.mb-8px{margin-bottom:8px}.p-12px{padding:12px}.px-20px{padding-left:20px;padding-right:20px}.py-10px{padding-top:10px;padding-bottom:10px}.py-20{padding-top:5rem;padding-bottom:5rem}.h-100\%{height:100%}.h-\[calc\(100\%-220px\)\]{height:calc(100% - 220px)}.w-30\%{width:30%}.gap-12px{gap:12px}.font-bold{font-weight:700}.text-14px{font-size:14px}.text-12px{font-size:12px}.text-center{text-align:center}.text-gray-400{color:#9ca3af}.text-gray-500{color:#6b7280}.text-\[var\(--el-text-color-primary\)\]{color:var(--el-text-color-primary)}.text-\[var\(--el-text-color-regular\)\],.color-\[var\(--el-text-color-regular\)\]{color:var(--el-text-color-regular)}.bg-\[var\(--el-fill-color-light\)\]{background-color:var(--el-fill-color-light)}.border{border-width:1px;border-style:solid}.border-solid{border-style:solid}.border-\[var\(--el-border-color-lighter\)\]{border-color:var(--el-border-color-lighter)}.rounded-8px{border-radius:8px}.shadow-md,.hover\:shadow-md:hover{box-shadow:0 4px 6px -1px #0000001a,0 2px 4px -2px #0000001a}.transition-shadow{transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.space-y-4px>:not([hidden])~:not([hidden]){margin-top:4px}.ip-port-item[data-v-16fc9c64]{border-style:dashed}.el-tab-pane[data-v-7172e806]{height:100%}
|
package/lib/t-probe-ui.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as H, useModel as ne, resolveComponent as p, openBlock as y, createElementBlock as x, Fragment as A, renderList as K, createVNode as e, withCtx as E, unref as M, createCommentVNode as O, ref as w, reactive as j, createTextVNode as q, createElementVNode as v, toDisplayString as C, mergeProps as X, createBlock as W } from "vue";
|
|
2
|
-
import { CircleClose as re, UploadFilled as
|
|
3
|
-
import { TdsTable as
|
|
2
|
+
import { CircleClose as re, UploadFilled as se } from "@element-plus/icons-vue";
|
|
3
|
+
import { TdsTable as ae, TdsForm as Y } from "topdatasec-ui";
|
|
4
4
|
import { ElMessage as Q } from "element-plus";
|
|
5
5
|
const ue = {
|
|
6
6
|
key: 0,
|
|
@@ -14,7 +14,7 @@ const ue = {
|
|
|
14
14
|
emits: ["update:modelValue"],
|
|
15
15
|
setup(t) {
|
|
16
16
|
const l = ne(t, "modelValue"), { $t: o } = window;
|
|
17
|
-
function
|
|
17
|
+
function a() {
|
|
18
18
|
l.value = [...l.value, { ip: "", port: "" }];
|
|
19
19
|
}
|
|
20
20
|
function c(m) {
|
|
@@ -22,7 +22,7 @@ const ue = {
|
|
|
22
22
|
r.splice(m, 1), l.value = r;
|
|
23
23
|
}
|
|
24
24
|
return (m, r) => {
|
|
25
|
-
const _ = p("el-input"), T = p("el-form-item"), b = p("el-icon"),
|
|
25
|
+
const _ = p("el-input"), T = p("el-form-item"), b = p("el-icon"), s = p("el-button");
|
|
26
26
|
return y(), x("div", null, [
|
|
27
27
|
(y(!0), x(A, null, K(l.value, (u, S) => (y(), x("div", {
|
|
28
28
|
key: S,
|
|
@@ -61,10 +61,10 @@ const ue = {
|
|
|
61
61
|
}, 8, ["onClick"])
|
|
62
62
|
])) : O("", !0)
|
|
63
63
|
]))), 128)),
|
|
64
|
-
e(
|
|
64
|
+
e(s, {
|
|
65
65
|
class: "w-100% mt-10px border-dashed!",
|
|
66
66
|
icon: "Plus",
|
|
67
|
-
onClick:
|
|
67
|
+
onClick: a
|
|
68
68
|
})
|
|
69
69
|
]);
|
|
70
70
|
};
|
|
@@ -72,17 +72,17 @@ const ue = {
|
|
|
72
72
|
});
|
|
73
73
|
const ee = (t, l) => {
|
|
74
74
|
const o = t.__vccOpts || t;
|
|
75
|
-
for (const [
|
|
76
|
-
o[
|
|
75
|
+
for (const [a, c] of l)
|
|
76
|
+
o[a] = c;
|
|
77
77
|
return o;
|
|
78
78
|
}, V = /* @__PURE__ */ ee(ie, [["__scopeId", "data-v-16fc9c64"]]), I = 5 * 1024 * 1024;
|
|
79
79
|
function de(t, l) {
|
|
80
|
-
return new Promise((o,
|
|
80
|
+
return new Promise((o, a) => {
|
|
81
81
|
const c = new (void 0)(), m = new FileReader(), r = Math.ceil(t.size / I);
|
|
82
82
|
let _ = 0;
|
|
83
83
|
m.onload = (b) => {
|
|
84
|
-
var
|
|
85
|
-
if (c.append((
|
|
84
|
+
var s;
|
|
85
|
+
if (c.append((s = b.target) == null ? void 0 : s.result), _++, l) {
|
|
86
86
|
const u = Math.floor(_ / r * 100);
|
|
87
87
|
l(u);
|
|
88
88
|
}
|
|
@@ -93,22 +93,22 @@ function de(t, l) {
|
|
|
93
93
|
o(u);
|
|
94
94
|
}
|
|
95
95
|
}, m.onerror = () => {
|
|
96
|
-
|
|
96
|
+
a(new Error("MD5计算失败"));
|
|
97
97
|
};
|
|
98
98
|
function T() {
|
|
99
|
-
const b = _ * I,
|
|
100
|
-
m.readAsArrayBuffer(t.slice(b,
|
|
99
|
+
const b = _ * I, s = Math.min(b + I, t.size);
|
|
100
|
+
m.readAsArrayBuffer(t.slice(b, s));
|
|
101
101
|
}
|
|
102
102
|
T();
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
async function pe(t, l, o,
|
|
106
|
-
const r = l * I, _ = Math.min(r + I, t.size), T = t.slice(r, _), b = _ - r,
|
|
107
|
-
|
|
105
|
+
async function pe(t, l, o, a, c, m = "/api/upload/chunk") {
|
|
106
|
+
const r = l * I, _ = Math.min(r + I, t.size), T = t.slice(r, _), b = _ - r, s = new FormData();
|
|
107
|
+
s.append("file", T, t.name), s.append("chunkIndex", String(l + 1)), s.append("totalChunkNum", String(o)), s.append("fileMd5", a), 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(I)), s.append("currentChunkSize", String(b));
|
|
108
108
|
try {
|
|
109
109
|
const u = await fetch(m, {
|
|
110
110
|
method: "POST",
|
|
111
|
-
body:
|
|
111
|
+
body: s
|
|
112
112
|
});
|
|
113
113
|
if (console.log(u, "upload response"), !u.ok)
|
|
114
114
|
throw new Error(`分片 ${l + 1} 上传失败,HTTP状态码: ${u.status}`);
|
|
@@ -136,14 +136,14 @@ async function ce(t, l = "/api/upload/merge") {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
async function me(t) {
|
|
139
|
-
const { token: l, file: o, fileDesc:
|
|
139
|
+
const { token: l, file: o, fileDesc: a = "", uploadUrl: c = "/api/upload/chunk", mergeUrl: m = "/api/upload/merge", onProgress: r, onSuccess: _, onError: T } = t;
|
|
140
140
|
try {
|
|
141
141
|
r == null || r({
|
|
142
142
|
progress: 0,
|
|
143
143
|
statusText: "正在计算文件MD5...",
|
|
144
144
|
status: "preparing"
|
|
145
145
|
});
|
|
146
|
-
const
|
|
146
|
+
const s = await de(o, (g) => {
|
|
147
147
|
r == null || r({
|
|
148
148
|
progress: Math.floor(g * 0.1),
|
|
149
149
|
// MD5计算占10%进度
|
|
@@ -155,14 +155,14 @@ async function me(t) {
|
|
|
155
155
|
progress: 10,
|
|
156
156
|
statusText: "MD5计算完成",
|
|
157
157
|
status: "preparing",
|
|
158
|
-
fileMd5:
|
|
158
|
+
fileMd5: s
|
|
159
159
|
});
|
|
160
160
|
const u = Math.ceil(o.size / I);
|
|
161
161
|
r == null || r({
|
|
162
162
|
progress: 10,
|
|
163
163
|
statusText: `开始上传 (共${u}个分片)`,
|
|
164
164
|
status: "uploading",
|
|
165
|
-
fileMd5:
|
|
165
|
+
fileMd5: s
|
|
166
166
|
});
|
|
167
167
|
for (let g = 0; g < u; g++) {
|
|
168
168
|
const P = Math.floor(g / u * 80);
|
|
@@ -170,19 +170,19 @@ async function me(t) {
|
|
|
170
170
|
progress: 10 + P,
|
|
171
171
|
statusText: `正在上传分片 ${g + 1}/${u}`,
|
|
172
172
|
status: "uploading",
|
|
173
|
-
fileMd5:
|
|
174
|
-
}), await pe(o, g, u,
|
|
173
|
+
fileMd5: s
|
|
174
|
+
}), await pe(o, g, u, s, l, c);
|
|
175
175
|
}
|
|
176
176
|
r == null || r({
|
|
177
177
|
progress: 90,
|
|
178
178
|
statusText: "正在合并文件...",
|
|
179
179
|
status: "merging",
|
|
180
|
-
fileMd5:
|
|
180
|
+
fileMd5: s
|
|
181
181
|
});
|
|
182
182
|
const S = o.name.substring(o.name.lastIndexOf(".") + 1), L = {
|
|
183
|
-
fileDesc:
|
|
183
|
+
fileDesc: a,
|
|
184
184
|
fileExt: S,
|
|
185
|
-
fileMd5:
|
|
185
|
+
fileMd5: s,
|
|
186
186
|
fileName: o.name,
|
|
187
187
|
fileSize: String(o.size),
|
|
188
188
|
tds_token: l,
|
|
@@ -194,8 +194,8 @@ async function me(t) {
|
|
|
194
194
|
progress: 100,
|
|
195
195
|
statusText: "上传成功",
|
|
196
196
|
status: "success",
|
|
197
|
-
fileMd5:
|
|
198
|
-
}), Q.success(`${o.name} 上传成功`), _ == null || _(
|
|
197
|
+
fileMd5: s
|
|
198
|
+
}), Q.success(`${o.name} 上传成功`), _ == null || _(s);
|
|
199
199
|
} catch (b) {
|
|
200
200
|
r == null || r({
|
|
201
201
|
progress: 0,
|
|
@@ -207,60 +207,61 @@ async function me(t) {
|
|
|
207
207
|
function _e(t) {
|
|
208
208
|
if (t === 0)
|
|
209
209
|
return "0 B";
|
|
210
|
-
const l = 1024, o = ["B", "KB", "MB", "GB", "TB"],
|
|
211
|
-
return Math.round(t / Math.pow(l,
|
|
210
|
+
const l = 1024, o = ["B", "KB", "MB", "GB", "TB"], a = Math.floor(Math.log(t) / Math.log(l));
|
|
211
|
+
return Math.round(t / Math.pow(l, a) * 100) / 100 + " " + o[a];
|
|
212
212
|
}
|
|
213
213
|
const U = {
|
|
214
214
|
get deployURL() {
|
|
215
215
|
return window.$probeURL || "";
|
|
216
216
|
}
|
|
217
217
|
}, te = (t = {}) => window.$http.request({
|
|
218
|
-
url: `${U.deployURL}/service_deploy/deployment/
|
|
219
|
-
method: "get",
|
|
220
|
-
params: t,
|
|
221
|
-
isError: !1
|
|
222
|
-
}), fe = (t) => window.$http.request({
|
|
223
|
-
url: `${U.deployURL}/service_deploy/deployment/servers/add`,
|
|
218
|
+
url: `${U.deployURL}/service_deploy/deployment/deploy`,
|
|
224
219
|
method: "post",
|
|
225
220
|
data: t
|
|
226
|
-
}),
|
|
227
|
-
url: `${U.deployURL}/service_deploy/deployment/servers/
|
|
228
|
-
method: "
|
|
221
|
+
}), fe = (t = {}) => window.$http.request({
|
|
222
|
+
url: `${U.deployURL}/service_deploy/deployment/servers/add`,
|
|
223
|
+
method: "post",
|
|
229
224
|
data: t
|
|
230
225
|
}), le = (t = {}) => window.$http.request({
|
|
231
226
|
url: `${U.deployURL}/service_deploy/deployment/packages/get`,
|
|
232
|
-
method: "
|
|
233
|
-
|
|
227
|
+
method: "post",
|
|
228
|
+
data: t,
|
|
234
229
|
isError: !1
|
|
235
|
-
}),
|
|
236
|
-
url: `${U.deployURL}/service_deploy/deployment/
|
|
237
|
-
method: "
|
|
238
|
-
data: t
|
|
239
|
-
}), ge = () => window.$http.request({
|
|
240
|
-
url: `${U.deployURL}/service_deploy/deployment/servers/arch_type`,
|
|
241
|
-
method: "get",
|
|
230
|
+
}), oe = (t = {}) => window.$http.request({
|
|
231
|
+
url: `${U.deployURL}/service_deploy/deployment/servers/get`,
|
|
232
|
+
method: "post",
|
|
233
|
+
data: t,
|
|
242
234
|
isError: !1
|
|
243
|
-
}),
|
|
244
|
-
url: `${U.deployURL}/service_deploy/deployment/
|
|
235
|
+
}), ve = (t = {}) => window.$http.request({
|
|
236
|
+
url: `${U.deployURL}/service_deploy/deployment/servers/del`,
|
|
237
|
+
method: "post",
|
|
238
|
+
data: t
|
|
239
|
+
}), ye = (t = {}) => window.$http.request({
|
|
240
|
+
url: `${U.deployURL}/service_deploy/deployment/packages/del`,
|
|
245
241
|
method: "post",
|
|
246
242
|
data: t
|
|
247
|
-
}),
|
|
248
|
-
url: `${U.deployURL}/service_deploy/deployment/servers/
|
|
243
|
+
}), ge = (t = {}) => window.$http.request({
|
|
244
|
+
url: `${U.deployURL}/service_deploy/deployment/servers/get_arch`,
|
|
245
|
+
method: "post",
|
|
246
|
+
data: t,
|
|
247
|
+
isError: !1
|
|
248
|
+
}), he = (t = {}) => window.$http.request({
|
|
249
|
+
url: `${U.deployURL}/service_deploy/deployment/deployment_history/get`,
|
|
250
|
+
method: "post",
|
|
251
|
+
data: t,
|
|
252
|
+
isError: !1
|
|
253
|
+
}), be = (t = {}) => window.$http.request({
|
|
254
|
+
url: `${U.deployURL}/service_deploy/deployment/servers/test_ssh`,
|
|
249
255
|
method: "post",
|
|
250
256
|
data: t
|
|
251
|
-
}),
|
|
257
|
+
}), we = (t = {}) => window.$http.request({
|
|
252
258
|
url: `${U.deployURL}/service_deploy/deployment/servers/check_env`,
|
|
253
259
|
method: "post",
|
|
254
260
|
data: t
|
|
255
|
-
}),
|
|
261
|
+
}), xe = (t = {}) => window.$http.request({
|
|
256
262
|
url: `${U.deployURL}/service_deploy/deployment/servers/install_env`,
|
|
257
263
|
method: "post",
|
|
258
264
|
data: t
|
|
259
|
-
}), xe = (t = {}) => window.$http.request({
|
|
260
|
-
url: `${U.deployURL}/service_deploy/deployment/history/get`,
|
|
261
|
-
method: "get",
|
|
262
|
-
params: t,
|
|
263
|
-
isError: !1
|
|
264
265
|
}), ke = {
|
|
265
266
|
class: "h-100%"
|
|
266
267
|
}, Te = {
|
|
@@ -296,7 +297,7 @@ const U = {
|
|
|
296
297
|
}
|
|
297
298
|
},
|
|
298
299
|
setup(t) {
|
|
299
|
-
const l = w(), o = w(),
|
|
300
|
+
const l = w(), o = w(), a = w("快速部署"), c = w({}), {
|
|
300
301
|
$t: m,
|
|
301
302
|
$messageBox: r
|
|
302
303
|
} = window;
|
|
@@ -311,7 +312,7 @@ const U = {
|
|
|
311
312
|
}]), b = w([{
|
|
312
313
|
ip: "",
|
|
313
314
|
port: ""
|
|
314
|
-
}]),
|
|
315
|
+
}]), s = w([{
|
|
315
316
|
ip: "",
|
|
316
317
|
port: ""
|
|
317
318
|
}]), u = w([{
|
|
@@ -343,10 +344,10 @@ const U = {
|
|
|
343
344
|
engine_ip: i.engine_ip || "",
|
|
344
345
|
engine_port: i.engine_port || "",
|
|
345
346
|
filterWhitelist: k(T.value, b.value),
|
|
346
|
-
filterBlacklist: k(
|
|
347
|
+
filterBlacklist: k(s.value, u.value)
|
|
347
348
|
}
|
|
348
349
|
};
|
|
349
|
-
await
|
|
350
|
+
await te({
|
|
350
351
|
data: B
|
|
351
352
|
}), l.value.getTableList(), o.value.close();
|
|
352
353
|
}
|
|
@@ -362,7 +363,7 @@ const U = {
|
|
|
362
363
|
{
|
|
363
364
|
field: "server_id",
|
|
364
365
|
name: "选择服务器",
|
|
365
|
-
enum:
|
|
366
|
+
enum: oe,
|
|
366
367
|
fieldNames: {
|
|
367
368
|
value: "id",
|
|
368
369
|
label: "server_name"
|
|
@@ -506,8 +507,8 @@ const U = {
|
|
|
506
507
|
render: () => e(A, null, [e("p", {
|
|
507
508
|
class: "color-[var(--el-text-color-regular)]"
|
|
508
509
|
}, [q("源ip端口:")]), e(V, {
|
|
509
|
-
modelValue:
|
|
510
|
-
"onUpdate:modelValue": (i) =>
|
|
510
|
+
modelValue: s.value,
|
|
511
|
+
"onUpdate:modelValue": (i) => s.value = i
|
|
511
512
|
}, null), e("p", {
|
|
512
513
|
class: "color-[var(--el-text-color-regular)]"
|
|
513
514
|
}, [q("目的ip端口:")]), e(V, {
|
|
@@ -597,7 +598,7 @@ const U = {
|
|
|
597
598
|
default: E(() => [e(B, {
|
|
598
599
|
class: "el-icon--upload"
|
|
599
600
|
}, {
|
|
600
|
-
default: E(() => [e(M(
|
|
601
|
+
default: E(() => [e(M(se))]),
|
|
601
602
|
_: 1
|
|
602
603
|
}), k[0] || (k[0] = v("div", {
|
|
603
604
|
class: "el-upload__text"
|
|
@@ -609,7 +610,7 @@ const U = {
|
|
|
609
610
|
}, [v("div", $e, [v("span", Ee, C(h.fileName), 1), v("span", Se, C(M(_e)(h.fileSize)), 1)]), e(d, {
|
|
610
611
|
percentage: h.progress,
|
|
611
612
|
status: h.progressStatus
|
|
612
|
-
}, null, 8, ["percentage", "status"]), v("div", Ue, C(h.statusText), 1)]))), 128))])) : O("", !0), v("div", Le, [e(M(
|
|
613
|
+
}, null, 8, ["percentage", "status"]), v("div", Ue, C(h.statusText), 1)]))), 128))])) : O("", !0), v("div", Le, [e(M(ae), {
|
|
613
614
|
ref_key: "refTdsTable",
|
|
614
615
|
ref: l,
|
|
615
616
|
columns: D,
|
|
@@ -632,7 +633,7 @@ const U = {
|
|
|
632
633
|
ref_key: "refTdsForm",
|
|
633
634
|
ref: o
|
|
634
635
|
}, i.$formBindProps({
|
|
635
|
-
title:
|
|
636
|
+
title: a.value,
|
|
636
637
|
form: c.value,
|
|
637
638
|
columns: D
|
|
638
639
|
}), {
|
|
@@ -661,7 +662,7 @@ const U = {
|
|
|
661
662
|
const {
|
|
662
663
|
$t: l,
|
|
663
664
|
$messageBox: o
|
|
664
|
-
} = window,
|
|
665
|
+
} = window, a = w(), c = w(), m = w(""), r = w({}), _ = w("show");
|
|
665
666
|
function T() {
|
|
666
667
|
r.value = {}, _.value = "show", m.value = "添加服务器", c.value.open();
|
|
667
668
|
}
|
|
@@ -669,10 +670,10 @@ const U = {
|
|
|
669
670
|
o(n, "server_name", l("button.delete"), "error").then(async () => {
|
|
670
671
|
await ve({
|
|
671
672
|
data: n.map((d) => d.id)
|
|
672
|
-
}),
|
|
673
|
+
}), a.value.getTableList();
|
|
673
674
|
});
|
|
674
675
|
};
|
|
675
|
-
function
|
|
676
|
+
function s(n) {
|
|
676
677
|
r.value = {
|
|
677
678
|
id: n.id
|
|
678
679
|
}, _.value = "deploy", m.value = "快速部署", c.value.open();
|
|
@@ -694,7 +695,7 @@ const U = {
|
|
|
694
695
|
if (_.value === "show") {
|
|
695
696
|
await fe({
|
|
696
697
|
data: n
|
|
697
|
-
}),
|
|
698
|
+
}), a.value.getTableList(), c.value.close();
|
|
698
699
|
return;
|
|
699
700
|
}
|
|
700
701
|
const d = (h, $) => {
|
|
@@ -724,24 +725,24 @@ const U = {
|
|
|
724
725
|
filterBlacklist: d(L.value, D.value)
|
|
725
726
|
}
|
|
726
727
|
};
|
|
727
|
-
await
|
|
728
|
+
await te({
|
|
728
729
|
data: f
|
|
729
|
-
}),
|
|
730
|
+
}), a.value.getTableList(), c.value.close();
|
|
730
731
|
}
|
|
731
732
|
function P(n) {
|
|
732
|
-
|
|
733
|
+
be({
|
|
733
734
|
data: [n.id]
|
|
734
|
-
}),
|
|
735
|
+
}), a.value.getTableList();
|
|
735
736
|
}
|
|
736
737
|
function i(n) {
|
|
737
|
-
|
|
738
|
+
we({
|
|
738
739
|
data: [n.id]
|
|
739
|
-
}),
|
|
740
|
+
}), a.value.getTableList();
|
|
740
741
|
}
|
|
741
742
|
function k(n) {
|
|
742
|
-
|
|
743
|
+
xe({
|
|
743
744
|
data: [n.id]
|
|
744
|
-
}),
|
|
745
|
+
}), a.value.getTableList();
|
|
745
746
|
}
|
|
746
747
|
const B = j([{
|
|
747
748
|
field: "server_name",
|
|
@@ -992,7 +993,7 @@ const U = {
|
|
|
992
993
|
link: !0,
|
|
993
994
|
type: "primary",
|
|
994
995
|
class: "custom-btn",
|
|
995
|
-
onClick: () =>
|
|
996
|
+
onClick: () => s(n.row)
|
|
996
997
|
}, {
|
|
997
998
|
icon: () => e(p("tds-svg-icon"), {
|
|
998
999
|
name: "deployed",
|
|
@@ -1010,9 +1011,9 @@ const U = {
|
|
|
1010
1011
|
const f = p("el-button"), h = p("el-table-column"), $ = p("TdsTable");
|
|
1011
1012
|
return y(), x("div", Ne, [e($, {
|
|
1012
1013
|
ref_key: "refTdsTable",
|
|
1013
|
-
ref:
|
|
1014
|
+
ref: a,
|
|
1014
1015
|
columns: B,
|
|
1015
|
-
"request-api": M(
|
|
1016
|
+
"request-api": M(oe),
|
|
1016
1017
|
"search-col": 4,
|
|
1017
1018
|
options: n.$tableOptions(),
|
|
1018
1019
|
"reserve-selection": ""
|
|
@@ -1098,13 +1099,13 @@ const U = {
|
|
|
1098
1099
|
tagType: "success"
|
|
1099
1100
|
}]
|
|
1100
1101
|
}]);
|
|
1101
|
-
return (o,
|
|
1102
|
+
return (o, a) => {
|
|
1102
1103
|
const c = p("el-table-column"), m = p("TdsTable");
|
|
1103
1104
|
return y(), x("div", He, [e(m, {
|
|
1104
1105
|
ref: "refTdsTable",
|
|
1105
1106
|
columns: l,
|
|
1106
1107
|
"search-col": 4,
|
|
1107
|
-
"request-api": M(
|
|
1108
|
+
"request-api": M(he),
|
|
1108
1109
|
options: o.$tableOptions(),
|
|
1109
1110
|
"reserve-selection": ""
|
|
1110
1111
|
}, {
|
|
@@ -1129,7 +1130,7 @@ const U = {
|
|
|
1129
1130
|
},
|
|
1130
1131
|
setup(t) {
|
|
1131
1132
|
const l = t, o = w("package");
|
|
1132
|
-
return (
|
|
1133
|
+
return (a, c) => {
|
|
1133
1134
|
const m = p("el-tab-pane"), r = p("el-tabs");
|
|
1134
1135
|
return y(), x("div", je, [
|
|
1135
1136
|
e(r, {
|
|
@@ -1177,18 +1178,18 @@ const U = {
|
|
|
1177
1178
|
});
|
|
1178
1179
|
const Je = /* @__PURE__ */ ee(Ge, [["__scopeId", "data-v-7172e806"]]), Ze = (t, l) => {
|
|
1179
1180
|
if (t.install = (o) => {
|
|
1180
|
-
for (const
|
|
1181
|
-
o.component(
|
|
1181
|
+
for (const a of [t, ...Object.values(l ?? {})])
|
|
1182
|
+
o.component(a.name, a);
|
|
1182
1183
|
}, l)
|
|
1183
|
-
for (const [o,
|
|
1184
|
-
t[o] =
|
|
1184
|
+
for (const [o, a] of Object.entries(l))
|
|
1185
|
+
t[o] = a;
|
|
1185
1186
|
return t;
|
|
1186
1187
|
}, Qe = Ze(Je), Xe = {
|
|
1187
1188
|
TCProbe: Qe
|
|
1188
1189
|
}, ot = {
|
|
1189
1190
|
install(t, l) {
|
|
1190
|
-
Object.entries(Xe).forEach(([o,
|
|
1191
|
-
t.component(o,
|
|
1191
|
+
Object.entries(Xe).forEach(([o, a]) => {
|
|
1192
|
+
t.component(o, a);
|
|
1192
1193
|
}), l != null && l.prodType && (window.$prodType = l.prodType), l != null && l.envURL && (window.$probeURL = l.envURL);
|
|
1193
1194
|
}
|
|
1194
1195
|
};
|
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("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","@element-plus/icons-vue","topdatasec-ui","element-plus"],e):(N=typeof globalThis<"u"?globalThis:N||self,e(N.TProbeUI={},N.Vue,N.IconsVue,N.TopdatasecUI,N.ElementPlus))})(this,function(N,e,U,F,D){"use strict";const K={key:0,class:"absolute right--13px text-#f56c6c hover:cursor-pointer"},W=e.defineComponent({__name:"IpPortList",props:{modelValue:{default:()=>[{ip:"",port:""}]},modelModifiers:{}},emits:["update:modelValue"],setup(t){const o=e.useModel(t,"modelValue"),{$t:l}=window;function s(){o.value=[...o.value,{ip:"",port:""}]}function p(u){const n=[...o.value];n.splice(u,1),o.value=n}return(u,n)=>{const m=e.resolveComponent("el-input"),w=e.resolveComponent("el-form-item"),g=e.resolveComponent("el-icon"),a=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(d,k)=>(e.openBlock(),e.createElementBlock("div",{key:k,class:"flex form-m0 w-100% mb-5px"},[e.createVNode(w,{class:"w-70%"},{default:e.withCtx(()=>[e.createVNode(m,{modelValue:d.ip,"onUpdate:modelValue":V=>d.ip=V,class:"min-w-300px w-100%",placeholder:"IP"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),e.createVNode(w,{class:"ml-auto w-30%"},{default:e.withCtx(()=>[e.createVNode(m,{modelValue:d.port,"onUpdate:modelValue":V=>d.port=V,class:"ml-10",placeholder:e.unref(l)("global.port")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1024),o.value.length>1?(e.openBlock(),e.createElementBlock("div",K,[e.createVNode(g,{onClick:V=>p(k)},{default:e.withCtx(()=>[e.createVNode(e.unref(U.CircleClose))]),_:1},8,["onClick"])])):e.createCommentVNode("",!0)]))),128)),e.createVNode(a,{class:"w-100% mt-10px border-dashed!",icon:"Plus",onClick:s})])}}}),Fe="",A=(t,o)=>{const l=t.__vccOpts||t;for(const[s,p]of o)l[s]=p;return l},E=A(W,[["__scopeId","data-v-16fc9c64"]]),B=5*1024*1024;function G(t,o){return new Promise((l,s)=>{const p=new(void 0),u=new FileReader,n=Math.ceil(t.size/B);let m=0;u.onload=g=>{var a;if(p.append((a=g.target)==null?void 0:a.result),m++,o){const d=Math.floor(m/n*100);o(d)}if(m<n)w();else{const d=p.end();l(d)}},u.onerror=()=>{s(new Error("MD5计算失败"))};function w(){const g=m*B,a=Math.min(g+B,t.size);u.readAsArrayBuffer(t.slice(g,a))}w()})}async function J(t,o,l,s,p,u="/api/upload/chunk"){const n=o*B,m=Math.min(n+B,t.size),w=t.slice(n,m),g=m-n,a=new FormData;a.append("file",w,t.name),a.append("chunkIndex",String(o+1)),a.append("totalChunkNum",String(l)),a.append("fileMd5",s),a.append("tds_token",p),a.append("fileName",t.name),a.append("fileSize",String(t.size)),a.append("fileExt",t.name.substring(t.name.lastIndexOf(".")+1)),a.append("chunkSize",String(B)),a.append("currentChunkSize",String(g));try{const d=await fetch(u,{method:"POST",body:a});if(console.log(d,"upload response"),!d.ok)throw new Error(`分片 ${o+1} 上传失败,HTTP状态码: ${d.status}`);const k=await d.json();if(console.log(k,"upload result"),k.recode!==0)throw new Error(`上传失败: ${k.remsg||"未知错误"}`);return!0}catch(d){throw console.error(`上传分片 ${o+1} 时出错:`,d),d}}async function Z(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(l){return console.error("合并分片时出错:",l),!1}}async function Q(t){const{token:o,file:l,fileDesc:s="",uploadUrl:p="/api/upload/chunk",mergeUrl:u="/api/upload/merge",onProgress:n,onSuccess:m,onError:w}=t;try{n==null||n({progress:0,statusText:"正在计算文件MD5...",status:"preparing"});const a=await G(l,f=>{n==null||n({progress:Math.floor(f*.1),statusText:`正在计算文件MD5... ${f}%`,status:"preparing"})});n==null||n({progress:10,statusText:"MD5计算完成",status:"preparing",fileMd5:a});const d=Math.ceil(l.size/B);n==null||n({progress:10,statusText:`开始上传 (共${d}个分片)`,status:"uploading",fileMd5:a});for(let f=0;f<d;f++){const q=Math.floor(f/d*80);n==null||n({progress:10+q,statusText:`正在上传分片 ${f+1}/${d}`,status:"uploading",fileMd5:a}),await J(l,f,d,a,o,p)}n==null||n({progress:90,statusText:"正在合并文件...",status:"merging",fileMd5:a});const k=l.name.substring(l.name.lastIndexOf(".")+1),V={fileDesc:s,fileExt:k,fileMd5:a,fileName:l.name,fileSize:String(l.size),tds_token:o,totalChunkNum:String(d)};if(!await Z(V,u))throw new Error("文件合并失败");n==null||n({progress:100,statusText:"上传成功",status:"success",fileMd5:a}),D.ElMessage.success(`${l.name} 上传成功`),m==null||m(a)}catch(g){n==null||n({progress:0,statusText:g.message||"上传失败",status:"error"}),D.ElMessage.error(`${l.name} 上传失败: ${g.message}`),w==null||w(g)}}function X(t){if(t===0)return"0 B";const o=1024,l=["B","KB","MB","GB","TB"],s=Math.floor(Math.log(t)/Math.log(o));return Math.round(t/Math.pow(o,s)*100)/100+" "+l[s]}const x={get deployURL(){return window.$probeURL||""}},I=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/get`,method:"get",params:t,isError:!1}),Y=t=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/add`,method:"post",data:t}),v=t=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/delete`,method:"delete",data:t}),P=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/packages/get`,method:"get",params:t,isError:!1}),ee=t=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/packages/delete`,method:"delete",data:t}),te=()=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/arch_type`,method:"get",isError:!1}),z=t=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/deploy`,method:"post",data:t}),oe=t=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/test_connectivity`,method:"post",data:t}),le=t=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/check_env`,method:"post",data:t}),re=t=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/install_env`,method:"post",data:t}),ne=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/history/get`,method:"get",params:t,isError:!1}),ae={class:"h-100%"},se={key:0,class:"upload-progress-list"},de={class:"file-info"},ie={class:"file-name"},ce={class:"file-size"},pe={class:"progress-text"},ue={class:"table-box h-[calc(100%-220px)]"},me={key:0},_e={class:"flex flex-wrap gap-12px p-12px"},fe={class:"font-bold text-14px mb-8px text-[var(--el-text-color-primary)]"},ye={class:"text-12px text-[var(--el-text-color-regular)] space-y-4px"},ge={key:1,class:"font-bold text-center text-gray-500 py-20"},he=e.defineComponent({__name:"index",props:{token:{type:String,default:""}},setup(t){const o=e.ref(),l=e.ref(),s=e.ref("快速部署"),p=e.ref({}),{$t:u,$messageBox:n}=window;function m(i){p.value={id:i.id},l.value.open()}const w=e.ref([{ip:"",port:""}]),g=e.ref([{ip:"",port:""}]),a=e.ref([{ip:"",port:""}]),d=e.ref([{ip:"",port:""}]);async function k(i){const h=(r,c)=>{const _=Math.max(r.length,c.length);return Array.from({length:_},(y,b)=>{var T,$,L,M;return{src_ip:((T=r[b])==null?void 0:T.ip)||"",src_port:Number(($=r[b])==null?void 0:$.port)||0,dst_ip:((L=c[b])==null?void 0:L.ip)||"",dst_port:Number((M=c[b])==null?void 0:M.port)||0}})},C={packages_id:[p.value.id],server_id:i.server_id,service_type:window.$prodType,deploy_params:{probe_name:i.probe_name||"",collection_mode:i.collection_mode,interface:i.interface||"",engine_ip:i.engine_ip||"",engine_port:i.engine_port||"",filterWhitelist:h(w.value,g.value),filterBlacklist:h(a.value,d.value)}};await z({data:C}),o.value.getTableList(),l.value.close()}async function V(i){n(i,"file_name",u("button.delete"),"error").then(async()=>{await ee({data:[i.id]}),o.value.getTableList()})}const S=e.reactive([{field:"server_id",name:"选择服务器",enum:I,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:i=>{var h;return((h=i.row.deployment_server)==null?void 0:h.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("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("源ip端口:")]),e.createVNode(E,{modelValue:w.value,"onUpdate:modelValue":i=>w.value=i},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode(E,{modelValue:g.value,"onUpdate:modelValue":i=>g.value=i},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(E,{modelValue:a.value,"onUpdate:modelValue":i=>a.value=i},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode(E,{modelValue:d.value,"onUpdate:modelValue":i=>d.value=i},null)])},hide:!0},{field:"operation",name:window.$t("global.operate"),width:140,fixed:"right",render:i=>e.createVNode("div",null,[e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",class:"custom-btn",onClick:()=>m(i.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:u("button.delete"),onClick:()=>V([i.row])},null)])}]),f=e.ref([]);function q(i){const h=i.raw;if(!h)return;const C={fileName:h.name,fileSize:h.size,progress:0,progressStatus:"",statusText:"准备上传..."};f.value.push(C);const r=f.value.length-1;Q({file:h,fileDesc:"探针安装包",uploadUrl:x.deployURL+"/service_deploy/deployment/packages/upload",mergeUrl:x.deployURL+"/service_deploy/deployment/packages/upload_merge",onProgress:c=>{const _=f.value[r];_&&(_.progress=c.progress,_.statusText=c.statusText,c.fileMd5&&(_.fileMd5=c.fileMd5),c.status==="error"?_.progressStatus="exception":c.status==="success"?_.progressStatus="success":_.progressStatus="")},onSuccess:()=>{var _;const c=f.value[r];c&&(c.progress=100,c.progressStatus="success",c.statusText="上传成功"),(_=o.value)==null||_.getTableList(),setTimeout(()=>{const y=f.value.findIndex(b=>b.fileName===h.name);y!==-1&&f.value.splice(y,1)},3e3)},onError:c=>{console.error("文件上传失败:",c);const _=f.value[r];_&&(_.progressStatus="exception",_.statusText=c.message||"上传失败")}})}return(i,h)=>{const C=e.resolveComponent("el-icon"),r=e.resolveComponent("el-upload"),c=e.resolveComponent("el-progress"),_=e.resolveComponent("el-table-column");return e.openBlock(),e.createElementBlock("div",ae,[e.createVNode(r,{class:"upload-demo mt-10px",drag:"",action:"","auto-upload":!1,accept:".tar.gz,.tgz","on-change":q,"show-file-list":!1,multiple:""},{default:e.withCtx(()=>[e.createVNode(C,{class:"el-icon--upload"},{default:e.withCtx(()=>[e.createVNode(e.unref(U.UploadFilled))]),_:1}),h[0]||(h[0]=e.createElementVNode("div",{class:"el-upload__text"},[e.createTextVNode(" 点击或拖拽文件到此处上传 "),e.createElementVNode("br"),e.createElementVNode("em",null,"支持的格式: tar.gz, tgz")],-1))]),_:1}),f.value.length>0?(e.openBlock(),e.createElementBlock("div",se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y.fileName,class:"upload-progress-item"},[e.createElementVNode("div",de,[e.createElementVNode("span",ie,e.toDisplayString(y.fileName),1),e.createElementVNode("span",ce,e.toDisplayString(e.unref(X)(y.fileSize)),1)]),e.createVNode(c,{percentage:y.progress,status:y.progressStatus},null,8,["percentage","status"]),e.createElementVNode("div",pe,e.toDisplayString(y.statusText),1)]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",ue,[e.createVNode(e.unref(F.TdsTable),{ref_key:"refTdsTable",ref:o,columns:S,"request-api":e.unref(P),options:i.$tableOptions()},{default:e.withCtx(()=>[e.createVNode(_,{type:"expand"},{default:e.withCtx(y=>[y.row.deployment_server&&y.row.deployment_server.length>0?(e.openBlock(),e.createElementBlock("div",me,[h[1]||(h[1]=e.createElementVNode("div",{class:"font-bold text-14px mt-12px"},"已部署的服务器",-1)),e.createElementVNode("div",_e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.row.deployment_server,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",fe,e.toDisplayString(b.server_name),1),e.createElementVNode("div",ye,[e.createElementVNode("p",null,"IP: "+e.toDisplayString(b.ip_address),1),e.createElementVNode("p",null,"部署时间: "+e.toDisplayString(b.deployment_time),1)])]))),128))])])):(e.openBlock(),e.createElementBlock("div",ge,"暂无部署服务器记录"))]),_:1})]),_:1},8,["columns","request-api","options"])]),e.createVNode(e.unref(F.TdsForm),e.mergeProps({ref_key:"refTdsForm",ref:l},i.$formBindProps({title:s.value,form:p.value,columns:S}),{onSubmit:k}),null,16)])}}}),we={class:"table-box"},be={class:"flex items-center"},ke={key:0},xe={class:"flex flex-wrap gap-12px p-12px"},Ve={class:"font-bold text-14px mb-8px text-[var(--el-text-color-primary)]"},Ne={class:"text-12px text-[var(--el-text-color-regular)] space-y-4px"},Te={key:1,class:"font-bold text-center text-gray-500 py-20"},Ee=e.defineComponent({__name:"index",setup(t){const{$t:o,$messageBox:l}=window,s=e.ref(),p=e.ref(),u=e.ref(""),n=e.ref({}),m=e.ref("show");function w(){n.value={},m.value="show",u.value="添加服务器",p.value.open()}const g=r=>{l(r,"server_name",o("button.delete"),"error").then(async()=>{await v({data:r.map(c=>c.id)}),s.value.getTableList()})};function a(r){n.value={id:r.id},m.value="deploy",u.value="快速部署",p.value.open()}const d=e.ref([{ip:"",port:""}]),k=e.ref([{ip:"",port:""}]),V=e.ref([{ip:"",port:""}]),S=e.ref([{ip:"",port:""}]);async function f(r){if(m.value==="show"){await Y({data:r}),s.value.getTableList(),p.value.close();return}const c=(y,b)=>{const T=Math.max(y.length,b.length);return Array.from({length:T},($,L)=>{var M,O,j,H;return{src_ip:((M=y[L])==null?void 0:M.ip)||"",src_port:Number((O=y[L])==null?void 0:O.port)||0,dst_ip:((j=b[L])==null?void 0:j.ip)||"",dst_port:Number((H=b[L])==null?void 0:H.port)||0}})},_={packages_id:[r.packages_id],server_id:[n.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:c(d.value,k.value),filterBlacklist:c(V.value,S.value)}};await z({data:_}),s.value.getTableList(),p.value.close()}function q(r){oe({data:[r.id]}),s.value.getTableList()}function i(r){le({data:[r.id]}),s.value.getTableList()}function h(r){re({data:[r.id]}),s.value.getTableList()}const C=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:te,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:P,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(E,{modelValue:d.value,"onUpdate:modelValue":r=>d.value=r},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode(E,{modelValue:k.value,"onUpdate:modelValue":r=>k.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(E,{modelValue:V.value,"onUpdate:modelValue":r=>V.value=r},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode(E,{modelValue:S.value,"onUpdate:modelValue":r=>S.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:()=>q(r.row)},null),e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",class:"custom-btn",onClick:()=>i(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:()=>h(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:()=>a(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:()=>g([r.row])},null)])}]);return(r,c)=>{const _=e.resolveComponent("el-button"),y=e.resolveComponent("el-table-column"),b=e.resolveComponent("TdsTable");return e.openBlock(),e.createElementBlock("div",we,[e.createVNode(b,{ref_key:"refTdsTable",ref:s,columns:C,"request-api":e.unref(I),"search-col":4,options:r.$tableOptions(),"reserve-selection":""},{tableHeader:e.withCtx(()=>[e.createElementVNode("div",be,[e.createVNode(_,{class:"custom-btn",type:"primary",icon:"Plus",plain:"",onClick:c[0]||(c[0]=T=>w())},{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(T=>[T.row.deployment_packages&&T.row.deployment_packages.length>0?(e.openBlock(),e.createElementBlock("div",ke,[c[1]||(c[1]=e.createElementVNode("div",{class:"font-bold text-14px mt-12px"},"已部署的探针包",-1)),e.createElementVNode("div",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.row.deployment_packages,$=>(e.openBlock(),e.createElementBlock("div",{key:$.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",Ve,e.toDisplayString($.file_name),1),e.createElementVNode("div",Ne,[e.createElementVNode("p",null,"版本: "+e.toDisplayString($.version),1),e.createElementVNode("p",null,"部署时间: "+e.toDisplayString($.deployment_time),1)])]))),128))])])):(e.openBlock(),e.createElementBlock("div",Te,"暂无部署服务器记录"))]),_:1})]),_:1},8,["columns","request-api","options"]),e.createVNode(e.unref(F.TdsForm),e.mergeProps({ref_key:"refTdsForm",ref:p},r.$formBindProps({title:u.value,form:n.value,columns:C,formKey:m.value}),{onSubmit:f}),null,16)])}}}),Ce={class:"table-box"},$e={style:{padding:"0 50px"}},Be=e.defineComponent({__name:"index",setup(t){const o=e.reactive([{field:"packages_name",name:"探针包",render:l=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"font-bold"},[l.row.packages_name]),e.createVNode("p",{class:"text-gray-400"},[l.row.packages_version])])},{field:"server_name",name:"服务器",render:l=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"font-bold"},[l.row.server_name]),e.createVNode("p",{class:"text-gray-400"},[l.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(l,s)=>{const p=e.resolveComponent("el-table-column"),u=e.resolveComponent("TdsTable");return e.openBlock(),e.createElementBlock("div",Ce,[e.createVNode(u,{ref:"refTdsTable",columns:o,"search-col":4,"request-api":e.unref(ne),options:l.$tableOptions(),"reserve-selection":""},{default:e.withCtx(()=>[e.createVNode(p,{type:"expand"},{default:e.withCtx(n=>[e.createElementVNode("div",$e,e.toDisplayString(n.row.deployment_log),1)]),_:1})]),_:1},8,["columns","request-api","options"])])}}}),Se={class:"main-wrapper"},Le=e.defineComponent({name:"TCProbe",__name:"index",props:{token:{type:String,default:""}},setup(t){const o=t,l=e.ref("package");return(s,p)=>{const u=e.resolveComponent("el-tab-pane"),n=e.resolveComponent("el-tabs");return e.openBlock(),e.createElementBlock("div",Se,[e.createVNode(n,{modelValue:l.value,"onUpdate:modelValue":p[0]||(p[0]=m=>l.value=m),class:"demo-tabs"},{default:e.withCtx(()=>[e.createVNode(u,{label:"安装包管理",name:"package"},{default:e.withCtx(()=>[l.value==="package"?(e.openBlock(),e.createBlock(he,{key:0,token:o.token},null,8,["token"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(u,{label:"探针部署",name:"deploy"},{default:e.withCtx(()=>[l.value==="deploy"?(e.openBlock(),e.createBlock(Ee,{key:0})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(u,{label:"部署历史",name:"history"},{default:e.withCtx(()=>[l.value==="history"?(e.openBlock(),e.createBlock(Be,{key:0})):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["modelValue"])])}}}),Ue="",R=((t,o)=>{if(t.install=l=>{for(const s of[t,...Object.values(o??{})])l.component(s.name,s)},o)for(const[l,s]of Object.entries(o))t[l]=s;return t})(A(Le,[["__scopeId","data-v-7172e806"]])),qe={TCProbe:R},Me={install(t,o){Object.entries(qe).forEach(([l,s])=>{t.component(l,s)}),o!=null&&o.prodType&&(window.$prodType=o.prodType),o!=null&&o.envURL&&(window.$probeURL=o.envURL)}};N.TCProbe=R,N.default=Me,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("element-plus")):typeof define=="function"&&define.amd?define(["exports","vue","@element-plus/icons-vue","topdatasec-ui","element-plus"],e):(N=typeof globalThis<"u"?globalThis:N||self,e(N.TProbeUI={},N.Vue,N.IconsVue,N.TopdatasecUI,N.ElementPlus))})(this,function(N,e,U,F,D){"use strict";const Fe="",K={key:0,class:"absolute right--13px text-#f56c6c hover:cursor-pointer"},W=e.defineComponent({__name:"IpPortList",props:{modelValue:{default:()=>[{ip:"",port:""}]},modelModifiers:{}},emits:["update:modelValue"],setup(t){const o=e.useModel(t,"modelValue"),{$t:l}=window;function s(){o.value=[...o.value,{ip:"",port:""}]}function p(u){const n=[...o.value];n.splice(u,1),o.value=n}return(u,n)=>{const m=e.resolveComponent("el-input"),w=e.resolveComponent("el-form-item"),g=e.resolveComponent("el-icon"),a=e.resolveComponent("el-button");return e.openBlock(),e.createElementBlock("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(d,k)=>(e.openBlock(),e.createElementBlock("div",{key:k,class:"flex form-m0 w-100% mb-5px"},[e.createVNode(w,{class:"w-70%"},{default:e.withCtx(()=>[e.createVNode(m,{modelValue:d.ip,"onUpdate:modelValue":V=>d.ip=V,class:"min-w-300px w-100%",placeholder:"IP"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),e.createVNode(w,{class:"ml-auto w-30%"},{default:e.withCtx(()=>[e.createVNode(m,{modelValue:d.port,"onUpdate:modelValue":V=>d.port=V,class:"ml-10",placeholder:e.unref(l)("global.port")},null,8,["modelValue","onUpdate:modelValue","placeholder"])]),_:2},1024),o.value.length>1?(e.openBlock(),e.createElementBlock("div",K,[e.createVNode(g,{onClick:V=>p(k)},{default:e.withCtx(()=>[e.createVNode(e.unref(U.CircleClose))]),_:1},8,["onClick"])])):e.createCommentVNode("",!0)]))),128)),e.createVNode(a,{class:"w-100% mt-10px border-dashed!",icon:"Plus",onClick:s})])}}}),Ue="",A=(t,o)=>{const l=t.__vccOpts||t;for(const[s,p]of o)l[s]=p;return l},E=A(W,[["__scopeId","data-v-16fc9c64"]]),B=5*1024*1024;function G(t,o){return new Promise((l,s)=>{const p=new(void 0),u=new FileReader,n=Math.ceil(t.size/B);let m=0;u.onload=g=>{var a;if(p.append((a=g.target)==null?void 0:a.result),m++,o){const d=Math.floor(m/n*100);o(d)}if(m<n)w();else{const d=p.end();l(d)}},u.onerror=()=>{s(new Error("MD5计算失败"))};function w(){const g=m*B,a=Math.min(g+B,t.size);u.readAsArrayBuffer(t.slice(g,a))}w()})}async function J(t,o,l,s,p,u="/api/upload/chunk"){const n=o*B,m=Math.min(n+B,t.size),w=t.slice(n,m),g=m-n,a=new FormData;a.append("file",w,t.name),a.append("chunkIndex",String(o+1)),a.append("totalChunkNum",String(l)),a.append("fileMd5",s),a.append("tds_token",p),a.append("fileName",t.name),a.append("fileSize",String(t.size)),a.append("fileExt",t.name.substring(t.name.lastIndexOf(".")+1)),a.append("chunkSize",String(B)),a.append("currentChunkSize",String(g));try{const d=await fetch(u,{method:"POST",body:a});if(console.log(d,"upload response"),!d.ok)throw new Error(`分片 ${o+1} 上传失败,HTTP状态码: ${d.status}`);const k=await d.json();if(console.log(k,"upload result"),k.recode!==0)throw new Error(`上传失败: ${k.remsg||"未知错误"}`);return!0}catch(d){throw console.error(`上传分片 ${o+1} 时出错:`,d),d}}async function Z(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(l){return console.error("合并分片时出错:",l),!1}}async function Q(t){const{token:o,file:l,fileDesc:s="",uploadUrl:p="/api/upload/chunk",mergeUrl:u="/api/upload/merge",onProgress:n,onSuccess:m,onError:w}=t;try{n==null||n({progress:0,statusText:"正在计算文件MD5...",status:"preparing"});const a=await G(l,f=>{n==null||n({progress:Math.floor(f*.1),statusText:`正在计算文件MD5... ${f}%`,status:"preparing"})});n==null||n({progress:10,statusText:"MD5计算完成",status:"preparing",fileMd5:a});const d=Math.ceil(l.size/B);n==null||n({progress:10,statusText:`开始上传 (共${d}个分片)`,status:"uploading",fileMd5:a});for(let f=0;f<d;f++){const q=Math.floor(f/d*80);n==null||n({progress:10+q,statusText:`正在上传分片 ${f+1}/${d}`,status:"uploading",fileMd5:a}),await J(l,f,d,a,o,p)}n==null||n({progress:90,statusText:"正在合并文件...",status:"merging",fileMd5:a});const k=l.name.substring(l.name.lastIndexOf(".")+1),V={fileDesc:s,fileExt:k,fileMd5:a,fileName:l.name,fileSize:String(l.size),tds_token:o,totalChunkNum:String(d)};if(!await Z(V,u))throw new Error("文件合并失败");n==null||n({progress:100,statusText:"上传成功",status:"success",fileMd5:a}),D.ElMessage.success(`${l.name} 上传成功`),m==null||m(a)}catch(g){n==null||n({progress:0,statusText:g.message||"上传失败",status:"error"}),D.ElMessage.error(`${l.name} 上传失败: ${g.message}`),w==null||w(g)}}function X(t){if(t===0)return"0 B";const o=1024,l=["B","KB","MB","GB","TB"],s=Math.floor(Math.log(t)/Math.log(o));return Math.round(t/Math.pow(o,s)*100)/100+" "+l[s]}const x={get deployURL(){return window.$probeURL||""}},I=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/deploy`,method:"post",data:t}),Y=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/add`,method:"post",data:t}),P=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/packages/get`,method:"post",data:t,isError:!1}),z=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/get`,method:"post",data:t,isError:!1}),v=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/del`,method:"post",data:t}),ee=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/packages/del`,method:"post",data:t}),te=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/get_arch`,method:"post",data:t,isError:!1}),oe=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/deployment_history/get`,method:"post",data:t,isError:!1}),le=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/test_ssh`,method:"post",data:t}),re=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/check_env`,method:"post",data:t}),ne=(t={})=>window.$http.request({url:`${x.deployURL}/service_deploy/deployment/servers/install_env`,method:"post",data:t}),ae={class:"h-100%"},se={key:0,class:"upload-progress-list"},de={class:"file-info"},ie={class:"file-name"},ce={class:"file-size"},pe={class:"progress-text"},ue={class:"table-box h-[calc(100%-220px)]"},me={key:0},_e={class:"flex flex-wrap gap-12px p-12px"},fe={class:"font-bold text-14px mb-8px text-[var(--el-text-color-primary)]"},ye={class:"text-12px text-[var(--el-text-color-regular)] space-y-4px"},ge={key:1,class:"font-bold text-center text-gray-500 py-20"},he=e.defineComponent({__name:"index",props:{token:{type:String,default:""}},setup(t){const o=e.ref(),l=e.ref(),s=e.ref("快速部署"),p=e.ref({}),{$t:u,$messageBox:n}=window;function m(i){p.value={id:i.id},l.value.open()}const w=e.ref([{ip:"",port:""}]),g=e.ref([{ip:"",port:""}]),a=e.ref([{ip:"",port:""}]),d=e.ref([{ip:"",port:""}]);async function k(i){const h=(r,c)=>{const _=Math.max(r.length,c.length);return Array.from({length:_},(y,b)=>{var T,$,L,M;return{src_ip:((T=r[b])==null?void 0:T.ip)||"",src_port:Number(($=r[b])==null?void 0:$.port)||0,dst_ip:((L=c[b])==null?void 0:L.ip)||"",dst_port:Number((M=c[b])==null?void 0:M.port)||0}})},C={packages_id:[p.value.id],server_id:i.server_id,service_type:window.$prodType,deploy_params:{probe_name:i.probe_name||"",collection_mode:i.collection_mode,interface:i.interface||"",engine_ip:i.engine_ip||"",engine_port:i.engine_port||"",filterWhitelist:h(w.value,g.value),filterBlacklist:h(a.value,d.value)}};await I({data:C}),o.value.getTableList(),l.value.close()}async function V(i){n(i,"file_name",u("button.delete"),"error").then(async()=>{await ee({data:[i.id]}),o.value.getTableList()})}const S=e.reactive([{field:"server_id",name:"选择服务器",enum:z,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:i=>{var h;return((h=i.row.deployment_server)==null?void 0:h.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("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("源ip端口:")]),e.createVNode(E,{modelValue:w.value,"onUpdate:modelValue":i=>w.value=i},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode(E,{modelValue:g.value,"onUpdate:modelValue":i=>g.value=i},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(E,{modelValue:a.value,"onUpdate:modelValue":i=>a.value=i},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode(E,{modelValue:d.value,"onUpdate:modelValue":i=>d.value=i},null)])},hide:!0},{field:"operation",name:window.$t("global.operate"),width:140,fixed:"right",render:i=>e.createVNode("div",null,[e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",class:"custom-btn",onClick:()=>m(i.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:u("button.delete"),onClick:()=>V([i.row])},null)])}]),f=e.ref([]);function q(i){const h=i.raw;if(!h)return;const C={fileName:h.name,fileSize:h.size,progress:0,progressStatus:"",statusText:"准备上传..."};f.value.push(C);const r=f.value.length-1;Q({file:h,fileDesc:"探针安装包",uploadUrl:x.deployURL+"/service_deploy/deployment/packages/upload",mergeUrl:x.deployURL+"/service_deploy/deployment/packages/upload_merge",onProgress:c=>{const _=f.value[r];_&&(_.progress=c.progress,_.statusText=c.statusText,c.fileMd5&&(_.fileMd5=c.fileMd5),c.status==="error"?_.progressStatus="exception":c.status==="success"?_.progressStatus="success":_.progressStatus="")},onSuccess:()=>{var _;const c=f.value[r];c&&(c.progress=100,c.progressStatus="success",c.statusText="上传成功"),(_=o.value)==null||_.getTableList(),setTimeout(()=>{const y=f.value.findIndex(b=>b.fileName===h.name);y!==-1&&f.value.splice(y,1)},3e3)},onError:c=>{console.error("文件上传失败:",c);const _=f.value[r];_&&(_.progressStatus="exception",_.statusText=c.message||"上传失败")}})}return(i,h)=>{const C=e.resolveComponent("el-icon"),r=e.resolveComponent("el-upload"),c=e.resolveComponent("el-progress"),_=e.resolveComponent("el-table-column");return e.openBlock(),e.createElementBlock("div",ae,[e.createVNode(r,{class:"upload-demo mt-10px",drag:"",action:"","auto-upload":!1,accept:".tar.gz,.tgz","on-change":q,"show-file-list":!1,multiple:""},{default:e.withCtx(()=>[e.createVNode(C,{class:"el-icon--upload"},{default:e.withCtx(()=>[e.createVNode(e.unref(U.UploadFilled))]),_:1}),h[0]||(h[0]=e.createElementVNode("div",{class:"el-upload__text"},[e.createTextVNode(" 点击或拖拽文件到此处上传 "),e.createElementVNode("br"),e.createElementVNode("em",null,"支持的格式: tar.gz, tgz")],-1))]),_:1}),f.value.length>0?(e.openBlock(),e.createElementBlock("div",se,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y.fileName,class:"upload-progress-item"},[e.createElementVNode("div",de,[e.createElementVNode("span",ie,e.toDisplayString(y.fileName),1),e.createElementVNode("span",ce,e.toDisplayString(e.unref(X)(y.fileSize)),1)]),e.createVNode(c,{percentage:y.progress,status:y.progressStatus},null,8,["percentage","status"]),e.createElementVNode("div",pe,e.toDisplayString(y.statusText),1)]))),128))])):e.createCommentVNode("",!0),e.createElementVNode("div",ue,[e.createVNode(e.unref(F.TdsTable),{ref_key:"refTdsTable",ref:o,columns:S,"request-api":e.unref(P),options:i.$tableOptions()},{default:e.withCtx(()=>[e.createVNode(_,{type:"expand"},{default:e.withCtx(y=>[y.row.deployment_server&&y.row.deployment_server.length>0?(e.openBlock(),e.createElementBlock("div",me,[h[1]||(h[1]=e.createElementVNode("div",{class:"font-bold text-14px mt-12px"},"已部署的服务器",-1)),e.createElementVNode("div",_e,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.row.deployment_server,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",fe,e.toDisplayString(b.server_name),1),e.createElementVNode("div",ye,[e.createElementVNode("p",null,"IP: "+e.toDisplayString(b.ip_address),1),e.createElementVNode("p",null,"部署时间: "+e.toDisplayString(b.deployment_time),1)])]))),128))])])):(e.openBlock(),e.createElementBlock("div",ge,"暂无部署服务器记录"))]),_:1})]),_:1},8,["columns","request-api","options"])]),e.createVNode(e.unref(F.TdsForm),e.mergeProps({ref_key:"refTdsForm",ref:l},i.$formBindProps({title:s.value,form:p.value,columns:S}),{onSubmit:k}),null,16)])}}}),we={class:"table-box"},be={class:"flex items-center"},ke={key:0},xe={class:"flex flex-wrap gap-12px p-12px"},Ve={class:"font-bold text-14px mb-8px text-[var(--el-text-color-primary)]"},Ne={class:"text-12px text-[var(--el-text-color-regular)] space-y-4px"},Te={key:1,class:"font-bold text-center text-gray-500 py-20"},Ee=e.defineComponent({__name:"index",setup(t){const{$t:o,$messageBox:l}=window,s=e.ref(),p=e.ref(),u=e.ref(""),n=e.ref({}),m=e.ref("show");function w(){n.value={},m.value="show",u.value="添加服务器",p.value.open()}const g=r=>{l(r,"server_name",o("button.delete"),"error").then(async()=>{await v({data:r.map(c=>c.id)}),s.value.getTableList()})};function a(r){n.value={id:r.id},m.value="deploy",u.value="快速部署",p.value.open()}const d=e.ref([{ip:"",port:""}]),k=e.ref([{ip:"",port:""}]),V=e.ref([{ip:"",port:""}]),S=e.ref([{ip:"",port:""}]);async function f(r){if(m.value==="show"){await Y({data:r}),s.value.getTableList(),p.value.close();return}const c=(y,b)=>{const T=Math.max(y.length,b.length);return Array.from({length:T},($,L)=>{var M,O,j,H;return{src_ip:((M=y[L])==null?void 0:M.ip)||"",src_port:Number((O=y[L])==null?void 0:O.port)||0,dst_ip:((j=b[L])==null?void 0:j.ip)||"",dst_port:Number((H=b[L])==null?void 0:H.port)||0}})},_={packages_id:[r.packages_id],server_id:[n.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:c(d.value,k.value),filterBlacklist:c(V.value,S.value)}};await I({data:_}),s.value.getTableList(),p.value.close()}function q(r){le({data:[r.id]}),s.value.getTableList()}function i(r){re({data:[r.id]}),s.value.getTableList()}function h(r){ne({data:[r.id]}),s.value.getTableList()}const C=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:te,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:P,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(E,{modelValue:d.value,"onUpdate:modelValue":r=>d.value=r},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode(E,{modelValue:k.value,"onUpdate:modelValue":r=>k.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(E,{modelValue:V.value,"onUpdate:modelValue":r=>V.value=r},null),e.createVNode("p",{class:"color-[var(--el-text-color-regular)]"},[e.createTextVNode("目的ip端口:")]),e.createVNode(E,{modelValue:S.value,"onUpdate:modelValue":r=>S.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:()=>q(r.row)},null),e.createVNode(e.resolveComponent("el-button"),{link:!0,type:"primary",class:"custom-btn",onClick:()=>i(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:()=>h(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:()=>a(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:()=>g([r.row])},null)])}]);return(r,c)=>{const _=e.resolveComponent("el-button"),y=e.resolveComponent("el-table-column"),b=e.resolveComponent("TdsTable");return e.openBlock(),e.createElementBlock("div",we,[e.createVNode(b,{ref_key:"refTdsTable",ref:s,columns:C,"request-api":e.unref(z),"search-col":4,options:r.$tableOptions(),"reserve-selection":""},{tableHeader:e.withCtx(()=>[e.createElementVNode("div",be,[e.createVNode(_,{class:"custom-btn",type:"primary",icon:"Plus",plain:"",onClick:c[0]||(c[0]=T=>w())},{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(T=>[T.row.deployment_packages&&T.row.deployment_packages.length>0?(e.openBlock(),e.createElementBlock("div",ke,[c[1]||(c[1]=e.createElementVNode("div",{class:"font-bold text-14px mt-12px"},"已部署的探针包",-1)),e.createElementVNode("div",xe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.row.deployment_packages,$=>(e.openBlock(),e.createElementBlock("div",{key:$.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",Ve,e.toDisplayString($.file_name),1),e.createElementVNode("div",Ne,[e.createElementVNode("p",null,"版本: "+e.toDisplayString($.version),1),e.createElementVNode("p",null,"部署时间: "+e.toDisplayString($.deployment_time),1)])]))),128))])])):(e.openBlock(),e.createElementBlock("div",Te,"暂无部署服务器记录"))]),_:1})]),_:1},8,["columns","request-api","options"]),e.createVNode(e.unref(F.TdsForm),e.mergeProps({ref_key:"refTdsForm",ref:p},r.$formBindProps({title:u.value,form:n.value,columns:C,formKey:m.value}),{onSubmit:f}),null,16)])}}}),Ce={class:"table-box"},$e={style:{padding:"0 50px"}},Be=e.defineComponent({__name:"index",setup(t){const o=e.reactive([{field:"packages_name",name:"探针包",render:l=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"font-bold"},[l.row.packages_name]),e.createVNode("p",{class:"text-gray-400"},[l.row.packages_version])])},{field:"server_name",name:"服务器",render:l=>e.createVNode(e.Fragment,null,[e.createVNode("p",{class:"font-bold"},[l.row.server_name]),e.createVNode("p",{class:"text-gray-400"},[l.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(l,s)=>{const p=e.resolveComponent("el-table-column"),u=e.resolveComponent("TdsTable");return e.openBlock(),e.createElementBlock("div",Ce,[e.createVNode(u,{ref:"refTdsTable",columns:o,"search-col":4,"request-api":e.unref(oe),options:l.$tableOptions(),"reserve-selection":""},{default:e.withCtx(()=>[e.createVNode(p,{type:"expand"},{default:e.withCtx(n=>[e.createElementVNode("div",$e,e.toDisplayString(n.row.deployment_log),1)]),_:1})]),_:1},8,["columns","request-api","options"])])}}}),Se={class:"main-wrapper"},Le=e.defineComponent({name:"TCProbe",__name:"index",props:{token:{type:String,default:""}},setup(t){const o=t,l=e.ref("package");return(s,p)=>{const u=e.resolveComponent("el-tab-pane"),n=e.resolveComponent("el-tabs");return e.openBlock(),e.createElementBlock("div",Se,[e.createVNode(n,{modelValue:l.value,"onUpdate:modelValue":p[0]||(p[0]=m=>l.value=m),class:"demo-tabs"},{default:e.withCtx(()=>[e.createVNode(u,{label:"安装包管理",name:"package"},{default:e.withCtx(()=>[l.value==="package"?(e.openBlock(),e.createBlock(he,{key:0,token:o.token},null,8,["token"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(u,{label:"探针部署",name:"deploy"},{default:e.withCtx(()=>[l.value==="deploy"?(e.openBlock(),e.createBlock(Ee,{key:0})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(u,{label:"部署历史",name:"history"},{default:e.withCtx(()=>[l.value==="history"?(e.openBlock(),e.createBlock(Be,{key:0})):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["modelValue"])])}}}),De="",R=((t,o)=>{if(t.install=l=>{for(const s of[t,...Object.values(o??{})])l.component(s.name,s)},o)for(const[l,s]of Object.entries(o))t[l]=s;return t})(A(Le,[["__scopeId","data-v-7172e806"]])),qe={TCProbe:R},Me={install(t,o){Object.entries(qe).forEach(([l,s])=>{t.component(l,s)}),o!=null&&o.prodType&&(window.$prodType=o.prodType),o!=null&&o.envURL&&(window.$probeURL=o.envURL)}};N.TCProbe=R,N.default=Me,Object.defineProperties(N,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|