mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-02 20:08:40 +08:00
优化 ssh 安装插件端,不输入节点ID、没有配置权限报错
This commit is contained in:
parent
ecc168f9e0
commit
51524a5ec0
@ -8,12 +8,13 @@
|
||||
|
||||
### 解决BUG、优化功能
|
||||
|
||||
1. 【server】没有配置监控信息节点首页报错(感谢@周健全)
|
||||
1. 【server】解决节点未配置监控周期接口报错+页面循环提示(感谢@周健全)
|
||||
2. Windows 无法关闭 Jpom 程序(感谢@……)
|
||||
3. 【server】修护项目搜索、节点分发项目的文件、控制管理无法正常使用(感谢@刘志远)
|
||||
4. 脚本文件提示内容取消中文,修改为英文
|
||||
5. 【agent】新增检查 jps 命令执行是否存在异常,异常则提示用户(感谢@……)
|
||||
6. 部分控制台输出日志调整为英文
|
||||
7. 【server】优化 ssh 安装插件端,不输入节点ID、没有配置权限报错(感谢@大土豆)
|
||||
|
||||
------
|
||||
|
||||
|
@ -64,11 +64,7 @@ public class SshInstallAgentController extends BaseServerController {
|
||||
@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "节点数据") String nodeData,
|
||||
@ValidatorItem(value = ValidatorRule.NOT_BLANK, msg = "安装路径") String path) throws Exception {
|
||||
// 判断输入的节点信息
|
||||
Object object = getNodeModel(nodeData);
|
||||
if (object instanceof JsonMessage) {
|
||||
return object.toString();
|
||||
}
|
||||
NodeModel nodeModel = (NodeModel) object;
|
||||
NodeModel nodeModel = this.getNodeModel(nodeData);
|
||||
//
|
||||
SshModel sshModel = sshService.getByKey(id, false);
|
||||
Objects.requireNonNull(sshModel, "没有找到对应ssh");
|
||||
@ -122,13 +118,14 @@ public class SshInstallAgentController extends BaseServerController {
|
||||
//
|
||||
String shPtah = FileUtil.normalize(path + StrUtil.SLASH + Type.Agent.name() + ".sh");
|
||||
String chmod = getParameter("chmod");
|
||||
if (StrUtil.isEmpty(chmod)) {
|
||||
if (StrUtil.isEmptyOrUndefined(chmod)) {
|
||||
chmod = StrUtil.EMPTY;
|
||||
} else {
|
||||
chmod = StrUtil.format("{} {} && ", chmod, shPtah);
|
||||
}
|
||||
String command = StrUtil.format("{}sh {} start upgrade", chmod, shPtah);
|
||||
String result = sshService.exec(sshModel, command);
|
||||
DefaultSystemLog.getLog().debug("ssh install agent node {} {}", command, result);
|
||||
// 休眠 5 秒, 尝试 5 次
|
||||
int waitCount = getParameterInt("waitCount", 5);
|
||||
waitCount = Math.max(waitCount, 5);
|
||||
@ -150,7 +147,7 @@ public class SshInstallAgentController extends BaseServerController {
|
||||
}
|
||||
nodeModel.setOpenStatus(1);
|
||||
// 绑定关系
|
||||
//nodeModel.setSshId(sshModel.getId());
|
||||
nodeModel.setSshId(sshModel.getId());
|
||||
nodeService.insert(nodeModel);
|
||||
//
|
||||
return JsonMessage.getString(200, "操作成功:" + result);
|
||||
@ -183,9 +180,9 @@ public class SshInstallAgentController extends BaseServerController {
|
||||
return null;
|
||||
}
|
||||
|
||||
private Object getNodeModel(String data) {
|
||||
private NodeModel getNodeModel(String data) {
|
||||
NodeModel nodeModel = JSONObject.toJavaObject(JSONObject.parseObject(data), NodeModel.class);
|
||||
Assert.hasText(nodeModel.getId(), "节点id错误");
|
||||
//Assert.hasText(nodeModel.getId(), "节点id错误");
|
||||
|
||||
Assert.hasText(nodeModel.getName(), "输入节点名称");
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="full-content">
|
||||
<div class="node-full-content">
|
||||
<!-- 历史监控数据 -->
|
||||
<a-button v-show="node.cycle && node.cycle !== 0" type="primary" @click="handleHistory">历史监控图表</a-button>
|
||||
<a-divider>图表</a-divider>
|
||||
@ -7,7 +7,7 @@
|
||||
<div id="top-chart">loading...</div>
|
||||
<a-divider>进程监控表格</a-divider>
|
||||
<!-- 进程表格数据 -->
|
||||
<a-table :loading="loading" :columns="columns" :data-source="processList" :scroll="{ x: '80vw' }" bordered rowKey="pid" class="node-table" :pagination="false">
|
||||
<a-table :loading="loading" :columns="columns" :data-source="processList" bordered rowKey="pid" class="node-table" :pagination="false">
|
||||
<a-tooltip slot="port" slot-scope="text" placement="topLeft" :title="text">
|
||||
<span>{{ text }}</span>
|
||||
</a-tooltip>
|
||||
@ -79,11 +79,12 @@ export default {
|
||||
this.loadNodeTop();
|
||||
this.loadNodeProcess();
|
||||
// 计算多久时间绘制图表
|
||||
const millis = this.node.cycle < 30000 ? 30000 : this.node.cycle;
|
||||
// const millis = this.node.cycle < 30000 ? 30000 : this.node.cycle;
|
||||
// console.log(millis);
|
||||
this.topChartTimer = setInterval(() => {
|
||||
this.loadNodeTop();
|
||||
this.loadNodeProcess();
|
||||
}, millis);
|
||||
}, 20000);
|
||||
}
|
||||
},
|
||||
// 请求 top 命令绘制图表
|
||||
@ -91,8 +92,8 @@ export default {
|
||||
getNodeTop(this.node.id).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.topData = res.data;
|
||||
this.drawTopChart();
|
||||
}
|
||||
this.drawTopChart();
|
||||
});
|
||||
},
|
||||
generateChart(data) {
|
||||
@ -177,9 +178,13 @@ export default {
|
||||
},
|
||||
// 绘制 top 图表
|
||||
drawTopChart() {
|
||||
let topChartDom = document.getElementById("top-chart");
|
||||
if (!topChartDom) {
|
||||
return;
|
||||
}
|
||||
let option = this.generateChart(this.topData);
|
||||
// 绘制图表
|
||||
const topChart = echarts.init(document.getElementById("top-chart"));
|
||||
const topChart = echarts.init(topChartDom);
|
||||
topChart.setOption(option);
|
||||
},
|
||||
// 加载节点进程列表
|
||||
@ -209,7 +214,6 @@ export default {
|
||||
if (res.code === 200) {
|
||||
this.$notification.success({
|
||||
message: res.msg,
|
||||
|
||||
});
|
||||
this.loadNodeProcess();
|
||||
}
|
||||
@ -234,8 +238,8 @@ export default {
|
||||
nodeMonitorData(params).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.historyData = res.data;
|
||||
this.drawHistoryChart();
|
||||
}
|
||||
this.drawHistoryChart();
|
||||
});
|
||||
},
|
||||
// 选择时间
|
||||
@ -244,9 +248,13 @@ export default {
|
||||
},
|
||||
// 画历史图表
|
||||
drawHistoryChart() {
|
||||
let historyChartDom = document.getElementById("history-chart");
|
||||
if (!historyChartDom) {
|
||||
return;
|
||||
}
|
||||
let option = this.generateChart(this.historyData);
|
||||
// 绘制图表
|
||||
const historyChart = echarts.init(document.getElementById("history-chart"));
|
||||
const historyChart = echarts.init(historyChartDom);
|
||||
historyChart.setOption(option);
|
||||
},
|
||||
},
|
||||
|
@ -119,9 +119,9 @@
|
||||
<a-modal v-model="nodeVisible" width="600px" title="安装节点" @ok="handleEditNodeOk" :maskClosable="false">
|
||||
<a-spin :spinning="formLoading" tip="这可能会花费一些时间,请勿关闭该页面">
|
||||
<a-form-model ref="nodeForm" :rules="rules" :model="tempNode" :label-col="{ span: 4 }" :wrapper-col="{ span: 18 }">
|
||||
<a-form-model-item label="节点 ID" prop="id">
|
||||
<!-- <a-form-model-item label="节点 ID" prop="id">
|
||||
<a-input v-model="tempNode.id" placeholder="节点 ID" />
|
||||
</a-form-model-item>
|
||||
</a-form-model-item> -->
|
||||
<a-form-model-item label="节点名称" prop="name">
|
||||
<a-input v-model="tempNode.name" placeholder="节点名称" />
|
||||
</a-form-model-item>
|
||||
@ -572,8 +572,8 @@ export default {
|
||||
formData.append("id", this.temp.id);
|
||||
formData.append("nodeData", JSON.stringify({ ...this.tempNode }));
|
||||
formData.append("path", this.tempNode.path);
|
||||
formData.append("waitCount", this.tempNode.waitCount);
|
||||
formData.append("chmod", this.tempNode.chmod);
|
||||
formData.append("waitCount", this.tempNode.waitCount || '');
|
||||
formData.append("chmod", this.tempNode.chmod || '');
|
||||
// 提交数据
|
||||
installAgentNode(formData).then((res) => {
|
||||
if (res.code === 200) {
|
||||
|
Loading…
Reference in New Issue
Block a user