mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-11-30 10:58:14 +08:00
关联节点分发后的操作
This commit is contained in:
parent
8ecba22eb2
commit
5e0c6b97e5
@ -17,6 +17,7 @@
|
||||
5. 【Server】构建历史支持配置单个构建最多保存多少个历史
|
||||
6. 【Server】解决节点分组筛选bug(感谢gitee@I17XEH)
|
||||
7. 【Server】角色权限动态数据,单个节点异常不影响所有节点配置(感谢@£天空之城~龙)
|
||||
8. 【Server】关联节点分发项目支持修改发布后操作
|
||||
|
||||
-----------------------------------------------------------
|
||||
|
||||
|
@ -56,7 +56,7 @@ public class NodeForward {
|
||||
* @param userModel user
|
||||
* @return JSON
|
||||
*/
|
||||
public static JsonMessage request(NodeModel nodeModel, NodeUrl nodeUrl, UserModel userModel, JSONObject jsonObject) {
|
||||
public static JsonMessage<String> request(NodeModel nodeModel, NodeUrl nodeUrl, UserModel userModel, JSONObject jsonObject) {
|
||||
return request(nodeModel, null, nodeUrl, true, userModel, jsonObject, null, null);
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ public class NodeForward {
|
||||
* @param val 其他参数
|
||||
* @return JSON
|
||||
*/
|
||||
public static JsonMessage requestBySys(NodeModel nodeModel, NodeUrl nodeUrl, String pName, Object pVal, Object... val) {
|
||||
public static <T> JsonMessage<T> requestBySys(NodeModel nodeModel, NodeUrl nodeUrl, String pName, Object pVal, Object... val) {
|
||||
return request(nodeModel, null, nodeUrl, false, null, null, pName, pVal, val);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package io.jpom.controller.outgiving;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.jiangzeyin.common.JsonMessage;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@ -8,6 +9,7 @@ import io.jpom.common.BaseServerController;
|
||||
import io.jpom.common.forward.NodeForward;
|
||||
import io.jpom.common.forward.NodeUrl;
|
||||
import io.jpom.common.interceptor.OptLog;
|
||||
import io.jpom.model.BaseEnum;
|
||||
import io.jpom.model.data.NodeModel;
|
||||
import io.jpom.model.data.OutGivingModel;
|
||||
import io.jpom.model.data.OutGivingNodeProject;
|
||||
@ -77,6 +79,8 @@ public class OutGivingController extends BaseServerController {
|
||||
String reqId = nodeService.cacheNodeList(nodeModels);
|
||||
setAttribute("reqId", reqId);
|
||||
|
||||
JSONArray afterOpt = BaseEnum.toJSONArray(OutGivingModel.AfterOpt.class);
|
||||
setAttribute("afterOpt", afterOpt);
|
||||
return "outgiving/edit";
|
||||
}
|
||||
|
||||
@ -124,7 +128,7 @@ public class OutGivingController extends BaseServerController {
|
||||
return error;
|
||||
}
|
||||
|
||||
private String doData(OutGivingModel outGivingModel) throws IOException {
|
||||
private String doData(OutGivingModel outGivingModel) {
|
||||
outGivingModel.setName(getParameter("name"));
|
||||
if (StrUtil.isEmpty(outGivingModel.getName())) {
|
||||
return JsonMessage.getString(405, "分发名称不能为空");
|
||||
@ -179,6 +183,13 @@ public class OutGivingController extends BaseServerController {
|
||||
return JsonMessage.getString(405, "至少选择2个节点项目");
|
||||
}
|
||||
outGivingModel.setOutGivingNodeProjectList(outGivingNodeProjects);
|
||||
//
|
||||
String afterOpt = getParameter("afterOpt");
|
||||
OutGivingModel.AfterOpt afterOpt1 = BaseEnum.getEnum(OutGivingModel.AfterOpt.class, Convert.toInt(afterOpt, 0));
|
||||
if (afterOpt1 == null) {
|
||||
return JsonMessage.getString(400, "请选择分发后的操作");
|
||||
}
|
||||
outGivingModel.setAfterOpt(afterOpt1.getCode());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ public class Monitor implements Task {
|
||||
if (monitorModel.isAutoRestart()) {
|
||||
// 执行重启
|
||||
try {
|
||||
JsonMessage reJson = NodeForward.requestBySys(nodeModel, NodeUrl.Manage_Restart, "id", id);
|
||||
JsonMessage<String> reJson = NodeForward.requestBySys(nodeModel, NodeUrl.Manage_Restart, "id", id);
|
||||
if (reJson.getCode() == HttpStatus.HTTP_OK) {
|
||||
// 重启成功
|
||||
runStatus = true;
|
||||
|
@ -128,7 +128,7 @@ public class OutGivingRun implements Callable<OutGivingNodeProject.Status> {
|
||||
updateStatus(this.logId, this.outGivingId, this.outGivingNodeProject,
|
||||
OutGivingNodeProject.Status.Ing, "开始分发");
|
||||
//
|
||||
JsonMessage jsonMessage = fileUpload(file,
|
||||
JsonMessage<String> jsonMessage = fileUpload(file,
|
||||
this.outGivingNodeProject.getProjectId(),
|
||||
unzip,
|
||||
afterOpt != OutGivingModel.AfterOpt.No,
|
||||
@ -162,10 +162,10 @@ public class OutGivingRun implements Callable<OutGivingNodeProject.Status> {
|
||||
* @param userModel 操作用户
|
||||
* @return json
|
||||
*/
|
||||
public static JsonMessage fileUpload(File file, String projectId,
|
||||
boolean unzip, boolean restart,
|
||||
NodeModel nodeModel, UserModel userModel,
|
||||
boolean clearOld) {
|
||||
public static JsonMessage<String> fileUpload(File file, String projectId,
|
||||
boolean unzip, boolean restart,
|
||||
NodeModel nodeModel, UserModel userModel,
|
||||
boolean clearOld) {
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("file", file);
|
||||
data.put("id", projectId);
|
||||
|
@ -52,6 +52,20 @@
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">分发后</label>
|
||||
<div class="layui-input-block">
|
||||
<select name="afterOpt" id="afterOpt">
|
||||
<option value="">请选择分发后的操作</option>
|
||||
<option th:each="sel : ${afterOpt}" th:value="${sel.code}"
|
||||
th:selected="${sel.code==item?.afterOpt}" th:text="${sel.desc}">
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item"
|
||||
style="padding-left: 20%;padding-top: 20px;">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="form_outgiving">提交
|
||||
|
Loading…
Reference in New Issue
Block a user