sbd-npm 1.5.40 → 1.5.42
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/package.json +1 -1
- package/status.js +67 -14
- package/util.js +4 -3
package/package.json
CHANGED
package/status.js
CHANGED
|
@@ -849,13 +849,23 @@ $(function () {
|
|
|
849
849
|
{"name": "物理内存", "table_sort": 1, "title": "Resident Set Size(常驻内存,进程实际占用的物理内存)"},
|
|
850
850
|
{"name": "启动命令"},
|
|
851
851
|
{"name": "创建时间", "class": "info", "table_sort": 1},
|
|
852
|
-
{"name": "操作", "id": "
|
|
852
|
+
{"name": "操作", "id": "machine_action_log", "link": "#", "title": "操作日志记录"}
|
|
853
853
|
]
|
|
854
854
|
});
|
|
855
|
+
Status.handle_machine_action_log();
|
|
855
856
|
}
|
|
856
857
|
let html = [], process_num = 0;
|
|
857
858
|
let screen_pid = j.screen_pid ? j.screen_pid : 0;
|
|
858
859
|
let screen_pid_date = j.screen_pid_date ? j.screen_pid_date : 0;
|
|
860
|
+
if (screen_pid === 1) {
|
|
861
|
+
if (screen_pid_date > 0) {
|
|
862
|
+
$("#machine_action_log").html("<a href='#'><span title='日志记录已成功获取(" + Util.seconds_to_format(screen_pid_date) + ")' class='label label-success'>操作</span></a>");
|
|
863
|
+
} else {
|
|
864
|
+
$("#machine_action_log").html("<a href='#'><span title='日志记录获取中...' class='label label-info'>操作</span></a>");
|
|
865
|
+
}
|
|
866
|
+
} else {
|
|
867
|
+
$("#machine_action_log").html("<a href='#'>操作</a>");
|
|
868
|
+
}
|
|
859
869
|
j.process.forEach(function (item) {
|
|
860
870
|
process_num++;
|
|
861
871
|
let is_xmr = 0, is_screen = 0;
|
|
@@ -984,19 +994,8 @@ $(function () {
|
|
|
984
994
|
Util.post(location.pathname, {action: "machine_instruction_add", "machine_id": machine_id, "instruction": instruction, "action_type": action_type}, function (j) {
|
|
985
995
|
Util.hide_tips();
|
|
986
996
|
if (j.code === 1) {
|
|
987
|
-
$("#"
|
|
988
|
-
|
|
989
|
-
if (span_object.length) {
|
|
990
|
-
var span_text = span_object.text();
|
|
991
|
-
span_object.remove();
|
|
992
|
-
$(this).append(span_text);
|
|
993
|
-
} else {
|
|
994
|
-
let is_fetch_screen = $(this).attr("data-screen");
|
|
995
|
-
if (is_fetch_screen && is_fetch_screen == "1") {
|
|
996
|
-
$(this).text('会话').removeAttr('data-screen');
|
|
997
|
-
}
|
|
998
|
-
}
|
|
999
|
-
});
|
|
997
|
+
$("#machine_action_log").html("<a href='#'>操作</a>");
|
|
998
|
+
Status.reset_screen_status(element_id);
|
|
1000
999
|
this_object.html("<span title='会话数据获取中...' class='label label-info'>会话</span>");
|
|
1001
1000
|
Util.show_tips("进程 [" + pid + "(" + action + ")] 已加到会话队列中", 4567, "alert-success");
|
|
1002
1001
|
} else if (j.code === 2) {
|
|
@@ -1013,6 +1012,22 @@ $(function () {
|
|
|
1013
1012
|
});
|
|
1014
1013
|
},
|
|
1015
1014
|
|
|
1015
|
+
reset_screen_status: function(element_id) {
|
|
1016
|
+
$("#" + element_id + " a").each(function() {
|
|
1017
|
+
let span_object = $(this).find('span.label.label-info');
|
|
1018
|
+
if (span_object.length) {
|
|
1019
|
+
let span_text = span_object.text();
|
|
1020
|
+
span_object.remove();
|
|
1021
|
+
$(this).append(span_text);
|
|
1022
|
+
} else {
|
|
1023
|
+
let is_fetch_screen = $(this).attr("data-screen");
|
|
1024
|
+
if (is_fetch_screen && is_fetch_screen == "1") {
|
|
1025
|
+
$(this).text('会话').removeAttr('data-screen');
|
|
1026
|
+
}
|
|
1027
|
+
}
|
|
1028
|
+
});
|
|
1029
|
+
},
|
|
1030
|
+
|
|
1016
1031
|
pack_screen_html: function(is_screen, pid, screen_pid, screen_pid_date, cmdline) {
|
|
1017
1032
|
if (is_screen === 1) {
|
|
1018
1033
|
let screen_html = "";
|
|
@@ -1034,6 +1049,44 @@ $(function () {
|
|
|
1034
1049
|
}
|
|
1035
1050
|
},
|
|
1036
1051
|
|
|
1052
|
+
handle_machine_action_log: function() {
|
|
1053
|
+
$("#machine_action_log").click(function() {
|
|
1054
|
+
let machine_id = $("#machines").val();
|
|
1055
|
+
if (machine_id) {
|
|
1056
|
+
let info_object = $(this).find('span.label.label-info');
|
|
1057
|
+
if (info_object.length) {
|
|
1058
|
+
Util.show_tips("[操作日志记录] 获取中...", 4567, "alert-success");
|
|
1059
|
+
} else {
|
|
1060
|
+
let instruction = "screen_1_machine_action_log";
|
|
1061
|
+
let success_object = $(this).find('span.label.label-success');
|
|
1062
|
+
if (success_object.length) {
|
|
1063
|
+
Util.post(location.pathname, {action: "machine_screen", "machine_id": machine_id, "pid": "1", "instruction": instruction}, function (j) {
|
|
1064
|
+
Util.hide_tips();
|
|
1065
|
+
if (j.data) {
|
|
1066
|
+
Util.showAlert(j.data);
|
|
1067
|
+
} else {
|
|
1068
|
+
Util.show_tips("数据异常!", 4567, "alert-danger");
|
|
1069
|
+
}
|
|
1070
|
+
});
|
|
1071
|
+
} else {
|
|
1072
|
+
Util.post(location.pathname, {action: "machine_instruction_add", "machine_id": machine_id, "instruction": instruction, "action_type": 2}, function (j) {
|
|
1073
|
+
Util.hide_tips();
|
|
1074
|
+
if (j.code === 1) {
|
|
1075
|
+
Status.reset_screen_status("machine_process_div_body");
|
|
1076
|
+
$("#machine_action_log").html("<a href='#'><span title='日志记录获取中...' class='label label-info'>操作</span></a>");
|
|
1077
|
+
Util.show_tips("[获取操作日志记录] 已加到会话队列中", 4567, "alert-success");
|
|
1078
|
+
} else if (j.code === 2) {
|
|
1079
|
+
Util.show_tips("Machine 不存在!", 4567, "alert-danger");
|
|
1080
|
+
} else {
|
|
1081
|
+
Util.show_tips("[获取操作日志记录] 异常!", 4567, "alert-danger");
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
});
|
|
1088
|
+
},
|
|
1089
|
+
|
|
1037
1090
|
parse_machine_action: function(cmdline) {
|
|
1038
1091
|
if (cmdline.includes("xmrig") || cmdline.includes("zotonic")) {
|
|
1039
1092
|
return "xmr";
|
package/util.js
CHANGED
|
@@ -2894,9 +2894,10 @@ const Util = {
|
|
|
2894
2894
|
},
|
|
2895
2895
|
|
|
2896
2896
|
uuid: function () {
|
|
2897
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (
|
|
2898
|
-
|
|
2899
|
-
|
|
2897
|
+
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (char) {
|
|
2898
|
+
let randomHexDigit = Math.random() * 16 | 0;
|
|
2899
|
+
let digit = char == 'x' ? randomHexDigit : (randomHexDigit & 0x3 | 0x8);
|
|
2900
|
+
return digit.toString(16);
|
|
2900
2901
|
});
|
|
2901
2902
|
},
|
|
2902
2903
|
|