[manager,webapp]bugfix#5 website monitor path Illegal character in path

[manager,webapp]bugfix website monitor path Illegal character in path
This commit is contained in:
tomsun28
2022-03-04 13:56:43 +08:00
committed by GitHub
5 changed files with 30 additions and 1 deletions

View File

@@ -55,6 +55,8 @@ public class WheelTimerTask implements TimerTask {
log.error("Aes Decode value {} error.", item.getValue());
}
item.setValue(decodeValue);
} else if (item.getValue() != null && item.getValue() instanceof String) {
item.setValue(((String) item.getValue()).trim());
}
})
.collect(Collectors.toMap(Configmap::getKey, item -> item));

View File

@@ -33,6 +33,7 @@ public class IpDomainUtil {
if (ipDomain == null || "".equals(ipDomain)) {
return false;
}
ipDomain = ipDomain.trim();
if (LOCALHOST.equalsIgnoreCase(ipDomain)) {
return true;
}

View File

@@ -126,9 +126,15 @@ public class MonitorServiceImpl implements MonitorService {
public void validate(MonitorDto monitorDto, Boolean isModify) throws IllegalArgumentException {
// 请求监控参数与监控参数定义映射校验匹配
Monitor monitor = monitorDto.getMonitor();
monitor.setHost(monitor.getHost().trim());
monitor.setName(monitor.getName().trim());
Map<String, Param> paramMap = monitorDto.getParams()
.stream()
.peek(param -> param.setMonitorId(monitor.getId()))
.peek(param -> {
param.setMonitorId(monitor.getId());
String value = param.getValue() == null ? null : param.getValue().trim();
param.setValue(value);
})
.collect(Collectors.toMap(Param::getField, param -> param));
// 校验名称唯一性
if (isModify != null) {

View File

@@ -112,11 +112,16 @@ export class MonitorEditComponent implements OnInit {
});
return;
}
this.monitor.host = this.monitor.host.trim();
this.monitor.name = this.monitor.name.trim();
// todo 暂时单独设置host属性值
this.params.forEach(param => {
if (param.field === 'host') {
param.value = this.monitor.host;
}
if (param.value != null && typeof param.value == 'string') {
param.value = (param.value as string).trim();
}
});
let addMonitor = {
detected: this.detected,
@@ -151,11 +156,16 @@ export class MonitorEditComponent implements OnInit {
});
return;
}
this.monitor.host = this.monitor.host.trim();
this.monitor.name = this.monitor.name.trim();
// todo 暂时单独设置host属性值
this.params.forEach(param => {
if (param.field === 'host') {
param.value = this.monitor.host;
}
if (param.value != null && typeof param.value == 'string') {
param.value = (param.value as string).trim();
}
});
let detectMonitor = {
detected: this.detected,

View File

@@ -93,11 +93,16 @@ export class MonitorNewComponent implements OnInit {
});
return;
}
this.monitor.host = this.monitor.host.trim();
this.monitor.name = this.monitor.name.trim();
// todo 暂时单独设置host属性值
this.params.forEach(param => {
if (param.field === 'host') {
param.value = this.monitor.host;
}
if (param.value != null && typeof param.value == 'string') {
param.value = (param.value as string).trim();
}
});
let addMonitor = {
detected: this.detected,
@@ -132,11 +137,16 @@ export class MonitorNewComponent implements OnInit {
});
return;
}
this.monitor.host = this.monitor.host.trim();
this.monitor.name = this.monitor.name.trim();
// todo 暂时单独设置host属性值
this.params.forEach(param => {
if (param.field === 'host') {
param.value = this.monitor.host;
}
if (param.value != null && typeof param.value == 'string') {
param.value = (param.value as string).trim();
}
});
let detectMonitor = {
detected: true,