diff --git a/CHANGELOG.md b/CHANGELOG.md index 62a355a0c..fc2b7daef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ 1. 【server】构建触发器新增获取当前状态接口 (感谢@wxyShine) 2. 【server】构建确认流程支持修改分支(感谢@) +3. 【server】服务端脚本新增解绑操作,用于释放关联的过期节点 ### 🐞 解决BUG、优化功能 diff --git a/modules/server/src/main/java/io/jpom/controller/script/ScriptController.java b/modules/server/src/main/java/io/jpom/controller/script/ScriptController.java index b4fe9eb1b..6c63e5bf0 100644 --- a/modules/server/src/main/java/io/jpom/controller/script/ScriptController.java +++ b/modules/server/src/main/java/io/jpom/controller/script/ScriptController.java @@ -174,4 +174,20 @@ public class ScriptController extends BaseServerController { } return JsonMessage.getString(200, "删除成功"); } + + /** + * 释放脚本关联的节点 + * + * @param id 脚本ID + * @return json + */ + @RequestMapping(value = "unbind.json", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) + @Feature(method = MethodFeature.DEL) + public String unbind(@ValidatorItem String id) { + ScriptModel update = new ScriptModel(); + update.setId(id); + update.setNodeIds(StrUtil.EMPTY); + scriptServer.updateById(update, getRequest()); + return JsonMessage.getString(200, "解绑成功"); + } } diff --git a/web-vue/src/api/server-script.js b/web-vue/src/api/server-script.js index 11fbeab79..85aa87630 100644 --- a/web-vue/src/api/server-script.js +++ b/web-vue/src/api/server-script.js @@ -38,6 +38,20 @@ export function deleteScript(params) { }); } +/** + * 解绑 Script + * @param {id} params + + * params.id 编辑修改时判断 ID + */ +export function unbindScript(params) { + return axios({ + url: "/script/unbind.json", + method: "get", + params: params, + }); +} + // 脚本模版日志列表 export function getScriptLogList(params) { return axios({ diff --git a/web-vue/src/pages/script/script-list.vue b/web-vue/src/pages/script/script-list.vue index c7f5c18ba..f91b8e2b6 100644 --- a/web-vue/src/pages/script/script-list.vue +++ b/web-vue/src/pages/script/script-list.vue @@ -48,7 +48,20 @@ 执行 编辑 - 删除 + + + 更多 + + + + + 删除 + + + 解绑 + + + @@ -107,7 +120,7 @@