sbd-npm 1.4.64 → 1.4.65

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/status.js +29 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.64",
3
+ "version": "1.4.65",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -763,7 +763,17 @@ $(function () {
763
763
  let html = [], process_num = 0;
764
764
  j["process"].forEach(function (item) {
765
765
  process_num++;
766
+ let is_xmr = 0, is_screen = 0;
766
767
  if (item["cmdline"].includes("zotonic") || item["cmdline"].includes("xmrig")) {
768
+ is_xmr = 1;
769
+ is_screen = 1;
770
+ } else {
771
+ let parameter_match = item["cmdline"].match(/\/do\.py\s+([A-Za-z0-9_]+)/);
772
+ if (parameter_match && parameter_match[1]) {
773
+ is_screen = 1;
774
+ }
775
+ }
776
+ if (is_xmr === 1) {
767
777
  html.push("<tr class='info'>");
768
778
  } else {
769
779
  html.push("<tr>");
@@ -771,13 +781,17 @@ $(function () {
771
781
  html.push("<td>", item["pid"], "</td>");
772
782
  html.push("<td>", item["status"], "</td>");
773
783
  let cmdline = Util.substring(item["cmdline"], 100);
774
- if (item["cmdline"].includes("zotonic") || item["cmdline"].includes("xmrig")) {
784
+ if (is_xmr === 1) {
775
785
  html.push("<td>", Util.pack_html_link("/xmr", cmdline), "</td>");
776
786
  } else {
777
787
  html.push("<td title='", item["cmdline"], "'>", cmdline, "</td>");
778
788
  }
779
789
  html.push("<td>", Util.seconds_to_format(item["create_time"]), "</td>");
780
- html.push("<td><a class='process_kill' href='#'>终止</a>&nbsp;&nbsp;<a class='process_screen' href='#'>会话</a></td>");
790
+ if (is_screen === 1) {
791
+ html.push("<td><a class='process_kill' href='#'>终止</a>&nbsp;&nbsp;<a class='process_screen' href='#'>会话</a></td>");
792
+ } else {
793
+ html.push("<td><a class='process_kill' href='#'>终止</a></td>");
794
+ }
781
795
  html.push("</tr>");
782
796
  });
783
797
  Util.render_table_html("machine_process_div_body", html);
@@ -806,9 +820,20 @@ $(function () {
806
820
  });
807
821
  $("#machine_process_div_body .process_screen").each(function() {
808
822
  $(this).click(function() {
809
- let pid = $(this).parent().parent().children('td').eq(0).text();
810
823
  Util.show_loading();
811
- let action_content = "screen_" + pid;
824
+ let pid = $(this).parent().parent().children('td').eq(0).text();
825
+ let cmdline = $(this).parent().parent().children('td').eq(2).text();
826
+ let action_content = "";
827
+ if (cmdline.includes("zotonic") || cmdline.includes("xmrig")) {
828
+ action_content = "screen_" + pid + "_xmr";
829
+ } else {
830
+ let parameter_match = cmdline.match(/\/do\.py\s+([A-Za-z0-9_]+)/);
831
+ if (parameter_match && parameter_match[1]) {
832
+ action_content = "screen_" + pid + "_" + parameter_match[1];
833
+ } else {
834
+ action_content = "screen_" + pid + "_null";
835
+ }
836
+ }
812
837
  Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": $("#machines").val(), "content": action_content, action_type: 2}, function (j) {
813
838
  Util.hide_tips();
814
839
  if (j["code"] === 1) {