Skip to content

Commit

Permalink
Add justify event trace activated for history overview.
Browse files Browse the repository at this point in the history
  • Loading branch information
haocao committed Apr 7, 2017
1 parent c808c8e commit ecadd14
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import com.dangdang.ddframe.job.event.type.JobExecutionEvent;
import com.dangdang.ddframe.job.event.type.JobStatusTraceEvent;
import com.dangdang.ddframe.job.lite.console.domain.EventTraceDataSourceConfiguration;
import com.dangdang.ddframe.job.lite.console.service.EventTraceDataSourceConfigurationService;
import com.dangdang.ddframe.job.lite.console.service.impl.EventTraceDataSourceConfigurationServiceImpl;
import com.dangdang.ddframe.job.lite.console.util.SessionEventTraceDataSourceConfiguration;
import com.google.common.base.Strings;
import org.apache.commons.dbcp.BasicDataSource;
Expand All @@ -37,6 +39,7 @@
import javax.ws.rs.core.UriInfo;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
Expand All @@ -51,6 +54,8 @@ public final class EventTraceHistoryRestfulApi {

private EventTraceDataSourceConfiguration eventTraceDataSourceConfiguration = SessionEventTraceDataSourceConfiguration.getEventTraceDataSourceConfiguration();

private EventTraceDataSourceConfigurationService eventTraceDataSourceConfigurationService = new EventTraceDataSourceConfigurationServiceImpl();

/**
* 查询作业执行事件.
*
Expand All @@ -63,6 +68,9 @@ public final class EventTraceHistoryRestfulApi {
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Result<JobExecutionEvent> findJobExecutionEvents(@Context final UriInfo uriInfo) throws ParseException {
if (!eventTraceDataSourceConfigurationService.loadActivated().isPresent()) {
return new Result<>(0, new ArrayList<JobExecutionEvent>());
}
JobEventRdbSearch jobEventRdbSearch = new JobEventRdbSearch(setUpEventTraceDataSource());
return jobEventRdbSearch.findJobExecutionEvents(buildCondition(uriInfo, new String[]{"jobName", "ip", "isSuccess"}));
}
Expand All @@ -79,6 +87,9 @@ public Result<JobExecutionEvent> findJobExecutionEvents(@Context final UriInfo u
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Result<JobStatusTraceEvent> findJobStatusTraceEvents(@Context final UriInfo uriInfo) throws ParseException {
if (!eventTraceDataSourceConfigurationService.loadActivated().isPresent()) {
return new Result<>(0, new ArrayList<JobStatusTraceEvent>());
}
JobEventRdbSearch jobEventRdbSearch = new JobEventRdbSearch(setUpEventTraceDataSource());
return jobEventRdbSearch.findJobStatusTraceEvents(buildCondition(uriInfo, new String[]{"jobName", "source", "executionType", "state"}));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ public final class EventTraceDataSourceRestfulApi {

private EventTraceDataSourceConfigurationService eventTraceDataSourceConfigurationService = new EventTraceDataSourceConfigurationServiceImpl();

/**
* 判断是否存在已连接的事件追踪数据源配置.
*
* @param request HTTP请求
* @return 是否存在已连接的事件追踪数据源配置
*/
@GET
@Path("/activated")
public boolean activated(final @Context HttpServletRequest request) {
return eventTraceDataSourceConfigurationService.loadActivated().isPresent();
}

/**
* 读取事件追踪数据源配置.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h4>历史作业执行轨迹 </h4>
<label>是否成功:</label>
<input type="radio" name="isSuccess" value="1">
<input type="radio" name="isSuccess" value="0">
<input type="radio" name="isSuccess" value="">全部
<input type="radio" name="isSuccess" value="" checked="checked">全部
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,5 @@ <h4>历史作业执行状态 </h4>
<script src="lib/bootstrap-table/bootstrap-table-zh-CN.js"></script>
<script src="lib/daterangepicker/moment.min.js"></script>
<script src="lib/daterangepicker/daterangepicker.js"></script>
<script src="lib/input-mask/jquery.inputmask.js"></script>
<script src="lib/input-mask/jquery.inputmask.date.extensions.js"></script>
<script src="lib/input-mask/jquery.inputmask.extensions.js"></script>
<script src="js/util/formatter.js"></script>
<script src="js/history/job_event_trace_history.js"></script>

0 comments on commit ecadd14

Please sign in to comment.