日志支持筛选用户

This commit is contained in:
jiangzeyin 2019-04-25 15:33:21 +08:00
parent 2a927e5acf
commit 6907ad5fd0
9 changed files with 48 additions and 18 deletions

View File

@ -0,0 +1,5 @@
### 使用的JDK版本、Jpom版本、操作系统及系统版本
### 问题描述(包括截图)
### 报错信息

View File

@ -1,5 +1,6 @@
package cn.keepbx.jpom.controller;
import cn.hutool.system.SystemUtil;
import cn.jiangzeyin.common.JsonMessage;
import cn.keepbx.jpom.BaseJpomApplication;
import cn.keepbx.jpom.common.BaseAgentController;
@ -61,6 +62,8 @@ public class IndexController extends BaseAgentController {
jsonObject.put("javaVirtualCount", JvmUtil.getJavaVirtualCount());
jsonObject.put("osName", BaseJpomApplication.OS_INFO.getName());
jsonObject.put("jpomVersion", JpomManifest.getInstance().getVersion());
jsonObject.put("javaVersion", SystemUtil.getJavaRuntimeInfo().getVersion());
if (projectInfoModels == null) {
jsonObject.put("count", 0);
jsonObject.put("runCount", 0);

View File

@ -120,7 +120,7 @@ public class ProjectListController extends BaseAgentController {
* @return obj
*/
@RequestMapping(value = "getProjectPort", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public String getProjectGroup(String ids) {
public String getProjectPort(String ids) {
if (StrUtil.isEmpty(ids)) {
return JsonMessage.getString(400, "");
}
@ -147,15 +147,4 @@ public class ProjectListController extends BaseAgentController {
}
return JsonMessage.getString(200, "", jsonObject);
}
// /**
// * 获取运行方式
// *
// * @return array
// */
// @RequestMapping(value = "getRunModes", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
// public String getRunModes() {
// ProjectInfoModel.RunMode[] runModes = ProjectInfoModel.RunMode.values();
// return JsonMessage.getString(200, "", runModes);
// }
}

View File

@ -89,13 +89,10 @@ public class ProjectInfoModel extends BaseModel {
/**
* 项目是否正在运行
*
* @param get 防止并发获取
* @param get 防止自动获取
* @return true 正在运行
*/
public boolean isStatus(boolean get) {
if (!get) {
return false;
}
try {
status = AbstractProjectCommander.getInstance().isRun(getId());
} catch (Exception e) {

View File

@ -96,8 +96,11 @@ public class ScriptModel extends BaseModel {
public void saveFile() {
File file = getFile(true);
FileUtil.writeString(getContext(), file, CharsetUtil.CHARSET_UTF_8);
// 添加权限
if (BaseJpomApplication.OS_INFO.isLinux()) {
CommandUtil.execCommand("chmod 755 " + FileUtil.getAbsolutePath(file));
}
}
/**
* 读取文件信息

View File

@ -15,8 +15,10 @@ import cn.hutool.db.sql.Order;
import cn.jiangzeyin.common.JsonMessage;
import cn.keepbx.jpom.common.BaseServerController;
import cn.keepbx.jpom.model.data.NodeModel;
import cn.keepbx.jpom.model.data.UserModel;
import cn.keepbx.jpom.model.data.UserOperateLogV1;
import cn.keepbx.jpom.service.node.NodeService;
import cn.keepbx.jpom.service.user.UserService;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.http.MediaType;
@ -40,6 +42,8 @@ import java.util.List;
public class UserOptLogController extends BaseServerController {
@Resource
private NodeService nodeService;
@Resource
private UserService userService;
/**
* 展示用户列表
@ -49,6 +53,9 @@ public class UserOptLogController extends BaseServerController {
// 所有节点
List<NodeModel> nodeModels = nodeService.list();
setAttribute("nodeArray", nodeModels);
// 用户
List<UserModel> userModels = userService.list();
setAttribute("userArray", userModels);
return "user/log/list";
}
@ -83,6 +90,11 @@ public class UserOptLogController extends BaseServerController {
entity.set("nodeId".toUpperCase(), selectNode);
}
String selectUser = getParameter("selectUser");
if (StrUtil.isNotEmpty(selectUser)) {
entity.set("userId".toUpperCase(), selectUser);
}
PageResult<Entity> pageResult = Db.use().page(entity, page);
CopyOptions copyOptions = new CopyOptions();
copyOptions.setIgnoreError(true);

View File

@ -61,6 +61,7 @@
var config = {
cols: [[
{field: 'osName', title: '系统名', width: "10%"},
{field: 'javaVersion', title: 'Java版本', width: "10%"},
{field: 'jpomVersion', title: 'Jpom版本', width: "10%"},
{field: 'count', title: '项目个数', width: "10%"},
{field: 'runCount', title: '运行中个数', width: "10%"},

View File

@ -65,6 +65,18 @@
</select>
</div>
</div>
<div class="layui-inline">
<label class="layui-form-label" style="width: auto !important;">用户</label>
<div class="layui-input-inline">
<select name="selectUser" id="selectUser" lay-verify="required" lay-filter="selectUser"
lay-search="">
<option value="">请选择</option>
#foreach($item in $userArray)
<option value="$item.id">$item.name</option>
#end
</select>
</div>
</div>
</div>
</form>
</script>
@ -107,6 +119,8 @@
renderDate();
// 选中
$("#selectNode option[value='" + apiWhere.selectNode + "']").attr("selected", "selected");
$("#selectUser option[value='" + apiWhere.selectUser + "']").attr("selected", "selected");
form.render();
}
});
@ -141,6 +155,11 @@
return true;
});
form.on('select(selectUser)', function (data) {
apiWhere.selectUser = data.value;
reloadTable();
return true;
});
}
function renderDate() {

View File

@ -1,3 +1,4 @@
import cn.hutool.system.SystemUtil;
import com.sun.tools.attach.AttachNotSupportedException;
import sun.jvmstat.monitor.*;
@ -21,7 +22,7 @@ public class TestJvm {
// Properties properties = virtualMachine.getAgentProperties();
// System.out.println(properties);
// }
System.out.println(SystemUtil.getJavaRuntimeInfo().getVersion());
// 获取监控主机
MonitoredHost local = MonitoredHost.getMonitoredHost("localhost");