sbd-npm 1.4.35 → 1.4.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 +74 -13
  3. package/util.js +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.35",
3
+ "version": "1.4.37",
4
4
  "description": "Stock Big Data",
5
5
  "author": "DHQ <dhq314@gmail.com>",
6
6
  "license": "ISC",
package/status.js CHANGED
@@ -35,6 +35,9 @@ $(function () {
35
35
  case "environment":
36
36
  Status.handle_environment();
37
37
  break;
38
+ case "sysctl":
39
+ Status.handle_system_control();
40
+ break;
38
41
  case "task":
39
42
  Status.handle_task();
40
43
  break;
@@ -250,7 +253,7 @@ $(function () {
250
253
  if (!document.getElementById("login_log_div_body")) {
251
254
  Util.init_table_skeleton({
252
255
  "element_id": "login_log_div",
253
- "caption": '<caption class="text-right" id="login_log_num"></caption>',
256
+ "caption": '<caption class="' + (Util.is_mobile() ? "text-left" : "text-right") + '" id="login_log_num"></caption>',
254
257
  "head_cols": [
255
258
  {"name": "序号"},
256
259
  {"name": "用户"},
@@ -276,7 +279,7 @@ $(function () {
276
279
  html.push("</tr>");
277
280
  });
278
281
  Util.render_table_html("login_log_div_body", html);
279
- $("#login_log_num").html("共 <span class='label label-info'>" + login_num + "</span> 条");
282
+ $("#login_log_num").html((Util.is_mobile() ? "&nbsp;&nbsp;" : "") + "共 <span class='label label-info'>" + login_num + "</span> 条");
280
283
  Util.hide_tips();
281
284
  });
282
285
  },
@@ -285,7 +288,7 @@ $(function () {
285
288
  if (!document.getElementById("database_table_div_body")) {
286
289
  Util.init_table_skeleton({
287
290
  "element_id": "database_table_div",
288
- "caption": '<caption class="text-right" id="table_num"></caption>',
291
+ "caption": '<caption class="' + (Util.is_mobile() ? "text-left" : "text-right") + '" id="table_num"></caption>',
289
292
  "head_cols": [
290
293
  {"name": "序号", "table_sort": 1},
291
294
  {"name": "表名", "table_sort": 1},
@@ -318,21 +321,31 @@ $(function () {
318
321
  html.push("</tr>");
319
322
  });
320
323
  Util.render_table_html("database_table_div_body", html);
321
- $("#table_num").html("共 <span class='label label-info'>" + table_num + "</span> 条");
324
+ $("#table_num").html((Util.is_mobile() ? "&nbsp;&nbsp;" : "") + "共 <span class='label label-info'>" + table_num + "</span> 条");
322
325
  Util.hide_tips();
323
326
  });
324
327
  },
325
328
 
326
329
  handle_database_variable: function () {
330
+ let is_mobile = Util.is_mobile();
327
331
  if (!document.getElementById("database_variable_div_body")) {
328
- Util.init_table_skeleton({
329
- "element_id": "database_variable_div",
330
- "caption": '<caption class="text-right" id="database_variable_num"></caption>',
331
- "head_cols": [
332
+ let head_cols = [];
333
+ if (is_mobile) {
334
+ head_cols = [
335
+ {"name": "键", "style": "width: 40%;", "table_sort": 1},
336
+ {"name": "值", "table_sort": 1},
337
+ ];
338
+ } else {
339
+ head_cols = [
332
340
  {"name": "序号", "style": "width: 100px;", "table_sort": 1},
333
341
  {"name": "键", "table_sort": 1},
334
342
  {"name": "值", "table_sort": 1},
335
- ]
343
+ ];
344
+ }
345
+ Util.init_table_skeleton({
346
+ "element_id": "database_variable_div",
347
+ "caption": '<caption class="text-right" id="database_variable_num"></caption>',
348
+ "head_cols": head_cols
336
349
  });
337
350
  }
338
351
  Util.post(location.pathname, {active_div: localStorage[Status.tab_token]}, function (j) {
@@ -340,13 +353,17 @@ $(function () {
340
353
  j["data"].forEach(function (item) {
341
354
  database_variable_num++;
342
355
  html.push("<tr>");
343
- html.push("<td>", database_variable_num, "</td>");
344
- html.push("<td class='text-right'>", item["key"], "</td>");
356
+ if (is_mobile) {
357
+ html.push("<td class='text-left' style='word-break: break-all'>", item["key"], "</td>");
358
+ } else {
359
+ html.push("<td>", database_variable_num, "</td>");
360
+ html.push("<td class='text-right'>", item["key"], "</td>");
361
+ }
345
362
  html.push("<td class='text-left' style='word-break: break-all'>", item["val"], "</td>");
346
363
  html.push("</tr>");
347
364
  });
348
365
  Util.render_table_html("database_variable_div_body", html);
349
- $("#database_variable_num").html("共 <span class='label label-info'>" + database_variable_num + "</span> ");
366
+ $("#database_variable_num").html("共 <span class='label label-info'>" + database_variable_num + "</span> 条&nbsp;&nbsp;");
350
367
  Util.hide_tips();
351
368
  });
352
369
  },
@@ -406,7 +423,51 @@ $(function () {
406
423
  html.push("</tr>");
407
424
  });
408
425
  Util.render_table_html("environment_div_body", html);
409
- $("#environment_num").html("共 <span class='label label-info'>" + environment_num + "</span> ");
426
+ $("#environment_num").html("共 <span class='label label-info'>" + environment_num + "</span> 条&nbsp;&nbsp;");
427
+ Util.hide_tips();
428
+ });
429
+ },
430
+
431
+ handle_system_control: function () {
432
+ let is_mobile = Util.is_mobile();
433
+ if (!document.getElementById("sysctl_div_body")) {
434
+ let head_cols = [];
435
+ if (is_mobile) {
436
+ head_cols = [
437
+ {"name": "键", "style": "width: 40%;", "table_sort": 1},
438
+ {"name": "值", "table_sort": 1},
439
+ ];
440
+ } else {
441
+ head_cols = [
442
+ {"name": "序号", "style": "width: 100px;", "table_sort": 1},
443
+ {"name": "键", "table_sort": 1},
444
+ {"name": "值", "table_sort": 1},
445
+ ];
446
+ }
447
+ Util.init_table_skeleton({
448
+ "element_id": "sysctl_div",
449
+ "caption": '<caption class="text-right" id="sysctl_num"></caption>',
450
+ "head_cols": head_cols
451
+ });
452
+ }
453
+ Util.post(location.pathname, {active_div: localStorage[Status.tab_token]}, function (j) {
454
+ let html = [], sysctl_num = 0;
455
+ if (j["data"]) {
456
+ for (let key in j["data"]) {
457
+ sysctl_num++;
458
+ html.push("<tr>");
459
+ if (is_mobile) {
460
+ html.push("<td class='text-left' style='word-break: break-all'>", key, "</td>");
461
+ } else {
462
+ html.push("<td>", sysctl_num, "</td>");
463
+ html.push("<td class='text-right'>", key, "</td>");
464
+ }
465
+ html.push("<td class='text-left' style='word-break: break-all'>", j["data"][key], "</td>");
466
+ html.push("</tr>");
467
+ };
468
+ }
469
+ Util.render_table_html("sysctl_div_body", html);
470
+ $("#sysctl_num").html("共 <span class='label label-info'>" + sysctl_num + "</span> 条&nbsp;&nbsp;");
410
471
  Util.hide_tips();
411
472
  });
412
473
  },
package/util.js CHANGED
@@ -62,7 +62,7 @@ const Util = {
62
62
  $("#search-stock").click(function () {
63
63
  let code = $("#stock").val();
64
64
  if (code) {
65
- if (window.location.pathname === "/status" && $("#word").hasClass('active') && (Util.is_alpha(code) || Util.is_chinese(code))) {
65
+ if (window.location.pathname === "/status" && $("#word").hasClass('active') && (Util.is_alphabet(code) || Util.is_chinese(code))) {
66
66
  Util.fetch_word_data(0, "", code);
67
67
  } else {
68
68
  window.open("/stock/" + code, "_blank");
@@ -102,7 +102,7 @@ const Util = {
102
102
  $("#stock").on("focus keyup", function () {
103
103
  let key_word = $(this).val();
104
104
  if (key_word) {
105
- if (Util.is_has_chinese(key_word) || (Util.is_alpha(key_word) && key_word.length >= 2) || ($.isNumeric(key_word) && key_word.length >= 3)) {
105
+ if (Util.is_has_chinese(key_word) || (Util.is_alphabet(key_word) && key_word.length >= 2) || ($.isNumeric(key_word) && key_word.length >= 3)) {
106
106
  if (window.location.pathname === "/status" && $("#word").hasClass('active')) {
107
107
  return false;
108
108
  }
@@ -366,7 +366,7 @@ const Util = {
366
366
  * @returns {*}
367
367
  */
368
368
  stock_basics_html: function (html, item) {
369
- let symbol = Util.is_alpha(item["code"]) ? item["code"].toUpperCase() : item["code"];
369
+ let symbol = Util.is_alphabet(item["code"]) ? item["code"].toUpperCase() : item["code"];
370
370
  let name = symbol;
371
371
  if (item["cname"]) {
372
372
  if (Util.is_us(item["code"])) {
@@ -2546,7 +2546,7 @@ const Util = {
2546
2546
  * @param str
2547
2547
  * @returns {boolean}
2548
2548
  */
2549
- is_alpha: function (str) {
2549
+ is_alphabet: function (str) {
2550
2550
  return /^[A-Za-z]+$/.test(str);
2551
2551
  },
2552
2552