sbd-npm 1.4.40 → 1.4.42
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 +39 -34
package/package.json
CHANGED
package/status.js
CHANGED
@@ -178,7 +178,7 @@ $(function () {
|
|
178
178
|
}
|
179
179
|
Util.init_table_skeleton({
|
180
180
|
"element_id": "process_div",
|
181
|
-
"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=".
|
181
|
+
"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=".machine_action_modal" data-type="1" href="#" class="btn btn-warning btn-xs">添加任务</a></caption>',
|
182
182
|
"head_cols": [
|
183
183
|
{"name": "进程ID", "table_sort": 1},
|
184
184
|
{"name": "进程名", "table_sort": 1},
|
@@ -195,8 +195,8 @@ $(function () {
|
|
195
195
|
Util.set_table_loading("process_div_body");
|
196
196
|
Status.handle_process();
|
197
197
|
});
|
198
|
-
if (!document.getElementById("
|
199
|
-
Status.
|
198
|
+
if (!document.getElementById("machine_action_add")) {
|
199
|
+
Status.init_machine_action_modal();
|
200
200
|
}
|
201
201
|
}
|
202
202
|
let is_py_process = $("#is_py_process").prop("checked") ? "1" : "0";
|
@@ -560,6 +560,7 @@ $(function () {
|
|
560
560
|
if (j["machines"].length > 0) {
|
561
561
|
$("#task_machines").change(function() {
|
562
562
|
Util.show_loading();
|
563
|
+
$("#task_tips").html("");
|
563
564
|
$("#task_result").val("");
|
564
565
|
Status.fetch_task_data(0);
|
565
566
|
});
|
@@ -608,6 +609,10 @@ $(function () {
|
|
608
609
|
clearTimeout(Status.task_timer_id);
|
609
610
|
}
|
610
611
|
Status.task_status = 0;
|
612
|
+
if (j["is_new"] && j["is_new"] === 1) {
|
613
|
+
$("#task_content").val("").prop('disabled', false);
|
614
|
+
$("#task_add").html('添加任务').prop('disabled', false).removeClass("btn-warning").addClass("btn-default");
|
615
|
+
}
|
611
616
|
}
|
612
617
|
Util.hide_tips();
|
613
618
|
});
|
@@ -628,14 +633,14 @@ $(function () {
|
|
628
633
|
machine_html.push('<option value="">Loading...</option>');
|
629
634
|
machine_html.push('</select>');
|
630
635
|
machine_html.push('</div>');
|
631
|
-
machine_html.push(' <a href="#" data-toggle="modal" data-target=".
|
636
|
+
machine_html.push(' <a href="#" data-toggle="modal" data-target=".machine_action_modal" data-type="2" class="btn btn-warning">添加任务</a>');
|
632
637
|
machine_html.push('<a href="#" data-toggle="modal" data-target=".client_cookie_modal" class="btn btn-warning">雪球Cookie</a>');
|
633
638
|
machine_html.push('<a href="#" id="machine_refresh" class="btn btn-warning">刷新Machine</a>');
|
634
639
|
machine_html.push('</form>');
|
635
640
|
machine_html.push('<div id="machine_process_div"></div>');
|
636
641
|
$("#machine_div").html(machine_html.join(""));
|
637
|
-
if (!document.getElementById("
|
638
|
-
Status.
|
642
|
+
if (!document.getElementById("machine_action_add")) {
|
643
|
+
Status.init_machine_action_modal();
|
639
644
|
Status.init_client_cookie_modal();
|
640
645
|
$("#machine_refresh").click(function() {
|
641
646
|
if (confirm("是否确定要“ 刷新Machine ” ?")) {
|
@@ -749,15 +754,15 @@ $(function () {
|
|
749
754
|
Util.fetch_word_data(is_init, "", "");
|
750
755
|
},
|
751
756
|
|
752
|
-
|
753
|
-
Util.init_modal_skeleton("
|
754
|
-
$("#
|
757
|
+
init_machine_action_modal: function () {
|
758
|
+
Util.init_modal_skeleton("machine_action_modal");
|
759
|
+
$("#machine_action_modal_title").html("添加任务");
|
755
760
|
let html = [];
|
756
761
|
html.push('<form data-parsley-validate class="form-horizontal form-label-left">');
|
757
762
|
html.push('<div class="form-group" id="action_machine_div">');
|
758
763
|
html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12">Machine </label>');
|
759
764
|
html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
|
760
|
-
html.push('<select id="
|
765
|
+
html.push('<select id="machine_action_machine" class="form-control col-md-7 col-xs-12">');
|
761
766
|
html.push('<option value="">Loading...</option>');
|
762
767
|
html.push('</select>');
|
763
768
|
html.push('</div>');
|
@@ -765,22 +770,22 @@ $(function () {
|
|
765
770
|
html.push('<div class="form-group">');
|
766
771
|
html.push('<label class="control-label col-md-3 col-sm-3 col-xs-12">任务命令 </label>');
|
767
772
|
html.push('<div class="col-md-6 col-sm-6 col-xs-12">');
|
768
|
-
html.push('<select id="
|
773
|
+
html.push('<select id="machine_action_content" class="form-control col-md-7 col-xs-12">');
|
769
774
|
html.push('<option value="">任务命令</option>');
|
770
775
|
html.push('</select>');
|
771
776
|
html.push('</div>');
|
772
777
|
html.push('</div>');
|
773
778
|
html.push('<div class="form-group">');
|
774
779
|
html.push('<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">');
|
775
|
-
html.push('<button id="
|
776
|
-
html.push('<span id="
|
780
|
+
html.push('<button id="machine_action_add" type="button" class="btn btn-success">添 加</button>');
|
781
|
+
html.push('<span id="machine_action_tips"></span>');
|
777
782
|
html.push('</div>');
|
778
783
|
html.push('</div>');
|
779
784
|
html.push('</form>');
|
780
|
-
let camb_obj = $("#
|
785
|
+
let camb_obj = $("#machine_action_modal_body");
|
781
786
|
camb_obj.html(html.join(""));
|
782
787
|
camb_obj.parent().parent().removeClass("modal-xlg");
|
783
|
-
let cam_obj = $('#
|
788
|
+
let cam_obj = $('#machine_action_modal');
|
784
789
|
cam_obj.on('show.bs.modal', function (e) {
|
785
790
|
Util.show_loading();
|
786
791
|
let action_type = parseInt($(e.relatedTarget).attr("data-type"));
|
@@ -789,12 +794,12 @@ $(function () {
|
|
789
794
|
} else {
|
790
795
|
$("#action_machine_div").css("display", "block");
|
791
796
|
}
|
792
|
-
Util.post(location.pathname, {active_div: "
|
797
|
+
Util.post(location.pathname, {active_div: "machine_action", action_type: action_type}, function (j) {
|
793
798
|
if (j["machines"]) {
|
794
|
-
Status.pack_machine_component("
|
799
|
+
Status.pack_machine_component("machine_action_machine", j["machines"]);
|
795
800
|
let machine = $("#machines").val();
|
796
801
|
if (machine) {
|
797
|
-
$("#
|
802
|
+
$("#machine_action_machine").find("option[value='" + machine + "']").attr("selected", true);
|
798
803
|
}
|
799
804
|
}
|
800
805
|
if (j["actions"]) {
|
@@ -802,45 +807,45 @@ $(function () {
|
|
802
807
|
j["actions"].forEach(function (action) {
|
803
808
|
action_html.push("<option value='", action, "'>", action, "</option>");
|
804
809
|
});
|
805
|
-
$("#
|
810
|
+
$("#machine_action_content").html(action_html.join(""));
|
806
811
|
}
|
807
812
|
Util.hide_tips();
|
808
813
|
});
|
809
814
|
});
|
810
815
|
cam_obj.on('hidden.bs.modal', function () {
|
811
|
-
$("#
|
816
|
+
$("#machine_action_tips").html("");
|
812
817
|
Util.hide_tips();
|
813
818
|
});
|
814
|
-
$("#
|
819
|
+
$("#machine_action_add").click(function() {
|
815
820
|
let action_type = 1, machine_id = "1";
|
816
821
|
if ($("#action_machine_div").css("display") === "block") {
|
817
822
|
action_type = 2;
|
818
|
-
machine_id = $("#
|
823
|
+
machine_id = $("#machine_action_machine").val();
|
819
824
|
}
|
820
825
|
if (machine_id) {
|
821
|
-
let action_content = $("#
|
826
|
+
let action_content = $("#machine_action_content").val();
|
822
827
|
if (action_content) {
|
823
828
|
Util.show_loading();
|
824
|
-
$("#
|
825
|
-
$("#
|
826
|
-
Util.post(location.pathname, {active_div: "
|
827
|
-
$("#
|
829
|
+
$("#machine_action_tips").html("");
|
830
|
+
$("#machine_action_add").attr("disabled", true);
|
831
|
+
Util.post(location.pathname, {active_div: "machine_action_add", "machine_id": machine_id, "content": action_content, action_type: action_type}, function (j) {
|
832
|
+
$("#machine_action_add").attr("disabled", false);
|
828
833
|
if (j["code"] && j["code"] === 1) {
|
829
|
-
$("#
|
834
|
+
$("#machine_action_tips").html("<b class='text-success'>任务`" + action_content + "`添加成功!</b>");
|
830
835
|
} else if (j["code"] && j["code"] === 2) {
|
831
|
-
$("#
|
836
|
+
$("#machine_action_tips").html("<b class='text-danger'>Machine 不存在!</b>");
|
832
837
|
} else if (j["code"] && j["code"] === 3) {
|
833
|
-
$("#
|
838
|
+
$("#machine_action_tips").html("<b class='text-danger'>任务内容异常!</b>");
|
834
839
|
} else {
|
835
|
-
$("#
|
840
|
+
$("#machine_action_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
|
836
841
|
}
|
837
842
|
Util.hide_tips();
|
838
843
|
});
|
839
844
|
} else {
|
840
|
-
$("#
|
845
|
+
$("#machine_action_tips").html("<b class='text-danger'>任务内容不能为空!</b>");
|
841
846
|
}
|
842
847
|
} else {
|
843
|
-
$("#
|
848
|
+
$("#machine_action_tips").html("<b class='text-danger'>Machine 异常!</b>");
|
844
849
|
}
|
845
850
|
return false;
|
846
851
|
});
|
@@ -878,7 +883,7 @@ $(function () {
|
|
878
883
|
let ccm_obj = $('#client_cookie_modal');
|
879
884
|
ccm_obj.on('show.bs.modal', function (e) {
|
880
885
|
Util.show_loading();
|
881
|
-
Util.post(location.pathname, {active_div: "
|
886
|
+
Util.post(location.pathname, {active_div: "machine_action", action_type: 2}, function (j) {
|
882
887
|
if (j["machines"]) {
|
883
888
|
Status.pack_machine_component("client_cookie_machine", j["machines"]);
|
884
889
|
let machine = $("#machines").val();
|