[manager,webapp]fix 页面全局监控搜索结果异常 (#28)
This commit is contained in:
@@ -121,15 +121,17 @@ public class CommonCache {
|
||||
timeoutMap.put(key, new Long[]{currentTime, DEFAULT_CACHE_TIMEOUT});
|
||||
} else if (cacheTime[0] + cacheTime[1] < currentTime) {
|
||||
// 过期了 discard 关闭这个cache的资源
|
||||
log.warn("[cache] clean the timeout cache, key {}", key);
|
||||
timeoutMap.remove(key);
|
||||
cacheMap.remove(key);
|
||||
if (value instanceof CacheCloseable) {
|
||||
log.warn("[cache] close the timeout cache, key {}", key);
|
||||
((CacheCloseable)value).close();
|
||||
}
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
log.error("clean timeout cache error: {}.", e.getMessage(), e);
|
||||
log.error("[cache] clean timeout cache error: {}.", e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,13 +179,14 @@ public class CommonCache {
|
||||
return Optional.empty();
|
||||
}
|
||||
if (cacheTime[0] + cacheTime[1] < System.currentTimeMillis()) {
|
||||
log.warn("[cache] is timeout, key {}.", key);
|
||||
log.warn("[cache] is timeout, remove it, key {}.", key);
|
||||
timeoutMap.remove(key);
|
||||
cacheMap.remove(key);
|
||||
return Optional.empty();
|
||||
}
|
||||
Object value = cacheMap.get(key);
|
||||
if (value == null) {
|
||||
log.error("[cache] value is null, remove it, key {}.", key);
|
||||
cacheMap.remove(key);
|
||||
timeoutMap.remove(key);
|
||||
} else if (refreshCache) {
|
||||
|
||||
@@ -79,9 +79,17 @@ public class MonitorsController {
|
||||
orList.add(predicateName);
|
||||
}
|
||||
Predicate[] orPredicates = new Predicate[orList.size()];
|
||||
Predicate orPredicate = criteriaBuilder.and(orList.toArray(orPredicates));
|
||||
Predicate orPredicate = criteriaBuilder.or(orList.toArray(orPredicates));
|
||||
|
||||
return query.where(andPredicate,orPredicate).getRestriction();
|
||||
if (andPredicate.getExpressions().isEmpty() && orPredicate.getExpressions().isEmpty()) {
|
||||
return query.where().getRestriction();
|
||||
} else if (andPredicate.getExpressions().isEmpty()) {
|
||||
return query.where(orPredicate).getRestriction();
|
||||
} else if (orPredicate.getExpressions().isEmpty()) {
|
||||
return query.where(andPredicate).getRestriction();
|
||||
} else {
|
||||
return query.where(andPredicate,orPredicate).getRestriction();
|
||||
}
|
||||
};
|
||||
// 分页是必须的
|
||||
Sort sortExp = Sort.by(new Sort.Order(Sort.Direction.fromString(order), sort));
|
||||
|
||||
@@ -96,7 +96,11 @@ export class HeaderSearchComponent implements AfterViewInit, OnDestroy {
|
||||
searchMonitors$.unsubscribe();
|
||||
if (message.code === 0) {
|
||||
let page = message.data;
|
||||
this.options = page.content;
|
||||
if (page.content != undefined) {
|
||||
this.options = page.content;
|
||||
} else {
|
||||
this.options = [];
|
||||
}
|
||||
this.cdr.detectChanges();
|
||||
} else {
|
||||
console.warn(message.msg);
|
||||
@@ -118,7 +122,7 @@ export class HeaderSearchComponent implements AfterViewInit, OnDestroy {
|
||||
qBlur(): void {
|
||||
this.focus = false;
|
||||
this.searchToggled = false;
|
||||
this.options.length = 0;
|
||||
this.options = [];
|
||||
this.toggleChangeChange.emit(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user