Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
yuan.cheng committed Dec 5, 2016
2 parents 689663b + 2c8066a commit c2ad4ce
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.idea
.DS_Store
target
/dist/
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.github.ltsopensource.admin.web.view;

import com.github.ltsopensource.admin.cluster.BackendAppContext;
import com.github.ltsopensource.biz.logger.domain.LogType;
import com.github.ltsopensource.core.cluster.NodeType;
import com.github.ltsopensource.core.commons.utils.DateUtils;
import com.github.ltsopensource.core.constant.Level;
import com.github.ltsopensource.queue.domain.NodeGroupPo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
Expand Down Expand Up @@ -63,6 +65,11 @@ public String jobLoggerUI(Model model, String realTaskId, String taskTrackerNode
if (startLogTime == null) {
startLogTime = DateUtils.addMinute(new Date(), -10);
}

model.addAttribute("logTypeList", LogType.values());

model.addAttribute("logLevelList", Level.values());

model.addAttribute("startLogTime", DateUtils.formatYMD_HMS(startLogTime));
if (endLogTime == null) {
endLogTime = new Date();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
</div>
</div>
</div>
`
</div>

<div class="modal inmodal" id="job-edit-modal" role="dialog" aria-hidden="true" style="display: none;">
Expand Down
48 changes: 45 additions & 3 deletions lts-admin/src/main/webapp/WEB-INF/views/templates/jobLogger.vm
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,37 @@
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 control-label">时间</label>
<label class="col-sm-2 control-label">日志类型</label>

<div class="col-sm-3">
<select class="form-control selectpicker" name="logType">
<option value="">-- 不限 --</option>
#foreach ($logType in $logTypeList)
<option value="$logType.name()">$logType.name()</option>
#end
</select>
</div>
<label class="col-sm-1 control-label">执行结果</label>

<div class="col-sm-3">
<select class="form-control selectpicker" name="success">
<option value="">-- 不限 --</option>
<option value="1">成功</option>
<option value="0">失败</option>
</select>
</div>
</div>
<div class="form-group row">
<label class="col-sm-2 control-label">日志级别</label>
<div class="col-sm-2">
<select class="form-control selectpicker" name="logLevel">
<option value="">-- 不限 --</option>
#foreach ($logLevel in $logLevelList)
<option value="$logLevel.name()">$logLevel.name()</option>
#end
</select>
</div>
<label class="col-sm-1 control-label">时间</label>

<div class="col-sm-2">
<input class="form-control datepicker" type="text" style="width:160px"
Expand All @@ -61,7 +91,9 @@
placeholder="yyyy-MM-dd HH:mm:ss"
value="$endLogTime"/>
</div>
<div class="col-sm-2">
</div>
<div class="form-group row" style="padding-right: 150px">
<div class="col-sm-3" style="float:right">
<div class="col-sm-2">
<button class="btn btn-primary" type="button" id="searchBtn">
搜索
Expand Down Expand Up @@ -99,7 +131,7 @@
<th data-hide="phone,tablet">提交节点组</th>
<th>日志类型</th>
<th>执行结果</th>
<th data-hide="all">日志级别</th>
<th>日志级别</th>
<th data-hide="all">依赖上一周期</th>
<th data-hide="all">重试次数</th>
<th data-hide="all">优先级</th>
Expand Down Expand Up @@ -195,6 +227,9 @@
// return;
// }
var taskTrackerNodeGroup = $("select[name='taskTrackerNodeGroup']").val();
var logType = $("select[name='logType']").val();
var logLevel = $("select[name='logLevel']").val();
var success = $("select[name='success']").val();
var startLogTime = $("input[name='startLogTime']").val();
var endLogTime = $("input[name='endLogTime']").val();
if (!startLogTime) {
Expand All @@ -217,6 +252,9 @@
var params = {
realTaskId: realTaskId,
taskTrackerNodeGroup: taskTrackerNodeGroup,
logType: logType,
level: logLevel,
success: success,
startLogTime: startLogTime, endLogTime: endLogTime
};
if (!realTaskId) {
Expand Down Expand Up @@ -255,5 +293,9 @@
$("#searchBtn").trigger("click");
// ltsTable.renderEmpty();
}
//翻译日志类型选择下拉列表
$("select[name='logType'] option").each(function(i, v){
$(v).text(LOG_TYPE[$(v).val()]);
})
});
</script>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.ltsopensource.biz.logger.domain;

import com.github.ltsopensource.admin.request.PaginationReq;
import com.sun.org.apache.xpath.internal.operations.Bool;

import java.util.Date;

Expand All @@ -14,6 +15,12 @@ public class JobLoggerRequest extends PaginationReq {

private String taskTrackerNodeGroup;

private String logType;

private String level;

private String success;

private Date startLogTime;

private Date endLogTime;
Expand Down Expand Up @@ -42,6 +49,30 @@ public void setTaskTrackerNodeGroup(String taskTrackerNodeGroup) {
this.taskTrackerNodeGroup = taskTrackerNodeGroup;
}

public String getLogType() {
return logType;
}

public void setLogType(String logType) {
this.logType = logType;
}

public String getLevel() {
return level;
}

public void setLevel(String level) {
this.level = level;
}

public String getSuccess() {
return success;
}

public void setSuccess(String success) {
this.success = success;
}

public Date getStartLogTime() {
return startLogTime;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ public PaginationRsp<JobLogPo> search(JobLoggerRequest request) {
if(StringUtils.isNotEmpty(request.getTaskTrackerNodeGroup())){
query.field("taskTrackerNodeGroup").equal(request.getTaskTrackerNodeGroup());
}
if(StringUtils.isNotEmpty(request.getLogType())){
query.field("logType").equal(request.getLogType());
}
if(StringUtils.isNotEmpty(request.getLevel())){
query.field("level").equal(request.getLevel());
}
if(StringUtils.isNotEmpty(request.getSuccess())){
query.field("success").equal(request.getSuccess());
}
if (request.getStartLogTime() != null) {
query.filter("logTime >= ", getTimestamp(request.getStartLogTime()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.github.ltsopensource.store.jdbc.builder.SelectSql;
import com.github.ltsopensource.store.jdbc.builder.WhereSql;
import com.github.ltsopensource.store.jdbc.dbutils.JdbcTypeUtils;
import com.sun.tools.internal.ws.wsdl.document.soap.SOAPUse;

import java.util.List;

Expand Down Expand Up @@ -147,6 +148,9 @@ private WhereSql buildWhereSql(JobLoggerRequest request) {
.andOnNotEmpty("task_id = ?", request.getTaskId())
.andOnNotEmpty("real_task_id = ?", request.getRealTaskId())
.andOnNotEmpty("task_tracker_node_group = ?", request.getTaskTrackerNodeGroup())
.andOnNotEmpty("log_type = ?", request.getLogType())
.andOnNotEmpty("level = ?", request.getLevel())
.andOnNotEmpty("success = ?", request.getSuccess())
.andBetween("log_time", JdbcTypeUtils.toTimestamp(request.getStartLogTime()), JdbcTypeUtils.toTimestamp(request.getEndLogTime()))
;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,25 @@ public void call() throws Exception {
@Override
public void debug(String msg) {
if (level.ordinal() <= Level.DEBUG.ordinal()) {
sendMsg(msg);
sendMsg(msg, Level.DEBUG);
}
}

@Override
public void info(String msg) {
if (level.ordinal() <= Level.INFO.ordinal()) {
sendMsg(msg);
sendMsg(msg, Level.INFO);
}
}

@Override
public void error(String msg) {
if (level.ordinal() <= Level.ERROR.ordinal()) {
sendMsg(msg);
sendMsg(msg, Level.ERROR);
}
}

private void sendMsg(String msg) {
private void sendMsg(String msg, Level level) {

BizLogSendRequest requestBody = CommandBodyWrapper.wrapper(appContext, new BizLogSendRequest());

Expand Down

0 comments on commit c2ad4ce

Please sign in to comment.