sbd-npm 1.4.61 → 1.4.63

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 (3) hide show
  1. package/package.json +1 -1
  2. package/status.js +39 -5
  3. package/util.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.61",
3
+ "version": "1.4.63",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -545,7 +545,7 @@ $(function () {
545
545
  $("#task_add").click(function() {
546
546
  let task_content = $("#task_content").val();
547
547
  task_content = task_content.replace(/[^\w\u4e00-\u9fff-]/g, ''); // 去掉除字母、数字、下划线(_)、汉字、横杠(-)外的其他字符(䒚 /[^\w\u3400-\u9fff\u{20000}-\u{2EBEF}]/gu)
548
- if (task_content && task_content.length > 0) {
548
+ if (Status.check_task_content(task_content)) {
549
549
  $("#task_content").prop('disabled', true);
550
550
  $("#task_add").prop('disabled', true);
551
551
  Util.show_loading();
@@ -583,8 +583,6 @@ $(function () {
583
583
  }
584
584
  Util.hide_tips();
585
585
  });
586
- } else {
587
- $("#task_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
588
586
  }
589
587
  return false;
590
588
  });
@@ -600,6 +598,23 @@ $(function () {
600
598
  Status.fetch_task_data(is_init);
601
599
  },
602
600
 
601
+ check_task_content: function(task_content) {
602
+ if (task_content && task_content.length > 0) {
603
+ let task_tips = $("#task_tips").text().trim();
604
+ if (task_tips.length > 0) {
605
+ let tips_match = task_tips.match(/^任务\s`(.+?)`\sDONE$/);
606
+ if (tips_match && tips_match[1] === task_content) {
607
+ Util.show_tips("任务 `" + tips_match[1] + "` 已经执行过", 3456, "alert-danger");
608
+ return false;
609
+ }
610
+ }
611
+ return true;
612
+ } else {
613
+ $("#task_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
614
+ return false;
615
+ }
616
+ },
617
+
603
618
  fetch_task_data: function(is_init = 0) {
604
619
  let machine_id = $("#task_machines").val();
605
620
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_init: is_init, machine_id: machine_id}, function (j) {
@@ -761,7 +776,7 @@ $(function () {
761
776
  html.push("<td title='", item["cmdline"], "'>", cmdline, "</td>");
762
777
  }
763
778
  html.push("<td>", Util.seconds_to_format(item["create_time"]), "</td>");
764
- html.push("<td><a class='process_kill' href='#'>终止</a></td>");
779
+ html.push("<td><a class='process_kill' href='#'>终止</a>&nbsp;&nbsp;<a class='process_screen' href='#'>会话</a></td>");
765
780
  html.push("</tr>");
766
781
  });
767
782
  Util.render_table_html("machine_process_div_body", html);
@@ -788,6 +803,25 @@ $(function () {
788
803
  }
789
804
  });
790
805
  });
806
+ $("#machine_process_div_body .process_screen").each(function() {
807
+ $(this).click(function() {
808
+ let pid = $(this).parent().parent().children('td').eq(0).text();
809
+ Util.show_loading();
810
+ let action_content = "screen_" + pid;
811
+ Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": $("#machines").val(), "content": action_content, action_type: 2}, function (j) {
812
+ Util.hide_tips();
813
+ if (j["code"] === 1) {
814
+ Util.show_tips("进程 [" + pid + "] 已加到会话队列中", 4567, "alert-success");
815
+ } else if (j["code"] === 2) {
816
+ Util.show_tips("Machine 不存在!", 4567, "alert-danger");
817
+ } else if (j["code"] === 3) {
818
+ Util.show_tips("进程 [" + pid + "] 异常!", 4567, "alert-danger");
819
+ } else {
820
+ Util.show_tips("进程值不能为空!", 4567, "alert-danger");
821
+ }
822
+ });
823
+ });
824
+ });
791
825
  } else if (is_init === 1) {
792
826
  $('#machines').html('<option value="">暂无Machine</option>');
793
827
  }
@@ -1355,7 +1389,7 @@ $(function () {
1355
1389
  map_url: function (location, location_name = "") {
1356
1390
  location_name = location_name === "" ? location : location_name;
1357
1391
  let location_arr = location.split(' ');
1358
- if (location.indexOf("中国") > -1 || location.indexOf("省") > -1 || location.indexOf("市") > -1) {
1392
+ if (/中国|省|市/.test(location)) {
1359
1393
  let url = Util.map_url(location_arr[0]);
1360
1394
  return url.replace('>' + location_arr[0] + '</a>', '>' + location_name + '</a>');
1361
1395
  }
package/util.js CHANGED
@@ -416,7 +416,7 @@ const Util = {
416
416
  if (location_name === "") {
417
417
  location_name = location.length > 20 ? location.substring(0, 20) : location;
418
418
  }
419
- if (Util.is_has_chinese(location)) {
419
+ if (Util.is_has_chinese(location) && !/美国|加拿大|新加坡|日本|澳大利亚/.test(location)) {
420
420
  //return "<a target='_blank' class='link_cls map_link' rel='noopener noreferrer nofollow' href='https://map.baidu.com/m?fr=ps01000&word=" + location + "'>" + location_name + "</a>";
421
421
  return "<a target='_blank' class='link_cls map_link' rel='noopener noreferrer nofollow' href='https://www.amap.com/search?query=" + location + "'>" + location_name + "</a>";
422
422
  }