sbd-npm 1.4.58 → 1.4.60
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 +25 -2
- package/stock_basics.js +1 -1
- package/util.js +116 -0
package/package.json
CHANGED
package/status.js
CHANGED
@@ -740,6 +740,7 @@ $(function () {
|
|
740
740
|
{"name": "状态", "table_sort": 1},
|
741
741
|
{"name": "启动命令"},
|
742
742
|
{"name": "创建时间", "class": "info", "table_sort": 1},
|
743
|
+
{"name": "操作"}
|
743
744
|
]
|
744
745
|
});
|
745
746
|
}
|
@@ -760,11 +761,33 @@ $(function () {
|
|
760
761
|
html.push("<td title='", item["cmdline"], "'>", cmdline, "</td>");
|
761
762
|
}
|
762
763
|
html.push("<td>", Util.seconds_to_format(item["create_time"]), "</td>");
|
764
|
+
html.push("<td><a class='process_kill' href='#'>终止</a></td>");
|
763
765
|
html.push("</tr>");
|
764
766
|
});
|
765
767
|
Util.render_table_html("machine_process_div_body", html);
|
766
768
|
$("#machine_process_tip").html('共 <span class="label label-info">' + process_num + '</span> 进程,最后更新时间:' + Util.seconds_to_format(j["date"]) + ',Revision:' + j["revision"] + ',MachineId:' + j["machine_id"]);
|
767
769
|
$("#machines option[value='" + j["machine_id"] + "']").text(j["ip"] + "(" + process_num + ")");
|
770
|
+
$("#machine_process_div_body .process_kill").each(function() {
|
771
|
+
$(this).click(function() {
|
772
|
+
let pid = $(this).parent().parent().children('td').eq(0).text();
|
773
|
+
if (confirm("是否确定要终止进程 [" + pid + "] ?")) {
|
774
|
+
Util.show_loading();
|
775
|
+
let action_content = "kill_pid_" + pid;
|
776
|
+
Util.post(location.pathname, {active_div: "machine_action_add", "machine_id": $("#machines").val(), "content": action_content, action_type: 2}, function (j) {
|
777
|
+
Util.hide_tips();
|
778
|
+
if (j["code"] === 1) {
|
779
|
+
Util.show_tips("进程 [" + pid + "] 已加到终止队列中", 4567, "alert-success");
|
780
|
+
} else if (j["code"] === 2) {
|
781
|
+
Util.show_tips("Machine 不存在!", 4567, "alert-danger");
|
782
|
+
} else if (j["code"] === 3) {
|
783
|
+
Util.show_tips("进程 [" + pid + "] 异常!", 4567, "alert-danger");
|
784
|
+
} else {
|
785
|
+
Util.show_tips("进程值不能为空!", 4567, "alert-danger");
|
786
|
+
}
|
787
|
+
});
|
788
|
+
}
|
789
|
+
});
|
790
|
+
});
|
768
791
|
} else if (is_init === 1) {
|
769
792
|
$('#machines').html('<option value="">暂无Machine</option>');
|
770
793
|
}
|
@@ -830,9 +853,9 @@ $(function () {
|
|
830
853
|
voices.forEach(voice => {
|
831
854
|
data.push(`Name: ${voice.name}, Lang: ${voice.lang}, Default: ${voice.default}`);
|
832
855
|
});
|
833
|
-
|
856
|
+
Util.showAlert(data.join("\n"));
|
834
857
|
} else {
|
835
|
-
|
858
|
+
Util.showAlert("空列表: []");
|
836
859
|
}
|
837
860
|
Util.is_load = false;
|
838
861
|
},
|
package/stock_basics.js
CHANGED
@@ -159,7 +159,7 @@ let Stock = {
|
|
159
159
|
|
160
160
|
let location_obj = $("#location");
|
161
161
|
if (location_obj.length > 0) {
|
162
|
-
let location_arr = location_obj.text().split(
|
162
|
+
let location_arr = location_obj.text().split(/[;;,]/);
|
163
163
|
html = [];
|
164
164
|
location_arr.forEach(function (location) {
|
165
165
|
html.push(Util.map_url(location, location) + ' ');
|
package/util.js
CHANGED
@@ -4650,6 +4650,122 @@ const Util = {
|
|
4650
4650
|
]
|
4651
4651
|
});
|
4652
4652
|
return chart_instance;
|
4653
|
+
},
|
4654
|
+
|
4655
|
+
/**
|
4656
|
+
* 显示自定义弹窗
|
4657
|
+
* @param {string} message - 要显示的消息内容
|
4658
|
+
* @returns {void}
|
4659
|
+
*/
|
4660
|
+
showAlert: function(message) {
|
4661
|
+
// 创建模态框容器
|
4662
|
+
const modal = document.createElement('div');
|
4663
|
+
modal.style.cssText = `
|
4664
|
+
position: fixed;
|
4665
|
+
top: 0;
|
4666
|
+
left: 0;
|
4667
|
+
width: 100%;
|
4668
|
+
height: 100%;
|
4669
|
+
background-color: rgba(0, 0, 0, 0.5);
|
4670
|
+
display: flex;
|
4671
|
+
justify-content: center;
|
4672
|
+
align-items: center;
|
4673
|
+
z-index: 9999;
|
4674
|
+
`;
|
4675
|
+
// 创建模态框内容
|
4676
|
+
const modalContent = document.createElement('div');
|
4677
|
+
modalContent.style.cssText = `
|
4678
|
+
background-color: white;
|
4679
|
+
padding: 20px;
|
4680
|
+
border-radius: 5px;
|
4681
|
+
max-width: 80%;
|
4682
|
+
max-height: 80%;
|
4683
|
+
overflow: auto;
|
4684
|
+
position: relative;
|
4685
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
4686
|
+
display: flex;
|
4687
|
+
flex-direction: column;
|
4688
|
+
align-items: center;
|
4689
|
+
`;
|
4690
|
+
// 创建消息内容
|
4691
|
+
const messageElement = document.createElement('div');
|
4692
|
+
messageElement.style.cssText = `
|
4693
|
+
margin-bottom: 20px;
|
4694
|
+
word-break: break-all;
|
4695
|
+
padding: 10px;
|
4696
|
+
border: 1px solid #ddd;
|
4697
|
+
background-color: #f9f9f9;
|
4698
|
+
width: 100%;
|
4699
|
+
box-sizing: border-box;
|
4700
|
+
`;
|
4701
|
+
messageElement.innerHTML = message.replace(/\n/g, '<br>');
|
4702
|
+
// 创建按钮容器
|
4703
|
+
const buttonContainer = document.createElement('div');
|
4704
|
+
buttonContainer.style.cssText = `
|
4705
|
+
display: flex;
|
4706
|
+
gap: 10px;
|
4707
|
+
margin-top: 10px;
|
4708
|
+
`;
|
4709
|
+
// 创建复制按钮
|
4710
|
+
const copyButton = document.createElement('button');
|
4711
|
+
copyButton.textContent = '复制';
|
4712
|
+
copyButton.style.cssText = `
|
4713
|
+
padding: 8px 20px;
|
4714
|
+
background-color: #4CAF50;
|
4715
|
+
color: white;
|
4716
|
+
border: none;
|
4717
|
+
border-radius: 3px;
|
4718
|
+
cursor: pointer;
|
4719
|
+
font-size: 14px;
|
4720
|
+
`;
|
4721
|
+
copyButton.addEventListener('click', function() {
|
4722
|
+
navigator.clipboard.writeText(message).then(
|
4723
|
+
function() {
|
4724
|
+
// 复制成功,临时改变按钮文字
|
4725
|
+
const originalText = copyButton.textContent;
|
4726
|
+
copyButton.textContent = '已复制';
|
4727
|
+
copyButton.style.backgroundColor = '#45a049';
|
4728
|
+
setTimeout(function() {
|
4729
|
+
copyButton.textContent = originalText;
|
4730
|
+
copyButton.style.backgroundColor = '#4CAF50';
|
4731
|
+
}, 2000);
|
4732
|
+
},
|
4733
|
+
function() {
|
4734
|
+
// 复制失败
|
4735
|
+
alert('复制失败,请重试');
|
4736
|
+
}
|
4737
|
+
);
|
4738
|
+
});
|
4739
|
+
// 创建关闭按钮
|
4740
|
+
const closeButton = document.createElement('button');
|
4741
|
+
closeButton.textContent = '关闭';
|
4742
|
+
closeButton.style.cssText = `
|
4743
|
+
padding: 8px 20px;
|
4744
|
+
background-color: #f44336;
|
4745
|
+
color: white;
|
4746
|
+
border: none;
|
4747
|
+
border-radius: 3px;
|
4748
|
+
cursor: pointer;
|
4749
|
+
font-size: 14px;
|
4750
|
+
`;
|
4751
|
+
closeButton.addEventListener('click', function() {
|
4752
|
+
document.body.removeChild(modal);
|
4753
|
+
});
|
4754
|
+
// 组装按钮容器
|
4755
|
+
buttonContainer.appendChild(copyButton);
|
4756
|
+
buttonContainer.appendChild(closeButton);
|
4757
|
+
// 组装模态框
|
4758
|
+
modalContent.appendChild(messageElement);
|
4759
|
+
modalContent.appendChild(buttonContainer);
|
4760
|
+
modal.appendChild(modalContent);
|
4761
|
+
// 添加到页面
|
4762
|
+
document.body.appendChild(modal);
|
4763
|
+
// 点击模态框背景也可以关闭
|
4764
|
+
modal.addEventListener('click', function(event) {
|
4765
|
+
if (event.target === modal) {
|
4766
|
+
document.body.removeChild(modal);
|
4767
|
+
}
|
4768
|
+
});
|
4653
4769
|
}
|
4654
4770
|
|
4655
4771
|
};
|