sbd-npm 1.4.65 → 1.4.67

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 +47 -23
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.65",
3
+ "version": "1.4.67",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -761,6 +761,7 @@ $(function () {
761
761
  });
762
762
  }
763
763
  let html = [], process_num = 0;
764
+ let screen_pid = j["screen_pid"] ? j["screen_pid"] : 0;
764
765
  j["process"].forEach(function (item) {
765
766
  process_num++;
766
767
  let is_xmr = 0, is_screen = 0;
@@ -768,9 +769,13 @@ $(function () {
768
769
  is_xmr = 1;
769
770
  is_screen = 1;
770
771
  } else {
771
- let parameter_match = item["cmdline"].match(/\/do\.py\s+([A-Za-z0-9_]+)/);
772
- if (parameter_match && parameter_match[1]) {
772
+ if (screen_pid === item["pid"]) {
773
773
  is_screen = 1;
774
+ } else {
775
+ let parameter_match = item["cmdline"].match(/\/do\.py\s+([A-Za-z0-9_]+)/);
776
+ if (parameter_match && parameter_match[1]) {
777
+ is_screen = 1;
778
+ }
774
779
  }
775
780
  }
776
781
  if (is_xmr === 1) {
@@ -788,7 +793,13 @@ $(function () {
788
793
  }
789
794
  html.push("<td>", Util.seconds_to_format(item["create_time"]), "</td>");
790
795
  if (is_screen === 1) {
791
- html.push("<td><a class='process_kill' href='#'>终止</a>&nbsp;&nbsp;<a class='process_screen' href='#'>会话</a></td>");
796
+ let screen_html = "";
797
+ if (screen_pid === item["pid"]) {
798
+ screen_html = "<a data-screen='1' class='process_screen' href='#'><span class='label label-success'>会话</span></a>";
799
+ } else {
800
+ screen_html = "<a class='process_screen' href='#'>会话</a>";
801
+ }
802
+ html.push("<td><a class='process_kill' href='#'>终止</a>&nbsp;&nbsp;", screen_html, "</td>");
792
803
  } else {
793
804
  html.push("<td><a class='process_kill' href='#'>终止</a></td>");
794
805
  }
@@ -822,30 +833,43 @@ $(function () {
822
833
  $(this).click(function() {
823
834
  Util.show_loading();
824
835
  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";
836
+ let is_fetch_screen = $(this).attr("data-screen");
837
+ if (is_fetch_screen && is_fetch_screen == "1") {
838
+ Util.post(location.pathname, {active_div: "machine_screen", "machine_id": $("#machines").val(), "pid": pid}, function (j) {
839
+ Util.hide_tips();
840
+ if (j["data"]) {
841
+ Util.showAlert(j["data"]);
842
+ } else {
843
+ Util.show_tips("数据异常!", 4567, "alert-danger");
844
+ }
845
+ });
829
846
  } 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];
847
+ let cmdline = $(this).parent().parent().children('td').eq(2).text();
848
+ let action = "";
849
+ if (cmdline.includes("zotonic") || cmdline.includes("xmrig")) {
850
+ action = "xmr";
833
851
  } else {
834
- action_content = "screen_" + pid + "_null";
852
+ let parameter_match = cmdline.match(/\/do\.py\s+([A-Za-z0-9_]+)/);
853
+ if (parameter_match && parameter_match[1]) {
854
+ action = parameter_match[1];
855
+ } else {
856
+ action = "null";
857
+ }
835
858
  }
859
+ let screen_content = "screen_" + pid + "_" + action;
860
+ Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": $("#machines").val(), "content": screen_content, action_type: 2}, function (j) {
861
+ Util.hide_tips();
862
+ if (j["code"] === 1) {
863
+ Util.show_tips("进程 [" + pid + "(" + action + ")] 已加到会话队列中", 4567, "alert-success");
864
+ } else if (j["code"] === 2) {
865
+ Util.show_tips("Machine 不存在!", 4567, "alert-danger");
866
+ } else if (j["code"] === 3) {
867
+ Util.show_tips("进程 [" + pid + "(" + action + ")] 异常!", 4567, "alert-danger");
868
+ } else {
869
+ Util.show_tips("进程值不能为空!", 4567, "alert-danger");
870
+ }
871
+ });
836
872
  }
837
- Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": $("#machines").val(), "content": action_content, action_type: 2}, function (j) {
838
- Util.hide_tips();
839
- if (j["code"] === 1) {
840
- Util.show_tips("进程 [" + pid + "] 已加到会话队列中", 4567, "alert-success");
841
- } else if (j["code"] === 2) {
842
- Util.show_tips("Machine 不存在!", 4567, "alert-danger");
843
- } else if (j["code"] === 3) {
844
- Util.show_tips("进程 [" + pid + "] 异常!", 4567, "alert-danger");
845
- } else {
846
- Util.show_tips("进程值不能为空!", 4567, "alert-danger");
847
- }
848
- });
849
873
  });
850
874
  });
851
875
  } else if (is_init === 1) {