mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-11-29 18:38:32 +08:00
fix 删除服务端脚本日志如果脚本不存在不能删除
This commit is contained in:
parent
fc5186be88
commit
7f3879532b
@ -6,6 +6,7 @@
|
||||
|
||||
1. 【server】修复 迁移项目关联构建关联的全局仓库无法完整迁移问题(感谢@奇奇)
|
||||
2. 【server】优化 仓库支持查看关联的构建
|
||||
3. 【server】修复 删除服务端脚本日志如果脚本不存在不能删除
|
||||
|
||||
------
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
package org.dromara.jpom.controller.script;
|
||||
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.keepbx.jpom.IJsonMessage;
|
||||
import cn.keepbx.jpom.model.JsonMessage;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
@ -90,11 +91,17 @@ public class ScriptLogController extends BaseServerController {
|
||||
@RequestMapping(value = "del_log", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.DEL)
|
||||
public IJsonMessage<Object> delLog(@ValidatorItem() String id,
|
||||
@ValidatorItem() String executeId,
|
||||
HttpServletRequest request) {
|
||||
ScriptModel item = scriptServer.getByKeyAndGlobal(id, request);
|
||||
Assert.notNull(item, "没有对应数据");
|
||||
File logFile = item.logFile(executeId);
|
||||
@ValidatorItem() String executeId,
|
||||
HttpServletRequest request) {
|
||||
ScriptModel item = null;
|
||||
try {
|
||||
item = scriptServer.getByKeyAndGlobal(id, request, "ignore");
|
||||
} catch (IllegalArgumentException | IllegalStateException e) {
|
||||
if (!StrUtil.equals("ignore", e.getMessage())) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
File logFile = item == null ? ScriptModel.logFile(id, executeId) : item.logFile(executeId);
|
||||
boolean fastDel = CommandUtil.systemFastDel(logFile);
|
||||
Assert.state(!fastDel, "删除日志文件失败");
|
||||
scriptExecuteLogServer.delByKey(executeId);
|
||||
@ -112,9 +119,9 @@ public class ScriptLogController extends BaseServerController {
|
||||
@RequestMapping(value = "log", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Feature(method = MethodFeature.LIST)
|
||||
public IJsonMessage<JSONObject> getNowLog(@ValidatorItem() String id,
|
||||
@ValidatorItem() String executeId,
|
||||
@ValidatorItem(value = ValidatorRule.POSITIVE_INTEGER, msg = "line") int line,
|
||||
HttpServletRequest request) {
|
||||
@ValidatorItem() String executeId,
|
||||
@ValidatorItem(value = ValidatorRule.POSITIVE_INTEGER, msg = "line") int line,
|
||||
HttpServletRequest request) {
|
||||
ScriptModel item = scriptServer.getByKey(id, request);
|
||||
Assert.notNull(item, "没有对应数据");
|
||||
File logFile = item.logFile(executeId);
|
||||
|
@ -254,7 +254,7 @@ public class WorkspaceController extends BaseServerController {
|
||||
}
|
||||
// 判断用户绑定关系
|
||||
boolean workspace = userBindWorkspaceService.existsWorkspace(id);
|
||||
Assert.state(!workspace, "当前工作空间下还绑定着用户信息");
|
||||
Assert.state(!workspace, "当前工作空间下还绑定着用户(权限组)信息");
|
||||
// 最后执行自动删除
|
||||
StringBuilder autoDelete = new StringBuilder(StrUtil.EMPTY);
|
||||
for (Class<?> aClass : autoDeleteClass) {
|
||||
|
@ -341,7 +341,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<!-- 关联构建 -->
|
||||
<a-modal destroyOnClose v-model="viewBuildVisible" width="80vw" title="关联构建" :maskClosable="false" :footer="null">
|
||||
<a-modal destroyOnClose v-model="viewBuildVisible" width="80vw" title="当前工作空间关联构建" :maskClosable="false" :footer="null">
|
||||
<component :is="buildListComponent" v-if="buildListComponent" :repositoryId="temp.id" :fullContent="false" />
|
||||
</a-modal>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user