sbd-npm 1.5.2 → 1.5.4

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 +18 -6
  3. package/util.js +13 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.5.2",
3
+ "version": "1.5.4",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -880,9 +880,15 @@ $(function () {
880
880
  handle_process_kill: function(element_id, action_type) {
881
881
  $("#" + element_id + " .process_kill").each(function() {
882
882
  $(this).click(function() {
883
- let pid = $(this).parent().parent().children('td').eq(0).text();
884
- let cmdline_index = action_type === 2 ? 2 : 6;
885
- let cmdline_obj = $(this).parent().parent().children('td').eq(cmdline_index);
883
+ let tr_obj = $(this).parent().parent();
884
+ let pid = tr_obj.children('td').eq(0).text();
885
+ let cmdline_index = tr_obj.parent().parent().find('thead td').filter(function () {
886
+ return $(this).text().includes('启动命令');
887
+ }).index();
888
+ if (cmdline_index < 0) {
889
+ cmdline_index = action_type === 2 ? 3 : 6;
890
+ }
891
+ let cmdline_obj = tr_obj.children('td').eq(cmdline_index);
886
892
  let cmdline = cmdline_obj.attr('title') ? cmdline_obj.attr('title') : cmdline_obj.text();
887
893
  let action = Status.parse_machine_action(cmdline);
888
894
  let pid_action = "[" + pid + "(" + action + ")]";
@@ -911,9 +917,15 @@ $(function () {
911
917
  $("#" + element_id + " .process_screen").each(function() {
912
918
  $(this).click(function() {
913
919
  Util.show_loading();
914
- let pid = $(this).parent().parent().children('td').eq(0).text();
915
- let cmdline_index = action_type === 2 ? 2 : 6;
916
- let cmdline_obj = $(this).parent().parent().children('td').eq(cmdline_index);
920
+ let tr_obj = $(this).parent().parent();
921
+ let pid = tr_obj.children('td').eq(0).text();
922
+ let cmdline_index = tr_obj.parent().parent().find('thead td').filter(function () {
923
+ return $(this).text().includes('启动命令');
924
+ }).index();
925
+ if (cmdline_index < 0) {
926
+ cmdline_index = action_type === 2 ? 3 : 6;
927
+ }
928
+ let cmdline_obj = tr_obj.children('td').eq(cmdline_index);
917
929
  let cmdline = cmdline_obj.attr('title') ? cmdline_obj.attr('title') : cmdline_obj.text();
918
930
  let action = Status.parse_machine_action(cmdline);
919
931
  let is_fetch_screen = $(this).attr("data-screen");
package/util.js CHANGED
@@ -323,6 +323,19 @@ const Util = {
323
323
  },
324
324
  error: function (jqXHR, textStatus, errorThrown) {
325
325
  Util.hide_tips();
326
+ if (!errorThrown) {
327
+ if ((textStatus === 'error' && jqXHR.status === 0) || !navigator.onLine) {
328
+ errorThrown = "网络异常";
329
+ } else if (textStatus === 'timeout') {
330
+ errorThrown = "请求超时";
331
+ } else if (textStatus === 'abort') {
332
+ errorThrown = "请求被中止";
333
+ } else if (jqXHR.status) {
334
+ errorThrown = '请求失败(HTTP ' + jqXHR.status + ')';
335
+ } else {
336
+ errorThrown = "未知错误";
337
+ }
338
+ }
326
339
  let msg = "[" + textStatus + "] " + errorThrown;
327
340
  Util.show_tips(msg, 0, "alert-danger");
328
341
  }