sbd-npm 1.4.9 → 1.4.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/status.js +2 -3
  3. package/util.js +38 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbd-npm",
3
- "version": "1.4.9",
3
+ "version": "1.4.10",
4
4
  "description": "Stock Big Data",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/status.js CHANGED
@@ -546,6 +546,7 @@ $(function () {
546
546
  $("#workers").change(function() {
547
547
  let worker_key = $(this).val();
548
548
  if (worker_key) {
549
+ Util.show_loading();
549
550
  Util.set_table_loading("worker_process_div_body");
550
551
  Status.handle_worker();
551
552
  }
@@ -564,7 +565,6 @@ $(function () {
564
565
  "caption": prefix_caption + '</caption>',
565
566
  "head_cols": [
566
567
  {"name": "进程ID", "table_sort": 1},
567
- {"name": "用户名", "table_sort": 1},
568
568
  {"name": "状态", "table_sort": 1},
569
569
  {"name": "启动命令"},
570
570
  {"name": "创建时间", "class": "info", "table_sort": 1},
@@ -576,9 +576,8 @@ $(function () {
576
576
  process_num++;
577
577
  html.push("<tr>");
578
578
  html.push("<td>", item["pid"], "</td>");
579
- html.push("<td>", item["username"], "</td>");
580
579
  html.push("<td>", item["status"], "</td>");
581
- html.push("<td title='", item["cmdline"], "'>", Util.sub_str(item["cmdline"], 60), "</td>");
580
+ html.push("<td title='", item["cmdline"], "'>", Util.sub_str(item["cmdline"], 100), "</td>");
582
581
  html.push("<td>", Util.seconds_to_format(item["create_time"]), "</td>");
583
582
  html.push("</tr>");
584
583
  });
package/util.js CHANGED
@@ -96,40 +96,16 @@ const Util = {
96
96
  });
97
97
 
98
98
  $('#stock').keyup(function () {
99
- let st_obj = $("#search-tips");
100
99
  let key_word = $(this).val();
101
100
  if (key_word) {
102
101
  if (Util.is_has_chinese(key_word) || (Util.is_alpha(key_word) && key_word.length >= 2) || ($.isNumeric(key_word) && key_word.length >= 3)) {
103
102
  Util.hide_tips();
104
103
  clearTimeout(Util.stock_timer_id);
105
- st_obj.css("display", "none");
106
- Util.stock_timer_id = setTimeout(function () {
107
- Util.show_loading();
108
- Util.post("/action", {action: "search", key_word: key_word}, function (j) {
109
- let key_word = $("#stock").val();
110
- if (key_word) {
111
- let _html = [];
112
- _html.push('<div class="list-group">');
113
- if (j.data.length > 0) {
114
- $.each(j.data, function (index, item) {
115
- let upper_code = item["code"].toUpperCase();
116
- _html.push('<a target="_blank" rel="noopener noreferrer nofollow" class="list-group-item" href="/stock/', upper_code, '">', (item["name"] ? item["name"] : upper_code), '(', upper_code, ')</a>');
117
- });
118
- } else {
119
- _html.push('<a href="#" class="list-group-item disabled">无数据</a>');
120
- }
121
- _html.push('</div>');
122
- st_obj.html(_html.join(""));
123
- st_obj.css("display", "block");
124
- } else {
125
- st_obj.css("display", "none");
126
- }
127
- Util.hide_tips();
128
- });
129
- }, 500);
104
+ $("#search-tips").css("display", "none");
105
+ Util.stock_timer_id = setTimeout(Util.request_search, 500);
130
106
  }
131
107
  } else {
132
- st_obj.css("display", "none");
108
+ $("#search-tips").css("display", "none");
133
109
  }
134
110
  });
135
111
 
@@ -175,6 +151,41 @@ const Util = {
175
151
  $("#sidebar-menu").html(_html.join(""));
176
152
  },
177
153
 
154
+ /**
155
+ * 查询请求
156
+ */
157
+ request_search: function() {
158
+ Util.show_loading();
159
+ Util.post("/action", {action: "search", key_word: $("#stock").val()}, function (j) {
160
+ let key_word = $("#stock").val();
161
+ if (key_word) {
162
+ if (key_word === j["key_word"]) {
163
+ let html = [];
164
+ html.push('<div class="list-group">');
165
+ if (j["data"] && j["data"].length > 0) {
166
+ j["data"].forEach(function (item) {
167
+ let upper_code = item["code"].toUpperCase();
168
+ html.push('<a target="_blank" rel="noopener noreferrer nofollow" class="list-group-item" href="/stock/', upper_code, '">', (item["name"] ? item["name"] : upper_code), '(', upper_code, ')</a>');
169
+ });
170
+ } else {
171
+ html.push('<a href="#" class="list-group-item disabled">无数据</a>');
172
+ }
173
+ html.push('</div>');
174
+ let st_obj = $("#search-tips");
175
+ st_obj.html(html.join(""));
176
+ st_obj.css("display", "block");
177
+ Util.hide_tips();
178
+ } else {
179
+ Util.hide_tips();
180
+ Util.request_search();
181
+ }
182
+ } else {
183
+ $("#search-tips").css("display", "none");
184
+ Util.hide_tips();
185
+ }
186
+ });
187
+ },
188
+
178
189
  /**
179
190
  * 获取链接 URL 地址
180
191
  * @param key