sbd-npm 1.4.12 → 1.4.14
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.
- package/package.json +1 -1
- package/status.js +23 -8
package/package.json
CHANGED
package/status.js
CHANGED
@@ -172,7 +172,7 @@ $(function () {
|
|
172
172
|
}
|
173
173
|
Util.init_table_skeleton({
|
174
174
|
"element_id": "process_div",
|
175
|
-
"caption": prefix_caption + '共 <span class="label label-info" id="process_num"></span> 进程, <input checked type="checkbox" id="is_py_process"> 只显示 Python
|
175
|
+
"caption": prefix_caption + '共 <span class="label label-info" id="process_num"></span> 进程, <input checked type="checkbox" id="is_py_process"> 只显示 Python 进程 <a href="#" data-toggle="modal" data-target=".client_action_modal" data-type="1" href="#" class="btn btn-warning btn-xs">添加任务</a></caption>',
|
176
176
|
"head_cols": [
|
177
177
|
{"name": "进程ID", "table_sort": 1},
|
178
178
|
{"name": "进程名", "table_sort": 1},
|
@@ -189,6 +189,9 @@ $(function () {
|
|
189
189
|
Util.set_table_loading("process_div_body");
|
190
190
|
Status.handle_process();
|
191
191
|
});
|
192
|
+
if (!document.getElementById("client_action_add")) {
|
193
|
+
Status.init_worker_modal();
|
194
|
+
}
|
192
195
|
}
|
193
196
|
let is_py_process = $("#is_py_process").prop("checked") ? "1" : "0";
|
194
197
|
Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_py_process: is_py_process}, function (j) {
|
@@ -530,11 +533,13 @@ $(function () {
|
|
530
533
|
hw_html.push('<option value="">Loading...</option>');
|
531
534
|
hw_html.push('</select>');
|
532
535
|
hw_html.push('</div>');
|
533
|
-
hw_html.push(' <a href="#" data-toggle="modal" data-target=".client_action_modal" class="btn btn-warning"
|
536
|
+
hw_html.push(' <a href="#" data-toggle="modal" data-target=".client_action_modal" data-type="2" class="btn btn-warning">添加任务</a>');
|
534
537
|
hw_html.push('</form>');
|
535
538
|
hw_html.push('<div id="worker_process_div"></div>');
|
536
539
|
$("#worker_div").html(hw_html.join(""));
|
537
|
-
|
540
|
+
if (!document.getElementById("client_action_add")) {
|
541
|
+
Status.init_worker_modal();
|
542
|
+
}
|
538
543
|
}
|
539
544
|
Util.post(location.pathname, {active_div: localStorage[Status.tab_token], is_init: is_init, key: $("#workers").val()}, function (j) {
|
540
545
|
if (j["workers"]) {
|
@@ -596,7 +601,7 @@ $(function () {
|
|
596
601
|
$("#client_action_modal_title").html("添加任务");
|
597
602
|
let html = [];
|
598
603
|
html.push('<form data-parsley-validate class="form-horizontal form-label-left">');
|
599
|
-
html.push('<div class="form-group">');
|
604
|
+
html.push('<div class="form-group" id="action_worker_div">');
|
600
605
|
html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12" for="search_ip">Worker </label>');
|
601
606
|
html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
|
602
607
|
html.push('<select id="client_action_worker" class="form-control col-md-7 col-xs-12">');
|
@@ -625,7 +630,13 @@ $(function () {
|
|
625
630
|
let cam_obj = $('#client_action_modal');
|
626
631
|
cam_obj.on('show.bs.modal', function (e) {
|
627
632
|
Util.show_loading();
|
628
|
-
|
633
|
+
let action_type = parseInt($(e.relatedTarget).attr("data-type"));
|
634
|
+
if (action_type === 1) {
|
635
|
+
$("#action_worker_div").css("display", "none");
|
636
|
+
} else {
|
637
|
+
$("#action_worker_div").css("display", "block");
|
638
|
+
}
|
639
|
+
Util.post(location.pathname, {active_div: "client_action", action_type: action_type}, function (j) {
|
629
640
|
if (j["workers"]) {
|
630
641
|
let worker_html = [];
|
631
642
|
j["workers"].forEach(function (w) {
|
@@ -654,14 +665,18 @@ $(function () {
|
|
654
665
|
Util.hide_tips();
|
655
666
|
});
|
656
667
|
$("#client_action_add").click(function() {
|
657
|
-
let worker_key =
|
668
|
+
let action_type = 1, worker_key = "1";
|
669
|
+
if ($("#action_worker_div").css("display") === "block") {
|
670
|
+
action_type = 2;
|
671
|
+
worker_key = $("#client_action_worker").val();
|
672
|
+
}
|
658
673
|
if (worker_key) {
|
659
674
|
let action_content = $("#client_action_content").val();
|
660
675
|
if (action_content) {
|
661
676
|
Util.show_loading();
|
662
677
|
$("#client_action_tips").html("");
|
663
678
|
$("#client_action_add").attr("disabled", true);
|
664
|
-
Util.post(location.pathname, {active_div: "client_action_add", "key": worker_key, "content": action_content}, function (j) {
|
679
|
+
Util.post(location.pathname, {active_div: "client_action_add", "key": worker_key, "content": action_content, action_type: action_type}, function (j) {
|
665
680
|
$("#client_action_add").attr("disabled", false);
|
666
681
|
if (j["code"] && j["code"] === 1) {
|
667
682
|
$("#client_action_tips").html("<b class='text-success'>任务`" + action_content + "`添加成功!</b>");
|
@@ -680,7 +695,7 @@ $(function () {
|
|
680
695
|
} else {
|
681
696
|
$("#client_action_tips").html("<b class='text-danger'>Worker 异常!</b>");
|
682
697
|
}
|
683
|
-
return
|
698
|
+
return false;
|
684
699
|
});
|
685
700
|
},
|
686
701
|
|