mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-02 20:08:40 +08:00
feat(add) 服务端脚本新增解绑操作,用于释放关联的过期节点
This commit is contained in:
parent
147b2553de
commit
1cc38ba6d2
@ -6,6 +6,7 @@
|
||||
|
||||
1. 【server】构建触发器新增获取当前状态接口 (感谢@wxyShine)
|
||||
2. 【server】构建确认流程支持修改分支(感谢@)
|
||||
3. 【server】服务端脚本新增解绑操作,用于释放关联的过期节点
|
||||
|
||||
### 🐞 解决BUG、优化功能
|
||||
|
||||
|
@ -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, "解绑成功");
|
||||
}
|
||||
}
|
||||
|
@ -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({
|
||||
|
@ -48,7 +48,20 @@
|
||||
<a-space>
|
||||
<a-button size="small" type="primary" @click="handleExec(record)">执行</a-button>
|
||||
<a-button size="small" type="primary" @click="handleEdit(record)">编辑</a-button>
|
||||
<a-button size="small" type="danger" @click="handleDelete(record)">删除</a-button>
|
||||
<a-dropdown>
|
||||
<a class="ant-dropdown-link" @click="(e) => e.preventDefault()">
|
||||
更多
|
||||
<a-icon type="down" />
|
||||
</a>
|
||||
<a-menu slot="overlay">
|
||||
<a-menu-item>
|
||||
<a-button size="small" type="danger" @click="handleDelete(record)">删除</a-button>
|
||||
</a-menu-item>
|
||||
<a-menu-item>
|
||||
<a-button size="small" type="danger" :disabled="!record.nodeIds" @click="handleUnbind(record)">解绑</a-button>
|
||||
</a-menu-item>
|
||||
</a-menu>
|
||||
</a-dropdown>
|
||||
</a-space>
|
||||
</template>
|
||||
</a-table>
|
||||
@ -107,7 +120,7 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getScriptListAll, editScript, deleteScript } from "@/api/server-script";
|
||||
import { getScriptListAll, editScript, deleteScript, unbindScript } from "@/api/server-script";
|
||||
import codeEditor from "@/components/codeEditor";
|
||||
import { getNodeListAll } from "@/api/node";
|
||||
import ScriptConsole from "@/pages/script/script-console";
|
||||
@ -266,6 +279,28 @@ export default {
|
||||
}
|
||||
this.loadData();
|
||||
},
|
||||
// 解绑
|
||||
handleUnbind(record) {
|
||||
this.$confirm({
|
||||
title: "系统提示",
|
||||
content: "真的要解绑脚本关联的节点么?解绑不会真实请求节点解绑,一般用于服务器无法连接且已经确定不再使用。如果误操作可能冗余数据",
|
||||
okText: "确认",
|
||||
cancelText: "取消",
|
||||
onOk: () => {
|
||||
// 解绑
|
||||
unbindScript({
|
||||
id: record.id,
|
||||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.$notification.success({
|
||||
message: res.msg,
|
||||
});
|
||||
this.loadData();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user