sbd-npm 1.4.60 → 1.4.62

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 +59 -40
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.60",
3
+ "version": "1.4.62",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -220,7 +220,7 @@ $(function () {
220
220
  }
221
221
  Util.init_table_skeleton({
222
222
  "element_id": "process_div",
223
- "caption": prefix_caption + '共 <span class="label label-info" id="process_num"></span> 进程,&nbsp;&nbsp;<input checked type="checkbox" id="is_py_process"> 只显示 Python 进程&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" data-toggle="modal" data-target=".machine_action_modal" data-type="1" href="#" class="btn btn-warning btn-xs">添加任务</a></caption>',
223
+ "caption": prefix_caption + '共 <span class="label label-info" id="process_num"></span> 进程,&nbsp;&nbsp;<input checked type="checkbox" id="is_py_process"> 只显示 Python 进程&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" data-toggle="modal" data-target=".machine_instruction_modal" data-type="1" href="#" class="btn btn-warning btn-xs">添加任务</a></caption>',
224
224
  "head_cols": [
225
225
  {"name": "进程ID", "table_sort": 1},
226
226
  {"name": "进程名", "table_sort": 1},
@@ -237,8 +237,8 @@ $(function () {
237
237
  Util.set_table_loading("process_div_body");
238
238
  Status.handle_process();
239
239
  });
240
- if (!document.getElementById("machine_action_add")) {
241
- Status.init_machine_action_modal();
240
+ if (!document.getElementById("machine_instruction_add")) {
241
+ Status.init_machine_instruction_modal();
242
242
  }
243
243
  }
244
244
  let is_py_process = $("#is_py_process").prop("checked") ? "1" : "0";
@@ -684,14 +684,14 @@ $(function () {
684
684
  machine_html.push('<option value="">Loading...</option>');
685
685
  machine_html.push('</select>');
686
686
  machine_html.push('</div>');
687
- machine_html.push('&nbsp;&nbsp;<a href="#" data-toggle="modal" data-target=".machine_action_modal" data-type="2" class="btn btn-warning">添加任务</a>');
687
+ machine_html.push('&nbsp;&nbsp;<a href="#" data-toggle="modal" data-target=".machine_instruction_modal" data-type="2" class="btn btn-warning">添加任务</a>');
688
688
  machine_html.push('<a href="#" data-toggle="modal" data-target=".machine_cookie_modal" class="btn btn-warning">雪球Cookie</a>');
689
689
  machine_html.push('<a href="#" id="machine_refresh" class="btn btn-warning">刷新Machine</a>');
690
690
  machine_html.push('</form>');
691
691
  machine_html.push('<div id="machine_process_div"></div>');
692
692
  $("#machine_div").html(machine_html.join(""));
693
- if (!document.getElementById("machine_action_add")) {
694
- Status.init_machine_action_modal();
693
+ if (!document.getElementById("machine_instruction_add")) {
694
+ Status.init_machine_instruction_modal();
695
695
  Status.init_machine_cookie_modal();
696
696
  $("#machine_refresh").click(function() {
697
697
  if (confirm("是否确定要“ 刷新Machine ” ?")) {
@@ -761,7 +761,7 @@ $(function () {
761
761
  html.push("<td title='", item["cmdline"], "'>", cmdline, "</td>");
762
762
  }
763
763
  html.push("<td>", Util.seconds_to_format(item["create_time"]), "</td>");
764
- html.push("<td><a class='process_kill' href='#'>终止</a></td>");
764
+ html.push("<td><a class='process_kill' href='#'>终止</a>&nbsp;&nbsp;<a class='process_screen' href='#'>会话</a></td>");
765
765
  html.push("</tr>");
766
766
  });
767
767
  Util.render_table_html("machine_process_div_body", html);
@@ -773,7 +773,7 @@ $(function () {
773
773
  if (confirm("是否确定要终止进程 [" + pid + "] ?")) {
774
774
  Util.show_loading();
775
775
  let action_content = "kill_pid_" + pid;
776
- Util.post(location.pathname, {active_div: "machine_action_add", "machine_id": $("#machines").val(), "content": action_content, action_type: 2}, function (j) {
776
+ Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": $("#machines").val(), "content": action_content, action_type: 2}, function (j) {
777
777
  Util.hide_tips();
778
778
  if (j["code"] === 1) {
779
779
  Util.show_tips("进程 [" + pid + "] 已加到终止队列中", 4567, "alert-success");
@@ -788,6 +788,25 @@ $(function () {
788
788
  }
789
789
  });
790
790
  });
791
+ $("#machine_process_div_body .process_screen").each(function() {
792
+ $(this).click(function() {
793
+ let pid = $(this).parent().parent().children('td').eq(0).text();
794
+ Util.show_loading();
795
+ let action_content = "screen_" + pid;
796
+ Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": $("#machines").val(), "content": action_content, action_type: 2}, function (j) {
797
+ Util.hide_tips();
798
+ if (j["code"] === 1) {
799
+ Util.show_tips("进程 [" + pid + "] 已加到会话队列中", 4567, "alert-success");
800
+ } else if (j["code"] === 2) {
801
+ Util.show_tips("Machine 不存在!", 4567, "alert-danger");
802
+ } else if (j["code"] === 3) {
803
+ Util.show_tips("进程 [" + pid + "] 异常!", 4567, "alert-danger");
804
+ } else {
805
+ Util.show_tips("进程值不能为空!", 4567, "alert-danger");
806
+ }
807
+ });
808
+ });
809
+ });
791
810
  } else if (is_init === 1) {
792
811
  $('#machines').html('<option value="">暂无Machine</option>');
793
812
  }
@@ -860,15 +879,15 @@ $(function () {
860
879
  Util.is_load = false;
861
880
  },
862
881
 
863
- init_machine_action_modal: function () {
864
- Util.init_modal_skeleton("machine_action_modal");
865
- $("#machine_action_modal_title").html("添加任务");
882
+ init_machine_instruction_modal: function () {
883
+ Util.init_modal_skeleton("machine_instruction_modal");
884
+ $("#machine_instruction_modal_title").html("添加任务");
866
885
  let html = [];
867
886
  html.push('<form data-parsley-validate class="form-horizontal form-label-left">');
868
887
  html.push('<div class="form-group" id="action_machine_div">');
869
888
  html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12">Machine </label>');
870
889
  html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
871
- html.push('<select id="machine_action_machine" class="form-control col-md-7 col-xs-12">');
890
+ html.push('<select id="machine_instruction_machine" class="form-control col-md-7 col-xs-12">');
872
891
  html.push('<option value="">Loading...</option>');
873
892
  html.push('</select>');
874
893
  html.push('</div>');
@@ -876,22 +895,22 @@ $(function () {
876
895
  html.push('<div class="form-group">');
877
896
  html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12">任务命令 </label>');
878
897
  html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
879
- html.push('<select id="machine_action_content" class="form-control col-md-7 col-xs-12">');
898
+ html.push('<select id="machine_instruction_content" class="form-control col-md-7 col-xs-12">');
880
899
  html.push('<option value="">任务命令</option>');
881
900
  html.push('</select>');
882
901
  html.push('</div>');
883
902
  html.push('</div>');
884
903
  html.push('<div class="form-group">');
885
904
  html.push('<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">');
886
- html.push('<button id="machine_action_add" type="button" class="btn btn-success">添 加</button>');
887
- html.push('<span id="machine_action_tips"></span>');
905
+ html.push('<button id="machine_instruction_add" type="button" class="btn btn-success">添 加</button>');
906
+ html.push('<span id="machine_instruction_tips"></span>');
888
907
  html.push('</div>');
889
908
  html.push('</div>');
890
909
  html.push('</form>');
891
- let camb_obj = $("#machine_action_modal_body");
910
+ let camb_obj = $("#machine_instruction_modal_body");
892
911
  camb_obj.html(html.join(""));
893
912
  camb_obj.parent().parent().removeClass("modal-xlg");
894
- let cam_obj = $('#machine_action_modal');
913
+ let cam_obj = $('#machine_instruction_modal');
895
914
  cam_obj.on('show.bs.modal', function (e) {
896
915
  Util.show_loading();
897
916
  let action_type = parseInt($(e.relatedTarget).attr("data-type"));
@@ -900,58 +919,58 @@ $(function () {
900
919
  } else {
901
920
  $("#action_machine_div").css("display", "block");
902
921
  }
903
- Util.post(location.pathname, {active_div: "machine_action", action_type: action_type}, function (j) {
922
+ Util.post(location.pathname, {active_div: "machine_instruction", action_type: action_type}, function (j) {
904
923
  if (j["machines"]) {
905
- Status.pack_machine_component("machine_action_machine", j["machines"]);
924
+ Status.pack_machine_component("machine_instruction_machine", j["machines"]);
906
925
  let machine = $("#machines").val();
907
926
  if (machine) {
908
- $("#machine_action_machine").find("option[value='" + machine + "']").attr("selected", true);
927
+ $("#machine_instruction_machine").find("option[value='" + machine + "']").attr("selected", true);
909
928
  }
910
929
  }
911
- if (j["actions"]) {
912
- let action_html = [];
913
- j["actions"].forEach(function (action) {
914
- action_html.push("<option value='", action, "'>", action, "</option>");
930
+ if (j["instructions"]) {
931
+ let instruction_html = [];
932
+ j["instructions"].forEach(function (instruction) {
933
+ instruction_html.push("<option value='", instruction, "'>", instruction, "</option>");
915
934
  });
916
- $("#machine_action_content").html(action_html.join(""));
935
+ $("#machine_instruction_content").html(instruction_html.join(""));
917
936
  }
918
937
  Util.hide_tips();
919
938
  });
920
939
  });
921
940
  cam_obj.on('hidden.bs.modal', function () {
922
- $("#machine_action_tips").html("");
941
+ $("#machine_instruction_tips").html("");
923
942
  Util.hide_tips();
924
943
  });
925
- $("#machine_action_add").click(function() {
944
+ $("#machine_instruction_add").click(function() {
926
945
  let action_type = 1, machine_id = "1";
927
946
  if ($("#action_machine_div").css("display") === "block") {
928
947
  action_type = 2;
929
- machine_id = $("#machine_action_machine").val();
948
+ machine_id = $("#machine_instruction_machine").val();
930
949
  }
931
950
  if (machine_id) {
932
- let action_content = $("#machine_action_content").val();
951
+ let action_content = $("#machine_instruction_content").val();
933
952
  if (action_content) {
934
953
  Util.show_loading();
935
- $("#machine_action_tips").html("");
936
- $("#machine_action_add").attr("disabled", true);
937
- Util.post(location.pathname, {active_div: "machine_action_add", "machine_id": machine_id, "content": action_content, action_type: action_type}, function (j) {
938
- $("#machine_action_add").attr("disabled", false);
954
+ $("#machine_instruction_tips").html("");
955
+ $("#machine_instruction_add").attr("disabled", true);
956
+ Util.post(location.pathname, {active_div: "machine_instruction_add", "machine_id": machine_id, "content": action_content, action_type: action_type}, function (j) {
957
+ $("#machine_instruction_add").attr("disabled", false);
939
958
  if (j["code"] === 1) {
940
- $("#machine_action_tips").html("<b class='text-success'>任务`" + action_content + "`添加成功!</b>");
959
+ $("#machine_instruction_tips").html("<b class='text-success'>任务`" + action_content + "`添加成功!</b>");
941
960
  } else if (j["code"] === 2) {
942
- $("#machine_action_tips").html("<b class='text-danger'>Machine 不存在!</b>");
961
+ $("#machine_instruction_tips").html("<b class='text-danger'>Machine 不存在!</b>");
943
962
  } else if (j["code"] === 3) {
944
- $("#machine_action_tips").html("<b class='text-danger'>任务内容异常!</b>");
963
+ $("#machine_instruction_tips").html("<b class='text-danger'>任务内容异常!</b>");
945
964
  } else {
946
- $("#machine_action_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
965
+ $("#machine_instruction_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
947
966
  }
948
967
  Util.hide_tips();
949
968
  });
950
969
  } else {
951
- $("#machine_action_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
970
+ $("#machine_instruction_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
952
971
  }
953
972
  } else {
954
- $("#machine_action_tips").html("<b class='text-danger'>Machine 异常!</b>");
973
+ $("#machine_instruction_tips").html("<b class='text-danger'>Machine 异常!</b>");
955
974
  }
956
975
  return false;
957
976
  });
@@ -989,7 +1008,7 @@ $(function () {
989
1008
  let ccm_obj = $('#machine_cookie_modal');
990
1009
  ccm_obj.on('show.bs.modal', function (e) {
991
1010
  Util.show_loading();
992
- Util.post(location.pathname, {active_div: "machine_action", action_type: 2}, function (j) {
1011
+ Util.post(location.pathname, {active_div: "machine_instruction", action_type: 2}, function (j) {
993
1012
  if (j["machines"]) {
994
1013
  Status.pack_machine_component("machine_cookie_machine", j["machines"]);
995
1014
  let machine = $("#machines").val();