sbd-npm 1.4.63 → 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 +31 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.63",
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
@@ -544,6 +544,7 @@ $(function () {
544
544
  $("#task_div").html(ht_html.join(""));
545
545
  $("#task_add").click(function() {
546
546
  let task_content = $("#task_content").val();
547
+ task_content = task_content.replace(/ü/g, 'u').replace(/ö/g, 'o'); // München、Köln
547
548
  task_content = task_content.replace(/[^\w\u4e00-\u9fff-]/g, ''); // 去掉除字母、数字、下划线(_)、汉字、横杠(-)外的其他字符(䒚 /[^\w\u3400-\u9fff\u{20000}-\u{2EBEF}]/gu)
548
549
  if (Status.check_task_content(task_content)) {
549
550
  $("#task_content").prop('disabled', true);
@@ -602,7 +603,7 @@ $(function () {
602
603
  if (task_content && task_content.length > 0) {
603
604
  let task_tips = $("#task_tips").text().trim();
604
605
  if (task_tips.length > 0) {
605
- let tips_match = task_tips.match(/^任务\s`(.+?)`\sDONE$/);
606
+ let tips_match = task_tips.match(/^任务\s*`(.+?)`\s*DONE$/);
606
607
  if (tips_match && tips_match[1] === task_content) {
607
608
  Util.show_tips("任务 `" + tips_match[1] + "` 已经执行过", 3456, "alert-danger");
608
609
  return false;
@@ -762,7 +763,17 @@ $(function () {
762
763
  let html = [], process_num = 0;
763
764
  j["process"].forEach(function (item) {
764
765
  process_num++;
766
+ let is_xmr = 0, is_screen = 0;
765
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) {
766
777
  html.push("<tr class='info'>");
767
778
  } else {
768
779
  html.push("<tr>");
@@ -770,13 +781,17 @@ $(function () {
770
781
  html.push("<td>", item["pid"], "</td>");
771
782
  html.push("<td>", item["status"], "</td>");
772
783
  let cmdline = Util.substring(item["cmdline"], 100);
773
- if (item["cmdline"].includes("zotonic") || item["cmdline"].includes("xmrig")) {
784
+ if (is_xmr === 1) {
774
785
  html.push("<td>", Util.pack_html_link("/xmr", cmdline), "</td>");
775
786
  } else {
776
787
  html.push("<td title='", item["cmdline"], "'>", cmdline, "</td>");
777
788
  }
778
789
  html.push("<td>", Util.seconds_to_format(item["create_time"]), "</td>");
779
- 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
+ }
780
795
  html.push("</tr>");
781
796
  });
782
797
  Util.render_table_html("machine_process_div_body", html);
@@ -805,9 +820,20 @@ $(function () {
805
820
  });
806
821
  $("#machine_process_div_body .process_screen").each(function() {
807
822
  $(this).click(function() {
808
- let pid = $(this).parent().parent().children('td').eq(0).text();
809
823
  Util.show_loading();
810
- 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
+ }
811
837
  Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": $("#machines").val(), "content": action_content, action_type: 2}, function (j) {
812
838
  Util.hide_tips();
813
839
  if (j["code"] === 1) {