解决端口映射编辑时,如果端口号没有变动,则不验证。避免出现端口映射正在使用时,无法更新端口映射其他信息的问题
This commit is contained in:
@@ -232,18 +232,18 @@ export default {
|
||||
loadSelect
|
||||
},
|
||||
data() {
|
||||
let isPortAvailable = (rule, value, callback) => {
|
||||
if(value!=null){
|
||||
let param = {port: value}
|
||||
const isPortAvailable = (rule, value, callback) => {
|
||||
if (value != null) {
|
||||
const param = { port: value, portMappingId: this.temp.id }
|
||||
portAvailable(param).then(res => {
|
||||
if(!res.data.data){
|
||||
return callback(new Error('该端口被占用'));
|
||||
}else{
|
||||
callback();
|
||||
if (!res.data.data) {
|
||||
return callback(new Error('该端口被占用'))
|
||||
} else {
|
||||
callback()
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
return {
|
||||
tableKey: 0,
|
||||
list: null,
|
||||
|
||||
+2
-2
@@ -136,9 +136,9 @@ public class PortPoolController {
|
||||
|
||||
@Get
|
||||
@Mapping("/port-available")
|
||||
public boolean portAvailable(Integer port) {
|
||||
public boolean portAvailable(Integer port, Integer portMappingId) {
|
||||
ParamCheckUtil.checkNotNull(port, "port");
|
||||
|
||||
return portPoolService.portAvailable(port);
|
||||
return portPoolService.portAvailable(port, portMappingId);
|
||||
}
|
||||
}
|
||||
|
||||
+9
-1
@@ -202,10 +202,18 @@ public class PortPoolService {
|
||||
|
||||
/**
|
||||
* 检查端口是否被占用
|
||||
* 端口映射编辑时,如果端口号没有变动,则不验证。避免出现端口映射正在使用时,无法更新端口映射其他信息的问题
|
||||
* @param port
|
||||
* @param portMappingId
|
||||
* @return
|
||||
*/
|
||||
public boolean portAvailable(Integer port) {
|
||||
public boolean portAvailable(Integer port, Integer portMappingId) {
|
||||
if (null != portMappingId) {
|
||||
PortMappingDO portMappingDO = portMappingMapper.findById(portMappingId);
|
||||
if (null != portMappingDO && portMappingDO.getServerPort().equals(port)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
}
|
||||
return PortAvailableUtil.isPortAvailable(port);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user