sbd-npm 1.5.36 → 1.5.37

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 +25 -20
  3. package/util.js +11 -11
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.5.36",
3
+ "version": "1.5.37",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -93,7 +93,7 @@ $(function () {
93
93
  });
94
94
  mysql_remote_ip = mri_html.join("、");
95
95
  }
96
- html.push("<tr><th><a data-toggle='modal' data-target='.mysql_access_modal'>数据库正在连接的IP</a></th><td colspan='5'>", mysql_remote_ip, "</td></tr>");
96
+ html.push("<tr><th><a data-toggle='modal' data-target='.mysql_ssh_modal'>数据库正在连接的IP</a></th><td colspan='5'>", mysql_remote_ip, "</td></tr>");
97
97
 
98
98
  let max_files_tips = "系统允许打开的最大文件描述符数量(即每个进程最多能打开多少个文件,包括网络连接、管道、实际文件等)";
99
99
  html.push("<tr><th>最大文件描述符数量 <i class='glyphicon glyphicon-info-sign' data-toggle='tooltip' data-original-title='", max_files_tips, "'></i></th><td>", (j.max_files == "None" ? "--" : j.max_files), "</td>");
@@ -190,9 +190,9 @@ $(function () {
190
190
  });
191
191
  },
192
192
 
193
- fetch_mysql_access_data: function() {
193
+ fetch_mysql_ssh_ip_data: function() {
194
194
  Util.show_loading();
195
- Util.post(location.pathname, {"active_div": "mysql_access", "filter_type": $("#mysql_access_filter").val()}, function (j) {
195
+ Util.post(location.pathname, {"active_div": "mysql_ssh_ip", "data_type": $("#mysql_ssh_type").val(), "filter_type": $("#mysql_ssh_filter").val()}, function (j) {
196
196
  let html = [], ip_num = 0;
197
197
  j.data.forEach(function (item) {
198
198
  ip_num++;
@@ -209,9 +209,9 @@ $(function () {
209
209
  html.push("<td>", Util.seconds_to_format(item.latest_time), "</td>");
210
210
  html.push("</tr>");
211
211
  });
212
- Util.render_table_html("mysql_access_modal_body_body", html);
213
- $("#mysql_access_summary").html("&nbsp;&nbsp;共 <span class='label label-info'>" + j.total_len + "</span> 条,屏蔽 <span class='label label-danger'>" + j.block_len + "</span> 条");
214
- $("#mysql_access_modal_body_body .block_ip").each(function() {
212
+ Util.render_table_html("mysql_ssh_modal_body_body", html);
213
+ $("#mysql_ssh_summary").html("&nbsp;&nbsp;共 <span class='label label-info'>" + j.total_len + "</span> 条,屏蔽 <span class='label label-danger'>" + j.block_len + "</span> 条");
214
+ $("#mysql_ssh_modal_body_body .block_ip").each(function() {
215
215
  $(this).click(function() {
216
216
  let ip = $(this).parent().parent().children('td').eq(1).text();
217
217
  let ip_address = $(this).parent().parent().children('td').eq(2).text();
@@ -1716,13 +1716,13 @@ $(function () {
1716
1716
  Util.set_table_loading("mysql_process_modal_body_body");
1717
1717
  });
1718
1718
 
1719
- Util.init_modal_skeleton("mysql_access_modal");
1720
- $("#mysql_access_modal_title").html("连接MySQL的IP日志统计数据");
1719
+ Util.init_modal_skeleton("mysql_ssh_modal");
1720
+ $("#mysql_ssh_modal_title").html("连接 <select id='mysql_ssh_type'><option value='1'>MySQL</option><option value='2'>SSH</option></select> 的IP日志统计数据");
1721
1721
  Util.init_table_skeleton({
1722
- "element_id": "mysql_access_modal_body",
1723
- "caption": '<caption class="' + (Util.is_mobile() ? "text-left" : "text-right") + '" id="mysql_access_summary"></caption>',
1722
+ "element_id": "mysql_ssh_modal_body",
1723
+ "caption": '<caption class="' + (Util.is_mobile() ? "text-left" : "text-right") + '" id="mysql_ssh_summary"></caption>',
1724
1724
  "head_columns": [
1725
- {"name": "", "select_id": "mysql_access_filter", "select_options": [{"key": "0", "val": "全部"},{"key": "1", "val": "正常"},{"key": "2", "val": "屏蔽"},{"key": "3", "val": "异常"}]},
1725
+ {"name": "", "select_id": "mysql_ssh_filter", "select_options": [{"key": "0", "val": "全部"},{"key": "1", "val": "正常"},{"key": "2", "val": "屏蔽"},{"key": "3", "val": "异常"}]},
1726
1726
  {"name": "IP", "table_sort": 1, "tooltip": "IP地址(Internet Protocol Address)是指互联网协议地址"},
1727
1727
  {"name": "地址信息", "table_sort": 1},
1728
1728
  {"name": "连接次数", "table_sort": 1},
@@ -1730,19 +1730,24 @@ $(function () {
1730
1730
  {"name": "最后一次连接时间", "class": "info", "table_sort": 1},
1731
1731
  ]
1732
1732
  });
1733
- $("#mysql_access_filter").change(function() {
1734
- $("#mysql_access_summary").html("");
1735
- Util.set_table_loading("mysql_access_modal_body_body");
1736
- Status.fetch_mysql_access_data();
1733
+ $("#mysql_ssh_type").change(function() {
1734
+ $("#mysql_ssh_summary").html("");
1735
+ Util.set_table_loading("mysql_ssh_modal_body_body");
1736
+ Status.fetch_mysql_ssh_ip_data();
1737
1737
  });
1738
- let mam_object = $('#mysql_access_modal');
1738
+ $("#mysql_ssh_filter").change(function() {
1739
+ $("#mysql_ssh_summary").html("");
1740
+ Util.set_table_loading("mysql_ssh_modal_body_body");
1741
+ Status.fetch_mysql_ssh_ip_data();
1742
+ });
1743
+ let mam_object = $('#mysql_ssh_modal');
1739
1744
  mam_object.on('shown.bs.modal', function (e) {
1740
- $("#mysql_access_filter").val("0");
1741
- Status.fetch_mysql_access_data();
1745
+ $("#mysql_ssh_filter").val("0");
1746
+ Status.fetch_mysql_ssh_ip_data();
1742
1747
  });
1743
1748
  mam_object.on('hidden.bs.modal', function () {
1744
- $("#mysql_access_summary").html("");
1745
- Util.set_table_loading("mysql_access_modal_body_body");
1749
+ $("#mysql_ssh_summary").html("");
1750
+ Util.set_table_loading("mysql_ssh_modal_body_body");
1746
1751
  });
1747
1752
 
1748
1753
  let request_arguments = Util.request_arguments();
package/util.js CHANGED
@@ -2901,27 +2901,27 @@ const Util = {
2901
2901
 
2902
2902
  /**
2903
2903
  * 提示信息显示
2904
- * @param msg
2904
+ * @param message
2905
2905
  * @param interval 信息持续的时间(毫秒,到期则关闭)
2906
2906
  * @param cls 样式:alert-warning | alert-danger
2907
2907
  * @param loading 设置加载状态效果表现
2908
2908
  */
2909
- show_tips: function (msg, interval = 0, cls = "", loading = 0) {
2909
+ show_tips: function (message, interval = 0, cls = "", loading = 0) {
2910
2910
  let tips_object = document.getElementById(Util.tips_token);
2911
2911
  if (tips_object) {
2912
2912
  if (loading > 0) {
2913
- let origin_msg = msg.replace(/\./g, '');
2913
+ let origin_message = message.replace(/\./g, '');
2914
2914
  let origin_txt = tips_object.innerText.replace(/\./g, '');
2915
- if (origin_msg === origin_txt) {
2915
+ if (origin_message === origin_txt) {
2916
2916
  loading = loading < 5 ? (loading + 1) : 1;
2917
2917
  let load_string = ".".repeat(loading);
2918
- tips_object.innerHTML = origin_msg + load_string;
2918
+ tips_object.innerHTML = origin_message + load_string;
2919
2919
  setTimeout(() => {
2920
- Util.show_tips(msg, interval, cls, loading);
2920
+ Util.show_tips(message, interval, cls, loading);
2921
2921
  }, 300);
2922
2922
  }
2923
2923
  } else {
2924
- tips_object.innerHTML = msg;
2924
+ tips_object.innerHTML = message;
2925
2925
  }
2926
2926
  } else {
2927
2927
  if (loading === 0) {
@@ -2929,15 +2929,15 @@ const Util = {
2929
2929
  tips_object.id = Util.tips_token;
2930
2930
  tips_object.className = "alert " + (cls === "" ? "alert-warning" : cls);
2931
2931
  tips_object.style = "position: fixed; right: 0; top: 0; z-index: 999;";
2932
- tips_object.innerHTML = msg;
2932
+ tips_object.innerHTML = message;
2933
2933
  document.getElementsByTagName('body')[0].appendChild(tips_object);
2934
2934
  if (interval > 0) {
2935
2935
  setTimeout(Util.hide_tips, interval);
2936
2936
  }
2937
- if (msg.endsWith('.')) {
2938
- loading = msg.replace(/[^.]/g, '').length;
2937
+ if (message.endsWith('.')) {
2938
+ loading = message.replace(/[^.]/g, '').length;
2939
2939
  setTimeout(() => {
2940
- Util.show_tips(msg, interval, cls, loading);
2940
+ Util.show_tips(message, interval, cls, loading);
2941
2941
  }, 200);
2942
2942
  }
2943
2943
  }