This is an automated email from the ASF dual-hosted git repository.
technoboy pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/shardingsphere-elasticjob-ui.git
The following commit(s) were added to refs/heads/master by this push:
new 82e3860 Fix time criteria doesn't work in History Status (#81)
82e3860 is described below
commit 82e3860a9d292ba6b774e6b8cd894ab17c957530
Author: 吴伟杰 <[email protected]>
AuthorDate: Tue Dec 22 22:31:41 2020 +0800
Fix time criteria doesn't work in History Status (#81)
---
.../request/FindJobStatusTraceEventsRequest.java | 16 ++++-------
.../service/impl/EventTraceHistoryServiceImpl.java | 4 +--
.../src/lang/en-US.js | 5 ++--
.../src/lang/zh-CN.js | 5 ++--
.../views/history-status/module/historyStatus.vue | 31 +++++++++++++---------
5 files changed, 31 insertions(+), 30 deletions(-)
diff --git
a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/lite/ui/dto/request/FindJobStatusTraceEventsRequest.java
b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/lite/ui/dto/request/FindJobStatusTraceEventsRequest.java
index b1ed536..23a172a 100644
---
a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/lite/ui/dto/request/FindJobStatusTraceEventsRequest.java
+++
b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/lite/ui/dto/request/FindJobStatusTraceEventsRequest.java
@@ -17,8 +17,6 @@
package org.apache.shardingsphere.elasticjob.lite.ui.dto.request;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -43,21 +41,17 @@ public class FindJobStatusTraceEventsRequest extends
BasePageRequest {
private String state;
- @JsonProperty("startTime")
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private Date start;
+ private Date creationTimeFrom;
- @JsonProperty("endTime")
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
- private Date end;
+ private Date creationTimeTo;
public FindJobStatusTraceEventsRequest(final Integer pageSize, final
Integer pageNumber) {
super(pageSize, pageNumber, null, null);
}
- public FindJobStatusTraceEventsRequest(final Integer pageSize, final
Integer pageNumber, final String sortBy, final String orderType, final Date
startTime, final Date endTime) {
+ public FindJobStatusTraceEventsRequest(final Integer pageSize, final
Integer pageNumber, final String sortBy, final String orderType, final Date
creationTimeFrom, final Date creationTimeTo) {
super(pageSize, pageNumber, sortBy, orderType);
- this.start = startTime;
- this.end = endTime;
+ this.creationTimeFrom = creationTimeFrom;
+ this.creationTimeTo = creationTimeTo;
}
}
diff --git
a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/lite/ui/service/impl/EventTraceHistoryServiceImpl.java
b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/lite/ui/service/impl/EventTraceHistoryServiceImpl.java
index db55b9d..fb4796a 100644
---
a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/lite/ui/service/impl/EventTraceHistoryServiceImpl.java
+++
b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-backend/src/main/java/org/apache/shardingsphere/elasticjob/lite/ui/service/impl/EventTraceHistoryServiceImpl.java
@@ -85,8 +85,8 @@ public final class EventTraceHistoryServiceImpl implements
EventTraceHistoryServ
@Override
public Page<JobStatusTraceEvent> findJobStatusTraceEvents(final
FindJobStatusTraceEventsRequest findJobStatusTraceEventsRequest) {
Example<JobStatusTraceLog> jobStatusTraceLogExample =
getExample(findJobStatusTraceEventsRequest, JobStatusTraceLog.class);
- Specification<JobStatusTraceLog> specification =
getSpecWithExampleAndDate(jobStatusTraceLogExample,
findJobStatusTraceEventsRequest.getStart(),
- findJobStatusTraceEventsRequest.getEnd(), "creationTime");
+ Specification<JobStatusTraceLog> specification =
getSpecWithExampleAndDate(jobStatusTraceLogExample,
findJobStatusTraceEventsRequest.getCreationTimeFrom(),
+ findJobStatusTraceEventsRequest.getCreationTimeTo(),
"creationTime");
Page<JobStatusTraceLog> page =
jobStatusTraceLogRepository.findAll(specification,
getPageable(findJobStatusTraceEventsRequest, JobStatusTraceLog.class));
return new
PageImpl<>(page.getContent().stream().map(JobStatusTraceLog::toJobStatusTraceEvent).collect(Collectors.toList()),
null, page.getTotalElements());
}
diff --git
a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/lang/en-US.js
b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/lang/en-US.js
index 8253963..993968b 100644
---
a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/lang/en-US.js
+++
b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/lang/en-US.js
@@ -278,8 +278,9 @@ export default {
},
searchForm: {
jobName: 'Job name',
- startTime: 'Creation start time',
- CompleteTime: 'Creation end time',
+ creationTimeRange: 'Creation time range',
+ creationTimeFrom: 'Creation time from',
+ creationTimeTo: 'Creation time to',
state: 'Select state',
stateStaging: 'Staging',
stateFailed: 'Failed',
diff --git
a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/lang/zh-CN.js
b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/lang/zh-CN.js
index 5065a83..01f178f 100644
---
a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/lang/zh-CN.js
+++
b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/lang/zh-CN.js
@@ -278,8 +278,9 @@ export default {
},
searchForm: {
jobName: '请输入作业名称',
- startTime: '请输入创建开始时间',
- CompleteTime: '请输入创建结束时间',
+ creationTimeRange: '创建时间范围',
+ creationTimeFrom: '创建时间起始',
+ creationTimeTo: '创建时间截止',
state: '选择状态',
stateStaging: '等待运行',
stateFailed: '运行失败',
diff --git
a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/history-status/module/historyStatus.vue
b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/history-status/module/historyStatus.vue
index cd6a43c..2093e17 100644
---
a/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/history-status/module/historyStatus.vue
+++
b/shardingsphere-elasticjob-lite-ui/shardingsphere-elasticjob-lite-ui-frontend/src/views/history-status/module/historyStatus.vue
@@ -25,16 +25,12 @@
clearable>
</el-autocomplete>
<el-date-picker
- :placeholder="$t('historyStatus.searchForm.startTime')"
- v-model="searchForm.start"
- type="datetime"
- clearable>
- </el-date-picker>
- <el-date-picker
- :placeholder="$t('historyStatus.searchForm.CompleteTime')"
- v-model="searchForm.end"
- type="datetime"
- clearable>
+ v-model="creationTimeRange"
+ :placeholder="$t('historyStatus.searchForm.creationTimeRange')"
+ :start-placeholder="$t('historyStatus.searchForm.creationTimeFrom')"
+ :end-placeholder="$t('historyStatus.searchForm.creationTimeTo')"
+ type="datetimerange"
+ >
</el-date-picker>
<el-select
:placeholder="$t('historyStatus.searchForm.state')"
@@ -79,6 +75,8 @@
<script>
import { mapActions } from 'vuex'
import API from '../api'
+import clone from 'lodash/clone'
+
export default {
name: 'HistoryStatus',
data() {
@@ -138,9 +136,10 @@ export default {
searchForm: {
jobName: '',
state: '',
- start: '',
- end: ''
+ creationTimeFrom: null,
+ creationTimeTo: null
},
+ creationTimeRange: [],
tableData: [],
cloneTableData: [],
currentPage: 1,
@@ -172,6 +171,8 @@ export default {
})
},
getJobStatus() {
+ this.currentPage = 1
+ this.total = 0
API.loadStatus(this.getSearchForm()).then(res => {
const data = res.model.rows
this.total = res.model.total
@@ -179,9 +180,13 @@ export default {
})
},
getSearchForm() {
- const requestBody = Object.assign({}, this.searchForm)
+ const requestBody = clone(this.searchForm)
requestBody.jobName = this.getNullIfEmpty(requestBody.jobName)
requestBody.state = this.getNullIfEmpty(requestBody.state)
+ if (this.creationTimeRange) {
+ requestBody.creationTimeFrom = this.creationTimeRange[0]
+ requestBody.creationTimeTo = this.creationTimeRange[1]
+ }
return requestBody
},
getNullIfEmpty(value) {