mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-04 13:09:28 +08:00
Merge branch 'dev' of github.com:fit2cloudrd/metersphere-server into dev
This commit is contained in:
commit
9d10c1e037
@ -0,0 +1,15 @@
|
||||
package io.metersphere.commons.constants;
|
||||
|
||||
/**
|
||||
* @author dongbin
|
||||
*/
|
||||
public enum ResourceStatusEnum {
|
||||
/**
|
||||
* 无效
|
||||
*/
|
||||
INVALID,
|
||||
/**
|
||||
* 有效
|
||||
*/
|
||||
VALID
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package io.metersphere.dto;
|
||||
|
||||
public class KubernetesDTO {
|
||||
|
||||
private String masterUrl;
|
||||
private String token;
|
||||
private Integer maxConcurrency;
|
||||
|
||||
public String getMasterUrl() {
|
||||
return masterUrl;
|
||||
}
|
||||
|
||||
public void setMasterUrl(String masterUrl) {
|
||||
this.masterUrl = masterUrl;
|
||||
}
|
||||
|
||||
public String getToken() {
|
||||
return token;
|
||||
}
|
||||
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public Integer getMaxConcurrency() {
|
||||
return maxConcurrency;
|
||||
}
|
||||
|
||||
public void setMaxConcurrency(Integer maxConcurrency) {
|
||||
this.maxConcurrency = maxConcurrency;
|
||||
}
|
||||
|
||||
}
|
@ -4,6 +4,7 @@ public class ClientCredential {
|
||||
|
||||
private String masterUrl;
|
||||
private String token;
|
||||
private Integer maxConcurrency;
|
||||
|
||||
public String getMasterUrl() {
|
||||
return masterUrl;
|
||||
@ -20,4 +21,12 @@ public class ClientCredential {
|
||||
public void setToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
public Integer getMaxConcurrency() {
|
||||
return maxConcurrency;
|
||||
}
|
||||
|
||||
public void setMaxConcurrency(Integer maxConcurrency) {
|
||||
this.maxConcurrency = maxConcurrency;
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import io.metersphere.base.mapper.TestResourceMapper;
|
||||
import io.metersphere.base.mapper.TestResourcePoolMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtTestReourcePoolMapper;
|
||||
import io.metersphere.commons.constants.ResourcePoolTypeEnum;
|
||||
import io.metersphere.commons.constants.ResourceStatusEnum;
|
||||
import io.metersphere.controller.request.resourcepool.QueryResourcePoolRequest;
|
||||
import io.metersphere.dto.NodeDTO;
|
||||
import io.metersphere.dto.TestResourcePoolDTO;
|
||||
@ -44,7 +45,7 @@ public class TestResourcePoolService {
|
||||
testResourcePool.setId(UUID.randomUUID().toString());
|
||||
testResourcePool.setCreateTime(System.currentTimeMillis());
|
||||
testResourcePool.setUpdateTime(System.currentTimeMillis());
|
||||
testResourcePool.setStatus("1");
|
||||
testResourcePool.setStatus(ResourceStatusEnum.VALID.name());
|
||||
validateTestResourcePool(testResourcePool);
|
||||
testResourcePoolMapper.insertSelective(testResourcePool);
|
||||
return testResourcePool;
|
||||
@ -83,10 +84,11 @@ public class TestResourcePoolService {
|
||||
NodeDTO nodeDTO = JSON.parseObject(resource.getConfiguration(), NodeDTO.class);
|
||||
boolean isValidate = validateNode(nodeDTO);
|
||||
if (!isValidate) {
|
||||
testResourcePool.setStatus("0");
|
||||
resource.setStatus("0");
|
||||
testResourcePool.setStatus(ResourceStatusEnum.INVALID.name());
|
||||
resource.setStatus(ResourceStatusEnum.INVALID.name());
|
||||
} else {
|
||||
resource.setStatus(ResourceStatusEnum.VALID.name());
|
||||
}
|
||||
resource.setStatus("1");
|
||||
resource.setTestResourcePoolId(testResourcePool.getId());
|
||||
updateTestResource(resource);
|
||||
|
||||
@ -114,10 +116,10 @@ public class TestResourcePoolService {
|
||||
try {
|
||||
KubernetesProvider provider = new KubernetesProvider(testResource.getConfiguration());
|
||||
provider.validateCredential();
|
||||
testResource.setStatus("1");
|
||||
testResource.setStatus(ResourceStatusEnum.VALID.name());
|
||||
} catch (Exception e) {
|
||||
testResource.setStatus("0");
|
||||
testResourcePool.setStatus("0");
|
||||
testResource.setStatus(ResourceStatusEnum.INVALID.name());
|
||||
testResourcePool.setStatus(ResourceStatusEnum.INVALID.name());
|
||||
}
|
||||
deleteTestResource(testResourcePool.getId());
|
||||
updateTestResource(testResource);
|
||||
|
@ -27,8 +27,8 @@
|
||||
<el-switch v-model="scope.row.status"
|
||||
active-color="#13ce66"
|
||||
inactive-color="#ff4949"
|
||||
active-value="1"
|
||||
inactive-value="0"
|
||||
active-value="VALID"
|
||||
inactive-value="INVALID"
|
||||
@change="changeSwitch(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
|
Loading…
Reference in New Issue
Block a user